CHANNEL_NAME
stringclasses 1
value | URL
stringlengths 43
43
| TITLE
stringlengths 12
100
| DESCRIPTION
stringlengths 66
5k
| TRANSCRIPTION
stringlengths 150
90.9k
| SEGMENTS
stringlengths 1.05k
146k
|
---|---|---|---|---|---|
Yannic Kilcher | 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 paper called Radioactive Data, tracing through training by Alexander Sablerol, Matis Duz, Cordelia Schmidt and Erve Jigou 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 market. You market with this mark and they call this 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 the kind of 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. Then you do a test to figure out which one it is. So we'll dive into the method and look at how well this works, pretty, 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 C410, 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. 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 this. It's non-linear 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 phi function would just put points here in somehow, let's just make them two classes, the x's and the o's and so on. So if the phi is good, then the last layer has a pretty easy job linearly classifying it right here. You can see here the phi is not very good. We can't linearly classify this data. So by training the neural network, what you do is you make phi 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. Okay. The exact slope 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. 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. Okay. 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 asked to classify cats from dogs from horses and so on, one feature could be does it have whiskers? Whiskers. One feature could be does it have fur, right? You can maybe distinguish cats from turtles and so 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. Okay. 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. So in this high dimensional space that is spanned by these d-dimensional vectors and you can, so this thing here, okay, sorry, I'm switching back and forth. This thing here, you can sort of if d is equal to 2, you can imagine it as 10 vectors in a space in this feature space, okay. 10 of these vectors. And whenever you get a point, that's, is that 8? 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, okay. So if you think of this, then what you want to do is you want to add a feature here, such that this is one per class, I'm going to 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, okay. 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 fake, a fake feature that we derive from the label, right. So we, we kind of cheat it. Here we 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, right. 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, okay. Now the, the danger of course here is that the classifier will, 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, determined 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. 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 this direction right here. 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. 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. And what I'll do is I'll shift my training data a bit into that direction. How do we do this? How are we doing this? I'll just dash it. 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 co-science 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 co-science 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 we choose a random direction, a random direction, you right here. This is you 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 co-science 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 co-science 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 co-science 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 all you have to do is mark your data in this way and then look at the final classifier, look at these blue vectors right here. These are just the entries of this final weight matrix, right? These are the blue vectors. We look at those and you simply determine if the, for the given class, if the vector for the given class has a high co-science 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, 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 want to 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 want, they also have the goal that this radioactive mark and cannot be detected first of all. And also that is it's a robust to re labeling. Like if you give me data and I go and re label it and ask my mechanical Turk workers to re label that data again, they will give them the same label even if you have radio actively mark them. This paper says nothing about defenses, right? These things are defended against fairly easily, I would guess, 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 your training process? I'm not sure, but I'm also sure there are better ways to radio actively 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 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'll 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 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 align, especially because you have this kind of symmetry. And they say right here we can fix that by if 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 classifiers there is 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 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 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. This is 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. 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 solve using those features. So it still needs to pay attention and of course your marked data also has 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 an experiment 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 image net on the ResNet 18. So these differences in accuracy 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, someone training with data couldn't just notice that it's maybe you actively marked by just saying 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 is 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. 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 radio actively marked data than 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 you 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 derive a different pure only this feature sample input it again and look what comes out so it's not it's not a pure type 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 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 would just want to point out I have a so there's a bit of an issue here 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'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 could not tell it was trained with radioactive data by just looking at the networks weights so maybe one idea would be that you craft inputs in some way that correlates to 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 and they appear to be fairly independent so you make sure that they are fairly independent during if you pass a regular data and then you craft data specifically you 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 and 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 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 side 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": 4.8, "text": " Are you tired of other people training on your data?"}, {"start": 4.8, "end": 7.16, "text": " That annoys me every time it happens."}, {"start": 7.16, "end": 9.84, "text": " I'm mad about this."}, {"start": 9.84, "end": 15.8, "text": " If only there was a way to somehow mark your data and when other people train on it, their"}, {"start": 15.8, "end": 18.04, "text": " computer would explode."}, {"start": 18.04, "end": 22.6, "text": " Well, this paper is a little bit like this, not entirely."}, {"start": 22.6, "end": 26.92, "text": " The explosion part, I think they're still working on on a follow-up paper."}, {"start": 26.92, "end": 34.84, "text": " But in this paper called Radioactive Data, tracing through training by Alexander Sablerol,"}, {"start": 34.84, "end": 41.52, "text": " Matis Duz, Cordelia Schmidt and Erve Jigou develop a method that at least you can detect"}, {"start": 41.52, "end": 47.68000000000001, "text": " if a given model was trained on your data or not on your data."}, {"start": 47.68000000000001, "end": 54.480000000000004, "text": " And they call this process Radioactive Marking or Radioactive Data for short."}, {"start": 54.48, "end": 59.239999999999995, "text": " So the overview you can see, it's pretty easy paper actually."}, {"start": 59.239999999999995, "end": 65.8, "text": " The concept is pretty easy and it's a nice concept and it's been around in one form"}, {"start": 65.8, "end": 66.8, "text": " or another."}, {"start": 66.8, "end": 68.56, "text": " It touches on adversarial examples."}, {"start": 68.56, "end": 72.47999999999999, "text": " It touches on differential privacy."}, {"start": 72.47999999999999, "end": 74.84, "text": " But in essence, it works like this."}, {"start": 74.84, "end": 82.36, "text": " If you suspect someone else training on your data or if you just have a data set that"}, {"start": 82.36, "end": 87.12, "text": " you want to protect, what you do is you market."}, {"start": 87.12, "end": 91.2, "text": " You market with this mark and they call this a radioactive mark."}, {"start": 91.2, "end": 96.32, "text": " But essentially, you just distort your images a little bit."}, {"start": 96.32, "end": 103.24, "text": " Then when someone else trains on that data, so here a convolutional neural network is trained"}, {"start": 103.24, "end": 106.8, "text": " on this data and not all of the data needs to be marked."}, {"start": 106.8, "end": 111.84, "text": " They can go as little as like one or two percent of the data being marked."}, {"start": 111.84, "end": 118.48, "text": " Then from the output of that network or from the inspecting the network itself, you can"}, {"start": 118.48, "end": 126.64, "text": " then test whether or not this network has been trained on this radioactively labeled data."}, {"start": 126.64, "end": 132.44, "text": " So you will see a clear difference to a network that has been trained on only what they"}, {"start": 132.44, "end": 133.68, "text": " call vanilla data."}, {"start": 133.68, "end": 136.44, "text": " So data that has not been marked."}, {"start": 136.44, "end": 143.72, "text": " So I hope that's clear what you do is you train, sorry, you mark your data."}, {"start": 143.72, "end": 148.12, "text": " What the kind of what Bob does, no, what's the attacker's name?"}, {"start": 148.12, "end": 149.12, "text": " I don't know."}, {"start": 149.12, "end": 156.64, "text": " But what Eve does is train here a network on data and you don't know whether it's this"}, {"start": 156.64, "end": 157.64, "text": " or this."}, {"start": 157.64, "end": 163.12, "text": " Then you do a test to figure out which one it is."}, {"start": 163.12, "end": 170.0, "text": " So we'll dive into the method and look at how well this works, pretty, pretty simple,"}, {"start": 170.0, "end": 171.56, "text": " but pretty cool."}, {"start": 171.56, "end": 179.64000000000001, "text": " So their entire method rests on this kind of notion that these classifiers, what they"}, {"start": 179.64000000000001, "end": 183.52, "text": " do is if you have a neural network, like a convolutional neural network, you have your"}, {"start": 183.52, "end": 189.36, "text": " image, your starting image of your prototypical, I don't know, cat."}, {"start": 189.36, "end": 195.32000000000002, "text": " And you input this into many, many layers of a neural network as we are used to."}, {"start": 195.32000000000002, "end": 198.12, "text": " But the last layer is a bit special, right?"}, {"start": 198.12, "end": 200.96, "text": " Because the last layer is the classification layer."}, {"start": 200.96, "end": 205.0, "text": " Let's just assume this is a classifier."}, {"start": 205.0, "end": 212.76000000000002, "text": " So if this is C410, for example, there are 10 different classes that you could output."}, {"start": 212.76000000000002, "end": 215.12, "text": " And so 10 of these bubbles right here."}, {"start": 215.12, "end": 221.36, "text": " That means that this matrix right here is a number of features."}, {"start": 221.36, "end": 227.28, "text": " Let's call it d by 10 matrix."}, {"start": 227.28, "end": 233.28, "text": " So the network, this part right here, we would usually call a feature extractor, something"}, {"start": 233.28, "end": 234.28, "text": " like this."}, {"start": 234.28, "end": 237.4, "text": " So the bottom part of the network basically does this."}, {"start": 237.4, "end": 242.6, "text": " It's non-linear transformation and so on extracts, d features."}, {"start": 242.6, "end": 244.56, "text": " These are latent features."}, {"start": 244.56, "end": 249.8, "text": " And then those features are linearly classified into 10 classes."}, {"start": 249.8, "end": 255.92000000000002, "text": " The important part here is that that last layer is actually just a linear classifier."}, {"start": 255.92000000000002, "end": 259.88, "text": " And we can reduce this actually down to a two class classifier."}, {"start": 259.88, "end": 268.8, "text": " So the phi function would just put points here in somehow, let's just make them two classes,"}, {"start": 268.8, "end": 273.0, "text": " the x's and the o's and so on."}, {"start": 273.0, "end": 281.28, "text": " So if the phi is good, then the last layer has a pretty easy job linearly classifying"}, {"start": 281.28, "end": 282.28, "text": " it right here."}, {"start": 282.28, "end": 284.0, "text": " You can see here the phi is not very good."}, {"start": 284.0, "end": 286.08, "text": " We can't linearly classify this data."}, {"start": 286.08, "end": 295.52, "text": " So by training the neural network, what you do is you make phi such that it will place"}, {"start": 295.52, "end": 300.92, "text": " hopefully the one class somehow on one side, the other class on the other side."}, {"start": 300.92, "end": 306.0, "text": " And you can pretty easily linearly classify that data."}, {"start": 306.0, "end": 307.0, "text": " Okay."}, {"start": 307.0, "end": 316.28000000000003, "text": " The exact slope of this line right here, the exact location of this line and direction"}, {"start": 316.28000000000003, "end": 321.56, "text": " of this line, that's what's encoded ultimately in this matrix right here."}, {"start": 321.56, "end": 328.92, "text": " So this matrix now not only for two classes, but for 10 different classes, it records"}, {"start": 328.92, "end": 330.88, "text": " these hyperplanes."}, {"start": 330.88, "end": 334.28, "text": " Separate one class from the other class."}, {"start": 334.28, "end": 336.76, "text": " And these are in D dimensional space."}, {"start": 336.76, "end": 343.36, "text": " So you have D dimensional 10 D dimensional hyperplanes separating the space of features"}, {"start": 343.36, "end": 346.84, "text": " linearly into the classes."}, {"start": 346.84, "end": 354.48, "text": " So what you can do is you can actually think of this D, sorry, of these D dimensions here"}, {"start": 354.48, "end": 356.0, "text": " as features, right?"}, {"start": 356.0, "end": 364.12, "text": " This is a feature extractor, so it provides features to a linear classifier."}, {"start": 364.12, "end": 373.52, "text": " Now what this method does is when it radioactively marks data points, it simply adds a feature."}, {"start": 373.52, "end": 374.52, "text": " Okay."}, {"start": 374.52, "end": 377.24, "text": " So how do you think about these features?"}, {"start": 377.24, "end": 383.6, "text": " So for example, let's say this is actually this animal classification example."}, {"start": 383.6, "end": 392.44, "text": " And if you are asked to classify cats from dogs from horses and so on, one feature could"}, {"start": 392.44, "end": 396.04, "text": " be does it have whiskers?"}, {"start": 396.04, "end": 397.36, "text": " Whiskers."}, {"start": 397.36, "end": 401.28000000000003, "text": " One feature could be does it have fur, right?"}, {"start": 401.28000000000003, "end": 407.52000000000004, "text": " You can maybe distinguish cats from turtles and so cats and dogs from turtles."}, {"start": 407.52000000000004, "end": 409.52000000000004, "text": " Does it have how many legs?"}, {"start": 409.52000000000004, "end": 412.68, "text": " So the number of legs."}, {"start": 412.68, "end": 413.68, "text": " And so on."}, {"start": 413.68, "end": 415.12, "text": " So you have all these features."}, {"start": 415.12, "end": 420.76, "text": " And the last layer simply linearly classifies those features together."}, {"start": 420.76, "end": 427.2, "text": " What this method does, this radioactive method, it adds a new feature per class."}, {"start": 427.2, "end": 436.32, "text": " So down here, I would add a new feature that says like, this is the radioactive feature."}, {"start": 436.32, "end": 437.88, "text": " Can I draw the radioactive symbol?"}, {"start": 437.88, "end": 445.28, "text": " This is the radioactive feature for the class cat."}, {"start": 445.28, "end": 446.28, "text": " Okay."}, {"start": 446.28, "end": 450.88, "text": " And then of course, I also have one for dog and so on."}, {"start": 450.88, "end": 457.71999999999997, "text": " So it would add or basically would you don't change the dimensionality, but in essence,"}, {"start": 457.71999999999997, "end": 462.08, "text": " you add one feature per class."}, {"start": 462.08, "end": 465.56, "text": " And that's what they mean here by this direction."}, {"start": 465.56, "end": 474.32, "text": " So in this high dimensional space that is spanned by these d-dimensional vectors and you can,"}, {"start": 474.32, "end": 477.78000000000003, "text": " so this thing here, okay, sorry, I'm switching back and forth."}, {"start": 477.78000000000003, "end": 487.12, "text": " This thing here, you can sort of if d is equal to 2, you can imagine it as 10 vectors in"}, {"start": 487.12, "end": 490.44, "text": " a space in this feature space, okay."}, {"start": 490.44, "end": 492.6, "text": " 10 of these vectors."}, {"start": 492.6, "end": 496.56, "text": " And whenever you get a point, that's, is that 8?"}, {"start": 496.56, "end": 502.44, "text": " Whenever you get a point, you simply look at, so if you get a data point right in here,"}, {"start": 502.44, "end": 511.52000000000004, "text": " goes through here, you come here and you look with which class does it align more the"}, {"start": 511.52000000000004, "end": 515.72, "text": " most and that's how you classify it, okay."}, {"start": 515.72, "end": 526.12, "text": " So if you think of this, then what you want to do is you want to add a feature here,"}, {"start": 526.12, "end": 534.08, "text": " such that this is one per class, I'm going to trouble articulating this."}, {"start": 534.08, "end": 536.28, "text": " And you want to change your data points."}, {"start": 536.28, "end": 538.1600000000001, "text": " Here you can see your data points."}, {"start": 538.16, "end": 546.4399999999999, "text": " And for this class X, we make this radioactive feature right here, which is the blue thing,"}, {"start": 546.4399999999999, "end": 550.6, "text": " we shift the data into the direction of this feature, okay."}, {"start": 550.6, "end": 557.04, "text": " So basically we add the feature U, which is just a random vector in this high dimensional"}, {"start": 557.04, "end": 558.04, "text": " space."}, {"start": 558.04, "end": 563.88, "text": " We choose one vector per class, but then we shift all the data for that class along this"}, {"start": 563.88, "end": 565.4, "text": " feature."}, {"start": 565.4, "end": 572.92, "text": " So what we are doing is we are introducing fake, a fake feature that we derive from the"}, {"start": 572.92, "end": 573.92, "text": " label, right."}, {"start": 573.92, "end": 576.9599999999999, "text": " So we, we kind of cheat it."}, {"start": 576.9599999999999, "end": 583.84, "text": " Here we have X and you're supposed to tell Y from it and that's your training data."}, {"start": 583.84, "end": 593.4399999999999, "text": " But then we cheat, we look at Y and we modify X with the feature of that particular class."}, {"start": 593.44, "end": 595.6800000000001, "text": " So what does that do?"}, {"start": 595.6800000000001, "end": 601.0400000000001, "text": " Ultimately we have, we end up with U1, U2, and so on."}, {"start": 601.0400000000001, "end": 609.6, "text": " So one feature per class, it trains the classifier to pay attention to these features, right."}, {"start": 609.6, "end": 616.72, "text": " So if U1 is the feature for cat, then we train this classifier by training it on the data"}, {"start": 616.72, "end": 619.24, "text": " that has been modified in this way."}, {"start": 619.24, "end": 629.96, "text": " We train it a cat should consist of something that has whiskers, has fur, has four legs,"}, {"start": 629.96, "end": 631.76, "text": " and so on."}, {"start": 631.76, "end": 635.0, "text": " And also has this cat feature, okay."}, {"start": 635.0, "end": 642.08, "text": " Now the, the danger of course here is that the classifier will, will stop to pay attention"}, {"start": 642.08, "end": 646.92, "text": " to anything else and only look at the cat feature because we introduced this feature"}, {"start": 646.92, "end": 652.04, "text": " to every single example that was of class cat."}, {"start": 652.04, "end": 658.4399999999999, "text": " So the classifier could have a pretty easy way just looking at this feature, determined"}, {"start": 658.4399999999999, "end": 661.8, "text": " well, all of this is cat and then it would not generalize at all."}, {"start": 661.8, "end": 668.36, "text": " So what we can do is, first of all, we can make the feature very low signal."}, {"start": 668.36, "end": 674.24, "text": " We can make it very small such that there are other features such that these other features"}, {"start": 674.24, "end": 677.92, "text": " are also pretty easy for the network to pay attention to."}, {"start": 677.92, "end": 682.32, "text": " And second of all, we can label not all data and that's what they do here."}, {"start": 682.32, "end": 689.24, "text": " They label maybe 10%, maybe 2% of the data with that, which forces the network to pay some"}, {"start": 689.24, "end": 694.52, "text": " attention to this feature, but also to pay attention to the other features."}, {"start": 694.52, "end": 701.32, "text": " And that ultimately, if you trade this off correctly, results in a classifier that it"}, {"start": 701.32, "end": 709.96, "text": " does give up some of its generalization capability because of course 0% of the test data has"}, {"start": 709.96, "end": 711.2800000000001, "text": " these features right here."}, {"start": 711.2800000000001, "end": 716.88, "text": " We modify the training data to add these features."}, {"start": 716.88, "end": 724.0, "text": " So you give up a little bit of generalization capability, but you force the classifier to"}, {"start": 724.0, "end": 730.6, "text": " pay attention to this feature during training and that is something that you can then detect."}, {"start": 730.6, "end": 736.08, "text": " So you can imagine if you train a classifier that has been trained on training data where"}, {"start": 736.08, "end": 742.12, "text": " some of the training data have these features in here and that's one distinct feature per"}, {"start": 742.12, "end": 744.36, "text": " class."}, {"start": 744.36, "end": 754.0400000000001, "text": " Then you can look at the final classifier and figure out whether or not the classifier"}, {"start": 754.0400000000001, "end": 755.64, "text": " has been trained."}, {"start": 755.64, "end": 756.64, "text": " How do we do that?"}, {"start": 756.64, "end": 764.28, "text": " So let's imagine that in this high dimensional space here, the training examples, they point"}, {"start": 764.28, "end": 768.3199999999999, "text": " in this direction right here."}, {"start": 768.3199999999999, "end": 772.68, "text": " So all the training examples of one particular class, so this is now the dog class."}, {"start": 772.68, "end": 776.1999999999999, "text": " All the training examples point here, how would you build your classifier?"}, {"start": 776.1999999999999, "end": 777.1999999999999, "text": " Well, it's pretty easy."}, {"start": 777.1999999999999, "end": 783.12, "text": " I would build it such that the dog class points in this direction."}, {"start": 783.12, "end": 788.6, "text": " I'm just erased a bunch of other classes right here."}, {"start": 788.6, "end": 792.52, "text": " Now I choose a random feature."}, {"start": 792.52, "end": 799.48, "text": " When I build my radioactive thing, I choose a random feature like this one right here."}, {"start": 799.48, "end": 806.88, "text": " And what I'll do is I'll shift my training data a bit into that direction."}, {"start": 806.88, "end": 808.72, "text": " How do we do this?"}, {"start": 808.72, "end": 810.04, "text": " How are we doing this?"}, {"start": 810.04, "end": 812.28, "text": " I'll just dash it."}, {"start": 812.28, "end": 818.1999999999999, "text": " So I'll shift my training data a little bit into this direction."}, {"start": 818.1999999999999, "end": 821.28, "text": " So all of these, they move over right here."}, {"start": 821.28, "end": 830.6, "text": " And that's where the final classifier will come to lie a lot more towards this new feature."}, {"start": 830.6, "end": 834.76, "text": " And this is something we can now test with a statistical test."}, {"start": 834.76, "end": 837.52, "text": " And that's what this paper kind of works out in the math."}, {"start": 837.52, "end": 845.96, "text": " So usually if you have one vector in high dimensional space like this one, and then you look at"}, {"start": 845.96, "end": 849.0799999999999, "text": " the distribution of random vectors."}, {"start": 849.0799999999999, "end": 853.04, "text": " So this one, maybe this one, this one feels pretty random."}, {"start": 853.04, "end": 854.56, "text": " This one's pretty random."}, {"start": 854.56, "end": 859.68, "text": " Okay, humans are terrible random number generators, but these feel pretty random."}, {"start": 859.68, "end": 865.8, "text": " And you look at the co-science between the random vector and the vector you plotted initially."}, {"start": 865.8, "end": 870.0799999999999, "text": " They follow, if this is truly random, they follow a distribution."}, {"start": 870.0799999999999, "end": 878.5999999999999, "text": " They follow this particular distribution that they derive here."}, {"start": 878.5999999999999, "end": 884.16, "text": " Okay, so you can see a classic result from statistics shows that this co-science similarity"}, {"start": 884.16, "end": 888.7199999999999, "text": " follows incomplete beta distribution with these parameters."}, {"start": 888.7199999999999, "end": 893.88, "text": " Now they from this, they derive a statistical test."}, {"start": 893.88, "end": 901.4, "text": " So if you know what kind of distribution a quantity follows, you can derive a statistical"}, {"start": 901.4, "end": 908.88, "text": " test to see whether or not what you measure is actually likely to come from that distribution"}, {"start": 908.88, "end": 910.52, "text": " or not."}, {"start": 910.52, "end": 918.8, "text": " So what we would expect if our data has not been modified is that we choose a random direction,"}, {"start": 918.8, "end": 923.28, "text": " a random direction, you right here."}, {"start": 923.28, "end": 926.4399999999999, "text": " This is you for dog."}, {"start": 926.4399999999999, "end": 928.24, "text": " We choose that random direction."}, {"start": 928.24, "end": 935.24, "text": " And if our training data has not been modified, we would expect this dog here to have its"}, {"start": 935.24, "end": 941.16, "text": " co-science similarity to be not very high because there's no reason for it, right?"}, {"start": 941.16, "end": 945.12, "text": " These are just basically two vectors that are random to each other."}, {"start": 945.12, "end": 948.48, "text": " And in high dimensions, they should be almost orthogonal."}, {"start": 948.48, "end": 951.92, "text": " So in high dimensions, random vectors are almost orthogonal."}, {"start": 951.92, "end": 958.7199999999999, "text": " However, if the data has been marked during before training, that means if the classifier"}, {"start": 958.7199999999999, "end": 965.0, "text": " used our marked data set to train it, we would expect this co-science similarity right"}, {"start": 965.0, "end": 971.4, "text": " here to be not orthogonal, so to be higher than just random."}, {"start": 971.4, "end": 973.24, "text": " And that's exactly what we can test."}, {"start": 973.24, "end": 977.8, "text": " And that's exactly what you saw at the beginning right here."}, {"start": 977.8, "end": 985.24, "text": " So here is the down here, you can see the distribution of co-science similarities."}, {"start": 985.24, "end": 994.0799999999999, "text": " And you can see that if you train with, without marked data, this centers, you know, around"}, {"start": 994.0799999999999, "end": 995.0799999999999, "text": " zero."}, {"start": 995.0799999999999, "end": 1001.4399999999999, "text": " However, if you train with marked data, you have a statistically significant shift between"}, {"start": 1001.44, "end": 1011.1600000000001, "text": " the marking direction, the marking feature, and between the classifier direction."}, {"start": 1011.1600000000001, "end": 1019.72, "text": " So all you have to do is mark your data in this way and then look at the final classifier,"}, {"start": 1019.72, "end": 1021.96, "text": " look at these blue vectors right here."}, {"start": 1021.96, "end": 1026.44, "text": " These are just the entries of this final weight matrix, right?"}, {"start": 1026.44, "end": 1029.6000000000001, "text": " These are the blue vectors."}, {"start": 1029.6, "end": 1037.28, "text": " We look at those and you simply determine if the, for the given class, if the vector for"}, {"start": 1037.28, "end": 1043.9599999999998, "text": " the given class has a high co-science similarity with the marking direction that you chose"}, {"start": 1043.9599999999998, "end": 1045.6799999999998, "text": " to mark your data."}, {"start": 1045.6799999999998, "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": 1052.0, "text": " okay?"}, {"start": 1052.0, "end": 1054.3999999999999, "text": " So I hope the principle is clear."}, {"start": 1054.3999999999999, "end": 1059.1999999999998, "text": " You introduce a fake feature per class and you make the network pay a little bit of attention"}, {"start": 1059.2, "end": 1063.28, "text": " to that feature because it's, you know, a good feature in the training data."}, {"start": 1063.28, "end": 1067.8, "text": " And then, you know, after training, you can go ahead and see whether or not the network"}, {"start": 1067.8, "end": 1072.16, "text": " is actually sensitive to that feature that you fake introduced that is actually not a"}, {"start": 1072.16, "end": 1073.88, "text": " real feature in the data."}, {"start": 1073.88, "end": 1081.56, "text": " If the network is sensitive to it, you can conclude that, you can conclude that your training"}, {"start": 1081.56, "end": 1085.16, "text": " data was used in order to produce it."}, {"start": 1085.16, "end": 1088.96, "text": " So there's a couple of finesses right here."}, {"start": 1088.96, "end": 1094.44, "text": " So as you might have noticed, we introduce these fake features in this last layer feature"}, {"start": 1094.44, "end": 1095.44, "text": " space right here."}, {"start": 1095.44, "end": 1102.4, "text": " However, our pictures are actually input here in front of this feature extractor."}, {"start": 1102.4, "end": 1109.28, "text": " So we need a way to say what we want to do is we want to say, I want this data point"}, {"start": 1109.28, "end": 1111.72, "text": " here to be shifted in this direction."}, {"start": 1111.72, "end": 1117.48, "text": " But I actually, this data point is actually a result from an input data point."}, {"start": 1117.48, "end": 1124.6, "text": " I want to call this I right here, going through a nonlinear neural network ending up here."}, {"start": 1124.6, "end": 1130.2, "text": " So the way this is done is by using the same kind of back propagation that we use when"}, {"start": 1130.2, "end": 1132.76, "text": " we create adversarial examples."}, {"start": 1132.76, "end": 1139.52, "text": " So what we do is we define this distance or this distance here where we would like to go"}, {"start": 1139.52, "end": 1145.1200000000001, "text": " and where we are as a loss and then back propagate that loss through the neural network."}, {"start": 1145.12, "end": 1152.3999999999999, "text": " And then at the end, we know how to change the image I in order to adjust that feature."}, {"start": 1152.3999999999999, "end": 1156.32, "text": " So they define a loss right here that they minimize."}, {"start": 1156.32, "end": 1160.9199999999998, "text": " And you can see here is where you want to go in feature space and they have different"}, {"start": 1160.9199999999998, "end": 1166.04, "text": " regularizers such that their perturbation in input space is not too high."}, {"start": 1166.04, "end": 1173.4799999999998, "text": " And also here their perturbation in feature space is actually not too high."}, {"start": 1173.48, "end": 1178.88, "text": " So they want, they also have the goal that this radioactive mark and cannot be detected"}, {"start": 1178.88, "end": 1180.44, "text": " first of all."}, {"start": 1180.44, "end": 1184.4, "text": " And also that is it's a robust to re labeling."}, {"start": 1184.4, "end": 1192.48, "text": " Like if you give me data and I go and re label it and ask my mechanical Turk workers to"}, {"start": 1192.48, "end": 1198.24, "text": " re label that data again, they will give them the same label even if you have radio actively"}, {"start": 1198.24, "end": 1200.44, "text": " mark them."}, {"start": 1200.44, "end": 1202.68, "text": " This paper says nothing about defenses, right?"}, {"start": 1202.68, "end": 1212.44, "text": " These things are defended against fairly easily, I would guess, by some Gaussian blur, I"}, {"start": 1212.44, "end": 1216.28, "text": " guess would be fairly effective right here."}, {"start": 1216.28, "end": 1218.64, "text": " Though there are also ways around this."}, {"start": 1218.64, "end": 1222.0, "text": " This gets into the same discussion as adversarial examples."}, {"start": 1222.0, "end": 1227.8400000000001, "text": " The question here is, can you detect somehow in the final classifier whether or not this"}, {"start": 1227.84, "end": 1233.6399999999999, "text": " someone has smuggled radioactive data into your training process?"}, {"start": 1233.6399999999999, "end": 1238.8, "text": " I'm not sure, but I'm also sure there are better ways to radio actively mark right here."}, {"start": 1238.8, "end": 1245.08, "text": " This is kind of an establishing paper doing the most basic thing right here."}, {"start": 1245.08, "end": 1251.6799999999998, "text": " Interestingly, they also back propagate through kind of data augmentation procedures as long"}, {"start": 1251.6799999999998, "end": 1254.36, "text": " as they are differentiable."}, {"start": 1254.36, "end": 1262.1999999999998, "text": " And the last kind of difficulty you have is that these neural networks, they have some"}, {"start": 1262.1999999999998, "end": 1264.1999999999998, "text": " symmetries built into them."}, {"start": 1264.1999999999998, "end": 1271.6, "text": " So if you retrain a neural network, there's actually no, so if your neural networks classification,"}, {"start": 1271.6, "end": 1275.6, "text": " let's say it's a three class classification, looks like this, right?"}, {"start": 1275.6, "end": 1279.8, "text": " This is the last layer and these are the classes it's determined."}, {"start": 1279.8, "end": 1286.08, "text": " If you retrain it, it might as well be that this now looks like this, right?"}, {"start": 1286.08, "end": 1295.8, "text": " So if you marked it with this direction right here and then you try to recover this direction,"}, {"start": 1295.8, "end": 1301.12, "text": " you'll find that it doesn't work because the entire classifier has shifted."}, {"start": 1301.12, "end": 1305.28, "text": " So what they have to do is they have to do what they call a subspace alignment, which"}, {"start": 1305.28, "end": 1313.16, "text": " you can do by simply here determining a linear transformation in the last layer."}, {"start": 1313.16, "end": 1322.48, "text": " This is usually enough and what this does is so their entire procedure is they train themselves"}, {"start": 1322.48, "end": 1325.2, "text": " a classifier on unmarked data."}, {"start": 1325.2, "end": 1328.3999999999999, "text": " I forgot this before I should have mentioned this."}, {"start": 1328.3999999999999, "end": 1331.56, "text": " They train themselves a classifier on unmarked data."}, {"start": 1331.56, "end": 1338.76, "text": " They use that classifier to mark the data, which you need in order to do this back propagation"}, {"start": 1338.76, "end": 1341.96, "text": " thing, you actually need a working classifier."}, {"start": 1341.96, "end": 1349.6799999999998, "text": " And then when they give the data to someone else to train, they are going to train their"}, {"start": 1349.6799999999998, "end": 1352.3999999999999, "text": " own classifier on the same data, right?"}, {"start": 1352.3999999999999, "end": 1357.36, "text": " So there is no guarantee that these two classifiers spaces align, especially because you have"}, {"start": 1357.36, "end": 1359.96, "text": " this kind of symmetry."}, {"start": 1359.96, "end": 1366.92, "text": " And they say right here we can fix that by if we have this classifier and at the end they"}, {"start": 1366.92, "end": 1370.32, "text": " give us this classifier to test."}, {"start": 1370.32, "end": 1376.1200000000001, "text": " We can simply determining this linear transformation here that maps one to the other."}, {"start": 1376.1200000000001, "end": 1380.88, "text": " So we go over our data set, we determine M, a linear transformation."}, {"start": 1380.88, "end": 1389.2, "text": " Basically here you would determine a rotation of this space that would map one to the other"}, {"start": 1389.2, "end": 1390.88, "text": " and vice versa."}, {"start": 1390.88, "end": 1397.0, "text": " This is not exact of course because the two classifiers there is no reason why they should"}, {"start": 1397.0, "end": 1399.16, "text": " even be linearly related."}, {"start": 1399.16, "end": 1403.8, "text": " But there is a reason coming from kind of neural network knowledge."}, {"start": 1403.8, "end": 1412.24, "text": " And that is that we know or we have a strong suspicion that these neural networks of course"}, {"start": 1412.24, "end": 1417.32, "text": " if they work well and if they reach good accuracy and if they reach similar accuracy, it's"}, {"start": 1417.32, "end": 1423.04, "text": " very probable that they have somehow figured out the same features."}, {"start": 1423.04, "end": 1424.04, "text": " Okay."}, {"start": 1424.04, "end": 1428.52, "text": " Even though these networks learn each feature from scratch and as I said you have some"}, {"start": 1428.52, "end": 1430.04, "text": " symmetries in there."}, {"start": 1430.04, "end": 1436.08, "text": " But ultimately at the end of the neural network is very likely that the network learns the"}, {"start": 1436.08, "end": 1443.6399999999999, "text": " same features as another network even of a different architecture that has been trained"}, {"start": 1443.6399999999999, "end": 1445.36, "text": " on the same data set."}, {"start": 1445.36, "end": 1452.76, "text": " This is I think this is supported by research in adversarial examples like this paper adversarial"}, {"start": 1452.76, "end": 1460.8, "text": " examples are features not bugs, you know transfer learning, transfer of adversarial examples,"}, {"start": 1460.8, "end": 1464.6399999999999, "text": " all of this kind of stuff points to the fact that these networks tend to extract the same"}, {"start": 1464.6399999999999, "end": 1472.36, "text": " features and therefore we can assume pretty safely that up to this kind of rotational symmetry,"}, {"start": 1472.36, "end": 1476.76, "text": " our space, our feature space will look the same."}, {"start": 1476.76, "end": 1482.56, "text": " And therefore determining kind of this linear transformation should probably be enough"}, {"start": 1482.56, "end": 1488.8799999999999, "text": " in order to align one subspace with the other and be able to compare your own classifier"}, {"start": 1488.8799999999999, "end": 1494.3999999999999, "text": " that you have trained to mark the data to the classifier that someone else has trained"}, {"start": 1494.3999999999999, "end": 1496.12, "text": " on the same data."}, {"start": 1496.12, "end": 1497.12, "text": " Okay."}, {"start": 1497.12, "end": 1506.6799999999998, "text": " This is kind of the one of the difficulties they had to overcome and they evaluate this,"}, {"start": 1506.6799999999998, "end": 1513.12, "text": " they evaluate this experimentally you can see right here on the right 20% of the training"}, {"start": 1513.12, "end": 1520.7199999999998, "text": " data has been marked in order for the orange data."}, {"start": 1520.7199999999998, "end": 1522.7199999999998, "text": " This is these are random directions."}, {"start": 1522.72, "end": 1530.0, "text": " So blue would be the correlation with random directions and because sorry orange is the"}, {"start": 1530.0, "end": 1535.44, "text": " correlation with these carrier directions with the directions of the fake features and"}, {"start": 1535.44, "end": 1541.48, "text": " green is the alignment with actually the features of the classes itself."}, {"start": 1541.48, "end": 1547.52, "text": " So you can see even if 20% of the data is marked the classifier still aligns mostly with"}, {"start": 1547.52, "end": 1553.32, "text": " the features of the actual classification problem it aligns a little bit with the features"}, {"start": 1553.32, "end": 1563.36, "text": " of the fake features or with the fake features and it does so such that there is a statistically"}, {"start": 1563.36, "end": 1567.92, "text": " significant difference between random directions and these."}, {"start": 1567.92, "end": 1573.48, "text": " You can see even if 2% of the data only are marked."}, {"start": 1573.48, "end": 1578.56, "text": " So only 2% of the training data has this mark and the mark is always imperceptible right"}, {"start": 1578.56, "end": 1583.84, "text": " the mark is always such that you can't see it by eye even then you can see that there"}, {"start": 1583.84, "end": 1585.96, "text": " is a difference."}, {"start": 1585.96, "end": 1592.24, "text": " So the classifier does learn to pay attention to that feature which is something you can"}, {"start": 1592.24, "end": 1595.08, "text": " detect afterwards."}, {"start": 1595.08, "end": 1599.84, "text": " This experiment on the left here is just the same basically saying so up here it starts"}, {"start": 1599.84, "end": 1605.56, "text": " with not a lot of data being marked and you can see it mostly aligns with the semantic"}, {"start": 1605.56, "end": 1611.52, "text": " direction which is the true features as you mark more and more of the data it goes down"}, {"start": 1611.52, "end": 1615.76, "text": " and down and down but it does not."}, {"start": 1615.76, "end": 1621.9599999999998, "text": " So I think this is 50% is the yellow 50% of the data is marked and still you can see"}, {"start": 1621.9599999999998, "end": 1629.36, "text": " there is a pretty good alignment with the actual features because the network will start"}, {"start": 1629.36, "end": 1633.6399999999999, "text": " paying more and more attention to your fake features because they're pretty good predictors"}, {"start": 1633.6399999999999, "end": 1641.08, "text": " right but it also has this other training data that it can solve using those features."}, {"start": 1641.08, "end": 1646.28, "text": " So it still needs to pay attention and of course your marked data also has these other"}, {"start": 1646.28, "end": 1651.8, "text": " true features so it is to be expected that even though your data is marked it's still"}, {"start": 1651.8, "end": 1660.56, "text": " the classifier still aligns more with the true features than with your fake features."}, {"start": 1660.56, "end": 1666.1599999999999, "text": " And they also show an experiment that you do not sacrifice a lot in accuracy so here"}, {"start": 1666.1599999999999, "end": 1675.04, "text": " you can see the delta in accuracy through their experiments is fairly, fairly low and they"}, {"start": 1675.04, "end": 1678.2, "text": " do image net on the ResNet 18."}, {"start": 1678.2, "end": 1690.04, "text": " So these differences in accuracy they are you know you notice but they are fairly small."}, {"start": 1690.04, "end": 1696.8, "text": " So you know someone also couldn't just go on a big accuracy drop when training on"}, {"start": 1696.8, "end": 1702.88, "text": " data like this so someone, someone training with data couldn't just notice that it's"}, {"start": 1702.88, "end": 1707.64, "text": " maybe you actively marked by just saying well this doesn't work at all."}, {"start": 1707.64, "end": 1711.48, "text": " I guess some clustering approaches would work where you look at the features and you just"}, {"start": 1711.48, "end": 1718.64, "text": " see this one feature is like only present in this very particular group of data that"}, {"start": 1718.64, "end": 1725.8000000000002, "text": " I got from this very shady person selling me 3.5 inch floppy disks around the street corner"}, {"start": 1725.8, "end": 1734.68, "text": " but other than that yeah it's not really it's not really detectable for someone training"}, {"start": 1734.68, "end": 1736.1599999999999, "text": " on it."}, {"start": 1736.1599999999999, "end": 1740.6399999999999, "text": " And lastly they have black box they defend against black box attacks and here is where"}, {"start": 1740.6399999999999, "end": 1746.3999999999999, "text": " I'm a bit skeptical they say well if we don't have access to the model what we can still"}, {"start": 1746.3999999999999, "end": 1752.72, "text": " do is basically this is here what we can still do is we can analyze the loss."}, {"start": 1752.72, "end": 1762.28, "text": " We can analyze the loss value of the radioactively marked data and if the network we're testing"}, {"start": 1762.28, "end": 1771.44, "text": " is has significantly lower loss on our on the radio actively marked data than on non marked"}, {"start": 1771.44, "end": 1777.68, "text": " data then that's an indication that they trained on marked data which you know if you don't"}, {"start": 1777.68, "end": 1783.0800000000002, "text": " have access to the model like what's the probability that you have access to the loss of the"}, {"start": 1783.0800000000002, "end": 1789.76, "text": " model like the usually you need you need the output distribution or something it's a bit"}, {"start": 1789.76, "end": 1797.5600000000002, "text": " shady what I would do actually is is just a little bit more sophisticated but what you"}, {"start": 1797.5600000000002, "end": 1802.64, "text": " could do is you could take your direction you right you could back propagate it through"}, {"start": 1802.64, "end": 1809.5200000000002, "text": " your network to derive like a pure adversarial example so not even going from from some image"}, {"start": 1809.5200000000002, "end": 1815.96, "text": " just go from random noise like just derive like a super duper image that only has that"}, {"start": 1815.96, "end": 1823.96, "text": " one feature like and then input that into this classifier so this is yours and then input"}, {"start": 1823.96, "end": 1832.0, "text": " that into the classifier that you are testing okay and if that classifier gives you back"}, {"start": 1832.0, "end": 1839.4, "text": " the class that you you know each one of these you is actually of a given class right so you"}, {"start": 1839.4, "end": 1848.16, "text": " have one feature per class if that gives you back the class of that feature you have a"}, {"start": 1848.16, "end": 1853.0, "text": " pretty strong indication that someone has been training on your data because so if you"}, {"start": 1853.0, "end": 1857.96, "text": " look at data in general as we said it has these true features and if it's marked it also"}, {"start": 1857.96, "end": 1864.6000000000001, "text": " has the fake features so what kind of class it's going for you can detect in the output"}, {"start": 1864.6000000000001, "end": 1872.8, "text": " distribution but if you then input like a pure only the fake feature and it still comes"}, {"start": 1872.8, "end": 1878.1200000000001, "text": " out the class that you assigned to the fake feature you know there is a one over number"}, {"start": 1878.1200000000001, "end": 1884.1200000000001, "text": " of classes probability only that that happens by chance and if you want you can derive"}, {"start": 1884.12, "end": 1891.76, "text": " a different you can do this again you can derive a different pure only this feature sample"}, {"start": 1891.76, "end": 1899.52, "text": " input it again and look what comes out so it's not it's not a pure type so these are not"}, {"start": 1899.52, "end": 1905.12, "text": " going to be independent so you probably shouldn't like just multiply but I would think a"}, {"start": 1905.12, "end": 1909.9199999999998, "text": " procedure like this and maybe they do this somewhere but they simply say we can look"}, {"start": 1909.92, "end": 1917.0800000000002, "text": " at the loss of marked and unmarked data which you know I'm not so sure that that's going"}, {"start": 1917.0800000000002, "end": 1924.2, "text": " to work fairly well okay as I said there are going to be many many ways to improve this"}, {"start": 1924.2, "end": 1929.0800000000002, "text": " the paper has more experiments, ablations, transfer learning between architectures and"}, {"start": 1929.0800000000002, "end": 1936.5600000000002, "text": " so on I would just want to point out I have a so there's a bit of an issue here where"}, {"start": 1936.56, "end": 1943.9199999999998, "text": " I think there is a lot of room to grow first of all here you simply train the network"}, {"start": 1943.9199999999998, "end": 1949.1599999999999, "text": " and then you look at the network at the end right you simply look at these 10 vectors"}, {"start": 1949.1599999999999, "end": 1954.12, "text": " right here and you determine their inner product with the marking directions and that's"}, {"start": 1954.12, "end": 1960.8799999999999, "text": " you know that's what you what you go by what I would what I would like to see as an"}, {"start": 1960.88, "end": 1968.64, "text": " iteration of this is where you have a neural network and you you can't just detect by looking"}, {"start": 1968.64, "end": 1974.72, "text": " at the end what you'd have to do you'd have to be much more sneaky so in order to avoid"}, {"start": 1974.72, "end": 1981.72, "text": " detection detecting your detecting strategy so in order to avoid defenses against this I"}, {"start": 1981.72, "end": 1987.16, "text": " would I would guess what you want to do is not just you know make the network such that"}, {"start": 1987.16, "end": 1994.76, "text": " in the end it's fairly obvious if by looking at this last matrix maybe you should only"}, {"start": 1994.76, "end": 2001.0400000000002, "text": " be able to detect this at the end by actually feeding data into it like we did with the"}, {"start": 2001.0400000000002, "end": 2007.92, "text": " black box test but if we had a white box test by feeding data into it and then and then"}, {"start": 2007.92, "end": 2015.0400000000002, "text": " looking at the responses of the network so but someone could not tell it was trained with"}, {"start": 2015.04, "end": 2023.04, "text": " radioactive data by just looking at the networks weights so maybe one idea would be that you"}, {"start": 2023.04, "end": 2028.72, "text": " craft inputs in some way that correlates to of the hidden features so let's say we have"}, {"start": 2028.72, "end": 2036.24, "text": " some hidden layer here and one here and these features are learned by the network right"}, {"start": 2036.24, "end": 2041.28, "text": " and they appear to be fairly independent so you make sure that they are fairly independent"}, {"start": 2041.28, "end": 2047.8799999999999, "text": " during if you pass a regular data and then you craft data specifically you craft data"}, {"start": 2047.8799999999999, "end": 2055.04, "text": " like you did here with the marking that makes the network correlate the two features but"}, {"start": 2055.04, "end": 2061.2799999999997, "text": " has little effect actually on the output distribution of the classes so you can retain"}, {"start": 2061.2799999999997, "end": 2066.96, "text": " your generalization much more right it doesn't change this last layer necessarily that much"}, {"start": 2066.96, "end": 2072.92, "text": " or not in a completely class dependent fashion what I would simply do is I would correlate"}, {"start": 2072.92, "end": 2080.2, "text": " two of these internal features I would force the network to learn to correlate them and because"}, {"start": 2080.2, "end": 2086.48, "text": " then I would expect this to be much more you know secretive and then at test time I can"}, {"start": 2086.48, "end": 2092.36, "text": " simply introduce my forged data again and look whether or not the internal responses are"}, {"start": 2092.36, "end": 2098.76, "text": " actually correlated as I said I could do this across classes to cancel out the effect"}, {"start": 2098.76, "end": 2105.1600000000003, "text": " of this actually being a feature for one given class and therefore changing the networks"}, {"start": 2105.1600000000003, "end": 2112.96, "text": " accuracy too much I think that would be a cool next direction to go into and again this"}, {"start": 2112.96, "end": 2119.6400000000003, "text": " should work because even the intermediate features we have good reason to assume that"}, {"start": 2119.64, "end": 2124.7999999999997, "text": " different networks even different architectures different training runs learn the same kind"}, {"start": 2124.7999999999997, "end": 2130.4, "text": " of intermediate features the question is only in the next network that feature could actually"}, {"start": 2130.4, "end": 2135.96, "text": " be like you know two layers up or three layers down or and so on so you'd have to learn"}, {"start": 2135.96, "end": 2143.48, "text": " some kind of more sophisticated alignment there but still I think that would be kind of"}, {"start": 2143.48, "end": 2151.2400000000002, "text": " an iteration of this which would be cool you know if you're doing this side channel yeah"}, {"start": 2151.2400000000002, "end": 2158.48, "text": " all right so that was it for me for this paper as I said pretty simple paper pretty cool"}, {"start": 2158.48, "end": 2188.44, "text": " idea and I'll see you next time bye bye"}] |
Yannic Kilcher | 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 André Barreto, Chavo Hall, Dianna Borsa, David Silver, and Dóinab 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 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 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 a 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's like go and things like this so where this combination of deep learning with reinforcement learning has really shined or shun 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 alpha go they need a simulator and they need to collect enormous amounts of data even more so with systems like the Dota AI the open AI5 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 dividing 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 whoops 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 reward of zero for the other task okay so the environment will somehow tell you which tasks 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 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 our 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 and I'm most reinforcement learning problems you can actually kind of forget about this part right here because well it it isn't 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 a 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 I 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 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 route 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 we want to where do i highlight policy evaluation i don't know but here they say this is the policy improvement okay i'll hear 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 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 i don't know p and we also have many reward functions reward one reward two reward three and so on until it 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 what not and that results in this particular policy and then the agent just from scratch you restarted 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 are 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 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 moved 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 um one if if it picks up a square sorry the square and 0 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 0 else so you can see the good policies right here so pi one is a good policy for a reward one because it just goes and collects these red things doesn't care about the blue things just goes and collects them pi 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 um it's 0 else except it's negative one if you pick up a blue thing or the order of these is kind of wrong but it's just for visual representation okay so now you're asked to um pick up the red things but avoid the blue things okay 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 um 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 um 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 a kind of want to leave out the next state right here just to make things easier on you so a feature here um 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 uh 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 uh 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 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 um simply the feature times a one zero which is the w vector okay 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 time that's the same as true for r2 if and I want to give it the new task r3 right um and you remember the reward function right there I can achieve that reward function but I simply multiplying the same features the exact same feature functions uh 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 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 uh constant across tasks or whereas the w defines the task all right so the 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 of course 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 um 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 worlds have all of our tasks in this world have to be a linear mix of the same features if that's given then our um 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 um 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 uh of course it comes from the fact of the linearity appear 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 they need to be cumulative again that comes from the fact that it's linear but uh to see so a feature like i want an an even number of steps or something like this would be terrible uh because and they're going into things like this later but it would be terrible because here we have the sum and um as soon as you if you have a feature that is very high if you have an even number of steps then um or if you have a feature that counts the steps you will never be able to 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 after 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 a pound sign the number of squares that you pick up okay similarly our feature too 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 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 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 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 task in fact here it's given right it this 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 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 that 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're 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 by not reinforcement learning at all in this new task so by structuring things like this here so what does it really say here if 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 we'll 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 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 the step or sorry our five for the step is going to be 0 1 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 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're 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 it won't you know explicitly go look for them so let's say the episode goes 10 more steps but the board has like a hundred 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 say but is 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 trials 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 1 and pi 2 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 these 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 imposors of the task so what happens if we only have the reward function we specify the task only in terms of the reward functions but we're kind of looking at the features and we're like agents 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 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 this is this gets closer and closer to transfer learning right 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 um i get closer and closer and you'll see this trend right here so it's pretty cool what you can do 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 and you might object and say wait i mean 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 task can be mixed from those so these are orthogonal vectors in this vector space so you're being pretty generous to the system what happens if we're not as generous so that's what they do here so they have different um 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 well they label it right here and this is going to be the zero one axis and this is evaluation so every direction on the 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 triangles at all cost 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 getting 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 policies so no learning as a baseline you have q learning which into a given direction um tells you basically how how long q learning or takes or how far q learning gets with a given amount of steps indicated by this one two three four and so on um 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 be this these methods but our hope is going to be that of course if we have this zero shot uh 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 um 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 um then the other extreme is when we give policy 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 while 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're um because there are also 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 um 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 um it's not it's not the the choices of actions we have from policy five aren't going to be super good at that and um they do another they do another thing right here so 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 um 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 these squares collect the triangle you can see it performs fairly well over here where it's all about avoiding the uh 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 um 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 uh because this policy here also needs to avoid um 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 um 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 um i don't i don't know if my vision but i'm pretty sure here the black thing is inside the blue thing uh 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 um 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 um which i'm not sure if if that makes sense um 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 uh therefore we are getting better i'm not i don't agree with this i given these results or maybe at the plotting the plotting is bad all right 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 um the the pi functions that lead to the successor 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 um we can see that before you can you so this is the small version of this plot right here this is like this uh section i think yeah you know you improve however we can also learn this pi function we can also learn the features were 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 um so i get i get it you have the i here and the w doesn't depend on the i and so on um but you're getting more and more back to actually simply learning non-linear functions mixing them linearly right here and i think that's going to be kind of the crux of this method uh the fact that the more complicated your problems are the less you are 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 um triangles or squares then they say well you can simply not have a single w but you can find a function w and uh 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 um 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 uh but i think you can simply view this let's say as a hidden layer in a neural network now i get it some of the held constant across uh sums and so on but you know i i like the method in terms of um you know in terms of the analysis so if you are given all this stuff it seems pretty cool that you can derive new policies uh it's implication for lifelong learning they say look here um 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 uh 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 uh 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 uh 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 um away from away from their setup and i'm 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 uh 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 um i'm not sure but from divide and conquer i almost 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 you know single task like this here the task 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 through like like one one metal layer and one actual layer like this one right here uh they they rarely go further maybe they go two layers but that's about it um i've seen very little in actual hierarchical or dividing conquer reinforcement learning just because it's so hard to train um yeah all in all cool paper and um if you want to get it 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 um if you just read from the beginning all these reinforcement learning papers it seems a bit like why why are we doing this right usually oh could we define this we define that we define this and you're a bit like i yeah but why so often it pays in these papers to go at the end to the examples and then uh 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": 4.32, "text": " Hi there! Today we're looking at fast reinforcement learning with generalized"}, {"start": 4.32, "end": 9.76, "text": " policy updates by Andr\u00e9 Barreto, Chavo Hall, Dianna Borsa, David Silver, and"}, {"start": 9.76, "end": 16.36, "text": " D\u00f3inab Precu. So on high level this paper proposes a framework for reinforcement"}, {"start": 16.36, "end": 21.96, "text": " learning where you have many tasks at the same time and they propose framework"}, {"start": 21.96, "end": 28.28, "text": " where they learn many policies at the same time that can or cannot correspond"}, {"start": 28.28, "end": 33.56, "text": " to these tasks and then their argument is that if you now have a new task that"}, {"start": 33.56, "end": 38.52, "text": " you haven't seen before you can easily construct a solution to that task from"}, {"start": 38.52, "end": 44.84, "text": " your old policies basically mixing what you learned about your old tasks and it's"}, {"start": 44.84, "end": 49.400000000000006, "text": " a pretty general framework and we're going to look at it in my opinion it's it's"}, {"start": 49.400000000000006, "end": 54.28, "text": " pretty cool for certain settings however I think it kind of breaks down the"}, {"start": 54.28, "end": 61.480000000000004, "text": " the more general you go which I guess is expected of such a framework but it's as"}, {"start": 61.480000000000004, "end": 68.04, "text": " you can see it's kind of math heavy but we'll get into the examples and what"}, {"start": 68.04, "end": 73.08, "text": " it's potentially useful for. Alright so that was it on a high level if you like"}, {"start": 73.08, "end": 78.04, "text": " content like this don't hesitate to subscribe to the channel and share it out"}, {"start": 78.04, "end": 83.08, "text": " leave a like and tell me in the comments what you think I'm still reading all"}, {"start": 83.08, "end": 91.32, "text": " of them so I will see it. Cool let's dive in. So they say the combination of"}, {"start": 91.32, "end": 94.67999999999999, "text": " reinforcement learning with deep learning is a promising approach to tackle"}, {"start": 94.67999999999999, "end": 98.75999999999999, "text": " important sequential decision making problems that are currently intractable."}, {"start": 98.75999999999999, "end": 106.16, "text": " Well they're taking they're talking about you know things like mostly these"}, {"start": 106.16, "end": 113.11999999999999, "text": " game playing AI's like go and things like this so where this combination of"}, {"start": 113.11999999999999, "end": 120.08, "text": " deep learning with reinforcement learning has really shined or shun whatever one"}, {"start": 120.08, "end": 124.72, "text": " obstacle to overcome is the amount of data needed by learning systems of this"}, {"start": 124.72, "end": 129.84, "text": " type. So again if you look at these systems like alpha go they need a"}, {"start": 129.84, "end": 135.6, "text": " simulator and they need to collect enormous amounts of data even more so with"}, {"start": 135.6, "end": 143.92, "text": " systems like the Dota AI the open AI5 Dota or Starcraft playing alpha star I"}, {"start": 143.92, "end": 149.51999999999998, "text": " think it's alpha star they need so many simulations in order to learn about"}, {"start": 149.51999999999998, "end": 155.35999999999999, "text": " the tasks because they always start from scratch. In this article they say we"}, {"start": 155.35999999999999, "end": 160.0, "text": " propose to address this issue through a dividing conquer approach we argue that"}, {"start": 160.0, "end": 164.48, "text": " complex decision problems can be naturally decomposed into multiple tasks"}, {"start": 164.48, "end": 170.72, "text": " that unfold in sequence or in parallel by associating each task with a reward"}, {"start": 170.72, "end": 175.76, "text": " function this problem decomposition can be seamlessly accommodated within the"}, {"start": 175.76, "end": 181.92, "text": " standard reinforcement learning formalism. Okay so what are they saying right here"}, {"start": 181.92, "end": 186.72, "text": " they are basically saying that if you have a task let's say you want to get"}, {"start": 186.72, "end": 192.48, "text": " whoops the from here to here and that's very complicated let's make it"}, {"start": 192.48, "end": 198.48, "text": " complicated super duper complicated you can basically subdivide that task into"}, {"start": 198.48, "end": 205.44, "text": " multiple sub tasks right so here is like left turn right turn go straight left"}, {"start": 205.44, "end": 210.64, "text": " turn go straight right turn and so on and each of these sub tasks you can see the"}, {"start": 210.64, "end": 215.04, "text": " two right turns here might share a lot of common information there could also be"}, {"start": 215.04, "end": 221.12, "text": " tasks that are at the same time like you need to go forward and jump can be decomposed"}, {"start": 221.12, "end": 226.48000000000002, "text": " into going forward and to jump now they're saying is if each of these tasks now"}, {"start": 226.48000000000002, "end": 232.08, "text": " has its separate reward function in the environment like for some reason the"}, {"start": 232.08, "end": 238.08, "text": " environment tells you this by the way is task task one and you're going to get a"}, {"start": 238.08, "end": 244.48000000000002, "text": " positive reward if you do a right turn and this down here is task two the"}, {"start": 244.48000000000002, "end": 249.52, "text": " left turn task and you're going to get a positive reward if for that task so"}, {"start": 249.52, "end": 255.60000000000002, "text": " the entire task state can be decomposed into a vector so in our case here we have"}, {"start": 255.60000000000002, "end": 260.96000000000004, "text": " maybe a vector with three elements okay the three elements correspond to turn"}, {"start": 260.96000000000004, "end": 269.92, "text": " right go straight and turn left and now you're this this right here is your"}, {"start": 269.92, "end": 274.40000000000003, "text": " reward vector so we're no longer talking this framework we're no longer talking"}, {"start": 274.4, "end": 280.71999999999997, "text": " about just a reward we're talking about a reward vector now each of these"}, {"start": 280.71999999999997, "end": 285.84, "text": " tasks is going to give you its own individual reward so let's say you're here"}, {"start": 285.84, "end": 291.03999999999996, "text": " and you're actually turning right this is going to give you a reward of one for"}, {"start": 291.03999999999996, "end": 298.88, "text": " this task but reward of zero for the other task okay so the environment will"}, {"start": 298.88, "end": 305.84, "text": " somehow tell you which tasks you get reward for now there is a notion where you"}, {"start": 305.84, "end": 310.0, "text": " can map this back to a single number and that is the second thing they"}, {"start": 310.0, "end": 313.84, "text": " introduce here so the second thing they introduce here is this thing they"}, {"start": 313.84, "end": 322.4, "text": " call w so w is going to be a mixing vector w is going to be a vector I will"}, {"start": 322.4, "end": 327.84, "text": " call w right here this is the reward vector w is going to be the vector that"}, {"start": 327.84, "end": 334.4, "text": " tells you your final reward so here we're going to do an inner product so we're"}, {"start": 334.4, "end": 342.23999999999995, "text": " going to transpose this and multiply by w and w mixes these rewards and comes up"}, {"start": 342.23999999999995, "end": 347.03999999999996, "text": " with your final reward right here so this this is maybe the reward vector"}, {"start": 347.03999999999996, "end": 353.28, "text": " this is the reward number how are we going to call this reward number so in this"}, {"start": 353.28, "end": 360.4, "text": " case w would have to look something like this let's say this is an example so"}, {"start": 360.4, "end": 366.15999999999997, "text": " the task right here would be to only do right turns now this is not a really"}, {"start": 366.15999999999997, "end": 370.23999999999995, "text": " nice example we're going to see some nicer examples later on but you can see"}, {"start": 370.23999999999995, "end": 375.2, "text": " that now the environment is specified as a vector of rewards and you can"}, {"start": 375.2, "end": 380.55999999999995, "text": " create a specific tasks like turning right simply by adjusting how you mix"}, {"start": 380.56, "end": 386.8, "text": " these different things by this vector w and this is going to be the key"}, {"start": 386.8, "end": 393.44, "text": " ingredient here so they discuss your general reinforcement learning"}, {"start": 393.44, "end": 397.28, "text": " reinforcement learning lingo and I think we've gone through this a number of"}, {"start": 397.28, "end": 403.68, "text": " times just very very quickly in reinforcement learning you're given these"}, {"start": 403.68, "end": 410.88, "text": " transitions you are in a state you take an action and that leads you to get a"}, {"start": 410.88, "end": 418.24, "text": " reward our prime and you get into a state s prime in the next state they say"}, {"start": 418.24, "end": 422.72, "text": " the reward is given by the reward function so the reward is purely a"}, {"start": 422.72, "end": 426.16, "text": " function of where you are and what you do and where you get to"}, {"start": 426.16, "end": 430.24, "text": " and I'm most reinforcement learning problems you can actually kind of forget"}, {"start": 430.24, "end": 435.6, "text": " about this part right here because well it it isn't it is kind of important"}, {"start": 435.6, "end": 442.0, "text": " but you could most reinforcement learning problems the reward is simply a"}, {"start": 442.0, "end": 446.24, "text": " matter of where you are and what you do and this can be a random variable"}, {"start": 446.24, "end": 451.28000000000003, "text": " there can be randomness but maybe it's easier if you for now think about the"}, {"start": 451.28000000000003, "end": 455.84000000000003, "text": " reward simply as a function of these two things so what you want to discover"}, {"start": 455.84, "end": 462.79999999999995, "text": " is a policy pi where you input you input where you are and the output is going"}, {"start": 462.79999999999995, "end": 468.15999999999997, "text": " to be what you should you do in that situation okay that is a policy"}, {"start": 468.15999999999997, "end": 473.35999999999996, "text": " and associated with each policy is this thing called a Q function so you can see"}, {"start": 473.35999999999996, "end": 480.4, "text": " right here the Q function of a policy is going to be a function of where you"}, {"start": 480.4, "end": 486.0, "text": " are and what you do and this is a bit confusing but it basically means that you"}, {"start": 486.0, "end": 491.03999999999996, "text": " are in state s so you are here and you have let's say three options"}, {"start": 491.03999999999996, "end": 497.35999999999996, "text": " action one action two action three to do now the Q function tells you"}, {"start": 497.35999999999996, "end": 502.71999999999997, "text": " the Q function this is s and the a's are the numbers okay so let's say we"}, {"start": 502.71999999999997, "end": 506.32, "text": " plug in the state s and for a we plug in number two"}, {"start": 506.32, "end": 514.16, "text": " what I will tell you is if I am in state s and I perform action number two"}, {"start": 514.16, "end": 520.88, "text": " then how valuable is that for me and value is defined by all the reward that"}, {"start": 520.88, "end": 526.4, "text": " I'm going to pick up from now until the end of time or the end of the"}, {"start": 526.4, "end": 533.36, "text": " episode it depends but let's say until the end of time well how much reward"}, {"start": 533.36, "end": 537.76, "text": " am I going to pick up from now until the end of time is a bit of a vague not a"}, {"start": 537.76, "end": 542.4, "text": " vague question but a difficult question I can tell you how much route I could"}, {"start": 542.4, "end": 547.6, "text": " estimate how much reward I'm going to pick up in the next step because I know"}, {"start": 547.6, "end": 550.88, "text": " what action I'm doing I'm performing action number two but what happens"}, {"start": 550.88, "end": 556.4, "text": " after that who knows so that's where this policy right here comes in"}, {"start": 556.4, "end": 561.52, "text": " this policy right here says so the full definition of the Q function is if I'm"}, {"start": 561.52, "end": 570.24, "text": " in state s and I perform action a right now and after that I follow policy pi"}, {"start": 570.24, "end": 574.16, "text": " what is my reward going to be right now it's well defined so right now you do"}, {"start": 574.16, "end": 579.6, "text": " action a and after that you do whatever action the policy tells you"}, {"start": 579.6, "end": 585.84, "text": " in that specific situation okay so that's the Q function and you can pretty easily"}, {"start": 585.84, "end": 590.48, "text": " see that if you have a Q function right if you have an accurate Q function you"}, {"start": 590.48, "end": 595.52, "text": " can get a good policy by simply always going with the action that gives you"}, {"start": 595.52, "end": 600.8000000000001, "text": " the highest Q value because it's because of a recurrence relationship called"}, {"start": 600.8000000000001, "end": 607.84, "text": " the the Bellman equation this thing right here so your Q function basically"}, {"start": 607.84, "end": 612.8000000000001, "text": " decomposes into the reward in the next step as we said plus"}, {"start": 612.8000000000001, "end": 616.5600000000001, "text": " whatever happens after that and whatever happens after that is just by the"}, {"start": 616.5600000000001, "end": 620.4, "text": " nature of how the things are defined is going to be the Q function"}, {"start": 620.4, "end": 626.9599999999999, "text": " of whatever the policy is telling you so you can get a pretty good policy by"}, {"start": 626.9599999999999, "end": 632.9599999999999, "text": " always doing whatever action your Q function tells you is best"}, {"start": 632.9599999999999, "end": 639.04, "text": " this step of calculating the Q function is called a policy"}, {"start": 639.04, "end": 644.16, "text": " evaluation and this paper here is going to"}, {"start": 644.16, "end": 650.0, "text": " generalize these notions sorry so this is a policy evaluation and then the"}, {"start": 650.0, "end": 653.92, "text": " act of selecting an action is going to be a policy"}, {"start": 653.92, "end": 659.44, "text": " improvement these are just names okay but we need to know them because the paper"}, {"start": 659.44, "end": 664.64, "text": " introduces two new things we want to where do i"}, {"start": 664.64, "end": 669.68, "text": " highlight policy evaluation"}, {"start": 669.68, "end": 674.4, "text": " i don't know but here they say this is the policy improvement okay"}, {"start": 674.4, "end": 679.2, "text": " i'll hear policy evaluation policy improvement these are the two steps so the"}, {"start": 679.2, "end": 683.76, "text": " first step is calculate the Q function the second step is to select an"}, {"start": 683.76, "end": 690.32, "text": " action and you can see how these things interlock namely"}, {"start": 690.32, "end": 696.4000000000001, "text": " we can calculate the Q function of a given policy and we can improve that"}, {"start": 696.4000000000001, "end": 702.8000000000001, "text": " policy by selecting whatever action is best for the Q function"}, {"start": 702.8000000000001, "end": 708.6400000000001, "text": " this paper generalizes this and you can see that there is a little"}, {"start": 708.64, "end": 715.52, "text": " a little r right here so the r is just a specific way to reference the"}, {"start": 715.52, "end": 723.36, "text": " reward function used right here okay and you can see it here as well"}, {"start": 723.36, "end": 729.28, "text": " now usually we have one policy and one reward"}, {"start": 729.28, "end": 733.2, "text": " and so what we do is we improve the policy"}, {"start": 733.2, "end": 736.96, "text": " and that leads us to better evaluate the Q function for a given reward"}, {"start": 736.96, "end": 740.32, "text": " function and that leads us to improve the policy"}, {"start": 740.32, "end": 745.76, "text": " now this paper is going to transform this into the following"}, {"start": 745.76, "end": 750.5600000000001, "text": " we have many policies so we have policy one policy two"}, {"start": 750.5600000000001, "end": 758.4000000000001, "text": " and so on until policy i don't know p and we also have many reward functions"}, {"start": 758.4000000000001, "end": 764.96, "text": " reward one reward two reward three and so on until it reward let's call that r"}, {"start": 764.96, "end": 772.32, "text": " so we have many different tasks right here and we have many policies now"}, {"start": 772.32, "end": 775.9200000000001, "text": " in essence they don't need to have some anything to do with each other for the"}, {"start": 775.9200000000001, "end": 782.32, "text": " theory of this paper but i can simplify this a bit of how they see the"}, {"start": 782.32, "end": 787.2800000000001, "text": " world so let's say you have an agent and the agent"}, {"start": 787.2800000000001, "end": 794.24, "text": " has been trained on simply that first task right here"}, {"start": 794.24, "end": 799.36, "text": " and has been trained using classic Q learning reinforcement learning what not"}, {"start": 799.36, "end": 805.04, "text": " and that results in this particular policy and then the agent just from scratch"}, {"start": 805.04, "end": 810.24, "text": " you restarted again you run reinforcement learning just on reward number two"}, {"start": 810.24, "end": 814.64, "text": " and obtained policy number two and so on so you do this for all these"}, {"start": 814.64, "end": 819.76, "text": " rewards individually okay so you give the agent a new task and you ask it to"}, {"start": 819.76, "end": 826.56, "text": " learn a policy for that task now you're in a situation where if you are in"}, {"start": 826.56, "end": 833.52, "text": " have a new task so are new the question is do you again"}, {"start": 833.52, "end": 840.64, "text": " need to train a new policy and the answer for this paper is no because we have"}, {"start": 840.64, "end": 846.0, "text": " all these policies we don't need to train a new we can simply mix and match"}, {"start": 846.0, "end": 853.76, "text": " these policies that we already know to obtain a good solution for the new task"}, {"start": 853.76, "end": 862.64, "text": " so how does the paper do it it does it yeah it does it in the following"}, {"start": 863.44, "end": 869.2, "text": " it defines the successor features okay maybe it's in maybe it's better if we"}, {"start": 869.2, "end": 874.0, "text": " first go to an example so the example they give here is the following otherwise"}, {"start": 874.0, "end": 878.16, "text": " this I guess this might sound just a bit too abstract okay so you have this"}, {"start": 878.16, "end": 885.04, "text": " world here the agent is the thing here in yellow and it can just move so its"}, {"start": 885.04, "end": 890.72, "text": " actions are moved left up right down this this is one step okay in the"}, {"start": 890.72, "end": 896.48, "text": " environment there are two different objects one object is a triangle and one"}, {"start": 896.48, "end": 903.76, "text": " object is a square okay so there are a number of tasks we can define"}, {"start": 903.76, "end": 912.72, "text": " right now in this thing so we define tasks according to a reward function so"}, {"start": 912.72, "end": 918.0, "text": " the reward let's say the reward one is going to be"}, {"start": 918.0, "end": 929.28, "text": " um one if if it picks up a square sorry the square and 0 else just if it picks"}, {"start": 929.28, "end": 934.16, "text": " up a square on any given step we give it a reward of one we don't care about"}, {"start": 934.16, "end": 939.52, "text": " the blue triangles okay and then reward two is going to be the opposite it's"}, {"start": 939.52, "end": 946.56, "text": " going to be one not the opposite but one if it picks up a triangle and 0 else"}, {"start": 946.56, "end": 953.12, "text": " so you can see the good policies right here"}, {"start": 953.12, "end": 958.56, "text": " so pi one is a good policy for a reward one because it just goes and collects"}, {"start": 958.56, "end": 961.92, "text": " these red things doesn't care about the blue things just goes and collects"}, {"start": 961.92, "end": 966.64, "text": " them pi two it goes and collects the blue things doesn't care about the red"}, {"start": 966.64, "end": 973.1199999999999, "text": " things okay so let's imagine that you have run reinforcement learning twice"}, {"start": 973.1199999999999, "end": 980.88, "text": " once for reward one and once for reward two and now you have two policies okay so"}, {"start": 980.88, "end": 987.8399999999999, "text": " you have two policies this will lead to pi one this will lead to pi two"}, {"start": 987.84, "end": 994.4, "text": " and now I give you the third task now the third task is a bit special it's one if"}, {"start": 994.4, "end": 1003.6800000000001, "text": " you pick up a square and it's um it's 0"}, {"start": 1003.6800000000001, "end": 1010.48, "text": " else except it's negative one if you pick up a blue thing"}, {"start": 1010.48, "end": 1015.9200000000001, "text": " or the order of these is kind of wrong but it's just for visual representation"}, {"start": 1015.92, "end": 1024.8799999999999, "text": " okay so now you're asked to um pick up the red things but avoid the blue things"}, {"start": 1024.8799999999999, "end": 1029.12, "text": " okay pick up as many red things as you can avoid the blue things"}, {"start": 1029.12, "end": 1034.8799999999999, "text": " and again as we said the question is do you now have to run reinforcement learning"}, {"start": 1034.8799999999999, "end": 1038.72, "text": " again in this agent with your simulator using like q learning or something"}, {"start": 1038.72, "end": 1044.08, "text": " like this from the start or can you come up with a solution"}, {"start": 1044.08, "end": 1052.32, "text": " just given these two policies that will perform well on the on this new task"}, {"start": 1052.32, "end": 1061.84, "text": " okay and we're going to see how they do it so what they do is they use"}, {"start": 1061.84, "end": 1066.6399999999999, "text": " successor features so these successor features um"}, {"start": 1067.6, "end": 1072.8, "text": " I've done a video about successor features and I'll link to that you can look at"}, {"start": 1072.8, "end": 1078.6399999999999, "text": " that but essentially essentially the successor features are defined like"}, {"start": 1078.6399999999999, "end": 1082.72, "text": " this and for that we need to know what this thing is right here they simply"}, {"start": 1082.72, "end": 1088.8799999999999, "text": " call this a feature function okay it's very it's very um"}, {"start": 1088.8799999999999, "end": 1094.6399999999999, "text": " ambiguous term a feature function is a function that"}, {"start": 1094.6399999999999, "end": 1100.48, "text": " takes in a transition so state action next state and maps it to a high"}, {"start": 1100.48, "end": 1104.8, "text": " dimensional vector note this is almost the same as a reward function except"}, {"start": 1104.8, "end": 1111.92, "text": " the reward function simply maps it to a number now this is mapped to a higher"}, {"start": 1111.92, "end": 1116.88, "text": " dimensional thing again I want to a kind of want to"}, {"start": 1116.88, "end": 1122.96, "text": " leave out the next state right here just to make things easier on you so"}, {"start": 1122.96, "end": 1132.0, "text": " a feature here um can be many many things but the structure of the"}, {"start": 1132.0, "end": 1137.3600000000001, "text": " features is going to be such that the reward function"}, {"start": 1137.3600000000001, "end": 1143.3600000000001, "text": " is going to be this feature times this w vector so it was a bit"}, {"start": 1143.3600000000001, "end": 1147.76, "text": " a bit not correct before uh when I said the reward is now a vector"}, {"start": 1147.76, "end": 1154.48, "text": " the reward of a particular task w can be seen as"}, {"start": 1154.48, "end": 1159.68, "text": " the inner product between the features and the task vector so w"}, {"start": 1159.68, "end": 1164.56, "text": " specifies the task and the features well they specify the features"}, {"start": 1164.56, "end": 1170.56, "text": " in our case it can be it can be fairly simple namely"}, {"start": 1170.56, "end": 1175.2, "text": " yes I was I was definitely wrong at the beginning so"}, {"start": 1175.2, "end": 1179.76, "text": " the feature functions right here is which object do you pick up okay"}, {"start": 1179.76, "end": 1187.76, "text": " so we define the feature function as uh one zero if you pick up a"}, {"start": 1187.76, "end": 1195.1200000000001, "text": " square and we define the feature function as zero one if you pick up a triangle"}, {"start": 1195.1200000000001, "end": 1202.4, "text": " and now you can and we define it as we define it as zero zero if you pick up"}, {"start": 1202.4, "end": 1208.3200000000002, "text": " nothing and now you can fairly easily see that the reward of each task"}, {"start": 1208.3200000000002, "end": 1212.96, "text": " can be simply calculated by mixing the features accordingly okay so"}, {"start": 1212.96, "end": 1218.72, "text": " reward one is going to be um simply the feature"}, {"start": 1218.72, "end": 1226.0800000000002, "text": " times a one zero which is the w vector okay so I can specify a task by giving"}, {"start": 1226.0800000000002, "end": 1230.64, "text": " the appropriate w vector and now you can see that if this is my reward"}, {"start": 1230.64, "end": 1234.5600000000002, "text": " function my agent can go out into the world if it collects a"}, {"start": 1234.5600000000002, "end": 1240.88, "text": " square it is going to be rewarded right here if it collects a triangle even"}, {"start": 1240.88, "end": 1244.8000000000002, "text": " though the features indicate that it collected a triangle it doesn't care"}, {"start": 1244.8000000000002, "end": 1250.8000000000002, "text": " about it because the w is zero right here if I now want to give it the new"}, {"start": 1250.8000000000002, "end": 1255.0400000000002, "text": " time that's the same as true for r2 if and I want to give it the new task r3"}, {"start": 1255.0400000000002, "end": 1259.44, "text": " right um and you remember the reward function right there I can achieve that"}, {"start": 1259.44, "end": 1264.8, "text": " reward function but I simply multiplying the same features the exact same"}, {"start": 1264.8, "end": 1272.16, "text": " feature functions uh by this vector right here okay"}, {"start": 1272.16, "end": 1276.88, "text": " remember there is a slight difference between the reward function and the"}, {"start": 1276.88, "end": 1280.4, "text": " feature function in this particular example the idea of the"}, {"start": 1280.4, "end": 1284.88, "text": " paper is that the feature function can be rich in in"}, {"start": 1284.88, "end": 1289.68, "text": " expressivity and you know tell you all sorts of things about your current state"}, {"start": 1289.68, "end": 1295.44, "text": " and the reward function is just a number right and then the the reward is"}, {"start": 1295.44, "end": 1301.3600000000001, "text": " specified by simply linearly mixing these features so the structure imposed by"}, {"start": 1301.3600000000001, "end": 1306.0800000000002, "text": " the paper here is that there are such a thing as a feature"}, {"start": 1306.0800000000002, "end": 1312.96, "text": " and any task can be described by mixing these same features okay that's"}, {"start": 1312.96, "end": 1320.4, "text": " that's the issue right here so the features are going to be uh constant"}, {"start": 1320.4, "end": 1332.88, "text": " across tasks or whereas the w defines the task"}, {"start": 1333.8400000000001, "end": 1340.48, "text": " all right so the the goal here is that if you have learned many many things"}, {"start": 1340.48, "end": 1344.72, "text": " during your tasks what you want to do is you want to learn this"}, {"start": 1344.72, "end": 1348.88, "text": " feature representation that is the same across all tasks"}, {"start": 1348.88, "end": 1354.96, "text": " and then you want to simply have the w specify how to mix these features to get"}, {"start": 1354.96, "end": 1359.2, "text": " the reward of course this is a very strict very very"}, {"start": 1359.2, "end": 1363.76, "text": " definition not not a lot of things will fall into this unless you make the"}, {"start": 1363.76, "end": 1369.44, "text": " features like exponentially big of course um however they do"}, {"start": 1369.44, "end": 1375.2, "text": " discuss whenever a task doesn't fall into that so i hope you're with me so far"}, {"start": 1375.2, "end": 1380.0, "text": " this is the first kind of restriction we impose on our worlds that we can tackle"}, {"start": 1380.0, "end": 1385.04, "text": " with this framework namely that all of our worlds have all of our tasks in"}, {"start": 1385.04, "end": 1392.56, "text": " this world have to be a linear mix of the same features if that's given"}, {"start": 1392.56, "end": 1399.36, "text": " then our um then we can derive policies for tasks that we have never seen"}, {"start": 1399.36, "end": 1406.08, "text": " we can derive good policies by doing zero learning simply by specifying the"}, {"start": 1406.08, "end": 1411.28, "text": " task we can have a good policy for that task from the policies we've already"}, {"start": 1411.28, "end": 1417.36, "text": " learned for the other tasks okay so the reward three is now simply"}, {"start": 1417.36, "end": 1421.84, "text": " this and yeah notice it's not the same as the reward function because the"}, {"start": 1421.84, "end": 1426.8, "text": " reward function had one if you pick up the square negative one if you pick up"}, {"start": 1426.8, "end": 1431.84, "text": " the triangle and zero else so the zero we don't have to specify here because"}, {"start": 1431.84, "end": 1437.4399999999998, "text": " it's not part of our features right so you can see that the reward"}, {"start": 1437.4399999999998, "end": 1444.9599999999998, "text": " function is given simply by that and we can now as i said derive a good"}, {"start": 1444.9599999999998, "end": 1451.1999999999998, "text": " policy for this reward by looking at the other policies even though none of"}, {"start": 1451.2, "end": 1456.4, "text": " these policies has ever learned to avoid anything"}, {"start": 1456.48, "end": 1462.64, "text": " so it makes it defines these successor features right here so the successor"}, {"start": 1462.64, "end": 1468.4, "text": " features is much like the q function you can see the signature is almost the same"}, {"start": 1468.4, "end": 1475.6000000000001, "text": " so as a q function tells you um how much reward you're going to get if you do"}, {"start": 1475.6, "end": 1481.6, "text": " the action a and then follow policy pi the successor features almost the same"}, {"start": 1481.6, "end": 1487.76, "text": " thing however it doesn't tell you what rewards you're going to get it tells you"}, {"start": 1487.76, "end": 1493.6799999999998, "text": " which features you're going to get and which features by that we mean the sum"}, {"start": 1493.6799999999998, "end": 1502.32, "text": " of future features now you can see this sum this a little bit this uh"}, {"start": 1502.32, "end": 1505.9199999999998, "text": " of course it comes from the fact of the linearity appear so it's not really an"}, {"start": 1505.9199999999998, "end": 1510.72, "text": " additional restriction but simply to clarify what this means for your"}, {"start": 1510.72, "end": 1517.36, "text": " environment your environment has to be able to be looked at in terms of these"}, {"start": 1517.36, "end": 1521.36, "text": " features and these features they need to be cumulative again that comes from"}, {"start": 1521.36, "end": 1526.72, "text": " the fact that it's linear but uh to see so a feature like"}, {"start": 1526.72, "end": 1534.0, "text": " i want an an even number of steps or something like this would be terrible"}, {"start": 1534.0, "end": 1538.24, "text": " uh because and they're going into things like this later but it would be"}, {"start": 1538.24, "end": 1542.8, "text": " terrible because here we have the sum and um as soon as you if you have a"}, {"start": 1542.8, "end": 1550.16, "text": " feature that is very high if you have an even number of steps then um"}, {"start": 1550.16, "end": 1553.44, "text": " or if you have a feature that counts the steps"}, {"start": 1553.44, "end": 1559.52, "text": " you will never be able to to do well because if you have a feature that counts"}, {"start": 1559.52, "end": 1563.3600000000001, "text": " the steps it simply counts up and up and up and up depending on how many steps"}, {"start": 1563.3600000000001, "end": 1568.24, "text": " you do and your reward can never be specified in terms of a mix of these"}, {"start": 1568.24, "end": 1572.4, "text": " features and therefore your successor features are going to be"}, {"start": 1572.4, "end": 1580.3200000000002, "text": " useless but in our case where it's where feature one is pick up"}, {"start": 1580.32, "end": 1587.04, "text": " is how many of the sorry after rephrase our feature one"}, {"start": 1587.04, "end": 1593.76, "text": " is whether or not you pick up a square therefore if we sum it up our"}, {"start": 1593.76, "end": 1599.04, "text": " successor feature one is going to be the number of"}, {"start": 1599.04, "end": 1604.72, "text": " this is this is a pound sign the number of squares that you pick up"}, {"start": 1604.72, "end": 1610.24, "text": " okay similarly our feature too is whether or not you pick up"}, {"start": 1610.24, "end": 1615.84, "text": " a triangle in a particular step so our successor feature number two is"}, {"start": 1615.84, "end": 1620.32, "text": " going to be the number of triangles that you pick up over time"}, {"start": 1620.32, "end": 1624.32, "text": " I can see that the successor features is kind of the analogous of your Q"}, {"start": 1624.32, "end": 1629.44, "text": " function but it is not in terms of a single number the reward it is going to"}, {"start": 1629.44, "end": 1635.36, "text": " be in terms of these features which is an entire vector okay and"}, {"start": 1635.36, "end": 1639.76, "text": " because we've constructed this in a linear way you can also pretty clearly"}, {"start": 1639.76, "end": 1646.56, "text": " see that the Q function is inherently related to the"}, {"start": 1646.56, "end": 1651.12, "text": " successor features you can obtain the Q function by simply"}, {"start": 1651.12, "end": 1656.8799999999999, "text": " multiplying the successor features by your task vector W"}, {"start": 1656.8799999999999, "end": 1661.76, "text": " now a lot of you might be wondering where does this W come from and in our"}, {"start": 1661.76, "end": 1666.32, "text": " initial case we're just going to frame everything as"}, {"start": 1666.32, "end": 1673.6, "text": " being given right so we're given this this W we're defining everything"}, {"start": 1673.6, "end": 1680.08, "text": " from our godlike perspective for now so don't think all of this is learned by"}, {"start": 1680.08, "end": 1683.9199999999998, "text": " now yeah"}, {"start": 1684.96, "end": 1691.76, "text": " all right so how can you now derive this magical new policy okay so we"}, {"start": 1691.76, "end": 1696.56, "text": " let's say we have this policy one and we have the policy two and they"}, {"start": 1696.56, "end": 1701.44, "text": " and you have the these features that you've learned constantly over both"}, {"start": 1701.44, "end": 1706.96, "text": " task in fact here it's given right it this pi function we give it we"}, {"start": 1706.96, "end": 1711.28, "text": " impose it that the feature one is whether you pick up a red square feature"}, {"start": 1711.28, "end": 1714.8799999999999, "text": " two is whether you pick up a blue square then we know that the reward"}, {"start": 1714.8799999999999, "end": 1719.76, "text": " functions can be achieved by doing the W so this here"}, {"start": 1719.76, "end": 1725.52, "text": " your W is going to be one zero and your W here is going to be zero one"}, {"start": 1725.52, "end": 1732.32, "text": " and we now we want a good policy for task three and we know we can achieve"}, {"start": 1732.32, "end": 1738.64, "text": " this by the one negative one W how can we derive a good policy"}, {"start": 1738.64, "end": 1744.4, "text": " and this is this algorithm this general policy evaluation general policy"}, {"start": 1744.4, "end": 1753.6000000000001, "text": " improvement so it assumes that you as we said you have many many different"}, {"start": 1753.6000000000001, "end": 1758.24, "text": " many different policy so here you can see policy one"}, {"start": 1758.24, "end": 1763.1200000000001, "text": " where's policy two here's policy two and so on it assumes"}, {"start": 1763.1200000000001, "end": 1767.52, "text": " that you have many different features and therefore many different successor"}, {"start": 1767.52, "end": 1772.0, "text": " features in fact you have a vector of them right so here you can see feature one"}, {"start": 1772.0, "end": 1777.12, "text": " feature two and so on and it also assumes that you're in a current state and"}, {"start": 1777.12, "end": 1782.56, "text": " you have many actions that your disposal right now action one action two"}, {"start": 1782.56, "end": 1788.56, "text": " and so on okay so this is all the past you've already defined your features"}, {"start": 1788.56, "end": 1793.76, "text": " you have learned these policies and now you're given a new W"}, {"start": 1793.76, "end": 1797.52, "text": " W new in our case it's this one negative one"}, {"start": 1797.52, "end": 1804.16, "text": " and we want the best action so we're in state s we are given this W we want the"}, {"start": 1804.16, "end": 1810.08, "text": " best action now here is a method where we can simply calculate the best action"}, {"start": 1810.08, "end": 1816.32, "text": " in terms by by not reinforcement learning at all in this new task"}, {"start": 1816.32, "end": 1822.72, "text": " so by structuring things like this here so what does it really say here"}, {"start": 1822.72, "end": 1832.24, "text": " if this thing says we are going to evaluate all of these different cells of"}, {"start": 1832.24, "end": 1836.4, "text": " this tensor right here so we're going to determine what is the successor"}, {"start": 1836.4, "end": 1842.72, "text": " feature number two for policy pi one"}, {"start": 1842.72, "end": 1849.04, "text": " in state s if I right now do a two this is very abstract so"}, {"start": 1849.04, "end": 1854.8799999999999, "text": " let's say you're here and action action two is actually going to the right okay"}, {"start": 1854.8799999999999, "end": 1860.32, "text": " so you're here oh this was yellow it doesn't matter so this is so this is"}, {"start": 1860.32, "end": 1867.52, "text": " action one this is action two so action two is you go to the right okay you can"}, {"start": 1867.52, "end": 1872.08, "text": " you can see that this will let you pick up"}, {"start": 1872.08, "end": 1879.76, "text": " we'll let you pick up a triangle now here that's action three and so on"}, {"start": 1879.76, "end": 1889.28, "text": " okay so what's this number going to be so we are in state s as we said"}, {"start": 1889.28, "end": 1898.3999999999999, "text": " we do action two so action two is going to pick up a triangle the triangle"}, {"start": 1898.4, "end": 1905.92, "text": " the picking up of a triangle means that our pi for the step or sorry our five for"}, {"start": 1905.92, "end": 1914.72, "text": " the step is going to be 0 1 okay so our successor features this is not the"}, {"start": 1914.72, "end": 1919.3600000000001, "text": " features itself this is the successor features the successor features decompose"}, {"start": 1919.3600000000001, "end": 1926.4, "text": " into the next step plus all the next steps that we can follow okay so all the"}, {"start": 1926.4, "end": 1931.52, "text": " steps that will come so what are these features going to be it's going to be"}, {"start": 1931.52, "end": 1938.3200000000002, "text": " the sum over that plus everything that follows and I can take a little bit of"}, {"start": 1938.3200000000002, "end": 1944.0800000000002, "text": " a guess here which means that this number so we're only care about feature two"}, {"start": 1944.0800000000002, "end": 1950.5600000000002, "text": " right here this feature feature two this number is going to be one for the next"}, {"start": 1950.5600000000002, "end": 1955.76, "text": " step because we are going to pick up a triangle if we do action two but then"}, {"start": 1955.76, "end": 1962.48, "text": " after that we're going to follow policy one and policy one has been trained"}, {"start": 1962.48, "end": 1968.8, "text": " to pick up the red squares and not care about triangles so I'm going to guess"}, {"start": 1968.8, "end": 1975.36, "text": " that every now and then it will kind of step over a triangle but it won't"}, {"start": 1975.36, "end": 1980.72, "text": " fall it won't you know explicitly go look for them so let's say the"}, {"start": 1980.72, "end": 1986.56, "text": " episode goes 10 more steps but the board has like a hundred squares so and it has"}, {"start": 1986.56, "end": 1994.4, "text": " like three triangles on it so let's say that's like three tenths in expectation"}, {"start": 1994.4, "end": 1999.3600000000001, "text": " okay so this is going to be this is going to be the number that we're looking"}, {"start": 1999.3600000000001, "end": 2006.48, "text": " for we're doing this for every single one of these cells okay this this thing"}, {"start": 2006.48, "end": 2012.72, "text": " is going to do for every single one of these cells and this is very similar to"}, {"start": 2012.72, "end": 2017.04, "text": " evaluating q functions except we're evaluating an entire vector right here"}, {"start": 2017.04, "end": 2023.3600000000001, "text": " that's the difference to simply learning many q functions so if you were to"}, {"start": 2023.3600000000001, "end": 2029.44, "text": " evaluate only a q function then you would only have this first matrix this"}, {"start": 2029.44, "end": 2036.4, "text": " first block right here okay but you have feature one feature two and so on so"}, {"start": 2036.4, "end": 2042.64, "text": " you calculate everything in terms of these features and then by linearity you"}, {"start": 2042.64, "end": 2047.0400000000002, "text": " can mix it with that vector so in our case this is going to be the one"}, {"start": 2047.0400000000002, "end": 2051.92, "text": " negative one which will give you the q functions right from what we've seen"}, {"start": 2051.92, "end": 2056.88, "text": " before you obtain a q function by simply mixing your successor features with"}, {"start": 2056.88, "end": 2062.96, "text": " your with this task vector and if you have a q function you can pretty easily"}, {"start": 2062.96, "end": 2067.76, "text": " determine which action you should take now you have here a q function with"}, {"start": 2067.76, "end": 2074.64, "text": " respect to every single policy but you can simply take the max right so the max"}, {"start": 2074.64, "end": 2083.76, "text": " across all of this will determine will determine so you take the max across all"}, {"start": 2083.76, "end": 2088.16, "text": " the policies which will give you the q function for a particular action over"}, {"start": 2088.16, "end": 2092.64, "text": " all policies that you consider and then you can simply take the arg max of"}, {"start": 2092.64, "end": 2099.52, "text": " that and determine the action you should take okay so it's a pretty big"}, {"start": 2099.52, "end": 2105.2799999999997, "text": " evaluation but if you do this that means you don't have to do reinforcement"}, {"start": 2105.2799999999997, "end": 2109.44, "text": " learning on this task it simply determines which"}, {"start": 2109.44, "end": 2115.44, "text": " action right now is the best given everything that I know from these old"}, {"start": 2115.44, "end": 2120.8799999999997, "text": " policies about the task and that's not going to be like the"}, {"start": 2120.88, "end": 2125.92, "text": " optimal policy per say but is going to be one policy that's"}, {"start": 2125.92, "end": 2130.7200000000003, "text": " pretty pretty good and you can actually prove some things across that so"}, {"start": 2130.7200000000003, "end": 2138.32, "text": " they do this right here and you can see that"}, {"start": 2138.32, "end": 2144.2400000000002, "text": " here is what q learning does on this new task of picking up the squares and"}, {"start": 2144.2400000000002, "end": 2150.2400000000002, "text": " avoiding the trials q learning takes a while to get there however"}, {"start": 2150.24, "end": 2156.16, "text": " if you do what they are suggesting and you know you give the w you can"}, {"start": 2156.16, "end": 2160.4799999999996, "text": " supply the w almost from the beginning you see right here almost from the"}, {"start": 2160.4799999999996, "end": 2165.3599999999997, "text": " beginning it is at a high reward now q learning surpasses it eventually"}, {"start": 2165.3599999999997, "end": 2172.4799999999996, "text": " but it's pretty impressive that without doing any learning you are"}, {"start": 2172.4799999999996, "end": 2177.4399999999996, "text": " immediately good right now the caveat here of course is that"}, {"start": 2177.44, "end": 2182.64, "text": " they already need these policy pi 1 and pi 2 given to the algorithm"}, {"start": 2182.64, "end": 2186.0, "text": " and that comes from previous reinforcement learning"}, {"start": 2186.0, "end": 2193.04, "text": " trials and they say that they give these trials as many steps as q"}, {"start": 2193.04, "end": 2197.36, "text": " learning uses so they give them these these amounts of steps on these other"}, {"start": 2197.36, "end": 2203.04, "text": " tasks so the comparison here is a bit shaky if you ask me"}, {"start": 2203.04, "end": 2207.6, "text": " but the point made is that if you have a new task right now you can obtain"}, {"start": 2207.6, "end": 2212.0, "text": " very good solutions and you don't have to do anything"}, {"start": 2212.0, "end": 2215.52, "text": " okay and these solutions can be the basis for new reinforcement learning"}, {"start": 2215.52, "end": 2220.24, "text": " right you could start q learning off right here and then get here much faster"}, {"start": 2220.24, "end": 2227.6, "text": " potentially and so on so the next objective right here is that now we have"}, {"start": 2227.6, "end": 2231.68, "text": " defined the tasks and we had we know what these features are"}, {"start": 2231.68, "end": 2236.48, "text": " and we know how to mix these features as imposors of the task"}, {"start": 2236.48, "end": 2244.0, "text": " so what happens if we only have the reward function we specify the task only"}, {"start": 2244.0, "end": 2246.7999999999997, "text": " in terms of the reward functions but we're kind of looking at the features and"}, {"start": 2246.7999999999997, "end": 2251.2799999999997, "text": " we're like agents please figure out yourself how"}, {"start": 2251.2799999999997, "end": 2256.3199999999997, "text": " to apply these features in order to make the reward high"}, {"start": 2256.3199999999997, "end": 2261.3599999999997, "text": " and that's what this thing is right here this gp and gpi with regress w"}, {"start": 2261.36, "end": 2266.1600000000003, "text": " so you don't no longer tell it what the w is"}, {"start": 2266.1600000000003, "end": 2270.0, "text": " it needs to infer it through reinforcement learning right"}, {"start": 2270.0, "end": 2275.04, "text": " and it's not really reinforcement learning but what it does where is it"}, {"start": 2275.04, "end": 2279.2000000000003, "text": " yeah it's simply because all of this is linear"}, {"start": 2279.2000000000003, "end": 2284.7200000000003, "text": " and this thing here is given so always remember this thing here is given"}, {"start": 2284.7200000000003, "end": 2289.6800000000003, "text": " and these are the rewards that you obtain you can simply do a regression"}, {"start": 2289.68, "end": 2294.56, "text": " to figure out the w of the task now that's going to take some time"}, {"start": 2294.56, "end": 2299.12, "text": " but as you can see right here it is going to take"}, {"start": 2299.12, "end": 2304.64, "text": " a lot less time than doing q learning from scratch"}, {"start": 2304.64, "end": 2308.96, "text": " notably because you have good features so this is this is this gets closer and"}, {"start": 2308.96, "end": 2315.7599999999998, "text": " closer to transfer learning right if you imagine that this right here"}, {"start": 2315.76, "end": 2322.0800000000004, "text": " is your pre-trained neural network and you simply learn the last layer of it"}, {"start": 2322.0800000000004, "end": 2327.92, "text": " you freeze this you do transfer learning fine tune the last layer"}, {"start": 2327.92, "end": 2335.84, "text": " here we are so um i get closer and closer and you'll see this trend right here"}, {"start": 2335.84, "end": 2340.4, "text": " so it's pretty cool what you can do but basically"}, {"start": 2340.4, "end": 2344.7200000000003, "text": " i think it's a lot of math around a framework and the more and more you"}, {"start": 2344.72, "end": 2351.2799999999997, "text": " relax the kind of impositions that they need for their framework"}, {"start": 2351.2799999999997, "end": 2356.08, "text": " the more it gets back to simply well we do reinforcement learning"}, {"start": 2356.08, "end": 2363.6, "text": " at least in my estimation so before we look at that this here is a pretty"}, {"start": 2363.6, "end": 2369.12, "text": " pretty cool experiment where they"}, {"start": 2369.12, "end": 2375.12, "text": " they look at how the how the different tasks can be achieved"}, {"start": 2375.12, "end": 2379.6, "text": " if you give different policies so you'll have noticed that we have always given"}, {"start": 2379.6, "end": 2385.68, "text": " these two two tasks one zero and zero one these were our tasks that we"}, {"start": 2385.68, "end": 2391.68, "text": " trained on and then one negative one is task we evaluated on"}, {"start": 2391.68, "end": 2395.8399999999997, "text": " and you might object and say wait i mean these these two tasks you know they're"}, {"start": 2395.84, "end": 2401.52, "text": " pretty good as let's say pre-training tasks because and it's basically the"}, {"start": 2401.52, "end": 2405.76, "text": " standard basis right and any other task can be mixed"}, {"start": 2405.76, "end": 2411.52, "text": " from those so these are orthogonal vectors in this vector space"}, {"start": 2411.52, "end": 2416.48, "text": " so you're being pretty generous to the system what happens if we're not as"}, {"start": 2416.48, "end": 2422.7200000000003, "text": " generous so that's what they do here so they have different um policies and they"}, {"start": 2422.72, "end": 2426.7999999999997, "text": " evaluate how much you can learn with these different"}, {"start": 2426.7999999999997, "end": 2430.7999999999997, "text": " policies so the way you have to read this diagram is"}, {"start": 2430.7999999999997, "end": 2437.2, "text": " right here it's going to be the one zero axis as they well they label it right"}, {"start": 2437.2, "end": 2442.56, "text": " here and this is going to be the zero one axis and this is evaluation so every"}, {"start": 2442.56, "end": 2447.12, "text": " direction on the circle defines a task for example"}, {"start": 2447.12, "end": 2452.0, "text": " this task right here as you can see is going to define the task of picking up"}, {"start": 2452.0, "end": 2457.68, "text": " both the squares and the triangles right whatever you pick up you get a reward"}, {"start": 2457.68, "end": 2463.12, "text": " however the task down here is going to be please pick up the squares but"}, {"start": 2463.12, "end": 2469.36, "text": " avoid triangles at all cost okay and now they're going to look"}, {"start": 2469.36, "end": 2474.64, "text": " what happens if we supply different policies to choose from remember we're in"}, {"start": 2474.64, "end": 2478.72, "text": " this situation we're getting in this situation where we give everything and we"}, {"start": 2478.72, "end": 2482.56, "text": " give initial policies we give the task vector and now it's about"}, {"start": 2482.56, "end": 2489.12, "text": " deriving a good policy just from looking at the old policies so no learning"}, {"start": 2489.12, "end": 2494.3999999999996, "text": " as a baseline you have q learning which into a given direction um"}, {"start": 2494.3999999999996, "end": 2499.68, "text": " tells you basically how how long q learning or"}, {"start": 2499.68, "end": 2505.2799999999997, "text": " takes or how far q learning gets with a given amount of steps indicated by this"}, {"start": 2505.28, "end": 2512.32, "text": " one two three four and so on um yeah you see I think this is"}, {"start": 2512.32, "end": 2518.0800000000004, "text": " this is this in how far q learning gets with these amounts of steps is the"}, {"start": 2518.0800000000004, "end": 2524.0, "text": " dotted lines right here so q learning gets this far with 10 to the I don't know"}, {"start": 2524.0, "end": 2531.52, "text": " four and then this far 10 to the five and so on so these are comparisons"}, {"start": 2531.52, "end": 2535.7599999999998, "text": " you can see that on the outside q learning is going to be"}, {"start": 2535.7599999999998, "end": 2541.44, "text": " this these methods but our hope is going to be that of course if we have this"}, {"start": 2541.44, "end": 2546.16, "text": " zero shot uh generalization it's much better than running q learning for"}, {"start": 2546.16, "end": 2551.92, "text": " really long if we get close to it so the green thing is what we've already"}, {"start": 2551.92, "end": 2559.04, "text": " seen policies one and two will give you a fairly you know good um"}, {"start": 2559.04, "end": 2563.84, "text": " fairly good extent right here so what does it mean it means it can solve"}, {"start": 2563.84, "end": 2570.08, "text": " it can solve pretty much everything from here here this task this this task"}, {"start": 2570.08, "end": 2575.52, "text": " this task it kind of falls off once we go down here so once we go to the"}, {"start": 2575.52, "end": 2580.72, "text": " avoid section it sort of falls off because it has never learned to avoid now"}, {"start": 2580.72, "end": 2585.84, "text": " still we can of course do the avoidance by simply imposing a negative"}, {"start": 2585.84, "end": 2590.56, "text": " collection but negative collecting and avoiding aren't exactly the same"}, {"start": 2590.56, "end": 2595.44, "text": " thing in these in these environments right because"}, {"start": 2595.44, "end": 2599.52, "text": " avoiding can also be going really close to something but not hitting it"}, {"start": 2599.52, "end": 2604.0, "text": " while collecting it's not the inverse of collecting the inverse of collecting"}, {"start": 2604.0, "end": 2607.76, "text": " would be like run away as far as as far as possible"}, {"start": 2607.76, "end": 2612.2400000000002, "text": " so we can expect that we've only ever learned to collect we're not going to be"}, {"start": 2612.24, "end": 2623.2799999999997, "text": " super good at avoiding um then the other extreme is when we give"}, {"start": 2623.2799999999997, "end": 2627.6, "text": " policy three and four I haven't told you but you can see it right here"}, {"start": 2627.6, "end": 2634.4799999999996, "text": " policy three is explicitly to collect one and avoid the other while policy four"}, {"start": 2634.4799999999996, "end": 2639.6, "text": " is the opposite right here avoid the squares collect the triangles"}, {"start": 2639.6, "end": 2647.44, "text": " and now this policy this policy is should be pretty good on all of the tasks"}, {"start": 2647.44, "end": 2651.2, "text": " in between as you can see it has the biggest extent"}, {"start": 2651.2, "end": 2654.88, "text": " right here and that also makes sense by the way"}, {"start": 2654.88, "end": 2660.08, "text": " there's nothing down here because the task of avoiding both things doesn't"}, {"start": 2660.08, "end": 2665.12, "text": " really make sense because you can just stay where you're um because there are"}, {"start": 2665.12, "end": 2671.3599999999997, "text": " also these squares where there's nothing but you can see that the mixture of"}, {"start": 2671.3599999999997, "end": 2677.52, "text": " those is quite potent so already we can see even though"}, {"start": 2677.52, "end": 2684.56, "text": " these span a basis in fact an orthogonal basis as much as these um because of"}, {"start": 2684.56, "end": 2688.0, "text": " the nature of the features that we define for the task they are not"}, {"start": 2688.0, "end": 2692.88, "text": " equivalent in mixing after so we can be more generous we can also be less"}, {"start": 2692.88, "end": 2699.12, "text": " generous if we only provide policy five and policy five is simply to pick up to"}, {"start": 2699.12, "end": 2704.32, "text": " pick up both objects then we're going to have a pretty hard time when it comes"}, {"start": 2704.32, "end": 2709.92, "text": " to avoiding things so you can see it can do fairly well picking up the various"}, {"start": 2709.92, "end": 2714.6400000000003, "text": " things in a positive manner but as soon as we cross this line into the like this"}, {"start": 2714.6400000000003, "end": 2720.0, "text": " horizontal line into where it's about avoiding a particular object"}, {"start": 2720.0, "end": 2727.2, "text": " um it's not it's not the the choices of actions we have from policy five"}, {"start": 2727.2, "end": 2733.36, "text": " aren't going to be super good at that"}, {"start": 2733.36, "end": 2739.84, "text": " and um they do another they do another thing right here so the left thing is where"}, {"start": 2739.84, "end": 2744.16, "text": " they say it's important which policies we provide"}, {"start": 2744.16, "end": 2747.84, "text": " and the right thing they want to say something like"}, {"start": 2747.84, "end": 2758.4, "text": " it's important um so they want to say if we provide more policies"}, {"start": 2758.4, "end": 2762.88, "text": " that can be advantageous because we basically have more options to choose from"}, {"start": 2762.88, "end": 2767.76, "text": " okay so now they start off with policy four and policy four is simply"}, {"start": 2767.76, "end": 2771.28, "text": " avoid these squares collect the triangle you can see it performs"}, {"start": 2771.28, "end": 2776.0, "text": " fairly well over here where it's all about avoiding the uh"}, {"start": 2776.0, "end": 2779.6, "text": " squares and collecting the triangles as soon as you get into"}, {"start": 2779.6, "end": 2785.12, "text": " you know collecting or even here the opposite directions it's pretty bad right"}, {"start": 2785.12, "end": 2790.8, "text": " that's the red thing and now they add policy two to policy four so policy two"}, {"start": 2790.8, "end": 2797.04, "text": " is going to be also to collect um the the triangles"}, {"start": 2797.04, "end": 2802.48, "text": " but to just neglect the squares and that will also do a bit better"}, {"start": 2802.48, "end": 2807.2, "text": " why does it do better because it's better at collecting uh because this"}, {"start": 2807.2, "end": 2812.0, "text": " policy here also needs to avoid um and this policy here"}, {"start": 2812.0, "end": 2818.2400000000002, "text": " doesn't care so in the regimes where it's better to not care than to"}, {"start": 2818.2400000000002, "end": 2822.08, "text": " avoid adding this policy adding these options is going to be good and you can"}, {"start": 2822.08, "end": 2827.12, "text": " see that there's a general expansion here as we add more policies however"}, {"start": 2827.12, "end": 2834.4, "text": " i want to point out that for example here this black thing um which should be"}, {"start": 2834.4, "end": 2838.72, "text": " technically superior to the blue thing because it contains as you can see here"}, {"start": 2838.72, "end": 2842.96, "text": " all the policies that the blue thing contains plus"}, {"start": 2842.96, "end": 2850.0, "text": " another policy um i don't i don't know if my vision but i'm pretty sure"}, {"start": 2850.0, "end": 2854.16, "text": " here the black thing is inside the blue thing"}, {"start": 2854.16, "end": 2861.2, "text": " uh so that means there can also be a disadvantage to adding more policies"}, {"start": 2861.2, "end": 2865.68, "text": " right here because maybe you got you have too much to choose from"}, {"start": 2865.68, "end": 2874.24, "text": " and um so right here what we say is we add a policy that is all about collecting"}, {"start": 2874.24, "end": 2879.04, "text": " the squares and it is performing it is actually decreasing the"}, {"start": 2879.04, "end": 2882.56, "text": " perform the addition of this is decreasing the performance on tasks where"}, {"start": 2882.56, "end": 2888.96, "text": " you have to avoid the squares um which i'm not sure if"}, {"start": 2888.96, "end": 2895.68, "text": " if that makes sense um again the opposite of collecting isn't avoiding but"}, {"start": 2895.68, "end": 2899.36, "text": " i'm just pointing this out and this isn't really mentioned in the paper the"}, {"start": 2899.36, "end": 2903.92, "text": " paper simply says see we add policies uh therefore we are"}, {"start": 2903.92, "end": 2909.6, "text": " getting better i'm not i don't agree with this i given these results or"}, {"start": 2909.6, "end": 2913.6, "text": " maybe at the plotting the plotting is bad"}, {"start": 2913.6, "end": 2919.12, "text": " all right so they say okay more policies better which i disagree with"}, {"start": 2919.12, "end": 2926.48, "text": " they also say oh we can as as much as we can regress the w"}, {"start": 2926.48, "end": 2932.24, "text": " right we regress w we figure out the task we can even learn the successor"}, {"start": 2932.24, "end": 2938.4, "text": " features okay we can not the successor features um the the pi functions that"}, {"start": 2938.4, "end": 2942.4, "text": " lead to the successor successor features and you can see if you do it with the"}, {"start": 2942.4, "end": 2947.76, "text": " true w you're really good at the beginning if you do it with a regress w um"}, {"start": 2947.76, "end": 2955.36, "text": " we can see that before you can you so this is the small version of this plot"}, {"start": 2955.36, "end": 2961.36, "text": " right here this is like this uh section i think yeah"}, {"start": 2961.36, "end": 2966.2400000000002, "text": " you know you improve however we can also learn this pi function we can also"}, {"start": 2966.24, "end": 2970.3999999999996, "text": " learn the features were if we're not given the features maybe we can"}, {"start": 2970.3999999999996, "end": 2976.8799999999997, "text": " learn the features and they say well we can do this with but also by regression"}, {"start": 2976.8799999999997, "end": 2983.04, "text": " so here what we can do is we can find the function that minimizes the"}, {"start": 2983.04, "end": 2988.08, "text": " function and the w along with it that minimizes this error right here"}, {"start": 2988.08, "end": 2993.9199999999996, "text": " okay so you're finding the function and the w that that matches this error"}, {"start": 2993.92, "end": 3000.2400000000002, "text": " and this now really is like learning a neural network i mean you know"}, {"start": 3000.2400000000002, "end": 3006.2400000000002, "text": " um so i get i get it you have the i here and the w doesn't depend on the i"}, {"start": 3006.2400000000002, "end": 3015.2000000000003, "text": " and so on um but you're getting more and more back to actually simply"}, {"start": 3015.2000000000003, "end": 3019.6800000000003, "text": " learning non-linear functions mixing them linearly right here"}, {"start": 3019.68, "end": 3025.3599999999997, "text": " and i think that's going to be kind of the crux of this method uh the fact that"}, {"start": 3025.3599999999997, "end": 3030.7999999999997, "text": " the more complicated your problems are the less you are going to be able to do"}, {"start": 3030.7999999999997, "end": 3036.0, "text": " this kind of stuff and they even go as far as to say well what if like before"}, {"start": 3036.0, "end": 3040.24, "text": " we the reward is actually something like whether or not you have collected an"}, {"start": 3040.24, "end": 3044.96, "text": " even number of um triangles or squares"}, {"start": 3044.96, "end": 3049.6, "text": " then they say well you can simply not have a single w but"}, {"start": 3049.6, "end": 3056.08, "text": " you can find a function w and uh now the policy is a function of the function"}, {"start": 3056.08, "end": 3061.04, "text": " of w and you can do potentially the same regression problem but"}, {"start": 3061.04, "end": 3068.3199999999997, "text": " as you can see it gets so now you um this right here is going to be a function"}, {"start": 3068.3199999999997, "end": 3075.68, "text": " of state and so you can see that it more and more"}, {"start": 3075.68, "end": 3082.0, "text": " it simply goes back to basically q learning again the only difference here is"}, {"start": 3082.0, "end": 3088.3999999999996, "text": " that you have this intermediate features uh but i think you can simply"}, {"start": 3088.3999999999996, "end": 3093.44, "text": " view this let's say as a hidden layer in a neural network"}, {"start": 3093.44, "end": 3099.3599999999997, "text": " now i get it some of the held constant across uh sums and so on but"}, {"start": 3099.36, "end": 3108.0, "text": " you know i i like the method in terms of um you know in terms of"}, {"start": 3108.0, "end": 3113.44, "text": " the analysis so if you are given all this stuff it seems pretty cool that you"}, {"start": 3113.44, "end": 3118.0, "text": " can derive new policies uh it's implication for lifelong learning they say"}, {"start": 3118.0, "end": 3123.52, "text": " look here um you have a bunch of tasks in your database"}, {"start": 3123.52, "end": 3127.76, "text": " that you've already learned on your agent is going out into the world"}, {"start": 3127.76, "end": 3132.96, "text": " it faces a new task it can use this thing it can use this thing to"}, {"start": 3132.96, "end": 3138.88, "text": " obtain a new uh good policy for that task it can then use reinforcement"}, {"start": 3138.88, "end": 3144.0800000000004, "text": " learning or l to refine that policy and then it can simply"}, {"start": 3144.0800000000004, "end": 3148.32, "text": " save that policy into the database so it keeps"}, {"start": 3148.32, "end": 3154.32, "text": " expanding and expanding uh this thing so it keeps adding"}, {"start": 3154.32, "end": 3160.0800000000004, "text": " rows and rows and rows right here of new policies that it's learned over the"}, {"start": 3160.0800000000004, "end": 3165.28, "text": " course of its life so once it's facing a new task it can just kind of draw"}, {"start": 3165.28, "end": 3168.32, "text": " from its experience and derive a good initial"}, {"start": 3168.32, "end": 3174.2400000000002, "text": " solution however uh the actual analysis only works"}, {"start": 3174.2400000000002, "end": 3179.6800000000003, "text": " i feel in quite limited circumstances and if you want to relax these"}, {"start": 3179.68, "end": 3184.8799999999997, "text": " limited circumstances then you need to basically regress and regress and"}, {"start": 3184.8799999999997, "end": 3191.9199999999996, "text": " regress um away from away from their setup and"}, {"start": 3191.9199999999996, "end": 3196.0, "text": " i'm i'm not sure i'm not sure where this is going to go if this is going to be a"}, {"start": 3196.0, "end": 3200.08, "text": " general framework for people uh it seems like it because it's pretty easy"}, {"start": 3200.08, "end": 3204.3999999999996, "text": " but then also it seems like most of the world doesn't really fall into this"}, {"start": 3204.4, "end": 3210.1600000000003, "text": " category in fact this divide and conquer approach um"}, {"start": 3210.1600000000003, "end": 3214.64, "text": " i'm not sure but from divide and conquer i almost imagine something like"}, {"start": 3214.64, "end": 3219.84, "text": " you subdivide and subdivide and subdivide until you know you are at some kind of"}, {"start": 3219.84, "end": 3223.92, "text": " basic task they still only go for you know single"}, {"start": 3223.92, "end": 3228.64, "text": " task like this here the task are somehow in sequence and"}, {"start": 3228.64, "end": 3235.52, "text": " i'm not i think we should really think about hierarchical rl now this can be"}, {"start": 3235.52, "end": 3239.8399999999997, "text": " a good first step right here but most hierarchical rl even the ones that"}, {"start": 3239.8399999999997, "end": 3244.08, "text": " specify themselves as fully hierarchical like we can do many layers"}, {"start": 3244.08, "end": 3248.72, "text": " they rarely go above two layers or through like like one"}, {"start": 3248.72, "end": 3252.8799999999997, "text": " one metal layer and one actual layer like this one"}, {"start": 3252.8799999999997, "end": 3257.52, "text": " right here uh they they rarely go further maybe they go two layers but"}, {"start": 3257.52, "end": 3261.6, "text": " that's about it um i've seen very little in actual"}, {"start": 3261.6, "end": 3265.44, "text": " hierarchical or dividing conquer reinforcement learning just because it's so"}, {"start": 3265.44, "end": 3271.6, "text": " hard to train um yeah all in all cool paper and um"}, {"start": 3271.6, "end": 3276.72, "text": " if you want to get it into the math a little bit i think it's pretty easy math"}, {"start": 3276.72, "end": 3280.4, "text": " once you kind of set your goals on what it's actually"}, {"start": 3280.4, "end": 3284.24, "text": " meant to achieve um if you just read from the beginning"}, {"start": 3284.24, "end": 3288.56, "text": " all these reinforcement learning papers it seems a bit like"}, {"start": 3288.56, "end": 3292.7999999999997, "text": " why why are we doing this right usually oh could we define this we"}, {"start": 3292.7999999999997, "end": 3296.4799999999996, "text": " define that we define this and you're a bit like"}, {"start": 3296.4799999999996, "end": 3301.2799999999997, "text": " i yeah but why so often it pays in these papers to go"}, {"start": 3301.2799999999997, "end": 3306.56, "text": " at the end to the examples and then uh come back to the theory knowing what"}, {"start": 3306.56, "end": 3310.3999999999996, "text": " they want to achieve all right that was it for me long rant i'll see you next time"}, {"start": 3310.4, "end": 3317.36, "text": " bye bye"}] |
Yannic Kilcher | 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 with 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 high level. As always, if you like content like this, consider subscribing and sharing it out. That would be excellent. So they say that on policy reinforcement learning has been successfully applied to many different continuous control tasks. While all 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 that I 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 do you always 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 first resonant paper that be image net to a significant degree over the last year's baseline. It was, oh yeah, we have the simple idea of the resonant and then 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 choices. But often it's hard to disentangle if the 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 or a framework, allowing us to investigate their impact in a large scale empirical study. So Lord scale empirical study is basically means great 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 our L 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 or a 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 initialized policy initialization scheme matters significantly. 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 our L 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 I get it you need to make the title a bit click baity but the title over states 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 mojo co 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 over states 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 commonly used choices and then implemented everything into starting from the seed or L code base seed or else 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 they use this or this should use this optimizer this optimizer 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 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 observation or dense sampling of this space then that might mean 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 are 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 consider like a three dimensional hyper parameters 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 or 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 of single dimensions in the space so or yes so let's consider the space of groups they have two different groups one is the group of network architecture parameters and the other one is the 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 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 the architecture parameter space now of course this is not just one parameter this since they make these groups this is a multi multi parameters 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 keep the others constant and that basically to me that means that this 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 and this is clearly only improved within 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 here they say the goal of this study is to better understand the importance of the policy loss function in the own policy setting considered in this paper because 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 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 V2 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 out performs in every single experiment here whereas the other losses under perform so their recommendation is use the PPO policy loss start with the clipping threshold to 0.25 but also try it lower and higher values if possible because they have found and 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 robots simulator 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 too lower to high values cost can cost significant drop in performance while 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 eGN 1.5 cheetah the best results are achieved with 16 to 32 units per layer 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 this some 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 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 tan H activations perform best and relu perform worst which is interesting right because you would think that in other deep learning tasks relus have become pretty popular and usually out perform 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 tan H 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 parameters were different but for now apparently a tan H 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 so in these continuous control tasks you basically for each of the joints you have to affect so 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 output and mean and a standard deviation I might be wrong here but mean and a 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 so you 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 is it does not matter too much 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 in the standard deviation soft plus and exponentially from similar 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 and the alternative of this offset is possible use 10h as both the activation function if the networks are not 2d right here this is probably where the railways would start to shine and transform the samples from the normal distribution to the bounded action space and to transform using a 10h use a wide value MLP no layers shared with the policy but tune the policy with 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 M-nist 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 0 to 255 so you have 0 to 255 what you want to do is you want to normalize that search that it's in the range negative 1 to 1 or alternatively such that it's mean is 0 and it's standard deviation is about 1 so people use both things and they tend this alone tends to already boost the performance and the fact that it's non that this is non negative and the fact that this number is somewhat higher than sort of in the 0 1 range these are quite important and they're going to figure out that this is also important right here and as 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 it basically the the value network needs to be trained right so you take a step and a step and a step and a step and in each step you get a reward and you get you put for 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 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 V trace and their hyper parameters and their recommendation is use the GA with lambda equals 0.9 okay I feel this is not too surprising right here because this this end step is a very basic estimator and the GA and the V trace are better and they say the GA and the V trace they appear to perform better and they have not found a significant performance difference between the two so cool last thing no 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 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 the room 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 many batches okay we've concluded that and you should recompute advantages once per day to pass now what's 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 then you're going to collect more experience and more different experience and that will speed up your 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 or 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 to start with a point nine nine discount factor drive frames keep it 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 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 important hyper parameter but it's good to note and then last second there's more second to last thing optimizers they investigate different optimizers we invested two grading based optimizers Adam and RMS prop as well as their hyper parameters and their results 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 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 call back libeler divergence between reference distribution and so on and they say we did not find evidence that any of the investigated regularizers help significantly on our environments with the exception of have cheat on 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 p p o loss as far as I understand the paper and there you can already see that there is a space that is not a space that is the setting of the original paper that introduced the thing and I think this this if you can remember this study the study like are all gans created equal they concluded that probably all gans are created equal especially like the other one is not too much better than anything else and the author of the vassar stangan paper was furious because they didn't in they clearly said in the vassar stangan paper that they atom optimizer doesn't work and they had to use rms prop and then the rms prop was not in that study included 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 as an 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 all right 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": 10.0, "text": " Hello there. Today we're looking at what matters in on policy reinforcement learning, a large scale empirical study by Google Brain."}, {"start": 10.0, "end": 24.0, "text": " 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."}, {"start": 24.0, "end": 42.0, "text": " So the different choices are like network with 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."}, {"start": 42.0, "end": 50.0, "text": " And they have some surprising findings that number seven will surprise you."}, {"start": 50.0, "end": 61.0, "text": " Yeah, okay, so that's the that's the study on high level. As always, if you like content like this, consider subscribing and sharing it out. That would be excellent."}, {"start": 61.0, "end": 71.0, "text": " So they say that on policy reinforcement learning has been successfully applied to many different continuous control tasks."}, {"start": 71.0, "end": 84.0, "text": " While all 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."}, {"start": 84.0, "end": 93.0, "text": " Those choices are usually not extensively discussed in the literature, leading to discrepancy between published descriptions of algorithms and their implementations."}, {"start": 93.0, "end": 102.0, "text": " So the sort of things that I mean here are the things that when you read the paper, the algorithm will be sort of described pretty well on the main idea."}, {"start": 102.0, "end": 112.0, "text": " 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."}, {"start": 112.0, "end": 126.0, "text": " Then the question is do you have like a random starts or do you always start at the exact same time, therefore the randomness of the level is not given, then you whether or not you normalize certain observations."}, {"start": 126.0, "end": 144.0, "text": " But we've had these things even in supervised learning or NLP things like this, we've had pre processing. I remember the first resonant paper that be image net to a significant degree over the last year's baseline."}, {"start": 144.0, "end": 156.0, "text": " It was, oh yeah, we have the simple idea of the resonant and then 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."}, {"start": 156.0, "end": 173.0, "text": " And I mean, there's an argument to be made for all of these choices. But often it's hard to disentangle if the choices of these pre processing things or whatever the choices are matters or if the idea in the paper matters."}, {"start": 173.0, "end": 184.0, "text": " 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."}, {"start": 184.0, "end": 198.0, "text": " They say as a step towards filling the gap, we implement over 50 such choices in a unified on policy or a framework, allowing us to investigate their impact in a large scale empirical study."}, {"start": 198.0, "end": 206.0, "text": " So Lord scale empirical study is basically means great search over these choices kind of smart grid search."}, {"start": 206.0, "end": 219.0, "text": " 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 our L agents."}, {"start": 219.0, "end": 232.0, "text": " 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 or a framework is not available yet."}, {"start": 232.0, "end": 246.0, "text": " 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."}, {"start": 246.0, "end": 257.0, "text": " 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."}, {"start": 257.0, "end": 272.0, "text": " 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."}, {"start": 272.0, "end": 284.0, "text": " And they can basically turn each one on and off and therefore they can investigate these algorithms."}, {"start": 284.0, "end": 299.0, "text": " So let's jump over the most surprising finding which okay, the most I can tell you the most surprising finding is that the initialized policy initialization scheme matters significantly."}, {"start": 299.0, "end": 311.0, "text": " 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 our L were already familiar with that."}, {"start": 311.0, "end": 320.0, "text": " 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."}, {"start": 320.0, "end": 332.0, "text": " 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."}, {"start": 332.0, "end": 342.0, "text": " Because the title is what matters in on policy reinforcement learning it's not what matters in on policy reinforcement learning for continuous control."}, {"start": 342.0, "end": 353.0, "text": " 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."}, {"start": 353.0, "end": 369.0, "text": " But I get it you need to make the title a bit click baity but the title over states a bit what this paper says this paper basically says what works in these particular five continuous control environments right."}, {"start": 369.0, "end": 390.0, "text": " 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 mojo co 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."}, {"start": 390.0, "end": 401.0, "text": " So consider this paper as an investigation in what works and doesn't work for these five and possibly for very relatively close environments."}, {"start": 401.0, "end": 413.0, "text": " So that's that's I think my biggest trouble I have with this paper right here is sort of it over states what it what it says in the title."}, {"start": 413.0, "end": 441.0, "text": " 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 commonly used choices and then implemented everything into starting from the seed or L code base seed or else kind of a framework for distributed or for reinforcement learning in general."}, {"start": 441.0, "end": 468.0, "text": " 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 they use this or this should use this optimizer this optimizer"}, {"start": 468.0, "end": 479.0, "text": " simply make a flag and then even if it's just one choice for now right just make a flag and parameterize everything."}, {"start": 479.0, "end": 497.0, "text": " And 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 observation or dense sampling of this space then"}, {"start": 497.0, "end": 507.0, "text": " that might mean 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."}, {"start": 507.0, "end": 520.0, "text": " 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."}, {"start": 520.0, "end": 524.0, "text": " There are two key reasons why this is challenging."}, {"start": 524.0, "end": 553.0, "text": " First we are 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 consider like a three dimensional hyper parameters space then there are combinations of hyper parameters that are very good right here maybe here so there's this"}, {"start": 553.0, "end": 569.0, "text": " 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 or here"}, {"start": 569.0, "end": 589.0, "text": " 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"}, {"start": 589.0, "end": 612.0, "text": " 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"}, {"start": 612.0, "end": 634.0, "text": " 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"}, {"start": 634.0, "end": 655.0, "text": " 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 of single dimensions in the space so or yes so let's consider the space of groups"}, {"start": 655.0, "end": 665.0, "text": " they have two different groups one is the group of network architecture parameters and the other one is the group of learning behavior like learning rate and training algorithm parameter"}, {"start": 665.0, "end": 674.0, "text": " what they're saying is they're saying we know of a configuration right here that is good this is ppo versus two"}, {"start": 674.0, "end": 695.0, "text": " 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"}, {"start": 695.0, "end": 713.0, "text": " 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 the architecture parameter space"}, {"start": 713.0, "end": 727.0, "text": " now of course this is not just one parameter this since they make these groups this is a multi multi parameters so at each point here you can imagine like a little subspace of the inner group and they then sample from these"}, {"start": 727.0, "end": 742.0, "text": " 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"}, {"start": 742.0, "end": 756.0, "text": " 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"}, {"start": 756.0, "end": 768.0, "text": " 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"}, {"start": 768.0, "end": 785.0, "text": " because you always keep one keep the others constant and that basically to me that means that this experiments are going to be heavily favored in in terms of which of the algorithms is closest to this to this baseline"}, {"start": 785.0, "end": 813.0, "text": " 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"}, {"start": 813.0, "end": 828.0, "text": " and this is clearly only improved within 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"}, {"start": 828.0, "end": 849.0, "text": " 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"}, {"start": 849.0, "end": 877.0, "text": " 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"}, {"start": 877.0, "end": 893.0, "text": " 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"}, {"start": 893.0, "end": 911.0, "text": " V trace is optimized for distributed reinforcement learning and they have a bunch of others and they here they say the goal of this study is to better understand the importance of the policy loss function in the own policy setting considered in this paper"}, {"start": 911.0, "end": 938.0, "text": " because 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 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"}, {"start": 938.0, "end": 962.0, "text": " and you have to keep in mind that the baseline parameters are PPO V2 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 out performs in every single experiment here"}, {"start": 962.0, "end": 988.0, "text": " whereas the other losses under perform so their recommendation is use the PPO policy loss start with the clipping threshold to 0.25 but also try it lower and higher values if possible because they have found and they have more experiments and the appendix the appendix is full of these experiments and you can go and look at them"}, {"start": 988.0, "end": 1002.0, "text": " 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"}, {"start": 1002.0, "end": 1026.0, "text": " 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 robots simulator robots"}, {"start": 1026.0, "end": 1042.0, "text": " 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"}, {"start": 1042.0, "end": 1063.0, "text": " and further regarding network sizes the optimal width of the policy m of the policy network depends on the complexity of the environment and too lower to high values cost can cost significant drop in performance while for the value function there seems to be no downside in using wider networks"}, {"start": 1063.0, "end": 1078.0, "text": " moreover on some environments it is beneficial to make the value network wider than the policy one eGN 1.5 cheetah the best results are achieved with 16 to 32 units per layer"}, {"start": 1078.0, "end": 1098.0, "text": " 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 this some dichotomy where the value network tries to estimate the reward"}, {"start": 1098.0, "end": 1123.0, "text": " 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"}, {"start": 1123.0, "end": 1145.0, "text": " 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 loss choice for the policy seems to be quite important"}, {"start": 1145.0, "end": 1160.0, "text": " 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"}, {"start": 1160.0, "end": 1182.0, "text": " okay so they say as for activation functions we observe that tan H activations perform best and relu perform worst which is interesting right because you would think that in other deep learning tasks relus have become pretty popular and usually out perform these others other activation functions"}, {"start": 1182.0, "end": 1198.0, "text": " 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"}, {"start": 1198.0, "end": 1220.0, "text": " whereas the tan H 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 parameters were different"}, {"start": 1220.0, "end": 1239.0, "text": " but for now apparently a tan H 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"}, {"start": 1239.0, "end": 1263.0, "text": " 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"}, {"start": 1263.0, "end": 1277.0, "text": " 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"}, {"start": 1277.0, "end": 1294.0, "text": " so in these continuous control tasks you basically for each of the joints you have to affect so you have like a little walker here with four legs and what's that that's like eight joints or something"}, {"start": 1294.0, "end": 1321.0, "text": " 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 output and mean and a standard deviation I might be wrong here but mean and a 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"}, {"start": 1321.0, "end": 1338.0, "text": " 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"}, {"start": 1338.0, "end": 1353.0, "text": " so you and I think their recommendation is to divide to initialize this by 100 times smaller weights than all the other layers"}, {"start": 1353.0, "end": 1368.0, "text": " so you 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 is it does not matter too much"}, {"start": 1368.0, "end": 1382.0, "text": " 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 in the standard deviation soft plus and exponentially from similar"}, {"start": 1382.0, "end": 1406.0, "text": " 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"}, {"start": 1406.0, "end": 1425.0, "text": " and the alternative of this offset is possible use 10h as both the activation function if the networks are not 2d right here this is probably where the railways would start to shine and transform the samples from the normal distribution to the bounded action space"}, {"start": 1425.0, "end": 1438.0, "text": " and to transform using a 10h use a wide value MLP no layers shared with the policy but tune the policy with it might need to be narrower than the value MLP"}, {"start": 1438.0, "end": 1452.0, "text": " 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"}, {"start": 1452.0, "end": 1464.0, "text": " 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"}, {"start": 1464.0, "end": 1478.0, "text": " 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"}, {"start": 1478.0, "end": 1496.0, "text": " so that's usually you do that for supervised learning like if you have if you have M-nist digits so this is a mostly black image with okay can I draw on this with like a small portion of it is white"}, {"start": 1496.0, "end": 1511.0, "text": " and what you want this is usually in the range of 0 to 255 so you have 0 to 255 what you want to do is you want to normalize that search that it's in the range negative 1 to 1"}, {"start": 1511.0, "end": 1525.0, "text": " or alternatively such that it's mean is 0 and it's standard deviation is about 1 so people use both things and they tend this alone tends to already boost the performance"}, {"start": 1525.0, "end": 1543.0, "text": " and the fact that it's non that this is non negative and the fact that this number is somewhat higher than sort of in the 0 1 range these are quite important and they're going to figure out that this is also important right here"}, {"start": 1543.0, "end": 1560.0, "text": " and as 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"}, {"start": 1560.0, "end": 1570.0, "text": " 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"}, {"start": 1570.0, "end": 1577.0, "text": " gradient clipping might slightly help but is of secondary importance"}, {"start": 1577.0, "end": 1590.0, "text": " 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"}, {"start": 1590.0, "end": 1611.0, "text": " yep then advantage estimation so advantage estimation in reinforcement learning is it basically the the value network needs to be trained right so you take a step and a step and a step and a step and in each step you get a reward"}, {"start": 1611.0, "end": 1625.0, "text": " and you get you put for 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"}, {"start": 1625.0, "end": 1641.0, "text": " now usually what you do is you can bootstrap this by sort of a temporal difference thing in that you consider the 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"}, {"start": 1641.0, "end": 1661.0, "text": " 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"}, {"start": 1661.0, "end": 1685.0, "text": " 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 V trace and their hyper parameters"}, {"start": 1685.0, "end": 1697.0, "text": " and their recommendation is use the GA with lambda equals 0.9"}, {"start": 1697.0, "end": 1721.0, "text": " okay I feel this is not too surprising right here because this this end step is a very basic estimator and the GA and the V trace are better and they say the GA and the V trace they appear to perform better"}, {"start": 1721.0, "end": 1733.0, "text": " and they have not found a significant performance difference between the two so cool"}, {"start": 1733.0, "end": 1749.0, "text": " last thing no 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"}, {"start": 1749.0, "end": 1759.0, "text": " 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 to matter quite a bit"}, {"start": 1759.0, "end": 1771.0, "text": " 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"}, {"start": 1771.0, "end": 1783.0, "text": " 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"}, {"start": 1783.0, "end": 1796.0, "text": " 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"}, {"start": 1796.0, "end": 1808.0, "text": " 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"}, {"start": 1808.0, "end": 1818.0, "text": " 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"}, {"start": 1818.0, "end": 1828.0, "text": " so you want to kind of shuffle them around in here each time before you go to the room you can go through them multiple times in different order and that works really well"}, {"start": 1828.0, "end": 1840.0, "text": " 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"}, {"start": 1840.0, "end": 1854.0, "text": " the second thing they say is you should shuffle individual transitions before assigning them to many batches okay we've concluded that and you should recompute advantages once per day to pass"}, {"start": 1854.0, "end": 1867.0, "text": " now what's 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"}, {"start": 1867.0, "end": 1884.0, "text": " 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"}, {"start": 1884.0, "end": 1894.0, "text": " 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"}, {"start": 1894.0, "end": 1921.0, "text": " 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"}, {"start": 1921.0, "end": 1941.0, "text": " 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"}, {"start": 1941.0, "end": 1970.0, "text": " 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 then you're going to collect more experience and more different experience and that will speed up your"}, {"start": 1970.0, "end": 1977.0, "text": " time that you need for learning you might collect more samples though so it will also increase your flops"}, {"start": 1977.0, "end": 1997.0, "text": " 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"}, {"start": 1997.0, "end": 2014.0, "text": " environments you can choose to like ignore intermediate frames how episode termination due to time step limit or 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"}, {"start": 2014.0, "end": 2028.0, "text": " and to start with a point nine nine discount factor drive frames keep it 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"}, {"start": 2028.0, "end": 2044.0, "text": " 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"}, {"start": 2044.0, "end": 2073.0, "text": " important hyper parameter but it's good to note and then last second there's more second to last thing optimizers they investigate different optimizers we invested two grading based optimizers Adam and RMS prop as well as their hyper parameters and their results says you should use Adam with momentum though I think they found that RMS prop isn't too much behind that but they say"}, {"start": 2073.0, "end": 2086.0, "text": " you should tune the learning rate absolutely which is also known in the community right you can't you you if you have a different problem it might require a different learning rate and they find the learning rate to be a"}, {"start": 2086.0, "end": 2107.0, "text": " 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"}, {"start": 2107.0, "end": 2135.0, "text": " so in regularization they try different regularizing methods such as entropy regularization soft constrained entropy should not be lower than some threshold call back libeler divergence between reference distribution and so on and they say we did not find evidence that any of the investigated regularizers help significantly on our environments with the exception of have cheat on which all constraints"}, {"start": 2135.0, "end": 2154.0, "text": " 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"}, {"start": 2154.0, "end": 2174.0, "text": " 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 p p o loss as far as I understand the paper and there you can already see that there is a space that is not"}, {"start": 2174.0, "end": 2190.0, "text": " a space that is the setting of the original paper that introduced the thing and I think this this if you can remember this study the study like are all gans created equal they concluded that probably all gans are created equal especially like"}, {"start": 2190.0, "end": 2210.0, "text": " the other one is not too much better than anything else and the author of the vassar stangan paper was furious because they didn't in they clearly said in the vassar stangan paper that they atom optimizer doesn't work and they had to use rms prop and then the rms prop was not in that study included"}, {"start": 2210.0, "end": 2228.0, "text": " 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"}, {"start": 2228.0, "end": 2245.0, "text": " 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"}, {"start": 2245.0, "end": 2256.0, "text": " otherwise what I'd much rather do is to just go to like a piece of code that implements as close as an environment as possible to the one I want and take the hyper parameters from there"}, {"start": 2256.0, "end": 2283.0, "text": " 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"}, {"start": 2283.0, "end": 2297.0, "text": " 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"}, {"start": 2297.0, "end": 2308.0, "text": " all right 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"}] |
Yannic Kilcher | 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 NURRIPS 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 theories two week or the assumptions aren't warranted or they just don't like your face and that's why they give you a week reject. Actually some of them think your paper is fantastic and give you a week reject. So a lot of people are angry, upset, dissatisfied with the quality of the reviews and machine learning conferences. And today I want to go look 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 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 fields, people that don't have time. So too many submissions, too few inexperienced and not really expert reviewers create pretty much a random process and this was also shown in a few years ago in the 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 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 gotta 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 higher 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 a 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, no, they can resubmit to the next conference. So I already have a giant prior to reject a paper. Add to that, that usually the papers that I 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. 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. Black planting 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 good will. 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 two's 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 good will 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 AC-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. This 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 experty, 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. You'll see how that fixes the incentive for you to reject anything. You just might write it in a little 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 text 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 a 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. It seems to be preposterous. I'm sorry. So people wonder, yep, 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 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 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 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. Another system then 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 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 that 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 that 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. They 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. This can be solved technologically pretty easy by creating something like a browser plug-in 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 conference 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.0, "end": 6.6000000000000005, "text": " It's review time, review time."}, {"start": 6.6000000000000005, "end": 14.32, "text": " So NURRIPS has recently released the reviews for submitted papers and pretty much everyone"}, {"start": 14.32, "end": 16.36, "text": " is not happy."}, {"start": 16.36, "end": 22.400000000000002, "text": " And I think the reason is that even though you have the reasonable reviewers of these conferences,"}, {"start": 22.400000000000002, "end": 26.92, "text": " there is always, always reviewer number two."}, {"start": 26.92, "end": 34.800000000000004, "text": " And reviewer number two leaves very short review, says that either there are not enough experiments"}, {"start": 34.800000000000004, "end": 40.32, "text": " or the theories two week or the assumptions aren't warranted or they just don't like your"}, {"start": 40.32, "end": 44.44, "text": " face and that's why they give you a week reject."}, {"start": 44.44, "end": 48.72, "text": " Actually some of them think your paper is fantastic and give you a week reject."}, {"start": 48.72, "end": 55.8, "text": " So a lot of people are angry, upset, dissatisfied with the quality of the reviews and machine"}, {"start": 55.8, "end": 57.76, "text": " learning conferences."}, {"start": 57.76, "end": 64.67999999999999, "text": " And today I want to go look into how this works, why this is the way that it is and what"}, {"start": 64.67999999999999, "end": 66.6, "text": " we could potentially do about it."}, {"start": 66.6, "end": 69.16, "text": " So what's happening with publishing in ML?"}, {"start": 69.16, "end": 71.6, "text": " The system seems to be overloaded."}, {"start": 71.6, "end": 76.36, "text": " There's so much attention in machine learning right now that there hasn't been few years"}, {"start": 76.36, "end": 82.47999999999999, "text": " ago that there's a huge influx of new people wanting to publish in this field."}, {"start": 82.48, "end": 88.84, "text": " That creates a lot of submissions and not enough reviewers to peer review these submissions."}, {"start": 88.84, "end": 93.64, "text": " So a lot of reviewers are recruited that probably shouldn't be reviewers."}, {"start": 93.64, "end": 99.80000000000001, "text": " I hear stories of undergrads being recruited as reviewers, people from way outside fields,"}, {"start": 99.80000000000001, "end": 100.96000000000001, "text": " people that don't have time."}, {"start": 100.96000000000001, "end": 107.64, "text": " So too many submissions, too few inexperienced and not really expert reviewers create pretty"}, {"start": 107.64, "end": 114.44, "text": " much a random process and this was also shown in a few years ago in the NIPs experiment"}, {"start": 114.44, "end": 119.44, "text": " where it showed that for most papers being accepted is pretty much a coin flip with a"}, {"start": 119.44, "end": 120.44, "text": " weighted coin."}, {"start": 120.44, "end": 124.8, "text": " The natural response as an author is going to be you're going to submit even more papers"}, {"start": 124.8, "end": 130.4, "text": " if it's a coin flip, you can just submit whatever and there's a chance it might get in."}, {"start": 130.4, "end": 133.16, "text": " Which of course only makes the problem worse."}, {"start": 133.16, "end": 137.36, "text": " So this entire process of science where you submit your manuscript and then you get the"}, {"start": 137.36, "end": 139.64000000000001, "text": " reviews and then you try to improve it."}, {"start": 139.64000000000001, "end": 145.16000000000003, "text": " It's completely broken because not only do you not care about the reviews, the next set"}, {"start": 145.16000000000003, "end": 148.12, "text": " of reviewers at the next conference are going to be different."}, {"start": 148.12, "end": 152.28, "text": " So no matter what you improve right now, the next set of people will have completely"}, {"start": 152.28, "end": 153.32000000000002, "text": " different criticism."}, {"start": 153.32000000000002, "end": 157.44000000000003, "text": " It just doesn't work like it is intended to work."}, {"start": 157.44000000000003, "end": 161.96, "text": " The review process is basically just some kind of a random nuisance to people that they"}, {"start": 161.96, "end": 164.20000000000002, "text": " have to get through."}, {"start": 164.2, "end": 169.07999999999998, "text": " And at the same time, people who are reviewers have every incentive to make it as hard as"}, {"start": 169.07999999999998, "end": 172.0, "text": " possible for the people that are submitting."}, {"start": 172.0, "end": 177.16, "text": " So in order to analyze this, I want to look at the incentives of the different groups"}, {"start": 177.16, "end": 183.72, "text": " in this process and kind of show how the incentive structure upholds this system that benefits"}, {"start": 183.72, "end": 189.6, "text": " pretty much everyone participating in it, but creates a worse outcome for all of us."}, {"start": 189.6, "end": 192.28, "text": " So first of all, let's look at paper authors."}, {"start": 192.28, "end": 195.76, "text": " What are your incentive if you're an author of a paper?"}, {"start": 195.76, "end": 201.04, "text": " First of all, authors they want to get as many papers as possible as fast as possible."}, {"start": 201.04, "end": 206.6, "text": " Now, in the current conference system, the fastness isn't really up for debate."}, {"start": 206.6, "end": 208.04, "text": " It's as fast as it is."}, {"start": 208.04, "end": 213.84, "text": " However, authors can simply upload their paper to archive and be as fast as they want"}, {"start": 213.84, "end": 214.84, "text": " there."}, {"start": 214.84, "end": 219.16, "text": " Another incentive for authors is to have as little comments on your paper as possible,"}, {"start": 219.16, "end": 224.2, "text": " because comments usually mean criticism and you don't want comments and especially you"}, {"start": 224.2, "end": 227.0, "text": " don't want public, permanent comments."}, {"start": 227.0, "end": 231.07999999999998, "text": " The good thing for authors right now is on archive comments aren't possible."}, {"start": 231.07999999999998, "end": 235.4, "text": " And conference reviews, even if they're made public, no one goes to look at them."}, {"start": 235.4, "end": 236.96, "text": " Everyone just goes to archive."}, {"start": 236.96, "end": 242.32, "text": " So authors right now are getting a pretty good deal with respect to not getting their"}, {"start": 242.32, "end": 244.0, "text": " work criticized."}, {"start": 244.0, "end": 248.96, "text": " authors are also incentivized to give as little credit to people as possible."}, {"start": 248.96, "end": 252.2, "text": " And again, the current system is totally in favor of that."}, {"start": 252.2, "end": 256.92, "text": " The no commenting on archive basically means that you can claim whatever you want."}, {"start": 256.92, "end": 260.84, "text": " And if someone wants to refute you, they have to make a big deal out of it and basically"}, {"start": 260.84, "end": 262.76, "text": " write their own paper."}, {"start": 262.76, "end": 265.88, "text": " And again, people will probably not find that."}, {"start": 265.88, "end": 270.24, "text": " On the other hand, in the conferences, reviewers are supposed to detect when you're not giving"}, {"start": 270.24, "end": 272.04, "text": " proper credit to other people."}, {"start": 272.04, "end": 274.64000000000004, "text": " However, most reviewers don't do that."}, {"start": 274.64000000000004, "end": 280.6, "text": " Going out and really looking if everything is credited properly is one of the most time"}, {"start": 280.6, "end": 283.84000000000003, "text": " consuming tasks when you review a paper."}, {"start": 283.84000000000003, "end": 287.6, "text": " And most reviewers simply aren't going through that trouble."}, {"start": 287.6, "end": 292.24, "text": " The only downside for most authors is, even though all of this is pretty much in their"}, {"start": 292.24, "end": 298.88, "text": " favor, a lot of them still require that stamp of approval, that peer review accepted"}, {"start": 298.88, "end": 300.16, "text": " at a good conference."}, {"start": 300.16, "end": 306.36, "text": " So their incentive is to keep submitting to conferences as many papers as possible, basically"}, {"start": 306.36, "end": 310.04, "text": " count on that random process to get them accepted."}, {"start": 310.04, "end": 312.20000000000005, "text": " And after that, they're just fine."}, {"start": 312.20000000000005, "end": 313.76000000000005, "text": " They have the stamp of approval."}, {"start": 313.76000000000005, "end": 316.52000000000004, "text": " There's absolutely no requirement to revise it."}, {"start": 316.52000000000004, "end": 321.56, "text": " There's absolutely no requirement to have other people comment further on the work."}, {"start": 321.56, "end": 325.92, "text": " So I guess the complaining here right now is just about the noisy process and everyone"}, {"start": 325.92, "end": 331.04, "text": " complains that their particular paper, which is at the behest of the noisy process as"}, {"start": 331.04, "end": 337.76, "text": " everyone else's paper, got an unfair treatment in that random process, which half the papers"}, {"start": 337.76, "end": 339.36, "text": " do probably more."}, {"start": 339.36, "end": 344.12, "text": " The incentives in the systems are actually even bigger for what I call the big names."}, {"start": 344.12, "end": 345.12, "text": " Okay?"}, {"start": 345.12, "end": 350.64, "text": " These are the big research institutions of companies or big name professors, anyone that"}, {"start": 350.64, "end": 352.56, "text": " has some sort of reputation."}, {"start": 352.56, "end": 359.12, "text": " People argue that anonymous reviewing is actually good for small authors, good for unknown authors"}, {"start": 359.12, "end": 363.96, "text": " because it hides their identity and the big names basically aren't able to play their"}, {"start": 363.96, "end": 365.68, "text": " big name credit to a paper."}, {"start": 365.68, "end": 369.44, "text": " However, there's an easy way to know that this isn't the case."}, {"start": 369.44, "end": 371.52, "text": " The big names are doing just fine."}, {"start": 371.52, "end": 372.52, "text": " Here's the issue."}, {"start": 372.52, "end": 378.16, "text": " If you want your name to be attached to something, you're gonna find a way to do it."}, {"start": 378.16, "end": 383.76000000000005, "text": " People are suggesting archive blackout periods and whatnot, anonymous submissions to archive."}, {"start": 383.76000000000005, "end": 389.84000000000003, "text": " You have to realize that if someone wants to give some information to the public, they"}, {"start": 389.84000000000003, "end": 391.08000000000004, "text": " are going to."}, {"start": 391.08000000000004, "end": 396.36, "text": " In fact, right now the big names are finding every possible way to have their names attached"}, {"start": 396.36, "end": 402.40000000000003, "text": " to things and massively increase their chances of getting through the anonymous peer review"}, {"start": 402.40000000000003, "end": 403.40000000000003, "text": " process."}, {"start": 403.40000000000003, "end": 407.32000000000005, "text": " You gotta realize if you're well connected, not only do you have an advertising platform,"}, {"start": 407.32, "end": 413.32, "text": " but you can also pretty easily find out who your area chairs are, who's reviewing, in"}, {"start": 413.32, "end": 415.8, "text": " which track your paper gets and so on."}, {"start": 415.8, "end": 420.64, "text": " So allow me to be a little bit skeptical about the claim that we need more anonymity in"}, {"start": 420.64, "end": 421.8, "text": " this process."}, {"start": 421.8, "end": 423.2, "text": " I think we need less."}, {"start": 423.2, "end": 426.64, "text": " Second, what are the incentives of the conferences itself?"}, {"start": 426.64, "end": 431.52, "text": " So the conference organizers, they want to have a good reputation, which basically means"}, {"start": 431.52, "end": 434.36, "text": " they want to be like a cool nightclub."}, {"start": 434.36, "end": 439.92, "text": " Lots of people want to get in, but they have to reject a lot of those people in order"}, {"start": 439.92, "end": 443.56, "text": " to make the club exclusive and have a higher reputation."}, {"start": 443.56, "end": 448.8, "text": " So conferences have every reason to invite everyone to submit as much as possible, but"}, {"start": 448.8, "end": 454.16, "text": " then to reject as much as possible to make it seem like it's super hard to get in."}, {"start": 454.16, "end": 456.08000000000004, "text": " This only makes the problem worse."}, {"start": 456.08000000000004, "end": 460.64, "text": " And I think the current explosion isn't really desired by the conferences."}, {"start": 460.64, "end": 465.96, "text": " As the process is super noisy, they're slowly losing their reputation that way, but still,"}, {"start": 465.96, "end": 471.84, "text": " the incentives aren't to lower the amount of submissions and increase the overall quality,"}, {"start": 471.84, "end": 475.71999999999997, "text": " because that means a higher percentage of submissions will have to get accepted, which"}, {"start": 475.71999999999997, "end": 479.59999999999997, "text": " means that the conference appears to be less exclusive."}, {"start": 479.59999999999997, "end": 483.4, "text": " And lastly, let's look at the reviewers themselves."}, {"start": 483.4, "end": 486.44, "text": " This is the most screwed-up part in the system."}, {"start": 486.44, "end": 491.24, "text": " I have every incentive to be a reviewer for one of these conferences, because I can write"}, {"start": 491.24, "end": 492.24, "text": " that on my CV."}, {"start": 492.24, "end": 495.48, "text": " Hey, I was a reviewer at a big name conference."}, {"start": 495.48, "end": 501.88, "text": " And then once I am accepted as a reviewer, I have every incentive to do absolutely nothing."}, {"start": 501.88, "end": 508.48, "text": " In fact, the less time I waste with this, the better, because I'm not getting any public"}, {"start": 508.48, "end": 509.48, "text": " credit."}, {"start": 509.48, "end": 510.48, "text": " I'm anonymous, right?"}, {"start": 510.48, "end": 512.04, "text": " Anonymous peer review."}, {"start": 512.04, "end": 518.76, "text": " I'm not getting any reputation out of this, and in fact, I can only lose from accepting"}, {"start": 518.76, "end": 523.3199999999999, "text": " papers, and I can only lose from writing detailed reviews."}, {"start": 523.3199999999999, "end": 529.68, "text": " If I'm short and vague, and I reject a paper, not only can I not really be criticized,"}, {"start": 529.68, "end": 534.4399999999999, "text": " because I'm not saying much, it's actually in my overwhelming interest, if the paper"}, {"start": 534.4399999999999, "end": 540.56, "text": " has some sort of big mistake, and I overlook it and I accept the paper, and the other reviewers"}, {"start": 540.56, "end": 544.0, "text": " see that mistake, this looks really, really bad for me."}, {"start": 544.0, "end": 549.16, "text": " Even though I'm anonymous in the broader context, it also looks bad for the area chair, supervising"}, {"start": 549.16, "end": 553.92, "text": " me if they don't see it, it looks bad for the conference if their area chairs don't see"}, {"start": 553.92, "end": 554.92, "text": " it."}, {"start": 554.92, "end": 559.3199999999999, "text": " So there's a massive push to not make mistakes."}, {"start": 559.3199999999999, "end": 565.3599999999999, "text": " However, if I reject a paper that was actually good, I can just say, well, no, they can"}, {"start": 565.3599999999999, "end": 567.76, "text": " resubmit to the next conference."}, {"start": 567.76, "end": 571.12, "text": " So I already have a giant prior to reject a paper."}, {"start": 571.12, "end": 576.28, "text": " Add to that, that usually the papers that I review might be my competition, and by the"}, {"start": 576.28, "end": 582.08, "text": " conference incentive of being pretty exclusive, the more of my competition gets accepted,"}, {"start": 582.08, "end": 587.88, "text": " the less I might get accepted, because not only are there limited amount of space, not"}, {"start": 587.88, "end": 593.24, "text": " formally, but informally, other work might overlap substantially with my own, and therefore"}, {"start": 593.24, "end": 598.16, "text": " make it less likely that I get published."}, {"start": 598.16, "end": 600.5600000000001, "text": " And I don't like that."}, {"start": 600.5600000000001, "end": 605.96, "text": " And this is a bit cynical, but I'm not saying everyone does this, but there is an incentive"}, {"start": 605.96, "end": 610.64, "text": " for you as a reviewer, especially if the work is close to what you're doing, to reject"}, {"start": 610.64, "end": 616.6800000000001, "text": " it now, implement the same or a very similar idea, and then submit to the next conference,"}, {"start": 616.6800000000001, "end": 622.24, "text": " where these other authors also will submit, and hope for the random process to just for"}, {"start": 622.24, "end": 625.16, "text": " your paper to get more lucky than their paper."}, {"start": 625.16, "end": 631.4, "text": " Black planting on archive counters this a little bit, but I'm afraid that with proposed solutions"}, {"start": 631.4, "end": 637.64, "text": " like more archive blackout periods, more anonymity, these problems will only get worse."}, {"start": 637.64, "end": 642.64, "text": " Maybe some people don't realize this, but as a reviewer, it's really easy for me to reject"}, {"start": 642.64, "end": 643.64, "text": " a paper."}, {"start": 643.64, "end": 646.88, "text": " I can almost always find reasons to reject a paper."}, {"start": 646.88, "end": 650.28, "text": " If it's a theory paper, I can ask for experiments."}, {"start": 650.28, "end": 653.9599999999999, "text": " If it's an experimental paper, I can ask for more experiments."}, {"start": 653.9599999999999, "end": 655.76, "text": " Why didn't you test that data set?"}, {"start": 655.76, "end": 657.76, "text": " Why didn't you compare against this method?"}, {"start": 657.76, "end": 659.6, "text": " Why are your assumptions so strong?"}, {"start": 659.6, "end": 661.72, "text": " They're never guaranteed in practice."}, {"start": 661.72, "end": 663.1999999999999, "text": " Is the problem even relevant?"}, {"start": 663.1999999999999, "end": 665.6, "text": " Your theory is too weak."}, {"start": 665.6, "end": 667.8, "text": " Have you looked at this other special case?"}, {"start": 667.8, "end": 673.76, "text": " And if I really want to, I can just ask many, many, many questions, not even criticisms,"}, {"start": 673.76, "end": 675.12, "text": " just many questions."}, {"start": 675.12, "end": 678.68, "text": " And I know the authors just have a one page rebuttal."}, {"start": 678.68, "end": 681.52, "text": " They can never answer all my questions if I do that."}, {"start": 681.52, "end": 686.4399999999999, "text": " And then I can simply argue, the authors failed to address all my questions properly."}, {"start": 686.4399999999999, "end": 692.1999999999999, "text": " So you might be asking, why do some reviewers actually do a good job?"}, {"start": 692.1999999999999, "end": 697.4399999999999, "text": " And that is, I believe, really a lot to do with good will."}, {"start": 697.4399999999999, "end": 699.9599999999999, "text": " Most people are actually well-intended."}, {"start": 699.9599999999999, "end": 705.92, "text": " Most people actually want to do a good job in reviewing, have the ethos of science, and"}, {"start": 705.92, "end": 711.5999999999999, "text": " do take the time to do the reviews, even though they're incentivized, to do them badly,"}, {"start": 711.5999999999999, "end": 714.56, "text": " even though they're incentivized to reject papers."}, {"start": 714.56, "end": 720.24, "text": " A lot of people still do a good job, however, reviewer number two usually doesn't."}, {"start": 720.24, "end": 725.5999999999999, "text": " And it only needs a very few reviewer number two's to make the field a whole lot worse."}, {"start": 725.5999999999999, "end": 727.5999999999999, "text": " Now, there's a question to be said."}, {"start": 727.5999999999999, "end": 730.16, "text": " Aren't we all a bit reviewer number two?"}, {"start": 730.16, "end": 735.24, "text": " Have you ever written a review that the authors might think is completely unreasonable?"}, {"start": 735.24, "end": 741.16, "text": " And while there is some truth to that argument, I definitely know that there are differences"}, {"start": 741.16, "end": 742.16, "text": " in reviews."}, {"start": 742.16, "end": 746.52, "text": " In fact, I've heard people brag about writing two line reviews where the second line is"}, {"start": 746.52, "end": 749.28, "text": " you didn't cite and compare to my own work."}, {"start": 749.28, "end": 750.52, "text": " And then laugh about that."}, {"start": 750.52, "end": 755.28, "text": " So good will won't carry us all the way if the incentive structure is bad."}, {"start": 755.28, "end": 761.36, "text": " And I believe most of this is because we've taken out the reputation game out of the review"}, {"start": 761.36, "end": 762.52, "text": " process."}, {"start": 762.52, "end": 767.56, "text": " In smaller fields of science, it used to be that the journal editors knew the reviewers"}, {"start": 767.56, "end": 774.3199999999999, "text": " and their reputation at least towards the journal editor was on the line for all of future"}, {"start": 774.3199999999999, "end": 775.72, "text": " if they did a bad job."}, {"start": 775.72, "end": 778.0799999999999, "text": " Right now everything's so big, so anonymous."}, {"start": 778.0799999999999, "end": 782.04, "text": " People hardly remember the names of their co-reviewers."}, {"start": 782.04, "end": 784.56, "text": " No reputation is being damaged by bad reviews."}, {"start": 784.56, "end": 785.56, "text": " And that's how we get here."}, {"start": 785.56, "end": 789.16, "text": " So, of course, I'm not the first one to observe these problems."}, {"start": 789.16, "end": 793.36, "text": " So many people have proposed solutions and most of these solutions fall into the basis"}, {"start": 793.36, "end": 800.7199999999999, "text": " of what I would call AC-based methods, which is basically where someone evaluates the"}, {"start": 800.7199999999999, "end": 804.48, "text": " reviews while the reviews remain anonymous."}, {"start": 804.48, "end": 807.3199999999999, "text": " And that someone is usually the area chair."}, {"start": 807.3199999999999, "end": 811.8399999999999, "text": " So right now the area chair can already decide that a reviewer is really bad and then the"}, {"start": 811.8399999999999, "end": 815.28, "text": " reviewer will not be invited to review the next time around."}, {"start": 815.28, "end": 818.3199999999999, "text": " I just want to point out the irony of the situation."}, {"start": 818.32, "end": 824.08, "text": " This nowadays have so little reviewers that they require every author to be a reviewer,"}, {"start": 824.08, "end": 830.0, "text": " but then your punishment for writing bad reviews is that you won't be invited to be a reviewer"}, {"start": 830.0, "end": 831.32, "text": " the next time around."}, {"start": 831.32, "end": 835.5600000000001, "text": " I mean, can you make a better point that the system is failing?"}, {"start": 835.5600000000001, "end": 841.5600000000001, "text": " Of course, the problem with all AC-based methods is that you're basically moving a problem"}, {"start": 841.56, "end": 848.5999999999999, "text": " that has everything to do with people being unaccountable, noisy, not experty, having no"}, {"start": 848.5999999999999, "end": 853.52, "text": " time and every single incentive to do as little as possible."}, {"start": 853.52, "end": 858.88, "text": " You transfer that problem to even less people that have even less time that have even more"}, {"start": 858.88, "end": 864.0, "text": " stress that have an even broader view and topic area."}, {"start": 864.0, "end": 867.92, "text": " And are single people instead of three or four people?"}, {"start": 867.92, "end": 873.52, "text": " So it's even more noisy. If anything like this is implemented, you'll just instead of"}, {"start": 873.52, "end": 875.8, "text": " seeing complaints about bad reviews."}, {"start": 875.8, "end": 881.68, "text": " In addition, you will also see complaints about bad ACs that will certainly not make the"}, {"start": 881.68, "end": 882.68, "text": " problem any less."}, {"start": 882.68, "end": 887.88, "text": " In fact, I would argue any AC-based solution will make the problem worse."}, {"start": 887.88, "end": 893.8, "text": " Other solutions are what I call payment-based solutions, like give the reviewers money to"}, {"start": 893.8, "end": 894.8, "text": " review."}, {"start": 894.8, "end": 898.52, "text": " You'll see how that fixes the incentive for you to reject anything."}, {"start": 898.52, "end": 901.64, "text": " You just might write it in a little bit more eloquent style."}, {"start": 901.64, "end": 906.3199999999999, "text": " Also as soon as you bring money into the game that automatically excludes a lot of people"}, {"start": 906.3199999999999, "end": 911.4799999999999, "text": " depending on how you do it, that aren't as affluent, which is certainly something we don't"}, {"start": 911.4799999999999, "end": 912.8, "text": " want as a community."}, {"start": 912.8, "end": 918.68, "text": " Other people are pointing to things like open review, which I agree is a better system."}, {"start": 918.68, "end": 921.3199999999999, "text": " However, it is still anonymous."}, {"start": 921.32, "end": 928.12, "text": " So the same incentives exist, and it is still a conference where you get a stamp of accept"}, {"start": 928.12, "end": 929.9200000000001, "text": " or reject."}, {"start": 929.9200000000001, "end": 933.6, "text": " And once it's accepted, no one cares about the reviews anymore."}, {"start": 933.6, "end": 939.96, "text": " In fact, in open review, you can write as much text as you want so the ACs are even more"}, {"start": 939.96, "end": 943.5600000000001, "text": " overloaded with lots of text to make their decisions."}, {"start": 943.5600000000001, "end": 949.08, "text": " So something I want to highlight is a thread by Thomas G. Dietrich on Twitter, where he"}, {"start": 949.08, "end": 955.08, "text": " basically suggests some sort of a wiki and sort of a collaborative research wiki, where"}, {"start": 955.08, "end": 962.08, "text": " you'd have a set of senior authors that basically maintain that wiki, that do a first check"}, {"start": 962.08, "end": 968.08, "text": " of papers and kind of match them against the wiki of what's already known."}, {"start": 968.08, "end": 970.0400000000001, "text": " I won't go through that here."}, {"start": 970.0400000000001, "end": 974.48, "text": " I will link it, and I definitely advise you to read it because it's a very interesting"}, {"start": 974.48, "end": 975.48, "text": " proposal."}, {"start": 975.48, "end": 977.08, "text": " It's a sort of utopian dream."}, {"start": 977.08, "end": 982.76, "text": " I would actually welcome if we all work together on increasing the knowledge of mankind in a wiki"}, {"start": 982.76, "end": 983.76, "text": " style way."}, {"start": 983.76, "end": 988.2, "text": " However, I think lots of people want their names attached to things."}, {"start": 988.2, "end": 992.76, "text": " And even if you do what Thomas suggests, and basically have people write papers, and"}, {"start": 992.76, "end": 998.72, "text": " then the editors integrate that into the wiki, it is not clear how that system, where the"}, {"start": 998.72, "end": 1004.1600000000001, "text": " editors clearly need to be senior and experienced, could deal any better with the explosion of"}, {"start": 1004.1600000000001, "end": 1006.76, "text": " research that we're dealing right now."}, {"start": 1006.76, "end": 1009.4399999999999, "text": " They would be as overloaded as the current system."}, {"start": 1009.4399999999999, "end": 1010.84, "text": " Plus who's going to be an editor?"}, {"start": 1010.84, "end": 1015.92, "text": " Thomas says becoming an editor would be a very esteemed career path."}, {"start": 1015.92, "end": 1021.4, "text": " And again, I completely welcome if that were the case in the future."}, {"start": 1021.4, "end": 1028.16, "text": " However, simply decreeing that something would be very esteemed doesn't make it that way."}, {"start": 1028.16, "end": 1029.64, "text": " It's not fiat money."}, {"start": 1029.64, "end": 1034.4, "text": " So as much as I would like that, I just don't believe it would work, and especially I don't"}, {"start": 1034.4, "end": 1040.3600000000001, "text": " believe it would work right now, and I think it would be subject to the same problems."}, {"start": 1040.3600000000001, "end": 1043.44, "text": " So can we come up with a better solution?"}, {"start": 1043.44, "end": 1045.1200000000001, "text": " I think yes."}, {"start": 1045.1200000000001, "end": 1051.44, "text": " But the way to go there is to align what we want as a community with the incentives of"}, {"start": 1051.44, "end": 1053.64, "text": " people and not go against it."}, {"start": 1053.64, "end": 1058.72, "text": " Because as soon as you go against it too much, people will find a way around it."}, {"start": 1058.72, "end": 1063.3600000000001, "text": " So the first thing I want to suggest is we abolish conference publishing."}, {"start": 1063.36, "end": 1069.4799999999998, "text": " This weird notion that you submit your paper to this conference, and then all at the same"}, {"start": 1069.4799999999998, "end": 1074.56, "text": " time, a random process is happening, and three random people give their opinion while"}, {"start": 1074.56, "end": 1077.28, "text": " reading your paper for a couple of minutes."}, {"start": 1077.28, "end": 1082.6399999999999, "text": " And then you get an accept after which your paper is there, never to be revised, or a"}, {"start": 1082.6399999999999, "end": 1085.56, "text": " reject, which simply means you try again."}, {"start": 1085.56, "end": 1086.8799999999999, "text": " It seems to be preposterous."}, {"start": 1086.8799999999999, "end": 1087.8799999999999, "text": " I'm sorry."}, {"start": 1087.8799999999999, "end": 1091.28, "text": " So people wonder, yep, how do we know when a paper is accepted?"}, {"start": 1091.28, "end": 1094.0, "text": " Who cares about acceptance? Who cares?"}, {"start": 1094.0, "end": 1097.3999999999999, "text": " Why can't we just switch to citations?"}, {"start": 1097.3999999999999, "end": 1101.3999999999999, "text": " Citations is a pretty good measure of how much people care about a paper."}, {"start": 1101.3999999999999, "end": 1107.6, "text": " And yes, big names will get more citations, but they do so now, and they do so more effectively"}, {"start": 1107.6, "end": 1108.6, "text": " than ever."}, {"start": 1108.6, "end": 1114.16, "text": " Why can't we just put our papers on archive and then run some kind of page rank algorithm"}, {"start": 1114.16, "end": 1116.04, "text": " over the citations?"}, {"start": 1116.04, "end": 1118.56, "text": " Such that self citations aren't worth as much."}, {"start": 1118.56, "end": 1127.0, "text": " I mean, search engines figured out how to deliver the most relevant search result to a query"}, {"start": 1127.0, "end": 1128.52, "text": " 20 years ago."}, {"start": 1128.52, "end": 1134.52, "text": " Why can't we simply apply the same techniques to research determining this work is quite"}, {"start": 1134.52, "end": 1135.52, "text": " relevant?"}, {"start": 1135.52, "end": 1137.44, "text": " This work is not that quite relevant."}, {"start": 1137.44, "end": 1138.44, "text": " I get it."}, {"start": 1138.44, "end": 1143.72, "text": " Citations take time, and you won't immediately know after publishing, but I think that's"}, {"start": 1143.72, "end": 1145.3999999999999, "text": " a step we can take."}, {"start": 1145.4, "end": 1150.8400000000001, "text": " Especially since conference publishing is also lagging like half a year behind publishing"}, {"start": 1150.8400000000001, "end": 1154.0, "text": " on archive, during which pretty much nothing happens."}, {"start": 1154.0, "end": 1157.0800000000002, "text": " And then people say, oh, but what about peer review?"}, {"start": 1157.0800000000002, "end": 1158.0800000000002, "text": " Peer review?"}, {"start": 1158.0800000000002, "end": 1159.24, "text": " Peer review does not work."}, {"start": 1159.24, "end": 1161.8400000000001, "text": " Peer review is a joke in machine learning."}, {"start": 1161.8400000000001, "end": 1162.8400000000001, "text": " Okay?"}, {"start": 1162.8400000000001, "end": 1166.24, "text": " No one cares about the reviews."}, {"start": 1166.24, "end": 1167.24, "text": " Reviewers are nuisance."}, {"start": 1167.24, "end": 1169.4, "text": " You have to get past them."}, {"start": 1169.4, "end": 1174.8400000000001, "text": " All the people still pretend to care that it means something that reviewers agree or disagree"}, {"start": 1174.8400000000001, "end": 1175.8400000000001, "text": " with you."}, {"start": 1175.8400000000001, "end": 1176.8400000000001, "text": " It doesn't."}, {"start": 1176.8400000000001, "end": 1181.24, "text": " In fact, I want to get to a system where peer review starts at the moment where you publish"}, {"start": 1181.24, "end": 1188.1200000000001, "text": " a paper on something like archive and then never finishes for the lifetime of that paper."}, {"start": 1188.1200000000001, "end": 1193.24, "text": " As new knowledge comes in from the field, the paper can be continuously re-examined."}, {"start": 1193.24, "end": 1198.3200000000002, "text": " And if the paper turns out to be really important, more and more scrutiny can be applied to"}, {"start": 1198.3200000000002, "end": 1199.3200000000002, "text": " it."}, {"start": 1199.32, "end": 1204.6, "text": " Another system then simply throwing the same amount of pretty random reviewers at every"}, {"start": 1204.6, "end": 1206.9199999999998, "text": " paper and then giving it the stamp or not."}, {"start": 1206.9199999999998, "end": 1208.56, "text": " So here's what I suggest."}, {"start": 1208.56, "end": 1213.6399999999999, "text": " We keep something like archive, but amended with a commenting function."}, {"start": 1213.6399999999999, "end": 1219.0, "text": " And the commenting can be pretty feature rich so you could incorporate plots and references"}, {"start": 1219.0, "end": 1220.32, "text": " to other things."}, {"start": 1220.32, "end": 1227.0, "text": " This goes very much towards a kind of a collaboratively edited wiki, but where people still put their"}, {"start": 1227.0, "end": 1228.52, "text": " names on things."}, {"start": 1228.52, "end": 1234.52, "text": " So let's say I publish a paper, someone else could publish a comment which would be not"}, {"start": 1234.52, "end": 1236.68, "text": " less in quality than a paper."}, {"start": 1236.68, "end": 1238.96, "text": " It can be a two line comment."}, {"start": 1238.96, "end": 1242.52, "text": " It can be a full rewrite of the paper."}, {"start": 1242.52, "end": 1244.4, "text": " It can be an amendment."}, {"start": 1244.4, "end": 1249.0, "text": " So I could have published a paper and someone else could say, look, I've done your code on"}, {"start": 1249.0, "end": 1251.96, "text": " a different data set and here are the results."}, {"start": 1251.96, "end": 1257.28, "text": " People could then cite my paper or they could cite comments and the citations will determine"}, {"start": 1257.28, "end": 1258.28, "text": " the relevance."}, {"start": 1258.28, "end": 1260.6, "text": " The comments would also be right there on archive."}, {"start": 1260.6, "end": 1265.68, "text": " So every time someone goes to look at that paper, they'll see the comments along with it."}, {"start": 1265.68, "end": 1269.92, "text": " So if the paper has a big mistake, they'll basically see the comment that says, hey, this"}, {"start": 1269.92, "end": 1273.8799999999999, "text": " paper has a mistake and I can prove it right here and then they can maybe see a response"}, {"start": 1273.8799999999999, "end": 1275.6399999999999, "text": " to that saying, no, you're wrong."}, {"start": 1275.6399999999999, "end": 1277.3999999999999, "text": " And people can make up their own minds."}, {"start": 1277.3999999999999, "end": 1282.8, "text": " We could build in some kind of voting system like a stack overflow system for ranking comments."}, {"start": 1282.8, "end": 1288.0, "text": " But instead of making this stamp of approval thing a one time event by a random set of people,"}, {"start": 1288.0, "end": 1294.12, "text": " let everyone make up their own mind and let people discuss and you can even have anonymous"}, {"start": 1294.12, "end": 1299.68, "text": " comments on these sites because the comments will be evaluated on what they are writing"}, {"start": 1299.68, "end": 1301.48, "text": " and not who it is by."}, {"start": 1301.48, "end": 1306.44, "text": " Now, of course, if it does turn out that commenting will become cool after a while, you can also"}, {"start": 1306.44, "end": 1311.88, "text": " comment non-anonymously and maybe get little medals that you get on stack overflow."}, {"start": 1311.88, "end": 1315.6, "text": " I don't see that happening, but if it does, the better."}, {"start": 1315.6, "end": 1320.7199999999998, "text": " Now, as a side suggestions, can we please stop publishing stuff in PDFs?"}, {"start": 1320.7199999999998, "end": 1324.48, "text": " It's so like, why do we still do this?"}, {"start": 1324.48, "end": 1327.1999999999998, "text": " This many pages, this margin and so on."}, {"start": 1327.1999999999998, "end": 1328.1999999999998, "text": " I get it."}, {"start": 1328.1999999999998, "end": 1335.0, "text": " Some people still print out their papers, but websites are so much nicer to look at and"}, {"start": 1335.0, "end": 1337.56, "text": " can be made to print adequately."}, {"start": 1337.56, "end": 1343.1599999999999, "text": " Let's start publishing research as HTML, not as PDFs."}, {"start": 1343.16, "end": 1347.8400000000001, "text": " So remember when I said the authors have a big incentive to not have comments on their"}, {"start": 1347.8400000000001, "end": 1350.96, "text": " paper, this pretty much goes against that, right?"}, {"start": 1350.96, "end": 1355.64, "text": " So it is entirely conceivable that the authors will just start self hosting."}, {"start": 1355.64, "end": 1359.8400000000001, "text": " They company like Google could simply not publish to archive anymore."}, {"start": 1359.8400000000001, "end": 1365.72, "text": " They could simply publish to their own website and remove themselves from the ability for"}, {"start": 1365.72, "end": 1367.3200000000002, "text": " other people to comment."}, {"start": 1367.3200000000002, "end": 1372.64, "text": " This can be solved technologically pretty easy by creating something like a browser plug-in"}, {"start": 1372.64, "end": 1378.76, "text": " that if you find a piece of research anywhere, it'll simply fuzzy match the title, find"}, {"start": 1378.76, "end": 1384.48, "text": " the appropriate comments to that research as a unified set of comments across all of"}, {"start": 1384.48, "end": 1385.5600000000002, "text": " the internet."}, {"start": 1385.5600000000002, "end": 1389.24, "text": " In contrast, conferences should be conferences."}, {"start": 1389.24, "end": 1394.8000000000002, "text": " It should be places where people come up, meet up and talk about relevant issues that"}, {"start": 1394.8000000000002, "end": 1396.68, "text": " are happening right now."}, {"start": 1396.68, "end": 1400.8000000000002, "text": " If I go to a conference now, most of the talks on the papers is from research that is"}, {"start": 1400.8, "end": 1403.0, "text": " six months old or older."}, {"start": 1403.0, "end": 1409.0, "text": " Why don't we have conferences that are simply consisting of invited keynotes, panel discussions,"}, {"start": 1409.0, "end": 1414.44, "text": " and things that are now called workshops where we discuss current, maybe unfinished research,"}, {"start": 1414.44, "end": 1417.9199999999998, "text": " have poster sessions for many more people."}, {"start": 1417.9199999999998, "end": 1420.68, "text": " There's no acceptance, there's no declining."}, {"start": 1420.68, "end": 1423.76, "text": " If there's not enough room, do a lottery or something like this."}, {"start": 1423.76, "end": 1429.28, "text": " But make the conferences a place where science is happening and not where we flash six months"}, {"start": 1429.28, "end": 1430.28, "text": " old research."}, {"start": 1430.28, "end": 1432.28, "text": " So, why is this not happening?"}, {"start": 1432.28, "end": 1437.28, "text": " I already said that most of the incentives are actually towards the current system as"}, {"start": 1437.28, "end": 1439.2, "text": " much as people complain about it."}, {"start": 1439.2, "end": 1445.6, "text": " Now conferences are slowly losing their reputations, as I said, because over time people will"}, {"start": 1445.6, "end": 1451.36, "text": " catch on to the fact that the signal being accepted at a particular conference is more"}, {"start": 1451.36, "end": 1452.36, "text": " and more noisy."}, {"start": 1452.36, "end": 1458.84, "text": " However, the system is still upheld by most PhD students, for example, needing a certain"}, {"start": 1458.84, "end": 1463.6, "text": " amount of conference accepted submissions in order to graduate."}, {"start": 1463.6, "end": 1469.6799999999998, "text": " So, what we really need is professors, and I'm calling on every professor out there,"}, {"start": 1469.6799999999998, "end": 1477.72, "text": " to start giving out PhDs while absolutely not caring about the number of conference accepted"}, {"start": 1477.72, "end": 1480.28, "text": " submissions that a student has."}, {"start": 1480.28, "end": 1484.84, "text": " And that seems like something that's very doable because it requires individuals professors"}, {"start": 1484.84, "end": 1489.04, "text": " to simply change their practices with which they let people graduate."}, {"start": 1489.04, "end": 1493.3999999999999, "text": " So that was it for my little rant on conferences and reviewer number two."}, {"start": 1493.3999999999999, "end": 1496.32, "text": " Please let me know what you think in the comments."}, {"start": 1496.32, "end": 1498.84, "text": " I value your input very much."}, {"start": 1498.84, "end": 1504.8799999999999, "text": " And I hope we can get to a future where conferences are conferences and research is just done on"}, {"start": 1504.8799999999999, "end": 1506.8799999999999, "text": " the basis of its coolness and relevance."}, {"start": 1506.8799999999999, "end": 1507.8799999999999, "text": " Alright, I'll see you."}, {"start": 1507.88, "end": 1519.64, "text": " Bye-bye."}] |
Yannic Kilcher | 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 you know things like GPT three 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 Raum or Riyalm I'm really not sure how to pronounce this the word would be called Raum I guess. It's retrieval augmented language model pre-training by Kelvin Gu Kenton Lee Zora Tang Panopong Pazapat and Mingwa Chang. 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. We're going to look at the entire architecture but just you know such that you're aware 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 pre-training method the kind of hacks that you need to get it to work and finally the results. As always if you'll enjoy content like this don't hesitate to share it out and 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 an LP task 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 the question. It's not like a little math question where you just have to do the correct calculations or so on or 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 intranparently it's very intranparently in the weights of the models baked together with the language modeling. 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-trains such a knowledge retriever in unsupervised manner using mask language modeling as a learning signal and backpropagating through a retrieval step that considers millions of documents. Okay so there's 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 mask 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 bird model like that's the fashionable thing to do. If you don't know what bird is I've made a video about bird but basically bird 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 z1, z2 and so on. What you want to do is you want to embed all of those. So you want to have b of z1 and b of z2. 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 triangles 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 datasets 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 I 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 z1, this could be z2, this could be z3 and so on and you want to train it in such a way that if you have a query then a query will be very close in inner product space 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 weight lifting I've 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 dome bell 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 birth. You mask out a token and then your goal is simply to reproduce that token. Okay so if we were in birth 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 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 can 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. Okay 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 the knowledge retriever right here is going to we're going to model this distribution as a joint distribution sorry this is oh yeah this is down here all right 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 masked 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. Okay 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 a certain degree in a back-propergatable 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 near-date to set and then you get a profiling of 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 allow it 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 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 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 what 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 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 they 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 the summation over all documents in the knowledge corp z we approximate this instead by summing over the top-cade 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-cade documents note that the ordering of documents is the same as under the relevant score okay which is an inner product thus we can employ maximum inner product search algorithms to find the approximate top-cade documents using a running time storage space that scales sub linearly with the number of documents so there are these algorithms to do maximum inner product search which you can use to find the top-cade 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 embedding 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 like 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 updated 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 hundred 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 hundred steps then every couple of hundred 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 this 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 this some fairly well the answer here that's pretty simple that's going to be just a birth model that takes in Z and X okay so this is going to be another birth model that's going to take in the retrieve document and the question and it's going to output Y how does that look in case of the mask language model we've already seen it 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 birth you have your query right here as text and then you have your documents Z right here and there somewhere would be a mask token you would put birth 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 documents 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 this 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 continuous 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 and 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 um 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 this 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 um and you you just because you only need to embed every query once and um 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 it 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 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 details namely first detail is how do you actually how do you even see that this does something sensible okay um and thereby they analyze the gradient of this thing so if you look at the gradient here's the gradient of the um 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 and we've discussed before like retrieving the documents and then marginalizing over the retrieved documents and so on okay so here you can see that the gradient um 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 or 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 quantity is quantity r 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 r the quantity r 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 then this is a negative number okay so let's look at the 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 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 document they can introduce noise like noise is often counterproductive for the systems because you have more input and then 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 you 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 and 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 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 you 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 mask language model pre-training where they already have this you know retrieval step in there even that needs to be itself initialize that a good point otherwise it doesn't help otherwise because you want to train the retriever such that the mask 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 star problem we warm start the embedding of the input and the docs so these are these are models 1 and 2 right I think this is what I called model 1 this is what I called model 2 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 orca paper and just quickly for the knowledge augmented encoder we warm started with bird tree training so this here I think this is this is model 3 so this is model 1 this here is model 2 that's model 3 so this paper here I believe that's the orca paper the orca paper is 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 in this case this is model 1 and this is model 2 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 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 veck 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 that in or in no in this iCT pre-training task this here is started from the public bird checkpoint or something like this so technically this you have the mask 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 iCT 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 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 all right so the next few things you have to do to get it to work yes 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 if the mask sentence comes from document z the knowledge augmented encoder can trivially predict why by looking at the on-masked version of it yes of course like if you do this mask language modeling and you take your sentence from that corpus then the retriever can simply go look for that document and then it 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 the document so you simply prohibit that particular thing so this is during pre-training this is for your mask language modeling pre-training the what we call here round 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 world like it will not require acquire any retrieval 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 introduce this null document along with the things they retrieve so if they retrieve maybe not five but eight i 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 mask language model pre-training what you'll do is simply you'll drop out not even words but word pieces right so um so here let's say 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 birthed or something you have word pieces so you maybe just drop out this c us right here and the low now people have observed that this is not 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 low cal also two faux horn on you can pretty easily deduce that's two 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 for most obvious thing is to drop out entire words even though you know bird 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 dropouts 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 mascaras spans only require what right and that requires much more world knowledge to answer that question it 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 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 the salient spans within a sentence for the mask language modeling task we show that this significantly outperforms other masking strategies and seconds in 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 sets so i guess they looked at the data set and you know you kind of as a developer you can look at your 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 yeah that's where it gets a bit long 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 this 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 um like i'm asked spans here and then i would ask my own model right my own half-trained model which um which if i want to predict this one right if i want to do mask my which one with this one i can use one of these your 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 uh 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 threshold right so the saliency in my mind should come directly from the model you're training and by that you're basically saying that you know model you've sort of learned your local um dependencies now i want you to go beyond that so you're you're basically really mean to the model you you forbid it from using everything it has learned so far uh 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 um this already exists kind of expanding the masks uh by assessing the model's own saliency all right 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 uh questioning datasets 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 um 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 uh this t5 so this t5 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 retriever's um 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 um if you only train the retriever but you reset the encoder uh before so that's the thing that actually answers the question if you reset that before fine tuning you drop a little bit uh 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 um but still it's fairly fairly competitive right here with the with uh sorry the previous state of the art oh yeah here here is the baseline it's uh 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 of masking that i discussed where are you drop by just word pieces or you know entire words or entire spans so you just uh you just take that idea further you say oh i'm asking an entire span but nothing with their saliency um so no no reg X's for dates no entity taggers and so on you you drop um quite a bit especially with the uniform masks you see here you drop quite a bit now with the random random span mask you also if 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 um so never forget when you see things like this that there are these engineering choices that can make uh as big a difference as the the actual idea in the paper itself okay so you can see this it's pretty the improvement is select three points from uniform masks to random span masks and then three points again from the random span masks to their round 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 um maybe i've seen it maybe it's somewhere else but i haven't seen it okay they also have an interesting uh thing right here oh they'll say for an interesting plot in the appendix where they show the num the performance um 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 in 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 um you know the in the knowledge is still baked into the language model they we were critical that this helps and so on then this would also always be zero now you can pretty easily or you can pretty easily see that this would be zero right there would be no improvement having the document versus not having the document having the null document um 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 it actually helps this is um just a concrete example so the question here is an equilateral triangle is easily constructed using a straight edge in 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 fermo is the correct answer is super duper low okay then if they give it the correct document they just search out the correct document which is here the conditional probability with this document 257 is a fermo prime that's 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 um 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 fermo 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 3 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 if this is marginal probability marginalizing over the top eight retrieve 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 um 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 fermo is only um 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 all right I hope you enjoyed this video I know it's been a bit of a long rant but um 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": 5.54, "text": " What's the angle of an equilateral triangle? So if your high school math isn't"}, {"start": 5.54, "end": 10.540000000000001, "text": " fresh in your head, you might be forgiven for not knowing this. But what do people"}, {"start": 10.540000000000001, "end": 15.040000000000001, "text": " do when they want to find out the answer to that question? Of course the"}, {"start": 15.040000000000001, "end": 20.84, "text": " standard way nowadays is to go to search engine like Google, type in the"}, {"start": 20.84, "end": 27.28, "text": " question, find some website that contains the answer, and then sort of read that"}, {"start": 27.28, "end": 33.64, "text": " website and answer the question from there. Now the goal of this paper here is to"}, {"start": 33.64, "end": 40.84, "text": " do the same thing but in a machine way. So the machine would see this question"}, {"start": 40.84, "end": 47.0, "text": " right here and it would be able, it will be able to get additional"}, {"start": 47.0, "end": 53.24, "text": " textual knowledge from a corpus and consult that and then at the end come up"}, {"start": 53.24, "end": 60.160000000000004, "text": " with the answer, which is 60 degrees right here. This type of this type of"}, {"start": 60.160000000000004, "end": 66.8, "text": " task is called open question answering. So like open QA or QA and the"}, {"start": 66.8, "end": 72.16, "text": " distinction here between this and the previous kind of tasks that were often"}, {"start": 72.16, "end": 76.6, "text": " called question answering is that usually in question answering you simply"}, {"start": 76.6, "end": 84.16, "text": " have a question and then you have either no help at all. So the model just has to"}, {"start": 84.16, "end": 89.6, "text": " answer the question and you know things like GPT three demonstrated that that"}, {"start": 89.6, "end": 94.8, "text": " is actually something that's possible if you have a large enough model or much"}, {"start": 94.8, "end": 100.03999999999999, "text": " more common you would provide the question and then one document and you would"}, {"start": 100.03999999999999, "end": 105.11999999999999, "text": " sort of guarantee that the answer is somewhere in this particular document. So"}, {"start": 105.12, "end": 109.84, "text": " even though the task was called question answering it was more like it was"}, {"start": 109.84, "end": 114.36, "text": " more a machine reading task because you knew okay all I have to do is I have to"}, {"start": 114.36, "end": 120.16000000000001, "text": " find the answer somewhere in the document to this particular question. So the"}, {"start": 120.16000000000001, "end": 127.2, "text": " task was more kind of a pattern matching sort of approach. Here the it's really"}, {"start": 127.2, "end": 132.12, "text": " the task really comes close to what humans understand as question answering"}, {"start": 132.12, "end": 136.64000000000001, "text": " namely you get a question you want an answer and it's open in the sense that"}, {"start": 136.64000000000001, "end": 142.64000000000001, "text": " you can the machine can go with the question to like a search engine I have no"}, {"start": 142.64000000000001, "end": 148.76, "text": " clue how to draw a globe to a search engine get multiple documents that would"}, {"start": 148.76, "end": 153.16, "text": " help it kind of rank them and so on. It's basically able to use a search"}, {"start": 153.16, "end": 156.88, "text": " engine and then answer the question from there. So that's what we're going to"}, {"start": 156.88, "end": 161.84, "text": " look at today there has been a lot of work I'm not not saying this task is new"}, {"start": 161.84, "end": 166.56, "text": " there has been a lot of work in open domain question answering and this is"}, {"start": 166.56, "end": 172.64000000000001, "text": " one of the latest incarnations of it. The paper is called Raum or Riyalm I'm"}, {"start": 172.64000000000001, "end": 177.64000000000001, "text": " really not sure how to pronounce this the word would be called Raum I guess. It's"}, {"start": 177.64000000000001, "end": 184.12, "text": " retrieval augmented language model pre-training by Kelvin Gu Kenton Lee Zora"}, {"start": 184.12, "end": 193.24, "text": " Tang Panopong Pazapat and Mingwa Chang. So the paper is first and foremost about"}, {"start": 193.24, "end": 199.4, "text": " a pre-training method as you can see right in the title. So the entire system"}, {"start": 199.4, "end": 204.08, "text": " that's presented here has sort of been explored in papers before like other"}, {"start": 204.08, "end": 208.72, "text": " papers have already done this or we retrieve other documents and in this"}, {"start": 208.72, "end": 214.2, "text": " particular case as you'll see the documents are retrieved using inner product"}, {"start": 214.2, "end": 220.76, "text": " search through a pre-embedded through Corpus which is usually Wikipedia. So you'll"}, {"start": 220.76, "end": 226.04, "text": " see all of this. The new thing about this paper just to make this clear is the"}, {"start": 226.04, "end": 232.96, "text": " way that the pre-training works for these systems. We're going to look at the"}, {"start": 232.96, "end": 236.76, "text": " entire architecture but just you know such that you're aware what's really"}, {"start": 236.76, "end": 241.67999999999998, "text": " coming from here and what's gathered from what's kind of conglomerated from"}, {"start": 241.67999999999998, "end": 246.48, "text": " what worked so far. So the improvements here are pretty stunning that they"}, {"start": 246.48, "end": 250.95999999999998, "text": " achieve with this new pre-training method which is pretty cool considering that"}, {"start": 250.95999999999998, "end": 254.32, "text": " it's you know the new thing is a pre-training method. So we'll look at this"}, {"start": 254.32, "end": 257.88, "text": " we'll look at the architecture pre-training method the kind of hacks that you"}, {"start": 257.88, "end": 263.92, "text": " need to get it to work and finally the results. As always if you'll enjoy"}, {"start": 263.92, "end": 268.64000000000004, "text": " content like this don't hesitate to share it out and subscribe if you are not"}, {"start": 268.64000000000004, "end": 275.72, "text": " already and with that let's jump in. So the abstract says that language model"}, {"start": 275.72, "end": 279.24, "text": " pre-training has been shown to capture a surprising amount of world knowledge"}, {"start": 279.24, "end": 285.16, "text": " crucial for an LP task such as question answering and here again we do we say"}, {"start": 285.16, "end": 289.44, "text": " question answering is kind of the broad category of anywhere where you have to"}, {"start": 289.44, "end": 295.2, "text": " answer a textual question. So what do they mean by world knowledge? What they"}, {"start": 295.2, "end": 300.08, "text": " mean by world knowledge they mean something like the question that we"}, {"start": 300.08, "end": 305.76, "text": " considered what's the angle of an equilateral triangle? You can't from the"}, {"start": 305.76, "end": 311.04, "text": " question itself you can't answer the you can't answer the the question. It's not"}, {"start": 311.04, "end": 315.32, "text": " like a little math question where you just have to do the correct calculations"}, {"start": 315.32, "end": 321.36, "text": " or so on or or or which one is the longest words of the following words it"}, {"start": 321.36, "end": 326.8, "text": " really is additional knowledge that you had to have learned somewhere. So that's"}, {"start": 326.8, "end": 332.15999999999997, "text": " what we call world knowledge and the fact that an equilateral triangle has 60"}, {"start": 332.15999999999997, "end": 337.28, "text": " degree angles you need to have picked that up from somewhere. Now if you are GPT"}, {"start": 337.28, "end": 345.0, "text": " three then what you have done is you've taken this giant corpus right and you"}, {"start": 345.0, "end": 352.16, "text": " just did language modeling on it and that gives you GPT three. Now that means"}, {"start": 352.16, "end": 356.92, "text": " since GPT three is so huge that means that all the world knowledge that is"}, {"start": 356.92, "end": 362.72, "text": " contained in this corpus is baked into the model and can be sort of parsed out"}, {"start": 362.72, "end": 367.28, "text": " with good querying. So if you provide a correct query you can sort of parse out"}, {"start": 367.28, "end": 371.6, "text": " what's in the weights of the model but it's very intranparently it's very"}, {"start": 371.6, "end": 376.44, "text": " intranparently in the weights of the models baked together with the language"}, {"start": 376.44, "end": 383.92, "text": " modeling. They are criticizing not criticizing but sort of arguing against this"}, {"start": 383.92, "end": 388.24, "text": " right here. They say however this knowledge is stored implicitly in the"}, {"start": 388.24, "end": 393.40000000000003, "text": " parameters of a neural network requiring ever larger networks to cover more"}, {"start": 393.40000000000003, "end": 400.04, "text": " facts. To capture knowledge in a more modular and interpretable way we augment"}, {"start": 400.04, "end": 404.84000000000003, "text": " language model pre-training with a latent knowledge retriever which allows"}, {"start": 404.84000000000003, "end": 409.28000000000003, "text": " the model to retrieve and attend over documents from a large corpus such as"}, {"start": 409.28000000000003, "end": 415.88, "text": " Wikipedia and sorry used during pre-training fine tuning and inference. For the"}, {"start": 415.88, "end": 420.08000000000004, "text": " first time we show how to pre-trains such a knowledge retriever in unsupervised"}, {"start": 420.08000000000004, "end": 424.76, "text": " manner using mask language modeling as a learning signal and backpropagating"}, {"start": 424.76, "end": 431.24, "text": " through a retrieval step that considers millions of documents. Okay so there's"}, {"start": 431.24, "end": 436.0, "text": " there's a lot of information here so first of all what they want to say is they"}, {"start": 436.0, "end": 441.28, "text": " want to say that in such a corpus there are two kinds of knowledge right there is"}, {"start": 441.28, "end": 450.12, "text": " there is language and there is this world knowledge. Okay and they want to make"}, {"start": 450.12, "end": 455.64, "text": " this sort of separate so they want to have a model that can go to the corpus"}, {"start": 455.64, "end": 461.52, "text": " retrieve documents and then use those documents so whereas previously the world"}, {"start": 461.52, "end": 465.04, "text": " knowledge has been joined with the language model they want to sever this"}, {"start": 465.04, "end": 470.64, "text": " connection say we want a model where we can simply teach it to go look for"}, {"start": 470.64, "end": 475.96, "text": " information. We can teach it to go search for things and then the searched things"}, {"start": 475.96, "end": 483.15999999999997, "text": " will inform its answering of the question. Okay so that's what that's what"}, {"start": 483.15999999999997, "end": 490.59999999999997, "text": " these systems are trying to achieve and we saw that before in the we saw that"}, {"start": 490.59999999999997, "end": 498.28, "text": " before in the diagram. So they say we augment language model pre-training with a"}, {"start": 498.28, "end": 502.76, "text": " latent knowledge retriever which allows the model to retrieve and attend over"}, {"start": 502.76, "end": 509.52, "text": " documents from a large corpus and also they use this mask language modeling as"}, {"start": 509.52, "end": 514.76, "text": " a pre-training as a learning signal and back propagating through the retrieval"}, {"start": 514.76, "end": 520.24, "text": " step. Now this is the interesting part right here so what you'll have is you'll"}, {"start": 520.24, "end": 525.96, "text": " have a question and we can actually look at this diagram right here. So the"}, {"start": 525.96, "end": 532.12, "text": " pre-training is going to be masked language modeling okay. Ultimately what you"}, {"start": 532.12, "end": 536.36, "text": " want to do is what we looked at before. Ultimately what you want to do is question"}, {"start": 536.36, "end": 542.36, "text": " answering. So this thing right here where the input is a query and then you want"}, {"start": 542.36, "end": 548.4, "text": " to retrieve documents and then you want to join them and let's actually draw this"}, {"start": 548.4, "end": 554.2, "text": " up. So you have a query and you want to retrieve documents. How do you do that?"}, {"start": 554.2, "end": 561.04, "text": " You train an embedding for the query which is usually a you know a bird model"}, {"start": 561.04, "end": 565.0, "text": " like that's the fashionable thing to do. If you don't know what bird is I've"}, {"start": 565.0, "end": 569.68, "text": " made a video about bird but basically bird can take a piece of text and then it"}, {"start": 569.68, "end": 575.0, "text": " will output a vector or multiple vectors for it. In this case we just need one"}, {"start": 575.0, "end": 580.0799999999999, "text": " single vector for the entire query okay and then you have a bunch of"}, {"start": 580.0799999999999, "end": 586.1999999999999, "text": " documents in your corpus. So in your corpus right here you have z1, z2 and so on."}, {"start": 586.2, "end": 593.6800000000001, "text": " What you want to do is you want to embed all of those. So you want to have b of z1"}, {"start": 593.6800000000001, "end": 602.6, "text": " and b of z2. Okay you want to embed all of those documents and then you want to"}, {"start": 602.6, "end": 609.48, "text": " compare these embeddings and the you want to retrieve the document that's most"}, {"start": 609.48, "end": 613.84, "text": " relevant for your question right. If your question is about equilateral triangles"}, {"start": 613.84, "end": 618.52, "text": " the angle in them then there's probably going to be like a Wikipedia article of"}, {"start": 618.52, "end": 623.0400000000001, "text": " triangles or equilateral triangles specifically. So this corpus right here we're"}, {"start": 623.0400000000001, "end": 629.8000000000001, "text": " going to consider this to be Wikipedia. Now ultimately especially like a"}, {"start": 629.8000000000001, "end": 634.72, "text": " company like Google would like this to be the entire internet but for the"}, {"start": 634.72, "end": 639.2, "text": " these tasks for the academic tasks this is often a limited corpus and then the"}, {"start": 639.2, "end": 644.1600000000001, "text": " datasets are also made such that they can often be answered with that limited"}, {"start": 644.1600000000001, "end": 649.84, "text": " corpus but in essence this could be the entire internet but for now it's"}, {"start": 649.84, "end": 653.32, "text": " Wikipedia. So I want to embed every single document in Wikipedia and then"}, {"start": 653.32, "end": 659.72, "text": " compare them using the inner product. So you train your model to first of all"}, {"start": 659.72, "end": 666.0400000000001, "text": " take this corpus and then assign each member of the corpus a vector. So this could"}, {"start": 666.04, "end": 672.8399999999999, "text": " be z1, this could be z2, this could be z3 and so on and you want to train it in"}, {"start": 672.8399999999999, "end": 681.04, "text": " such a way that if you have a query then a query will be very close in inner"}, {"start": 681.04, "end": 686.0, "text": " product space to the document that's relevant. So the query might be your"}, {"start": 686.0, "end": 690.52, "text": " question about the angles and the document right here might be the document"}, {"start": 690.52, "end": 696.4399999999999, "text": " about triangles. Okay and this document might be the document about I don't know"}, {"start": 696.4399999999999, "end": 705.64, "text": " England and this one right here might be the document about I don't know weight"}, {"start": 705.64, "end": 710.64, "text": " lifting I've no idea. Like just random Wikipedia documents okay so you want"}, {"start": 710.64, "end": 714.84, "text": " them you want them to be let's let's you know let's draw a little dome"}, {"start": 714.84, "end": 721.88, "text": " bell right here. So you want you want the other documents to be far apart from"}, {"start": 721.88, "end": 729.52, "text": " the query. So you train two things you train this model right here which is the"}, {"start": 729.52, "end": 735.88, "text": " embedding of the corpus. Okay and you train this model right here which is the"}, {"start": 735.88, "end": 739.8000000000001, "text": " embedding of the query. These are two separate models and then you want the"}, {"start": 739.8, "end": 745.8399999999999, "text": " inner product between the two to be small to be large whenever the document is"}, {"start": 745.8399999999999, "end": 750.56, "text": " relevant for answering the query and you want them to be far apart whenever it"}, {"start": 750.56, "end": 758.9599999999999, "text": " is not. Now the question is of course how do you know how do you know when it is"}, {"start": 758.9599999999999, "end": 762.3599999999999, "text": " relevant when it is not because you have to have some training signal right here"}, {"start": 762.36, "end": 769.92, "text": " right you you have to basically know in advance which documents are relevant"}, {"start": 769.92, "end": 774.92, "text": " and you don't. So they start out with this masked language model pre-training"}, {"start": 774.92, "end": 781.5600000000001, "text": " which we see up here. The masked language model pre-training does the following."}, {"start": 781.5600000000001, "end": 791.0, "text": " So this is unsupervised you take some string right like this one the and then"}, {"start": 791.0, "end": 796.56, "text": " you mask out a token. This comes straight from birth. You mask out a token and then"}, {"start": 796.56, "end": 804.24, "text": " your goal is simply to reproduce that token. Okay so if we were in birth you would"}, {"start": 804.24, "end": 810.32, "text": " forget about all of this. You would simply try to predict what the mask token is"}, {"start": 810.32, "end": 816.68, "text": " but here we say well we allow the model to use additional context in order to"}, {"start": 816.68, "end": 823.3599999999999, "text": " to fill in the blank and you can see already how this is going to help later"}, {"start": 823.3599999999999, "end": 829.52, "text": " but okay so we take this sentence and we allow it to retrieve documents and"}, {"start": 829.52, "end": 835.64, "text": " maybe the document retrieved is this one right here the pyramidion on top"}, {"start": 835.64, "end": 841.12, "text": " allows for less material higher up the pyramid and then you concatenate the"}, {"start": 841.12, "end": 846.88, "text": " input sorry the input is this right here with the mask token as you can see here"}, {"start": 846.88, "end": 853.04, "text": " you can concatenate that with together with this thing which is this thing"}, {"start": 853.04, "end": 860.6, "text": " right here and then you train a different model to take this as an input and"}, {"start": 860.6, "end": 865.04, "text": " tell you what the mask token is now if the retriever is good then this model has"}, {"start": 865.04, "end": 870.24, "text": " a pretty easy job because here you see at the top something is at the top and"}, {"start": 870.24, "end": 878.16, "text": " here you see the pyramidion is on top then it becomes fairly fairly easy. Okay the"}, {"start": 878.16, "end": 885.96, "text": " question again of course is how do you teach the retriever to do well and this"}, {"start": 885.96, "end": 895.32, "text": " is somewhat of a of a loop so informally the knowledge retriever right here is"}, {"start": 895.32, "end": 900.44, "text": " going to we're going to model this distribution as a joint distribution sorry this"}, {"start": 900.44, "end": 909.6, "text": " is oh yeah this is down here all right so here the central formula is this what"}, {"start": 909.6, "end": 915.72, "text": " you want is a model that takes in a question or in pre-training a masked"}, {"start": 915.72, "end": 921.72, "text": " string and it produces the answer or in pre-training this is going to be the"}, {"start": 921.72, "end": 927.72, "text": " masked token so this is going to be the question and this is the answer or this"}, {"start": 927.72, "end": 933.8000000000001, "text": " is going to be the masked string and this is going to be the token that has"}, {"start": 933.8000000000001, "end": 940.8000000000001, "text": " been masked from the string. Okay now you're saying I can decompose this"}, {"start": 940.8000000000001, "end": 946.6800000000001, "text": " probability distribution into the following probability distribution and here"}, {"start": 946.68, "end": 956.0799999999999, "text": " we take Z as a latent variable usually but here Z is the document okay so what"}, {"start": 956.0799999999999, "end": 964.92, "text": " we want is a model that takes in your question and a document that is"}, {"start": 964.92, "end": 971.76, "text": " relevant for answering the question and from that it produces the answer and in"}, {"start": 971.76, "end": 975.9599999999999, "text": " order to fill our probability distribution we have to have this other model"}, {"start": 975.96, "end": 982.84, "text": " that takes in the question and outputs a document okay so this here is the"}, {"start": 982.84, "end": 995.2, "text": " retriever and this here is going to be the answer and in order to make this"}, {"start": 995.2, "end": 999.32, "text": " the valid probability distribution you need to marginalize over all of the"}, {"start": 999.32, "end": 1005.24, "text": " documents in your corpus so now you can see how you train this you simply"}, {"start": 1005.24, "end": 1011.5600000000001, "text": " retrieve all of you train this model here to predict which documents are"}, {"start": 1011.5600000000001, "end": 1015.5600000000001, "text": " relevant to a certain degree in a back-propergatable way so in a continuous"}, {"start": 1015.5600000000001, "end": 1020.6, "text": " fashion assign each document a probability to be relevant for answering this"}, {"start": 1020.6, "end": 1026.36, "text": " particular question and then you take each of the documents and answer the"}, {"start": 1026.36, "end": 1031.84, "text": " question why from it and you marginalize over all the documents in your"}, {"start": 1031.84, "end": 1037.28, "text": " near-date to set and then you get a profiling of probability and all of this is"}, {"start": 1037.28, "end": 1042.6399999999999, "text": " completely differentiable the problem of course is that especially in this"}, {"start": 1042.6399999999999, "end": 1048.6799999999998, "text": " paper here there are like 13 million documents so you won't be able to train"}, {"start": 1048.6799999999998, "end": 1055.1999999999998, "text": " very far according to that so let's look at the individual parts first of all"}, {"start": 1055.1999999999998, "end": 1060.48, "text": " this knowledge retriever the knowledge retriever model is a model that will"}, {"start": 1060.48, "end": 1070.08, "text": " take in a question and a document and tell you how likely that how relevant that"}, {"start": 1070.08, "end": 1075.92, "text": " document is for this particular question and this as you can see is defined as a"}, {"start": 1075.92, "end": 1083.32, "text": " probability distribution specifically here this exponential distribution of f and"}, {"start": 1083.32, "end": 1087.04, "text": " what is f we've already seen f is simply the inner product between the"}, {"start": 1087.04, "end": 1092.3999999999999, "text": " embedding and of the question and the document so that's the kind of thing we"}, {"start": 1092.3999999999999, "end": 1098.92, "text": " drew before where the document is supposed to be have a high inner product with"}, {"start": 1098.92, "end": 1107.84, "text": " the query that it is relevant to and allow it with all the other queries now"}, {"start": 1107.84, "end": 1115.96, "text": " since they cannot take all of the documents what they do is simply they go in"}, {"start": 1115.96, "end": 1122.8, "text": " so at the beginning you know if let's say you're somewhere during training"}, {"start": 1122.8, "end": 1130.3600000000001, "text": " right and you have this index built up of all of the documents what you'll do is"}, {"start": 1130.3600000000001, "end": 1136.44, "text": " you'll go you'll project your query into this space and you retrieve the couple of"}, {"start": 1136.44, "end": 1142.4, "text": " documents that are closest to the query okay and you only use those so you"}, {"start": 1142.4, "end": 1147.68, "text": " sample a few documents this is the same thing that we do in you know contrastive"}, {"start": 1147.68, "end": 1158.64, "text": " pre-training and so on it's just taken here to the the retrieval mode so you"}, {"start": 1158.64, "end": 1162.2, "text": " don't marginalize over all documents because that would be computationally too"}, {"start": 1162.2, "end": 1167.64, "text": " hard you simply marginalize over all the documents that have a reasonably high"}, {"start": 1167.64, "end": 1172.2800000000002, "text": " inner product with the query that you're considering what does that make sense"}, {"start": 1172.2800000000002, "end": 1178.2800000000002, "text": " because if you look at any other like this one here the inner product is going"}, {"start": 1178.2800000000002, "end": 1183.48, "text": " to be almost zero so the inner product with the query is going to be almost zero"}, {"start": 1183.48, "end": 1190.2, "text": " so it does not contribute at all to this probability right here which also"}, {"start": 1190.2, "end": 1194.88, "text": " means that the gradient is going to be fairly small now even though the"}, {"start": 1194.88, "end": 1200.72, "text": " gradient is fairly small it can still be that you haven't learned something"}, {"start": 1200.72, "end": 1205.4, "text": " good yet and actually the document would be pretty relevant for that query and"}, {"start": 1205.4, "end": 1213.5600000000002, "text": " because you never use it to train you will you know you will never ever recover"}, {"start": 1213.5600000000002, "end": 1217.0400000000002, "text": " it because you don't ever use it to train there's no gradient flowing to it"}, {"start": 1217.0400000000002, "end": 1222.68, "text": " and so on so you're sort of relying on this being sort of self-organizing like"}, {"start": 1222.68, "end": 1227.48, "text": " over time you know these these turn out to not really be relevant because you've"}, {"start": 1227.48, "end": 1231.64, "text": " learned something stupid and then your query embedding either would change and"}, {"start": 1231.64, "end": 1236.2, "text": " change the query maybe during training change the query more towards the"}, {"start": 1236.2, "end": 1240.44, "text": " direction of the relevant documents or the relevant documents themselves would"}, {"start": 1240.44, "end": 1245.68, "text": " sort of shift and push each other around and so on so kind of relying on effects"}, {"start": 1245.68, "end": 1252.16, "text": " like this but there's definitely a death spiral that can go on so they make a"}, {"start": 1252.16, "end": 1263.68, "text": " they make a they address this right here and yeah they address this right here"}, {"start": 1269.4, "end": 1275.3600000000001, "text": " here the key computational challenge is that marginal probability P y of x which"}, {"start": 1275.3600000000001, "end": 1278.64, "text": " is this one involves the summation over all documents in the knowledge corp"}, {"start": 1278.64, "end": 1282.72, "text": " z we approximate this instead by summing over the top-cade documents with the"}, {"start": 1282.72, "end": 1286.5200000000002, "text": " highest probability under this retrieval step this is reasonable if most"}, {"start": 1286.5200000000002, "end": 1290.92, "text": " documents have near zero probability even with this approximation we still"}, {"start": 1290.92, "end": 1294.6000000000001, "text": " need an efficient way to find the top-cade documents note that the ordering of"}, {"start": 1294.6000000000001, "end": 1300.76, "text": " documents is the same as under the relevant score okay which is an inner product"}, {"start": 1300.76, "end": 1304.48, "text": " thus we can employ maximum inner product search algorithms to find the"}, {"start": 1304.48, "end": 1308.0, "text": " approximate top-cade documents using a running time storage space that"}, {"start": 1308.0, "end": 1311.8, "text": " scales sub linearly with the number of documents so there are these algorithms to"}, {"start": 1311.8, "end": 1316.88, "text": " do maximum inner product search which you can use to find the top-cade documents"}, {"start": 1316.88, "end": 1322.6, "text": " to employ these algorithms we must pre-compute the embedding so all the"}, {"start": 1322.6, "end": 1328.36, "text": " embedding of the documents in the corpus must pre-compute them for every z and"}, {"start": 1328.36, "end": 1332.36, "text": " construct an efficient search index over these embedding so this now becomes"}, {"start": 1332.36, "end": 1337.08, "text": " very much like a search engine where you have to have your corpus and you have to"}, {"start": 1337.08, "end": 1342.4399999999998, "text": " build an index in order to find things fast in there like it looks easy in our"}, {"start": 1342.4399999999998, "end": 1346.8799999999999, "text": " 2d examples but to find maximum inner products in high-dimensional spaces"}, {"start": 1346.8799999999999, "end": 1352.28, "text": " actually very challenging task however this data structure will no longer be"}, {"start": 1352.28, "end": 1358.9199999999998, "text": " consistent with P with this retrieval thing right because as we train it our"}, {"start": 1358.9199999999998, "end": 1365.6, "text": " index is going to be old so as we train it our index might change but if we"}, {"start": 1365.6, "end": 1371.04, "text": " only build it once then that's of no use if the parameters of the embedding are"}, {"start": 1371.04, "end": 1375.8799999999999, "text": " later updated hence the search index goes stale after every gradient update on"}, {"start": 1375.8799999999999, "end": 1381.1999999999998, "text": " theta our solution is to refresh the index by asynchronously re-embedding and"}, {"start": 1381.1999999999998, "end": 1385.48, "text": " re-indexing all the documents every several hundred training steps and they"}, {"start": 1385.48, "end": 1391.7199999999998, "text": " have a drawing of this right here so they have two different jobs the trainer"}, {"start": 1391.72, "end": 1399.44, "text": " here trains updates itself using the old index so an index for a couple of"}, {"start": 1399.44, "end": 1402.68, "text": " hundred steps then every couple of hundred steps it sends over its new"}, {"start": 1402.68, "end": 1409.96, "text": " weights and the index builder builds a new index using these new weights right and"}, {"start": 1409.96, "end": 1415.0, "text": " then the process starts again this can run in parallel as you can imagine so as"}, {"start": 1415.0, "end": 1420.04, "text": " soon as the index builder is done it sends over the new index retrieves the new"}, {"start": 1420.04, "end": 1424.6399999999999, "text": " parameters and starts again building an index because ideally you want to"}, {"start": 1424.6399999999999, "end": 1429.1599999999999, "text": " rebuild the index after every single step but of course that's going to waste"}, {"start": 1429.1599999999999, "end": 1436.72, "text": " too much time as well so that was the retriever step the actual answer step is"}, {"start": 1436.72, "end": 1443.96, "text": " fairly fairly easy so once you've retrieved good documents right now you don't"}, {"start": 1443.96, "end": 1448.72, "text": " need as we said you don't need all the documents where we are right here you"}, {"start": 1448.72, "end": 1452.16, "text": " don't need we're not going to do this with all the documents anymore we'll"}, {"start": 1452.16, "end": 1458.92, "text": " simply retrieve the most relevant documents because that's going to approximate"}, {"start": 1458.92, "end": 1464.72, "text": " this some fairly well the answer here that's pretty simple that's going to be"}, {"start": 1464.72, "end": 1470.8, "text": " just a birth model that takes in Z and X okay so this is going to be another"}, {"start": 1470.8, "end": 1479.24, "text": " birth model that's going to take in the retrieve document and the question and"}, {"start": 1479.24, "end": 1485.32, "text": " it's going to output Y how does that look in case of the mask language model we've"}, {"start": 1485.32, "end": 1491.56, "text": " already seen it you simply would input where is it you simply would input the"}, {"start": 1491.56, "end": 1497.44, "text": " concatenation of the two with the mask as you can see right here and then the"}, {"start": 1497.44, "end": 1503.04, "text": " output is going to classify at the classification task so in the case of"}, {"start": 1503.04, "end": 1509.44, "text": " birth you have your query right here as text and then you have your documents"}, {"start": 1509.44, "end": 1515.28, "text": " Z right here and there somewhere would be a mask token you would put birth on"}, {"start": 1515.28, "end": 1523.2, "text": " top of that everything together and then at the position of the mask token you"}, {"start": 1523.2, "end": 1528.64, "text": " would do a classification across all of your vocabulary right and see which"}, {"start": 1528.64, "end": 1534.76, "text": " word is most likely and that's how you train that and evaluate that if you are"}, {"start": 1534.76, "end": 1541.6000000000001, "text": " in the fine tuning mode then you don't have masks anymore so what you would put"}, {"start": 1541.6000000000001, "end": 1547.8400000000001, "text": " is your query right here and your documents that you retrieved and then you"}, {"start": 1547.84, "end": 1554.8799999999999, "text": " would you would simply output now here is an assumption and the assumption is"}, {"start": 1554.8799999999999, "end": 1561.28, "text": " often baked into these data sets you assume that if you have the correct"}, {"start": 1561.28, "end": 1568.24, "text": " document the span the answer is somewhere in in the Z document right here so Y"}, {"start": 1568.24, "end": 1572.0, "text": " is somewhere in here and what you would do is you would classify the start and"}, {"start": 1572.0, "end": 1578.88, "text": " the end of the span of Y right this correspond to these so that's your"}, {"start": 1578.88, "end": 1583.44, "text": " training signal right there as I said this is not always the case but very often"}, {"start": 1583.44, "end": 1588.4, "text": " especially in these data sets it's the case that it is a single continuous span"}, {"start": 1588.4, "end": 1596.72, "text": " as the answer okay so that's basically the architecture as I said the"}, {"start": 1596.72, "end": 1603.68, "text": " architecture is using inner product to retrieve retrieving top whatever K"}, {"start": 1603.68, "end": 1608.16, "text": " documents in this case I think it's about five they retrieve five documents"}, {"start": 1608.16, "end": 1615.68, "text": " for each document they run it through this bird in this joint way"}, {"start": 1615.68, "end": 1620.32, "text": " like on the bottom and then they classify the output and you can you can do it"}, {"start": 1620.32, "end": 1624.64, "text": " with a top one document but you can marginalize over the top documents for"}, {"start": 1624.64, "end": 1631.68, "text": " both pre-training and for actually answering a question there's lots of"}, {"start": 1631.68, "end": 1637.92, "text": " stuff you can do the important thing right here is that this thing is what the"}, {"start": 1637.92, "end": 1643.44, "text": " paper proposes and it's basically saying how do we do masked language modeling"}, {"start": 1643.44, "end": 1650.5600000000002, "text": " pre-training with a system like this all right"}, {"start": 1650.56, "end": 1657.28, "text": " okay and the rest of the paper basically goes into more detail like how do you"}, {"start": 1657.28, "end": 1662.56, "text": " how do you join how do you exactly what's the input right here and we've"}, {"start": 1662.56, "end": 1667.36, "text": " already seen you just concatenate whatever you have you concatenate your"}, {"start": 1667.36, "end": 1674.72, "text": " um query and your documents and so on so the important thing is"}, {"start": 1674.72, "end": 1680.48, "text": " it's two distinct like there are three models right here right model one"}, {"start": 1680.48, "end": 1691.76, "text": " model one is used to take a document from the corpus and map it into a"}, {"start": 1691.76, "end": 1697.28, "text": " vector in this in this vector space right here okay that's model one"}, {"start": 1697.28, "end": 1701.68, "text": " that is the model that you want to build this index for right every now and"}, {"start": 1701.68, "end": 1708.32, "text": " then you take that model and build an index for your whole corpus"}, {"start": 1708.32, "end": 1715.52, "text": " then model two is the model that takes a query okay a question to answer or a"}, {"start": 1715.52, "end": 1722.08, "text": " masked string and also generates a vector in this vector space right here"}, {"start": 1722.08, "end": 1727.28, "text": " okay that is a different model than the model that embeds the document and"}, {"start": 1727.28, "end": 1733.36, "text": " you don't build indices for that you continuously train it um and you"}, {"start": 1733.36, "end": 1740.08, "text": " you just because you only need to embed every query once and um if you were to"}, {"start": 1740.08, "end": 1743.52, "text": " not build an index for model one then you would need to re embed the whole"}, {"start": 1743.52, "end": 1748.3999999999999, "text": " corpus for every training step and then model three is something yet"}, {"start": 1748.3999999999999, "end": 1753.9199999999998, "text": " completely different model three takes whatever documents you"}, {"start": 1753.9199999999998, "end": 1763.28, "text": " retrieved right here as z along with the query as text so not the vectors"}, {"start": 1763.28, "end": 1769.44, "text": " but it takes the text of these documents it it takes the text of the query"}, {"start": 1769.44, "end": 1775.2, "text": " and it produces an answer why which is either the mask token or the answer"}, {"start": 1775.2, "end": 1781.68, "text": " span in the document okay but this is again this is a text model this is nothing"}, {"start": 1781.68, "end": 1786.16, "text": " to do with the vectors from before"}, {"start": 1786.16, "end": 1794.0800000000002, "text": " all right so that was the architecture and the pre-training now they go into a"}, {"start": 1794.0800000000002, "end": 1800.48, "text": " few details namely first detail is how do you actually how do you even see"}, {"start": 1800.48, "end": 1806.24, "text": " that this does something sensible okay um and thereby they analyze the"}, {"start": 1806.24, "end": 1811.1200000000001, "text": " gradient of this thing so if you look at the gradient here's the gradient of"}, {"start": 1811.12, "end": 1816.8, "text": " the um of py of x py is this is as we said the answer"}, {"start": 1816.8, "end": 1821.36, "text": " and this is the question and this probability distribution has everything in"}, {"start": 1821.36, "end": 1825.9199999999998, "text": " and we've discussed before like retrieving the documents and then marginalizing"}, {"start": 1825.9199999999998, "end": 1831.9199999999998, "text": " over the retrieved documents and so on okay so here you can see that the"}, {"start": 1831.9199999999998, "end": 1838.6399999999999, "text": " gradient um is first of all it goes into the direction of this inner product"}, {"start": 1838.64, "end": 1844.88, "text": " okay this f here that's that's the inner product between the embeddings of"}, {"start": 1844.88, "end": 1850.4, "text": " x and the relevant documents z or relevant according to"}, {"start": 1850.4, "end": 1855.5200000000002, "text": " their relevance okay so the gradient of the entire model"}, {"start": 1855.5200000000002, "end": 1860.16, "text": " is goes into the direction of the gradient of the inner product so that's"}, {"start": 1860.16, "end": 1866.4, "text": " already a good thing right now we can mask ourselves we can ask ourselves"}, {"start": 1866.4, "end": 1870.96, "text": " when do we want the gradient of the entire model to be"}, {"start": 1870.96, "end": 1875.6000000000001, "text": " strongly correlated with the gradient of this inner product when not that of"}, {"start": 1875.6000000000001, "end": 1878.48, "text": " course depends on the document itself and this"}, {"start": 1878.48, "end": 1884.0, "text": " quantity is quantity r specifies how much that is so if this turns out like we"}, {"start": 1884.0, "end": 1887.6000000000001, "text": " want it then we can say okay the training of this model does"}, {"start": 1887.6000000000001, "end": 1893.68, "text": " something sensible so what's this quantity r the quantity r notably has this"}, {"start": 1893.68, "end": 1900.5600000000002, "text": " ratio right here this ratio minus one now what does it say if"}, {"start": 1900.5600000000002, "end": 1906.3200000000002, "text": " if the top of the fraction is larger than the bottom of the fraction then this"}, {"start": 1906.3200000000002, "end": 1912.3200000000002, "text": " is a positive number right and if the bottom is larger"}, {"start": 1912.3200000000002, "end": 1920.0800000000002, "text": " then this is a negative number okay so let's look at the the two elements the"}, {"start": 1920.08, "end": 1925.6799999999998, "text": " top mean the top the ratio basically means that"}, {"start": 1925.6799999999998, "end": 1932.48, "text": " the difference here is this z so the ratio is larger than one if the"}, {"start": 1932.48, "end": 1939.36, "text": " probability of the answer rises when you have z in there versus when you do not"}, {"start": 1939.36, "end": 1943.36, "text": " have z right here there is no z so what it basically means is that the"}, {"start": 1943.36, "end": 1948.32, "text": " document helps if the document helps for for answering the"}, {"start": 1948.32, "end": 1952.72, "text": " question x then that probability is larger than the bottom"}, {"start": 1952.72, "end": 1957.28, "text": " probability if the document is irrelevant then that's one right and the"}, {"start": 1957.28, "end": 1961.6799999999998, "text": " entire thing becomes zero and therefore no gradient and if the document is"}, {"start": 1961.6799999999998, "end": 1965.12, "text": " counterproductive and that's often the case actually because this document"}, {"start": 1965.12, "end": 1969.04, "text": " they can introduce noise like noise is often counterproductive for the"}, {"start": 1969.04, "end": 1973.6, "text": " systems because you have more input and then the"}, {"start": 1973.6, "end": 1977.76, "text": " distribution of y will become more noisy and therefore"}, {"start": 1977.76, "end": 1983.04, "text": " flatter and this fraction would be lower than one so this is going to be"}, {"start": 1983.04, "end": 1988.56, "text": " negative so this quantity is positive the more"}, {"start": 1988.56, "end": 1993.36, "text": " relevant the easier it is to answer the question"}, {"start": 1993.36, "end": 1999.44, "text": " with y given the document and that's exactly what we want out of a system"}, {"start": 1999.44, "end": 2002.96, "text": " like this so if you look at the gradient of the system"}, {"start": 2002.96, "end": 2009.52, "text": " it shows you that what we want to happen namely"}, {"start": 2009.52, "end": 2014.0, "text": " that the system is trained in such a way that the relevant documents will"}, {"start": 2014.0, "end": 2021.68, "text": " help it is actually happening okay so that's the left hand side and"}, {"start": 2021.68, "end": 2027.04, "text": " there's a little bit to be said about this thing right here the probability"}, {"start": 2027.04, "end": 2032.16, "text": " this is proportional always to the probability that you retriever outputs this"}, {"start": 2032.16, "end": 2038.0800000000002, "text": " document okay so the this quantity r is going to be even larger"}, {"start": 2038.0800000000002, "end": 2043.28, "text": " if your retriever outputs that document frequently so if it is a helpful"}, {"start": 2043.28, "end": 2047.0400000000002, "text": " document and the retriever outputs it very frequently"}, {"start": 2047.0400000000002, "end": 2051.52, "text": " for the given question then this quantity r is super large"}, {"start": 2051.52, "end": 2058.88, "text": " and that's exactly what we want right okay so the next thing they do"}, {"start": 2058.88, "end": 2066.0, "text": " is they they have to they have to sort of"}, {"start": 2066.0, "end": 2069.92, "text": " take care of the initialization here because the problem we've spoken of before"}, {"start": 2069.92, "end": 2075.52, "text": " is that if your retriever is bad right it will not retrieve the good documents"}, {"start": 2075.52, "end": 2080.1600000000003, "text": " and so it won't retrieve this z here very often"}, {"start": 2080.1600000000003, "end": 2085.52, "text": " and then it really doesn't matter what this quantity is right here"}, {"start": 2085.52, "end": 2089.28, "text": " because this is going to be very low like even if it hits upon a correct"}, {"start": 2089.28, "end": 2093.2, "text": " document and probably it doesn't because there's like 13 million documents"}, {"start": 2093.2, "end": 2100.24, "text": " and you retrieve five or so so very probably you're not by chance going to"}, {"start": 2100.24, "end": 2104.88, "text": " hit the correct document so you never have a chance to get the"}, {"start": 2104.88, "end": 2108.08, "text": " document that would actually help you answering the question then you get"}, {"start": 2108.08, "end": 2113.52, "text": " a bad gradient and then you screw everything up even more and so on so"}, {"start": 2113.52, "end": 2117.36, "text": " the problem is that if you just train this from scratch you have a pretty bad"}, {"start": 2117.36, "end": 2122.48, "text": " learning signal so what they do is they have to take care of"}, {"start": 2122.48, "end": 2129.2, "text": " initialization so they have to initialize things such that they are already"}, {"start": 2129.2, "end": 2135.6, "text": " working fairly well before anything else happens"}, {"start": 2135.6, "end": 2142.32, "text": " and this is sort of if I had to you know criticize these systems a bit"}, {"start": 2142.32, "end": 2148.88, "text": " it's that there are many hacks to to getting them to work right you have to"}, {"start": 2148.88, "end": 2152.96, "text": " really take care of initialization and so on because they sort of build in a loop"}, {"start": 2152.96, "end": 2156.0, "text": " right the better the retriever the better the model that can answer the"}, {"start": 2156.0, "end": 2159.04, "text": " question and the better the model that can answer the question the better"}, {"start": 2159.04, "end": 2163.6800000000003, "text": " gradient you get for the retriever but the retriever only samples"}, {"start": 2163.6800000000003, "end": 2167.28, "text": " so it doesn't even see all the documents so how can it ever learn that a given"}, {"start": 2167.28, "end": 2172.1600000000003, "text": " document is going to be relevant if you never sees it and so on so"}, {"start": 2172.16, "end": 2177.7599999999998, "text": " there's quite an interdependence and you you only can do that with good"}, {"start": 2177.7599999999998, "end": 2183.2799999999997, "text": " initialization as you know is the case for a lot of these language tasks"}, {"start": 2183.2799999999997, "end": 2187.2799999999997, "text": " but here even the pre-training so that's the point even the mask language"}, {"start": 2187.2799999999997, "end": 2191.7599999999998, "text": " model pre-training where they already have this you know retrieval step in"}, {"start": 2191.7599999999998, "end": 2197.3599999999997, "text": " there even that needs to be itself initialize that a good point otherwise"}, {"start": 2197.36, "end": 2202.48, "text": " it doesn't help otherwise because you want to train the retriever such that"}, {"start": 2202.48, "end": 2207.52, "text": " the mask language model becomes easier and you have to take care of a bunch of"}, {"start": 2207.52, "end": 2211.1200000000003, "text": " stuff so here they say at the beginning of training if the retriever does not"}, {"start": 2211.1200000000003, "end": 2216.32, "text": " have good embeddings the retrieved documents will likely be unrelated to x"}, {"start": 2216.32, "end": 2220.6400000000003, "text": " this causes the knowledge augmented encoder to learn to ignore the retrieved"}, {"start": 2220.6400000000003, "end": 2225.28, "text": " documents okay so it basically just falls back to a model that does not have"}, {"start": 2225.28, "end": 2228.1600000000003, "text": " these other documents because none of the retrieved documents are"}, {"start": 2228.1600000000003, "end": 2232.5600000000004, "text": " relevant once this occurs the knowledge retriever does not receive a meaningful"}, {"start": 2232.5600000000004, "end": 2236.0800000000004, "text": " gradient and cannot improve creating a vicious cycle to avoid this"}, {"start": 2236.0800000000004, "end": 2241.0400000000004, "text": " cold star problem we warm start the embedding of the input and the"}, {"start": 2241.0400000000004, "end": 2244.88, "text": " docs so these are these are models 1 and 2 right I think this is what I"}, {"start": 2244.88, "end": 2249.76, "text": " called model 1 this is what I called model 2 using a simple training"}, {"start": 2249.76, "end": 2254.32, "text": " objective known as the inverse closed task where given a sentence the model is"}, {"start": 2254.32, "end": 2258.7200000000003, "text": " trained to retrieve the document where that sentence came from refer to this"}, {"start": 2258.7200000000003, "end": 2261.76, "text": " paper so this paper I believe is the the orca"}, {"start": 2261.76, "end": 2267.04, "text": " paper and just quickly for the knowledge augmented encoder we warm started with"}, {"start": 2267.04, "end": 2272.32, "text": " bird tree training so this here I think this is this is model 3"}, {"start": 2272.32, "end": 2278.48, "text": " so this is model 1 this here is model 2 that's model 3"}, {"start": 2278.48, "end": 2283.2000000000003, "text": " so this paper here I believe that's the orca paper"}, {"start": 2283.2, "end": 2287.68, "text": " the orca paper is very very close to this paper it also has this retrieval"}, {"start": 2287.68, "end": 2295.04, "text": " step and so on but it it took it said that it introduced this inverse closed"}, {"start": 2295.04, "end": 2299.7599999999998, "text": " task as pre-training for its own model so you can see this paper right here as"}, {"start": 2299.7599999999998, "end": 2306.0, "text": " sort of an evolution where they go from from orca and basically use that as an"}, {"start": 2306.0, "end": 2312.8799999999997, "text": " initialization for their own model now it's not exactly the same and so on but"}, {"start": 2312.88, "end": 2317.28, "text": " this inverse closed task in that orca paper was"}, {"start": 2317.28, "end": 2323.6800000000003, "text": " quite a central point so what you want to do is you simply take a document from"}, {"start": 2323.6800000000003, "end": 2330.1600000000003, "text": " your corpus any document and then you select a span like this span right here"}, {"start": 2330.1600000000003, "end": 2335.6800000000003, "text": " and then you make two things out of that first of all the span is going to"}, {"start": 2335.6800000000003, "end": 2341.28, "text": " become your x okay and then the document right here"}, {"start": 2341.28, "end": 2346.48, "text": " the document but without the span obviously so the span you just leave empty"}, {"start": 2346.48, "end": 2352.48, "text": " that's going to become the thing to retrieve and you simply now train a model"}, {"start": 2352.48, "end": 2358.48, "text": " your models so in this case this is model 1 and this is model 2"}, {"start": 2358.48, "end": 2363.6000000000004, "text": " you train them such that the inner product between"}, {"start": 2363.6000000000004, "end": 2370.48, "text": " between the two so your embedding of x times your embedding of z is going to be"}, {"start": 2370.48, "end": 2374.96, "text": " large I guess they have a weight matrices in front of that but it doesn't matter"}, {"start": 2374.96, "end": 2380.32, "text": " so you can see that you train the model to retrieve the document where a"}, {"start": 2380.32, "end": 2385.92, "text": " piece of text came from okay and you train these model in conjunction with"}, {"start": 2385.92, "end": 2389.36, "text": " each other you simply make the inner products large and you can do negative"}, {"start": 2389.36, "end": 2394.0, "text": " sampling for this in order to contrast this with other documents where the"}, {"start": 2394.0, "end": 2399.52, "text": " text isn't from if you don't know what negative sampling is I've done a bunch"}, {"start": 2399.52, "end": 2405.2, "text": " of papers most notably the word to veck paper where that was sort of"}, {"start": 2405.2, "end": 2411.7599999999998, "text": " introduced so that's your pre pre-training task and I'm going to just take a"}, {"start": 2411.7599999999998, "end": 2416.88, "text": " wild guess here and I'm going to guess that in or in no in this iCT pre-training"}, {"start": 2416.88, "end": 2420.96, "text": " task this here is started from the public"}, {"start": 2420.96, "end": 2427.44, "text": " bird checkpoint or something like this so technically this you have the"}, {"start": 2427.44, "end": 2432.32, "text": " mask language model of models one and two would be the pre pre pre-training"}, {"start": 2432.32, "end": 2438.7200000000003, "text": " and then this iCT would be the pre pre-training and then the masked language"}, {"start": 2438.7200000000003, "end": 2444.0, "text": " modeling with the retriever based on iCT built on iCT is going to be the"}, {"start": 2444.0, "end": 2450.56, "text": " pre-training and then the question answering using that retriever is going"}, {"start": 2450.56, "end": 2458.64, "text": " to be the actual training okay so there's a lot of build-up here"}, {"start": 2458.64, "end": 2463.2, "text": " one thing to say is that yeah as you see here so here is this pre-training on"}, {"start": 2463.2, "end": 2467.92, "text": " the left unsupervised where you simply again the"}, {"start": 2467.92, "end": 2473.04, "text": " the way you have to think about it is what document do i have to retrieve to"}, {"start": 2473.04, "end": 2477.7599999999998, "text": " make the job of filling in the blank here easier okay"}, {"start": 2477.76, "end": 2483.1200000000003, "text": " and the hope is that that correlates well with the job of what document do i"}, {"start": 2483.1200000000003, "end": 2490.1600000000003, "text": " have to retrieve to answering the question easier okay"}, {"start": 2490.1600000000003, "end": 2495.6800000000003, "text": " what document do i have to retrieve to make to make the job for the model that"}, {"start": 2495.6800000000003, "end": 2501.0400000000004, "text": " answers the question easier i guess that's the way of formulating it"}, {"start": 2501.0400000000004, "end": 2504.7200000000003, "text": " all right so the next few things you have to do to get it to work"}, {"start": 2504.72, "end": 2511.12, "text": " yes prohibiting trivial retrievals they say if the pre-training corpus and the"}, {"start": 2511.12, "end": 2515.2799999999997, "text": " knowledge corpus are the same which i guess they sometimes are because"}, {"start": 2515.2799999999997, "end": 2521.8399999999997, "text": " you know it pays off to do the pre-training on the same corpus as your"}, {"start": 2521.8399999999997, "end": 2527.7599999999998, "text": " knowledge corpus if it is large enough a trivial retrieval candidate"}, {"start": 2527.7599999999998, "end": 2531.6, "text": " z that is too informative right there exists a trivial retrieval"}, {"start": 2531.6, "end": 2536.4, "text": " if the mask sentence comes from document z the knowledge augmented encoder"}, {"start": 2536.4, "end": 2540.64, "text": " can trivially predict why by looking at the on-masked version of it yes of"}, {"start": 2540.64, "end": 2544.7999999999997, "text": " course like if you do this mask language modeling and you take your"}, {"start": 2544.7999999999997, "end": 2549.6, "text": " sentence from that corpus then the retriever can simply go look for that"}, {"start": 2549.6, "end": 2554.48, "text": " document and then it becomes very very easy to fill in the blank right because"}, {"start": 2554.48, "end": 2558.64, "text": " you just do this pattern matching and that's of no use because what you want"}, {"start": 2558.64, "end": 2562.3199999999997, "text": " to teach the model essentially is to kind of look at the semantics of the"}, {"start": 2562.3199999999997, "end": 2567.8399999999997, "text": " document so you simply prohibit that particular thing so this is"}, {"start": 2567.8399999999997, "end": 2572.96, "text": " during pre-training this is for your mask language modeling"}, {"start": 2572.96, "end": 2576.64, "text": " pre-training the what we call here round pre-training"}, {"start": 2576.64, "end": 2582.4, "text": " during that you simply prohibit for this reason we exclude this trivial"}, {"start": 2582.4, "end": 2587.04, "text": " candidate during pre-training so that's one thing you have to do and i feel"}, {"start": 2587.04, "end": 2590.24, "text": " here is you know where the specifics of your"}, {"start": 2590.24, "end": 2595.2799999999997, "text": " task and your data set come in because you know on the internet"}, {"start": 2595.2799999999997, "end": 2601.2799999999997, "text": " many things are copied and sort of copied and translated and so on"}, {"start": 2601.2799999999997, "end": 2607.12, "text": " so if you were to do this not in Wikipedia but in a more unstructured way this"}, {"start": 2607.12, "end": 2611.68, "text": " would be one of the pain points i guess because imagine you know there is"}, {"start": 2611.68, "end": 2615.44, "text": " just a website that translates all the other websites to"}, {"start": 2615.44, "end": 2619.04, "text": " French and then your model can simply learn to translate"}, {"start": 2619.04, "end": 2623.36, "text": " from French and always retrieve the French document and fill in the blank"}, {"start": 2623.36, "end": 2627.92, "text": " using that it will learn nothing about the world like it will not require"}, {"start": 2627.92, "end": 2633.6, "text": " acquire any retrieval along semantics of world knowledge it will simply"}, {"start": 2633.6, "end": 2637.52, "text": " learn to translate to French and so on so i think that this is"}, {"start": 2637.52, "end": 2641.36, "text": " rather more crucial than this simple one paragraph"}, {"start": 2641.36, "end": 2648.56, "text": " appears to to have it then they also introduce this null document"}, {"start": 2648.56, "end": 2651.52, "text": " along with the things they retrieve so if they retrieve"}, {"start": 2651.52, "end": 2655.92, "text": " maybe not five but eight i i think they retrieve eight in the experiments if"}, {"start": 2655.92, "end": 2660.1600000000003, "text": " they retrieve so they retrieve seven documents the seven closest ones in"}, {"start": 2660.1600000000003, "end": 2664.2400000000002, "text": " inner product space plus a null document"}, {"start": 2664.2400000000002, "end": 2669.28, "text": " such that the model has the opportunity to ignore all the documents"}, {"start": 2669.28, "end": 2672.4, "text": " right so it can basically just go to the null document"}, {"start": 2672.4, "end": 2677.44, "text": " assign a large weight to that and just answer the question outright"}, {"start": 2677.44, "end": 2682.4, "text": " so if the answer is already contained in the question itself it can just"}, {"start": 2682.4, "end": 2687.1200000000003, "text": " you know point to that it doesn't need the an additional document to answer"}, {"start": 2687.1200000000003, "end": 2691.84, "text": " the question so they leave room for this possibility right here"}, {"start": 2691.84, "end": 2695.28, "text": " now this would also be a good metric to assess"}, {"start": 2695.28, "end": 2700.6400000000003, "text": " how much the model makes use of the other documents and i think they have this"}, {"start": 2700.6400000000003, "end": 2705.1200000000003, "text": " further down and then the last thing here is the salient"}, {"start": 2705.1200000000003, "end": 2711.2000000000003, "text": " span masking so when you do mask language model pre-training what you'll do is"}, {"start": 2711.2000000000003, "end": 2717.44, "text": " simply you'll drop out not even words but word pieces right so um so here let's"}, {"start": 2717.44, "end": 2722.32, "text": " say say this you have this span of text what you do is you just drop out like"}, {"start": 2722.32, "end": 2727.1200000000003, "text": " at random words or as i said even worse if this is"}, {"start": 2727.1200000000003, "end": 2731.6800000000003, "text": " birthed or something you have word pieces so you maybe just drop out"}, {"start": 2731.6800000000003, "end": 2740.88, "text": " this c us right here and the low now people have observed that"}, {"start": 2740.88, "end": 2746.1600000000003, "text": " this is not pretty easy for the model and most notably it doesn't require a lot"}, {"start": 2746.1600000000003, "end": 2750.4, "text": " of world knowledge it doesn't require even a lot of attention to the other"}, {"start": 2750.4, "end": 2753.44, "text": " parts of the sentence which is what you would like to"}, {"start": 2753.44, "end": 2758.08, "text": " induce with this pre-training all you basically need to do is you need to say"}, {"start": 2758.08, "end": 2763.12, "text": " oh there is something and then cal and maybe you look at the words around it"}, {"start": 2763.12, "end": 2766.64, "text": " and you can pretty easily deduce that it's low cal"}, {"start": 2766.64, "end": 2774.0, "text": " also two faux horn on you can pretty easily deduce that's two focus so"}, {"start": 2774.0, "end": 2779.6800000000003, "text": " this kind of pre-training doesn't really mean the model learns some long-range"}, {"start": 2779.68, "end": 2783.7599999999998, "text": " dependencies or understands language pretty well so people have been"}, {"start": 2783.7599999999998, "end": 2788.64, "text": " upping the kind of smartness with which they drop out"}, {"start": 2788.64, "end": 2794.24, "text": " things so the for most obvious thing is to drop out entire words even though"}, {"start": 2794.24, "end": 2798.72, "text": " you know bird works in word pieces you can simply always enforce that entire"}, {"start": 2798.72, "end": 2803.68, "text": " words are dropped out now it's a bit harder then what people do is like"}, {"start": 2803.68, "end": 2808.72, "text": " salient span dropouts and that's what they do right here"}, {"start": 2808.72, "end": 2813.4399999999996, "text": " so what you want to do is you want to drop out"}, {"start": 2813.4399999999996, "end": 2817.7599999999998, "text": " things that are sort of kind of little snippets that are"}, {"start": 2817.7599999999998, "end": 2824.16, "text": " belong together so for example if i drop here local context if i drop this out"}, {"start": 2824.16, "end": 2827.8399999999997, "text": " right then i need you know some mascaras spans"}, {"start": 2827.8399999999997, "end": 2832.8799999999997, "text": " only require what right and that requires much more"}, {"start": 2832.8799999999997, "end": 2836.9599999999996, "text": " world knowledge to answer that question it requires much more long-range"}, {"start": 2836.96, "end": 2840.4, "text": " dependency resolution in my language model and so on"}, {"start": 2840.4, "end": 2844.56, "text": " in order to see that there is world knowledge and this is exactly what you"}, {"start": 2844.56, "end": 2849.36, "text": " want to induce here right you want to induce your model to learn"}, {"start": 2849.36, "end": 2855.76, "text": " learn more global knowledge more world knowledge more semantics of the"}, {"start": 2855.76, "end": 2860.7200000000003, "text": " language and you can relate this to sort of pre-training or data"}, {"start": 2860.7200000000003, "end": 2865.6, "text": " augmentation i'd say in image in image in vision"}, {"start": 2865.6, "end": 2870.48, "text": " for example there you have the random cropping so you only crop out part of"}, {"start": 2870.48, "end": 2873.7599999999998, "text": " the picture and then you crop out another part"}, {"start": 2873.7599999999998, "end": 2877.8399999999997, "text": " maybe here and then you ask the model does this come from the same or from"}, {"start": 2877.8399999999997, "end": 2883.44, "text": " different images these two parts and the more you crop sort of the more the"}, {"start": 2883.44, "end": 2888.0, "text": " model has to cannot rely on just single pixels"}, {"start": 2888.0, "end": 2893.68, "text": " somewhere but actually has to understand image scenes and so on what direction is"}, {"start": 2893.68, "end": 2897.6, "text": " up and whatnot so we see qualitative difference between"}, {"start": 2897.6, "end": 2902.16, "text": " pre-training methods and augmentation methods for images"}, {"start": 2902.16, "end": 2905.2799999999997, "text": " it only makes sense that we see a qualitative difference and"}, {"start": 2905.2799999999997, "end": 2909.2, "text": " different in differently induced inductive"}, {"start": 2909.2, "end": 2914.3199999999997, "text": " priors in text if we do this so what they do is they say"}, {"start": 2914.3199999999997, "end": 2918.24, "text": " since we want to induce this kind of thing we will not only drop out"}, {"start": 2918.24, "end": 2922.64, "text": " entire words we actually drop out entire salient spans"}, {"start": 2922.64, "end": 2929.2799999999997, "text": " such as united kingdom or july 1969 we use a bird-based tagger"}, {"start": 2929.2799999999997, "end": 2935.3599999999997, "text": " to identify named entities and a regular expression to identify dates"}, {"start": 2935.3599999999997, "end": 2939.04, "text": " we select and mask one of the salient spans within a sentence for the"}, {"start": 2939.04, "end": 2941.6, "text": " mask language modeling task we show that this"}, {"start": 2941.6, "end": 2944.3199999999997, "text": " significantly outperforms other masking strategies and"}, {"start": 2944.3199999999997, "end": 2949.44, "text": " seconds in 4.5 now while i agree with the notion of salient"}, {"start": 2949.44, "end": 2955.44, "text": " span masking i have big troubles with the way they do it here"}, {"start": 2955.44, "end": 2960.88, "text": " and i think this is where you kind of start to overfit on the particular"}, {"start": 2960.88, "end": 2964.88, "text": " data sets so i guess they looked at the data set and you know you kind of as a"}, {"start": 2964.88, "end": 2968.7200000000003, "text": " developer you can look at your just kind of questions are there and they"}, {"start": 2968.7200000000003, "end": 2973.36, "text": " saw often it's you know questions about entities question about"}, {"start": 2973.36, "end": 2980.1600000000003, "text": " dates and so on so you know we can just pre-train with those things in mind"}, {"start": 2980.1600000000003, "end": 2984.88, "text": " and yeah that's where it gets a bit long and really specific to your task"}, {"start": 2984.88, "end": 2990.4, "text": " really specific to your data sets and so on to do that so this is already"}, {"start": 2990.4, "end": 2995.2000000000003, "text": " baking in a bit of knowledge or a lot of knowledge i would argue about the"}, {"start": 2995.2000000000003, "end": 3000.0, "text": " task itself and we're going to see that this is actually fairly important in"}, {"start": 3000.0, "end": 3007.6, "text": " the results this salient span masking and yeah this it's sort of"}, {"start": 3007.6, "end": 3014.16, "text": " i get it you get better numbers with it but also it's kind of dirty and very"}, {"start": 3014.16, "end": 3018.16, "text": " very specified to the task i won't actually see and i don't know if people have"}, {"start": 3018.16, "end": 3021.92, "text": " actually have done this but the way i would do it in a kind of more principled"}, {"start": 3021.92, "end": 3026.88, "text": " way is if you have a piece of text what you do is you start by masking one word"}, {"start": 3026.88, "end": 3034.48, "text": " okay um like i'm asked spans here and then i would ask my own model right my own"}, {"start": 3034.48, "end": 3040.8, "text": " half-trained model which um which if i want to predict this one right if i"}, {"start": 3040.8, "end": 3045.44, "text": " want to do mask my which one with this one i can use one of these your saliency"}, {"start": 3045.44, "end": 3050.8, "text": " methods to ask which other words are most relevant to predicting this one"}, {"start": 3050.8, "end": 3055.44, "text": " okay and it will probably be say okay salient is really important"}, {"start": 3055.44, "end": 3062.08, "text": " right because if i know that there is salient in front of it uh i can predict"}, {"start": 3062.08, "end": 3068.08, "text": " that there spans really easily and then i can say well okay so i'll mask salient as"}, {"start": 3068.08, "end": 3072.32, "text": " well now i have masked these two and i do that up to some threshold right so"}, {"start": 3072.32, "end": 3076.88, "text": " the saliency in my mind should come directly from the model you're"}, {"start": 3076.88, "end": 3080.64, "text": " training and by that you're basically saying that you know model you've"}, {"start": 3080.64, "end": 3086.7999999999997, "text": " sort of learned your local um dependencies now i want you to go beyond that"}, {"start": 3086.7999999999997, "end": 3092.64, "text": " so you're you're basically really mean to the model you you forbid it from using"}, {"start": 3092.64, "end": 3096.3199999999997, "text": " everything it has learned so far uh to make the task more"}, {"start": 3096.3199999999997, "end": 3100.0, "text": " challenging and more challenging over time i think this is kind of a built-in"}, {"start": 3100.0, "end": 3103.3599999999997, "text": " curriculum learning and that's how what i would see if you"}, {"start": 3103.3599999999997, "end": 3107.04, "text": " if this is already done maybe someone's already done it just let me know in the"}, {"start": 3107.04, "end": 3114.08, "text": " comments um this already exists kind of expanding the masks uh by assessing"}, {"start": 3114.08, "end": 3119.7599999999998, "text": " the model's own saliency all right so let's jump into the results and the"}, {"start": 3119.7599999999998, "end": 3125.2, "text": " results as you've already maybe seen in the abstract are pretty pretty good"}, {"start": 3125.2, "end": 3130.24, "text": " so on these open domain uh questioning datasets they outperform all the"}, {"start": 3130.24, "end": 3134.72, "text": " previous state of the art not only by a little but by significant margins as you"}, {"start": 3134.72, "end": 3139.04, "text": " can see here and they do it in when both the pre-training"}, {"start": 3139.04, "end": 3142.8799999999997, "text": " corpus is the same as the knowledge corpus and when the pre-training corpus is"}, {"start": 3142.8799999999997, "end": 3148.24, "text": " actually a different one um that tends to work actually even better in in"}, {"start": 3148.24, "end": 3154.0, "text": " two of the three tasks so fairly cool also not more parameters than you know"}, {"start": 3154.0, "end": 3159.9199999999996, "text": " previous models especially not this uh this t5 so this t5 here is an example"}, {"start": 3159.9199999999996, "end": 3164.08, "text": " of just you know where everything is baked into the language model"}, {"start": 3164.08, "end": 3169.04, "text": " whereas i believe these models right here they have a retriever's um"}, {"start": 3169.04, "end": 3172.72, "text": " along with it yeah you can see here they all have retrievers along with it"}, {"start": 3172.72, "end": 3176.16, "text": " but their pre-training objective and their architecture sometimes is"}, {"start": 3176.16, "end": 3180.64, "text": " different i believe you can also see the fact here that orca has the same"}, {"start": 3180.64, "end": 3184.24, "text": " amount of parameters it's very close to the model"}, {"start": 3184.24, "end": 3188.0, "text": " right here it's just that the pre-training here is different"}, {"start": 3188.0, "end": 3193.44, "text": " and you also see right here they do some ablations where they say okay how"}, {"start": 3193.44, "end": 3197.44, "text": " important are the different parts right here so you can see on the development"}, {"start": 3197.44, "end": 3203.04, "text": " set you get what your 38.2 exact match score um if you only train the"}, {"start": 3203.04, "end": 3209.2000000000003, "text": " retriever but you reset the encoder uh before so that's the"}, {"start": 3209.2000000000003, "end": 3213.52, "text": " thing that actually answers the question if you reset that before fine tuning"}, {"start": 3213.52, "end": 3217.92, "text": " you drop a little bit uh if you reset the retriever you drop actually you"}, {"start": 3217.92, "end": 3223.6, "text": " drop more but still it's i would say it's fairly competitive as you can see"}, {"start": 3223.6, "end": 3228.08, "text": " now this is probably the test set um but still it's fairly"}, {"start": 3228.08, "end": 3234.2400000000002, "text": " fairly competitive right here with the with uh"}, {"start": 3234.2400000000002, "end": 3240.08, "text": " sorry the previous state of the art oh yeah here here is the baseline it's uh 31.3"}, {"start": 3240.08, "end": 3243.6800000000003, "text": " now interestingly as you can see right here"}, {"start": 3243.68, "end": 3249.68, "text": " if you have uniform masks or random span masks which is the two types that i"}, {"start": 3249.68, "end": 3254.24, "text": " of masking that i discussed where are you drop by just word pieces or"}, {"start": 3254.24, "end": 3259.7599999999998, "text": " you know entire words or entire spans so you just uh you just take that idea"}, {"start": 3259.7599999999998, "end": 3262.56, "text": " further you say oh i'm asking an entire span but"}, {"start": 3262.56, "end": 3270.08, "text": " nothing with their saliency um so no no reg X's for dates no entity taggers"}, {"start": 3270.08, "end": 3274.7999999999997, "text": " and so on you you drop um quite a bit especially with the uniform masks you see"}, {"start": 3274.7999999999997, "end": 3278.72, "text": " here you drop quite a bit now with the random"}, {"start": 3278.72, "end": 3283.04, "text": " random span mask you also if you drop you drop for the random spans and then you"}, {"start": 3283.04, "end": 3286.72, "text": " drop again for the uniform masks so this seems to be"}, {"start": 3286.72, "end": 3291.84, "text": " pretty pretty important um so never forget when you see things like this that"}, {"start": 3291.84, "end": 3298.72, "text": " there are these engineering choices that can make uh as big a difference"}, {"start": 3298.72, "end": 3304.7999999999997, "text": " as the the actual idea in the paper itself okay so you can see this it's"}, {"start": 3304.7999999999997, "end": 3308.7999999999997, "text": " pretty the improvement is select three points from uniform masks to random"}, {"start": 3308.7999999999997, "end": 3313.2, "text": " span masks and then three points again from the random span masks to their"}, {"start": 3313.2, "end": 3317.4399999999996, "text": " round pre-training and the actual improvement with the uniform masks"}, {"start": 3317.4399999999996, "end": 3323.8399999999997, "text": " over the baseline right here is not as high now the baseline you know uses a"}, {"start": 3323.84, "end": 3329.1200000000003, "text": " different thing it uses this iCT as pre-training but"}, {"start": 3329.1200000000003, "end": 3336.0, "text": " still i haven't seen the saliency masking um maybe i've seen it maybe it's"}, {"start": 3336.0, "end": 3341.2000000000003, "text": " somewhere else but i haven't seen it okay they also have an"}, {"start": 3341.2000000000003, "end": 3346.7200000000003, "text": " interesting uh thing right here oh they'll say for an interesting plot in the"}, {"start": 3346.72, "end": 3355.2799999999997, "text": " appendix where they show the num the performance um"}, {"start": 3355.2799999999997, "end": 3360.9599999999996, "text": " of the different masking styles with respect to this retrieval utility and the"}, {"start": 3360.9599999999996, "end": 3367.52, "text": " retrieval utility compares this these two things that we've looked at so it"}, {"start": 3367.52, "end": 3372.3999999999996, "text": " compares how good is document z in answering the question why"}, {"start": 3372.3999999999996, "end": 3375.9199999999996, "text": " versus this null document so the null document is basically"}, {"start": 3375.92, "end": 3382.08, "text": " just answer the why right so if let's let's play devil's advocate and say that"}, {"start": 3382.08, "end": 3386.64, "text": " all of this retrieval stuff it's just bollocks right um"}, {"start": 3386.64, "end": 3391.28, "text": " you know the in the knowledge is still baked into the language model"}, {"start": 3391.28, "end": 3396.7200000000003, "text": " they we were critical that this helps and so on then this would also always be"}, {"start": 3396.7200000000003, "end": 3402.16, "text": " zero now you can pretty easily or you can pretty easily see that this would be"}, {"start": 3402.16, "end": 3406.3199999999997, "text": " zero right there would be no improvement having the document versus not having"}, {"start": 3406.3199999999997, "end": 3411.7599999999998, "text": " the document having the null document um so if this is high that means these"}, {"start": 3411.7599999999998, "end": 3416.08, "text": " retrieved documents are actually relevant"}, {"start": 3416.08, "end": 3422.0, "text": " so you can see that if you do random uniform masking then"}, {"start": 3422.0, "end": 3428.16, "text": " it's it's okay it gets above zero all right if you do random span masking"}, {"start": 3428.16, "end": 3434.24, "text": " it gets even higher and if you do salient span masking it gets"}, {"start": 3434.24, "end": 3438.48, "text": " very high so again you see here the difference between"}, {"start": 3438.48, "end": 3443.8399999999997, "text": " the salient masking and the others is you know I would say higher than the"}, {"start": 3443.8399999999997, "end": 3447.7599999999998, "text": " difference between not having the document at all and doing the random"}, {"start": 3447.7599999999998, "end": 3453.52, "text": " uniform masking in pre-training so again you know something to think about"}, {"start": 3453.52, "end": 3457.12, "text": " at last they have one example right here where they can show"}, {"start": 3457.12, "end": 3462.16, "text": " it actually helps this is um just a concrete example"}, {"start": 3462.16, "end": 3468.16, "text": " so the question here is an equilateral triangle is easily constructed using"}, {"start": 3468.16, "end": 3473.12, "text": " a straight edge in a compass because three is a and then blank prime so this"}, {"start": 3473.12, "end": 3477.92, "text": " is the masked word right here if they just ask the model what they should"}, {"start": 3477.92, "end": 3482.64, "text": " feel what it should fill in the probability and fermo is the correct answer"}, {"start": 3482.64, "end": 3488.64, "text": " is super duper low okay then if they give it the correct document"}, {"start": 3488.64, "end": 3493.68, "text": " they just search out the correct document which is"}, {"start": 3493.68, "end": 3498.0, "text": " here the conditional probability with this document 257 is a fermo prime that's"}, {"start": 3498.0, "end": 3502.96, "text": " a regular polygon with 257 sides is constructible with"}, {"start": 3502.96, "end": 3509.44, "text": " compass so you can see that it has it has some overlap like the"}, {"start": 3509.44, "end": 3515.6, "text": " constructible with compass okay the constructible with compass"}, {"start": 3515.6, "end": 3518.96, "text": " it's not an exact overlap so it's debatable whether a classic search"}, {"start": 3518.96, "end": 3525.28, "text": " engine would find this probably but um not and then the a something prime a"}, {"start": 3525.28, "end": 3531.2000000000003, "text": " something prime they are here so given this document you can see how a model"}, {"start": 3531.2000000000003, "end": 3536.2400000000002, "text": " could easily classify fermo as the correct answer and in fact the"}, {"start": 3536.24, "end": 3541.9199999999996, "text": " probability is I guess it's not 1.0 but it's around that 1.0 so if you give"}, {"start": 3541.9199999999996, "end": 3547.8399999999997, "text": " the model the you know model 3 if you give it the"}, {"start": 3547.8399999999997, "end": 3551.8399999999997, "text": " relevant document it immediately knows what the answer is"}, {"start": 3551.8399999999997, "end": 3560.0, "text": " and if you give the if you do this whole retrieval step in between so if this"}, {"start": 3560.0, "end": 3565.6, "text": " is marginal probability marginalizing over the top eight retrieve documents so"}, {"start": 3565.6, "end": 3569.36, "text": " now they don't tell it what the correct answer is but they actually"}, {"start": 3569.36, "end": 3573.04, "text": " let it do its whole retrieval thing and marginalize over the top"}, {"start": 3573.04, "end": 3575.8399999999997, "text": " documents then it still assigns a very high"}, {"start": 3575.8399999999997, "end": 3578.0, "text": " probability and I'm going to guess that's the top"}, {"start": 3578.0, "end": 3582.4, "text": " probability for all of the words but you see there is a considerable"}, {"start": 3582.4, "end": 3587.92, "text": " decline so it's not like um it's not like it's always super sure"}, {"start": 3587.92, "end": 3592.88, "text": " and I think there is quite a bit of improvement still to be to be done"}, {"start": 3592.88, "end": 3597.84, "text": " right here because as a human if I go look for an answer for this question"}, {"start": 3597.84, "end": 3601.6, "text": " and I find even if I consider the top eight documents I don't think they"}, {"start": 3601.6, "end": 3608.48, "text": " would confuse me to the point where I'd say that fermo is only um 12%"}, {"start": 3608.48, "end": 3613.44, "text": " likely even though it might be more likely than any other word I would"}, {"start": 3613.44, "end": 3618.48, "text": " assign it probably a much higher probability so I think there's"}, {"start": 3618.48, "end": 3623.44, "text": " there's a bit of improvement still to be made right here and I'm looking"}, {"start": 3623.44, "end": 3627.6, "text": " forward to what people can come up with all right I hope you enjoyed this video"}, {"start": 3627.6, "end": 3632.8, "text": " I know it's been a bit of a long rant but um I wanted to make sure the"}, {"start": 3632.8, "end": 3637.12, "text": " individual parts are clear let me know what you think of it of the"}, {"start": 3637.12, "end": 3650.56, "text": " model itself and I wish you a good one bye bye"}] |
Yannic Kilcher | 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. See, 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 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 heavy and 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 heavy and plasticity is and the difference to classic reinforcement learning and then we'll look at the experiments and that's gonna 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 one 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 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 out compete RL anytime soon it's just a different way in a biologically more plausible way in order to do that. So 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 in 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 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 to 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 initialize network so what's actually learned here isn't the weights of the network what's learned during training is these rules that transform any randomly initialize 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 awards 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 the 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 are a driver like there is 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 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 up 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 oh i and oh 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 oh i times oh 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 oh i and oh j and then you'll adjust the weights 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 weight it 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 in response to 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 as you can see it's 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 heavy in these heavy in rules you learn ABCD and it 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 or else 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 it's 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 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 a hundred steps so that doesn't it 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 hebian rule in the other two methods but this shows you kind of the the difference and the power that these hebian rules or these generally neuroplasticity might have because the hebian one is perfectly capable of at least in part adapting to the different situations now you can see that is not symmetric also the hebian rules they learn to you know there's 860 and there's 440 of a thing that should actually be symmetric right we do expect a drop when there's damage but it's not symmetric which means that also the hebian 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 gonna wire them together because that's how I walk you know from 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 we have damage instead if they are not wire together I'm going to and can do this in the next layer of the neural network why are these other two things together you know if if the first thing is not the case I'm gonna 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 there you that there might be there might be like a qualitative difference in certain situations again by no means this is meant to outcompete or else 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 heavy and non-hebbing way okay so the heavy and non-hebbing 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 gonna say classic or even though the terminology is not really correct classic rl and evolutionary methods okay so in classic or l 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 or especially in this is a policy gradient method right now so I use my policy my weights together 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 out the reward out and you 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 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 just want to know 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 there can be advantages to not doing gradient calculation sometimes backpropagation simply isn't possible even if it is possible and this is maybe the case where we are 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 that that that you have 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 or else 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 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 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 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 heavy and uptake rules as well you can use RL to learn the fixed weight or the uptake rules in this paper they use evolutionary methods to learn the heavy and uptake 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 heavy and weights since we learn the heavy and weights so how they'll update each agent is going to be they'll take the heavy and weights and this this here is how you update right this is your delta h how do you update the heavy and weights well what you do is you you perform in random perturbations so I take my weights and I add noise I just add noise okay so I I'm 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 f i 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 backprop no nothing basically blackbox 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 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 or 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 out performing 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 that's the 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 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 intervention if you do this I mean 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 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 it is actually diagonal and the forward the fully connected layer is just defined as something like Wt 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 and 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 heavy in coefficients then your algorithm just jumps around kind of in in weight space around the zero point however if you actually learn these heavy in coefficients as they do you have like this clear attractor here and you have these kind of oscillating curves when you know when you do that and you can see here 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 this neuroplasticity is it's a different way you know it's unclear to say if it will ever deliver the 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 futures societal consequence of this work are hard to predict but likely similar to other work dealing with more adaptive agents and robots in particular by giving the robust 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 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 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 papers far from being deployed in these areas but it's 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 statement 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 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 if 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 heavyens 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.0, "end": 5.28, "text": " Hi there. Take a look at the following problem on the left right here. See,"}, {"start": 5.28, "end": 10.4, "text": " have this quadruped and the goal is to have it walk forward or in any direction"}, {"start": 10.4, "end": 16.36, "text": " as far as possible. Now usually this is the domain of sort of reinforcement"}, {"start": 16.36, "end": 21.86, "text": " learning. So you have inputs which is the sensors of the joints of the quadruped"}, {"start": 21.86, "end": 26.76, "text": " and you have outputs which is how much force you want to put on each of the"}, {"start": 26.76, "end": 31.44, "text": " legs and you have to somehow learn a policy to make it walk forward."}, {"start": 31.44, "end": 36.800000000000004, "text": " Reinforcement learning does that by sort of trial and error using an environment"}, {"start": 36.800000000000004, "end": 42.84, "text": " to learn the policy directly. However this paper does something different."}, {"start": 42.84, "end": 49.28, "text": " What it does is it learns a policy that is adaptive during training which"}, {"start": 49.28, "end": 54.52, "text": " basically means that at the beginning of each episode the policy is"}, {"start": 54.52, "end": 61.32, "text": " initialized randomly and by policy here we mean a policy network policy neural"}, {"start": 61.32, "end": 65.44, "text": " network which you can see at the bottom. So that's initialized randomly and"}, {"start": 65.44, "end": 72.52000000000001, "text": " then during the episode depending on the input this network is changed and"}, {"start": 72.52000000000001, "end": 78.92, "text": " adapted in order to achieve high performance. So even at test time the"}, {"start": 78.92, "end": 86.08, "text": " network is started randomly and then adapted during the episode. So this paper"}, {"start": 86.08, "end": 92.0, "text": " deals with this problem and tries to implement this sort of more biologically"}, {"start": 92.0, "end": 98.24000000000001, "text": " plausible way of learning a policy adapting to the environment and achieve"}, {"start": 98.24000000000001, "end": 103.44, "text": " ultimately good performance in this task and it has some nice property namely"}, {"start": 103.44, "end": 107.92, "text": " that it can deal with these things as you can see here front right leg"}, {"start": 107.92, "end": 112.88, "text": " damage front left leg damage but we'll get to that later but just so you know"}, {"start": 112.88, "end": 116.8, "text": " what's coming. So the paper is called meta learning through"}, {"start": 116.8, "end": 122.88, "text": " heavy and plasticity in random networks by Elias Naharo and Sebastian Rizzi."}, {"start": 122.88, "end": 128.0, "text": " So we'll go through the paper what it does what evolutionary methods are"}, {"start": 128.0, "end": 132.44, "text": " really briefly which they use what heavy and plasticity is and the difference"}, {"start": 132.44, "end": 137.76, "text": " to classic reinforcement learning and then we'll look at the experiments and"}, {"start": 137.76, "end": 143.16, "text": " that's gonna be it. If you like content like this as always don't hesitate to"}, {"start": 143.16, "end": 148.48, "text": " subscribe and share it out and tell me what you think in the comments. I still"}, {"start": 148.48, "end": 153.0, "text": " read all the comments so I am very interested in what you think about works"}, {"start": 153.0, "end": 158.36, "text": " like this and about the video itself. Okay so they say lifelong learning and"}, {"start": 158.36, "end": 164.48000000000002, "text": " adaptability are two defining aspects of biological agents. Modern reinforcement"}, {"start": 164.48000000000002, "end": 168.24, "text": " learning approaches have shown significant progress in solving complex tasks"}, {"start": 168.24, "end": 173.96, "text": " however one training is concluded the found solutions are typically static and"}, {"start": 173.96, "end": 180.56, "text": " incapable of adapting to new information or perturbations. So they contrast the"}, {"start": 180.56, "end": 185.68, "text": " two things here. Reinforcement learning as you know is very powerful in these"}, {"start": 185.68, "end": 191.8, "text": " domains but its goal is to learn a policy and then that policy is fixed and it's"}, {"start": 191.8, "end": 198.88, "text": " specific to that particular problem. However biological agents you know humans"}, {"start": 198.88, "end": 204.56, "text": " animals and so on they are able to adapt usually very very quickly they give"}, {"start": 204.56, "end": 210.48000000000002, "text": " some sort of examples right here like if an animal is born it almost"}, {"start": 210.48, "end": 216.0, "text": " immediately knows how to walk so even if it has some sort of injury even if it"}, {"start": 216.0, "end": 222.67999999999998, "text": " has some sort of disability usually the animal can walk pretty much instantly"}, {"start": 222.67999999999998, "end": 228.88, "text": " and that means it sort of adapts to the body that it is in sort of reconfigures"}, {"start": 228.88, "end": 233.07999999999998, "text": " itself on the fly and that's what we're going to explore here. So this isn't going"}, {"start": 233.07999999999998, "end": 239.83999999999997, "text": " to out compete RL anytime soon it's just a different way in a biologically more"}, {"start": 239.84, "end": 245.64000000000001, "text": " plausible way in order to do that. So again they say we still don't know"}, {"start": 245.64000000000001, "end": 250.88, "text": " completely how biological brains learn and adapt so efficiently from experience"}, {"start": 250.88, "end": 255.48000000000002, "text": " it is believed that synaptic plasticity plays a prominent role in this"}, {"start": 255.48000000000002, "end": 261.6, "text": " process and that's why they are using these hebbian learning rules in order to"}, {"start": 261.6, "end": 267.84000000000003, "text": " configure the network. So let's contrast the two things for a second. In reinforcement"}, {"start": 267.84, "end": 272.67999999999995, "text": " learning what you have is a policy network. Now the policy network is a neural"}, {"start": 272.67999999999995, "end": 278.71999999999997, "text": " network that maps sensory inputs to actions. Okay so you have the observation"}, {"start": 278.71999999999997, "end": 285.12, "text": " goes in and outcomes in action. This is your policy network. Now during training"}, {"start": 285.12, "end": 288.88, "text": " in reinforcement learning what you do is you have some sort of environment. Okay"}, {"start": 288.88, "end": 293.47999999999996, "text": " this is the environment and you play this back and forth game with the"}, {"start": 293.48, "end": 301.0, "text": " environment and you try to improve this policy network right here as best as"}, {"start": 301.0, "end": 307.76, "text": " you can in order to achieve a high reward. Then during testing so this is"}, {"start": 307.76, "end": 314.56, "text": " train then during testing you freeze you freeze this network right here so you"}, {"start": 314.56, "end": 321.20000000000005, "text": " freeze the network and then you simply play that game and you see how well it"}, {"start": 321.2, "end": 325.4, "text": " does. Okay so this gives you some sort of reward and that's going to be your"}, {"start": 325.4, "end": 329.71999999999997, "text": " testing reward and you know that can be generalization it can be to different"}, {"start": 329.71999999999997, "end": 335.15999999999997, "text": " environments and so on but the crucial part is that you in train you learn and"}, {"start": 335.15999999999997, "end": 343.15999999999997, "text": " then you freeze during test. In this in this particular paper right here they do"}, {"start": 343.15999999999997, "end": 350.12, "text": " something different so let's call that the hebbian plasticity world in the"}, {"start": 350.12, "end": 355.4, "text": " hebbian plasticity world again you have your environment and you play this game"}, {"start": 355.4, "end": 364.24, "text": " but you play the game in episodes and at the beginning of each episode you"}, {"start": 364.24, "end": 369.16, "text": " initialize this using some sort of distribution here a normal distribution you"}, {"start": 369.16, "end": 375.92, "text": " initialize the network and then you learn you adapt during the episode you"}, {"start": 375.92, "end": 383.2, "text": " adapt the network to have good performance okay so this thing right here these"}, {"start": 383.2, "end": 391.44, "text": " are the hebbian rules so you update the network during the episode and then at"}, {"start": 391.44, "end": 396.84000000000003, "text": " the end of the episode you go back you initialize the network again you start a"}, {"start": 396.84000000000003, "end": 402.56, "text": " new episode and you again adapt that randomly initialize network so what's"}, {"start": 402.56, "end": 406.76, "text": " actually learned here isn't the weights of the network what's learned during"}, {"start": 406.76, "end": 412.92, "text": " training is these rules that transform any randomly initialize network into a"}, {"start": 412.92, "end": 419.08, "text": " high performing network now of course you might just object and say hey wait a"}, {"start": 419.08, "end": 425.76, "text": " minute I can just basically hard code the you know the optimal weights here"}, {"start": 425.76, "end": 430.88, "text": " into these hebbian rules like my rules can simply you know not care about the"}, {"start": 430.88, "end": 435.71999999999997, "text": " input and simply output whatever good weights there are and ultimately that"}, {"start": 435.71999999999997, "end": 441.48, "text": " would lead back to RL but as you will be able to see in the experiments they"}, {"start": 441.48, "end": 445.8, "text": " also have some videos provided that I invite you to watch you can really see"}, {"start": 445.8, "end": 451.71999999999997, "text": " that the network reconfigures itself first of all at the beginning it reconfigures"}, {"start": 451.71999999999997, "end": 456.12, "text": " itself to a good state but then also as the episode is progressing it"}, {"start": 456.12, "end": 461.44, "text": " continuously reconfigures itself depending on the input so this is the real"}, {"start": 461.44, "end": 465.32, "text": " power of these hebbian rules in that during the episode the network can"}, {"start": 465.32, "end": 469.6, "text": " continuously reconfigure itself in order to achieve higher awards it's not"}, {"start": 469.6, "end": 474.2, "text": " just that I can go from the random initialization to a good performing"}, {"start": 474.2, "end": 479.36, "text": " policy I can adapt that policy depending on what the input is so at test time"}, {"start": 479.36, "end": 486.84000000000003, "text": " in this hebbian world what we're going to do is again we are going to freeze the"}, {"start": 486.84000000000003, "end": 493.04, "text": " learning rules so you have to kind of rethink we're going to freeze the hebbian"}, {"start": 493.04, "end": 499.16, "text": " rules but still we're going to randomly initialize our policy in each"}, {"start": 499.16, "end": 505.92, "text": " episode and then we're going to change that during the episode okay and then"}, {"start": 505.92, "end": 512.28, "text": " that's ultimately going to give us our reward so the the thing that's learned"}, {"start": 512.28, "end": 517.9200000000001, "text": " is just something different here you learn the weights directly in the RL"}, {"start": 517.9200000000001, "end": 521.76, "text": " setting and then the hebbian plasticity setting you learn the rules to"}, {"start": 521.76, "end": 527.0, "text": " update the weights dynamically depending on the input this is a form of"}, {"start": 527.0, "end": 533.6800000000001, "text": " meta learning right it's not exactly but it is a form of meta learning so let's"}, {"start": 533.68, "end": 538.4, "text": " see what those hebbian rules are and you can as again you can see this right"}, {"start": 538.4, "end": 544.9599999999999, "text": " here during training so this is one episode and it always starts with these"}, {"start": 544.9599999999999, "end": 548.8399999999999, "text": " random networks at the beginning and then you can see as you progress there is"}, {"start": 548.8399999999999, "end": 554.92, "text": " structure emerging and again I linked to the videos and you can see that"}, {"start": 554.92, "end": 559.04, "text": " during the episode even this is changing and this is especially visible on"}, {"start": 559.04, "end": 565.3199999999999, "text": " their other example that they have here like this this car example so in this"}, {"start": 565.3199999999999, "end": 569.28, "text": " car example during the video you'll see that now there's a curve like this and"}, {"start": 569.28, "end": 574.16, "text": " then as imagine you are a driver like there is a kind of a left curve coming and"}, {"start": 574.16, "end": 580.0, "text": " you adjust your mental state let's say to say okay I don't know what's around"}, {"start": 580.0, "end": 584.0, "text": " the curve I need to be ready to break and so on and then there is a straight"}, {"start": 584.0, "end": 588.28, "text": " piece coming and you'll be like well I see everything you know I can focus on"}, {"start": 588.28, "end": 594.04, "text": " different things you can reconfigure your state in order to adapt to the"}, {"start": 594.04, "end": 598.48, "text": " observation and that's exactly what you'll see in that video is that the weights"}, {"start": 598.48, "end": 602.9599999999999, "text": " are continuously updating not so much in these quarter pets to which we'll get"}, {"start": 602.9599999999999, "end": 609.04, "text": " later so these hebbian rules what do they look like these are biologically"}, {"start": 609.04, "end": 616.9599999999999, "text": " inspired rules and they say the following so this here is the Delta W I J and"}, {"start": 616.96, "end": 623.0, "text": " our perspective of policy networks is going to be that this is a neural network"}, {"start": 623.0, "end": 628.52, "text": " as we said and we'll just pick up one layer right here and there is going to be"}, {"start": 628.52, "end": 632.2800000000001, "text": " weights right here you know weights from all to all these are going to be fully"}, {"start": 632.2800000000001, "end": 639.12, "text": " connected networks and like this and there's going to be neuron I somewhere here"}, {"start": 639.12, "end": 645.4000000000001, "text": " and neuron J somewhere here okay so neuron I and neuron J are going to have a"}, {"start": 645.4, "end": 651.4, "text": " connection together this thing right here and there's going this the question is"}, {"start": 651.4, "end": 656.1999999999999, "text": " going to be how do we update that weight from one time step to the next"}, {"start": 656.1999999999999, "end": 661.88, "text": " remembering the weights here are changed in each time step each time step"}, {"start": 661.88, "end": 666.16, "text": " during the episode we update the weights so how are they going to be updated"}, {"start": 666.16, "end": 672.16, "text": " let's contrast this first to classic reinforcement learning so in classic"}, {"start": 672.16, "end": 676.0799999999999, "text": " reinforcement learning we would keep these weights the same during the entire"}, {"start": 676.0799999999999, "end": 680.7199999999999, "text": " episode and then at the end of the episode right we keep those the same and at"}, {"start": 680.7199999999999, "end": 684.28, "text": " the end of the episode we'll get a reward and then we'll go back we'll look back"}, {"start": 684.28, "end": 688.12, "text": " and say how do we need to change the weights such that in the next episode the"}, {"start": 688.12, "end": 693.3199999999999, "text": " reward will be higher and in again in classic reinforcement learning for"}, {"start": 693.3199999999999, "end": 699.0799999999999, "text": " example in policy gradient methods you will actually calculate a gradient with"}, {"start": 699.08, "end": 704.44, "text": " respect to these weights right here actually let's let's go into that later"}, {"start": 704.44, "end": 708.6800000000001, "text": " when we contrast evolutionary methods so the important part right here is that"}, {"start": 708.6800000000001, "end": 712.84, "text": " we change the weights in each time step so how do we change the weights of course"}, {"start": 712.84, "end": 717.32, "text": " we don't have access to the reward right in order to change the weights the"}, {"start": 717.32, "end": 721.44, "text": " reward is going to come into play when we change the rules to change the weights"}, {"start": 721.44, "end": 726.6400000000001, "text": " but during the episode we don't have the reward at least we assume we only get"}, {"start": 726.64, "end": 732.92, "text": " kind of the reward at the end so we need a different method and the method is"}, {"start": 732.92, "end": 738.28, "text": " going to be the following right here the important things in this formula"}, {"start": 738.28, "end": 742.04, "text": " are going to be so how do we change the weights that's dependent on two"}, {"start": 742.04, "end": 749.0, "text": " quantities that appear during each time step oh i and oh j and these are going"}, {"start": 749.0, "end": 755.48, "text": " to be the outputs of neuron i and neuron j so how do we change the connection"}, {"start": 755.48, "end": 760.8000000000001, "text": " that's going to be dependent on the output of neuron i which is here called"}, {"start": 760.8000000000001, "end": 765.2, "text": " the pre-synaptic output and the output of neuron j which is going to be the"}, {"start": 765.2, "end": 772.9200000000001, "text": " post-synaptic output the rule the kind of mantra here is the fire together"}, {"start": 772.9200000000001, "end": 778.76, "text": " wire together means that if two neurons are active at the same time regularly"}, {"start": 778.76, "end": 783.8000000000001, "text": " then they probably should be connected together because they already correlate"}, {"start": 783.8, "end": 790.3599999999999, "text": " and you can see right here that there is a term in this formula that is oh i"}, {"start": 790.3599999999999, "end": 798.52, "text": " times oh j so this here is the correlation between or the covariance or just"}, {"start": 798.52, "end": 805.12, "text": " the product if we're exact between these two neurons and if they are both"}, {"start": 805.12, "end": 809.0, "text": " active regularly then this quantity is going to be high and if they're both"}, {"start": 809.0, "end": 813.24, "text": " not active regularly that or if one is active and the other one isn't that"}, {"start": 813.24, "end": 819.24, "text": " quantity is going to be low and the a parameter here specifies how the weights"}, {"start": 819.24, "end": 827.4, "text": " are updated in response to this so the a b c d and eta parameters right here"}, {"start": 827.4, "end": 832.48, "text": " are these are the learned parameters these are going to be your learned rules"}, {"start": 832.48, "end": 838.24, "text": " to update the weights so these change once after once per learning step was a"}, {"start": 838.24, "end": 842.52, "text": " once per so after the episode is done you're going to change these capital"}, {"start": 842.52, "end": 847.8, "text": " constants right here including the eta which is the learning rate these things"}, {"start": 847.8, "end": 854.36, "text": " right here these are per step so this is each step gives you a different oh i and"}, {"start": 854.36, "end": 858.36, "text": " oh j and then you'll adjust the weights based on that you'll see that these"}, {"start": 858.36, "end": 864.28, "text": " constants here they are per weight so for each weight in this neural network we"}, {"start": 864.28, "end": 870.76, "text": " learn a separate rule of how to update that particular weight so the algorithm"}, {"start": 870.76, "end": 876.28, "text": " can it can basically decide for a particular weight it can decide well if these"}, {"start": 876.28, "end": 881.92, "text": " two things fire together often I want to update my weight very heavily in"}, {"start": 881.92, "end": 887.68, "text": " response to that okay so if the a is very high that means the connection"}, {"start": 887.68, "end": 895.8, "text": " responds very thoroughly to when the two neurons fire together that is not the"}, {"start": 895.8, "end": 900.64, "text": " same as to say that connection should always be very strong it's dependent on"}, {"start": 900.64, "end": 906.72, "text": " the input so only when this quantity is high should the network or should the"}, {"start": 906.72, "end": 915.1999999999999, "text": " weight be updated and the a parameter modulates how well it's updated or how how"}, {"start": 915.1999999999999, "end": 919.4, "text": " strongly it's up it can also be negative it can be zero basically meaning that"}, {"start": 919.4, "end": 923.84, "text": " you know it doesn't matter if they fire together I don't want to update the"}, {"start": 923.84, "end": 928.24, "text": " weight this particular weight in response to that so you can see that you can"}, {"start": 928.24, "end": 933.6, "text": " learn these rules that can adapt to different inputs because all of the"}, {"start": 933.6, "end": 940.12, "text": " changes the delta here is dependent on the inputs so on the correlation but"}, {"start": 940.12, "end": 946.2, "text": " also on the different inputs themselves and then there is also a constant"}, {"start": 946.2, "end": 954.04, "text": " right here okay this as you can see it's it's a linear function of the inputs"}, {"start": 954.04, "end": 962.16, "text": " of the OI and OJ and their product so I hope this is clear that the these"}, {"start": 962.16, "end": 968.04, "text": " heavy in these heavy in rules you learn ABCD and it and that gives rise to an"}, {"start": 968.04, "end": 972.8, "text": " adaptive network that can change and reconfigure itself over the course of an"}, {"start": 972.8, "end": 980.7199999999999, "text": " episode depending on the inputs and one of the things right here and we'll get"}, {"start": 980.72, "end": 984.6800000000001, "text": " to how you actually learn the rules itself in a second but one of the things"}, {"start": 984.6800000000001, "end": 988.8000000000001, "text": " right here is very visible as I said in this first experiment where it"}, {"start": 988.8000000000001, "end": 994.08, "text": " reconfigures itself continuously but also in this experiment with this quadruped"}, {"start": 994.08, "end": 999.08, "text": " right here so this quadruped usually it's you know you simply walk in a"}, {"start": 999.08, "end": 1003.52, "text": " direction that's your reward and or else is perfectly fine at this as well"}, {"start": 1003.52, "end": 1009.28, "text": " however this is a bit of a has a bit of a trick to it namely you are always in"}, {"start": 1009.28, "end": 1015.1999999999999, "text": " one of three situations either you have an undamaged quadruped or it's kind"}, {"start": 1015.1999999999999, "end": 1022.9599999999999, "text": " of left leg front left leg is damaged or it's front right leg is damaged okay"}, {"start": 1022.9599999999999, "end": 1029.36, "text": " and you don't tell the you simply sample these situations uniformly and you"}, {"start": 1029.36, "end": 1036.04, "text": " don't tell the algorithm which situation it is in now if you look at if you"}, {"start": 1036.04, "end": 1040.72, "text": " compare two methods one where you directly learn the weights you learn a fixed"}, {"start": 1040.72, "end": 1047.28, "text": " policy to solve you know this is one task right this is one task and all of"}, {"start": 1047.28, "end": 1051.8, "text": " these three things appear with equal probability so you have to learn one"}, {"start": 1051.8, "end": 1058.84, "text": " policy to make all of this work if you learn the weights directly and you don't"}, {"start": 1058.84, "end": 1062.48, "text": " have a power like there's no doubt that like a powerful RL approach could deal"}, {"start": 1062.48, "end": 1068.04, "text": " with this task but if in this case if you just put a standard weight learner"}, {"start": 1068.04, "end": 1073.68, "text": " with the same number of the same size of policy as the Hebbian they compare to"}, {"start": 1073.68, "end": 1079.48, "text": " if you put a weight learner on it it will not be able to solve this task"}, {"start": 1079.48, "end": 1083.88, "text": " satisfactorily what it will do is it will say well I need one set of rules"}, {"start": 1083.88, "end": 1089.88, "text": " that make me walk as far as possible as often as possible so if you can see at"}, {"start": 1089.88, "end": 1096.3200000000002, "text": " the table I'm already showing you the results right here the table right here if"}, {"start": 1096.3200000000002, "end": 1101.8000000000002, "text": " you have these static weights you can see that it's performing pretty well in"}, {"start": 1101.8000000000002, "end": 1109.44, "text": " two out of three situations right so it what it basically does it says okay"}, {"start": 1109.44, "end": 1115.72, "text": " here is what where there's damage what it does is it says I'm going to learn to"}, {"start": 1115.72, "end": 1121.4, "text": " walk with my left leg using my left front leg that means when I have no"}, {"start": 1121.4, "end": 1125.92, "text": " damage or damage to the right front leg I'm just fine and I'm just going to"}, {"start": 1125.92, "end": 1130.24, "text": " take the hit basically where I have damage to the left front leg because I'm"}, {"start": 1130.24, "end": 1134.4, "text": " it's just going to suck so they solved they solve this like walk more than a"}, {"start": 1134.4, "end": 1141.24, "text": " hundred steps so that doesn't it since it can only learn a fixed policy it"}, {"start": 1141.24, "end": 1146.94, "text": " basically discards the case where there's damage to the left front leg it"}, {"start": 1146.94, "end": 1152.04, "text": " takes that hit in order to be better in the other two methods you can see it's"}, {"start": 1152.04, "end": 1157.28, "text": " outperforming the hebian rule in the other two methods but this shows you kind"}, {"start": 1157.28, "end": 1162.96, "text": " of the the difference and the power that these hebian rules or these generally"}, {"start": 1162.96, "end": 1169.68, "text": " neuroplasticity might have because the hebian one is perfectly capable of at"}, {"start": 1169.68, "end": 1175.8, "text": " least in part adapting to the different situations now you can see that is not"}, {"start": 1175.8, "end": 1181.16, "text": " symmetric also the hebian rules they learn to you know there's 860 and there's"}, {"start": 1181.16, "end": 1186.6000000000001, "text": " 440 of a thing that should actually be symmetric right we do expect a drop"}, {"start": 1186.6000000000001, "end": 1192.48, "text": " when there's damage but it's not symmetric which means that also the hebian"}, {"start": 1192.48, "end": 1198.48, "text": " rules they kind of randomly focus on one over the other but at least they're"}, {"start": 1198.48, "end": 1205.6, "text": " able in some degree to adapt to both and that's because it depending on the"}, {"start": 1205.6, "end": 1210.04, "text": " input you know it has a rule in there that basically says well if the if the"}, {"start": 1210.04, "end": 1215.3600000000001, "text": " back left leg and the front right leg you know if they fire together then I"}, {"start": 1215.3600000000001, "end": 1221.28, "text": " want to if they if they fire together the sensors that show me that they're"}, {"start": 1221.28, "end": 1225.08, "text": " moving if they fire together I'm gonna wire them together because that's how I"}, {"start": 1225.08, "end": 1231.24, "text": " walk you know from right back left and then the other way around and if that's"}, {"start": 1231.24, "end": 1235.04, "text": " not the case I'm not going to wire them together so that would be the situation"}, {"start": 1235.04, "end": 1240.08, "text": " where we have damage instead if they are not wire together I'm going to and"}, {"start": 1240.08, "end": 1243.4399999999998, "text": " can do this in the next layer of the neural network why are these other two"}, {"start": 1243.4399999999998, "end": 1248.1599999999999, "text": " things together you know if if the first thing is not the case I'm gonna wire"}, {"start": 1248.1599999999999, "end": 1253.96, "text": " these other two things together to make up for that loss and there you can see"}, {"start": 1253.96, "end": 1259.48, "text": " there is kind of this logic built into the network now again I know you can do"}, {"start": 1259.48, "end": 1264.72, "text": " this with learning a fixed policy you can achieve the same effects the point"}, {"start": 1264.72, "end": 1271.08, "text": " here is just to show that given kind of a same size networks and so on there"}, {"start": 1271.08, "end": 1277.1200000000001, "text": " you that there might be there might be like a qualitative difference in certain"}, {"start": 1277.1200000000001, "end": 1281.92, "text": " situations again by no means this is meant to outcompete or else or anything"}, {"start": 1281.92, "end": 1289.8000000000002, "text": " like this okay so we'll we went there now how are these rules actually"}, {"start": 1289.8000000000002, "end": 1295.2, "text": " learned and there we have to again make a distinction that is completely separate"}, {"start": 1295.2, "end": 1300.68, "text": " from the heavy and non-hebbing way okay so the heavy and non-hebbing"}, {"start": 1300.68, "end": 1305.8000000000002, "text": " distinction was do we learn the weights of the policy network directly or do we"}, {"start": 1305.8000000000002, "end": 1311.52, "text": " learn the rules to update the weights now the question is whatever we learn how"}, {"start": 1311.52, "end": 1316.76, "text": " do we learn it and again we have to draw the distinction this time between I'm"}, {"start": 1316.76, "end": 1321.44, "text": " gonna say classic or even though the terminology is not really correct classic"}, {"start": 1321.44, "end": 1329.8799999999999, "text": " rl and evolutionary methods okay so in classic or l what I would do is I would"}, {"start": 1329.8799999999999, "end": 1336.96, "text": " use my weights in order to obtain a reward and then I would update my weights"}, {"start": 1336.96, "end": 1346.96, "text": " so my delta w would be proportional to the gradient of w of the reward okay so"}, {"start": 1346.96, "end": 1352.48, "text": " in the classic or especially in this is a policy gradient method right now so"}, {"start": 1352.48, "end": 1356.56, "text": " I use my policy my weights together reward and then I would calculate a"}, {"start": 1356.56, "end": 1361.72, "text": " gradient and you know usually the reward isn't differentiable so you have"}, {"start": 1361.72, "end": 1366.64, "text": " this reinforced trick in order to pull out the reward out and you you can"}, {"start": 1366.64, "end": 1372.64, "text": " read all of this up if you look at policy gradient the basic policy gradient"}, {"start": 1372.64, "end": 1379.8000000000002, "text": " methods but this here tells me I need a gradient usually this is going to be"}, {"start": 1379.8000000000002, "end": 1391.24, "text": " the reward times the gradient of my fw of my input so what this means is what"}, {"start": 1391.24, "end": 1398.56, "text": " this means is that if my reward is high then I just want to know what do I need"}, {"start": 1398.56, "end": 1405.36, "text": " to do to make more of what I just did okay and the gradient ensures that for"}, {"start": 1405.36, "end": 1412.68, "text": " every single weight in your neural network you know what to do so the gradient"}, {"start": 1412.68, "end": 1417.52, "text": " means that I have an exact handle on how do I need to change this weight how"}, {"start": 1417.52, "end": 1422.48, "text": " do I need to change that weight how do I need to change this weight in order if"}, {"start": 1422.48, "end": 1427.6, "text": " the reward is high and because of this multiplication here I want to make more"}, {"start": 1427.6, "end": 1432.24, "text": " of what I just did and the gradient tells me how if the reward is low on the"}, {"start": 1432.24, "end": 1437.32, "text": " other hand I want to make less of what I just did but also the gradient tells"}, {"start": 1437.32, "end": 1442.24, "text": " me how that can be achieved I simply go into the other direction than I would if"}, {"start": 1442.24, "end": 1447.28, "text": " the reward is high in evolutionary methods we don't have we don't do this"}, {"start": 1447.28, "end": 1452.28, "text": " gradient calculation okay now there there can be advantages to not doing"}, {"start": 1452.28, "end": 1457.0, "text": " gradient calculation sometimes backpropagation simply isn't possible even if"}, {"start": 1457.0, "end": 1463.24, "text": " it is possible and this is maybe the case where we are now what we need to"}, {"start": 1463.24, "end": 1467.96, "text": " learn in our case is these rules to update the rules and imagine you have an"}, {"start": 1467.96, "end": 1472.68, "text": " episode and that's kind of episode that that that you have step step step"}, {"start": 1472.68, "end": 1477.64, "text": " and in each step these rules are applied right in each of these steps the rules"}, {"start": 1477.64, "end": 1483.3600000000001, "text": " are applied and at the end you get a reward so what you need to do is to back"}, {"start": 1483.3600000000001, "end": 1489.1200000000001, "text": " propagate that reward through all the steps and then through all the rules okay"}, {"start": 1489.1200000000001, "end": 1493.44, "text": " and that might be just computationally not feasible or the rules the rules"}, {"start": 1493.44, "end": 1499.64, "text": " right here are pretty pretty easy but the rules might not be differentiable you"}, {"start": 1499.64, "end": 1505.16, "text": " actually have the same problem in general in classic or else well but you know"}, {"start": 1505.16, "end": 1509.44, "text": " you can cut off time steps and so on there are various hacks in any case there"}, {"start": 1509.44, "end": 1514.2800000000002, "text": " can be advantages to not having that gradient and evolutionary methods are a"}, {"start": 1514.2800000000002, "end": 1520.48, "text": " way to do that in evolutionary method usually you are don't train one agent you"}, {"start": 1520.48, "end": 1527.0400000000002, "text": " train a population of agents so you have a bunch of these neural network agents"}, {"start": 1527.04, "end": 1532.96, "text": " in here and the way you update the neural network agent is you simply let them"}, {"start": 1532.96, "end": 1539.72, "text": " run you know you let them run your episode so this is your W one of them you"}, {"start": 1539.72, "end": 1546.28, "text": " let them run the episode they get a reward and then you can do multiple things so"}, {"start": 1546.28, "end": 1550.2, "text": " this depends on the evolutionary method so you can either pick out the best"}, {"start": 1550.2, "end": 1557.6000000000001, "text": " performing agent or you can update each agent according to some rule the goal"}, {"start": 1557.6000000000001, "end": 1563.24, "text": " here is simply to basically you always want to take your weights you want to add"}, {"start": 1563.24, "end": 1568.8, "text": " some noise to them and you want to see does it get better or worse if it gets"}, {"start": 1568.8, "end": 1574.24, "text": " better good if it gets worse not good okay the difference is without the gradient"}, {"start": 1574.24, "end": 1578.32, "text": " you don't have a handle on how do you need to change each individual weight all"}, {"start": 1578.32, "end": 1581.8, "text": " you can do is basically random walk and observe what happens and if the"}, {"start": 1581.8, "end": 1586.6799999999998, "text": " random walk is you know turns out to be good you go more into that direction of"}, {"start": 1586.6799999999998, "end": 1594.0, "text": " that random walk so it's sort of a sort of a poor poor man's gradient method in"}, {"start": 1594.0, "end": 1598.24, "text": " these evolutionary methods again completely independent of what we learn you"}, {"start": 1598.24, "end": 1603.1599999999999, "text": " can use the evolutionary method to learn the fixed weights and that's what"}, {"start": 1603.16, "end": 1608.52, "text": " actually what happens in the table I've shown you below or you can use the"}, {"start": 1608.52, "end": 1612.52, "text": " evolutionary method to learn the heavy and uptake rules as well you can use"}, {"start": 1612.52, "end": 1616.64, "text": " RL to learn the fixed weight or the uptake rules in this paper they use"}, {"start": 1616.64, "end": 1621.64, "text": " evolutionary methods to learn the heavy and uptake rules and they compare"}, {"start": 1621.64, "end": 1630.2, "text": " mostly with using evolutionary methods to learn the fixed weights okay the exact"}, {"start": 1630.2, "end": 1636.56, "text": " evolutionary step they use right here is the following so ht here is going to be"}, {"start": 1636.56, "end": 1641.3600000000001, "text": " the thing that you learn now as compared to w being the network weights h is"}, {"start": 1641.3600000000001, "end": 1647.24, "text": " going to be the heavy and weights since we learn the heavy and weights so how"}, {"start": 1647.24, "end": 1653.16, "text": " they'll update each agent is going to be they'll take the heavy and weights and"}, {"start": 1653.16, "end": 1658.88, "text": " this this here is how you update right this is your delta h how do you update the"}, {"start": 1658.88, "end": 1666.8400000000001, "text": " heavy and weights well what you do is you you perform in random perturbations so"}, {"start": 1666.8400000000001, "end": 1673.0800000000002, "text": " I take my weights and I add noise I just add noise okay so I I'm here and I"}, {"start": 1673.0800000000002, "end": 1679.44, "text": " just make a bunch of versions of it and then I observe how well are these"}, {"start": 1679.44, "end": 1683.96, "text": " versions doing so how well are my random perturbations doing this is going to"}, {"start": 1683.96, "end": 1688.48, "text": " be the fitness f i right here is going to be the fitness and then I'm just going"}, {"start": 1688.48, "end": 1695.96, "text": " to perform a weighted average so this is my weighted average of these new"}, {"start": 1695.96, "end": 1702.84, "text": " solutions okay so if this solution here did pretty well and this solution did"}, {"start": 1702.84, "end": 1708.68, "text": " pretty poorly I want to walk you know in this direction and then again I do the"}, {"start": 1708.68, "end": 1715.28, "text": " same thing here from here I do a bunch of perturbations and maybe this one did"}, {"start": 1715.28, "end": 1719.2, "text": " pretty well and this one did pretty poorly I want to walk in this direction and"}, {"start": 1719.2, "end": 1727.96, "text": " so on okay so that's how you you'll change the you'll change weights or rules or"}, {"start": 1727.96, "end": 1733.8799999999999, "text": " whatever you want in an evolutionary method is you know it's pretty easy it's"}, {"start": 1733.8799999999999, "end": 1739.8, "text": " easier than reinforcement learning no backprop no nothing basically blackbox"}, {"start": 1739.8, "end": 1746.28, "text": " optimizer there are more complicated evolutionary methods but no we don't go"}, {"start": 1746.28, "end": 1754.24, "text": " into those here right now okay so again I've already shown you these results"}, {"start": 1754.24, "end": 1759.08, "text": " now I said these static weights are also with evolutionary method they also"}, {"start": 1759.08, "end": 1766.0, "text": " report what you would get with like a RL approach like PPO you would get kind"}, {"start": 1766.0, "end": 1775.0, "text": " of the same thing as they get as they get here so oh sorry this is not the same"}, {"start": 1775.0, "end": 1780.04, "text": " as the table yeah I was confused for a for a second this here is for the car"}, {"start": 1780.04, "end": 1786.08, "text": " environment okay this is this vision-based environment so with their method"}, {"start": 1786.08, "end": 1792.72, "text": " they get like an 870 rewards with the heavy and based approach with the"}, {"start": 1792.72, "end": 1797.72, "text": " static weight but still evolutionary method they get a much lower reward in"}, {"start": 1797.72, "end": 1803.16, "text": " fact the heavy and based approach is about the same as you get here with an"}, {"start": 1803.16, "end": 1811.48, "text": " RL algorithm and as we said the RL algorithm more complicated and if you use"}, {"start": 1811.48, "end": 1816.44, "text": " like a if you use like a state of the art or algorithm not just PPO you get a"}, {"start": 1816.44, "end": 1821.88, "text": " bit of a better performance but not that much if you look at if you look at the"}, {"start": 1821.88, "end": 1827.8000000000002, "text": " actual numbers so you know pretty cool to see that again this is not out"}, {"start": 1827.8000000000002, "end": 1835.24, "text": " performing anything this is simply showing that you can do that they do a"}, {"start": 1835.24, "end": 1840.1200000000001, "text": " number of experiments where they go in the episode and they kind of change"}, {"start": 1840.1200000000001, "end": 1846.2800000000002, "text": " stuff in the episode and one cool thing here is that they go and you know this"}, {"start": 1846.2800000000002, "end": 1851.16, "text": " is an episode so at the episode you start with a random network each time in"}, {"start": 1851.16, "end": 1856.88, "text": " this heavy and setting and then pretty quickly the rules adapt for a high"}, {"start": 1856.88, "end": 1862.5600000000002, "text": " performing right so it starts to walk it reconfigures itself and starts to walk"}, {"start": 1862.5600000000002, "end": 1866.96, "text": " the reward here again it doesn't have access to that but we can measure it of"}, {"start": 1866.96, "end": 1873.6000000000001, "text": " course and then that's the step a right here they simply go to the weights and"}, {"start": 1873.6000000000001, "end": 1878.8000000000002, "text": " zero them out so they just delete these weights right here and only 10"}, {"start": 1878.8, "end": 1885.52, "text": " time steps later it has reconfigured itself as you can see right here in order"}, {"start": 1885.52, "end": 1890.36, "text": " to walk again so 10 time steps later reconfigures itself reconfigures itself"}, {"start": 1890.36, "end": 1895.6, "text": " and after a short while right here it's back to its kind of original"}, {"start": 1895.6, "end": 1904.08, "text": " performance as you can see so that's I'd say that's fairly fairly impressive in"}, {"start": 1904.08, "end": 1909.8799999999999, "text": " this very short amount of time able to recover from such an intervention if"}, {"start": 1909.8799999999999, "end": 1914.28, "text": " you do this I mean of course if you do this to your policy network that's"}, {"start": 1914.28, "end": 1918.0, "text": " statically learned it's going to be garbage but I guess the fair comparison"}, {"start": 1918.0, "end": 1924.8799999999999, "text": " would be to delete the heavy and rules themselves and you know so it's not"}, {"start": 1924.8799999999999, "end": 1930.0, "text": " like it's not like this can adapt to new situations or something like this"}, {"start": 1930.0, "end": 1934.32, "text": " this is still learned for particular environments right but the the point here"}, {"start": 1934.32, "end": 1940.32, "text": " is that you learn the rules and this is kind of a study on neuroplasticity now"}, {"start": 1940.32, "end": 1945.96, "text": " my question actually would be why this diagonal pattern appears and I have not"}, {"start": 1945.96, "end": 1954.28, "text": " seen like a clear explanation especially is this anti diagonal pattern it's not"}, {"start": 1954.28, "end": 1958.76, "text": " so much here in the output layer right this is the output layer there are"}, {"start": 1958.76, "end": 1965.32, "text": " 21 actions or so and this one is this this dimension so not that much there"}, {"start": 1965.32, "end": 1969.8, "text": " but there seems to be this rule and this is not the case at the beginning"}, {"start": 1969.8, "end": 1974.48, "text": " right you saw the beginning you saw at the beginning it was pretty random"}, {"start": 1974.48, "end": 1983.56, "text": " matrix so why why yeah here pretty random and then there's this diagonal"}, {"start": 1983.56, "end": 1989.8, "text": " pattern I don't know why if you know let me know I mean it's anti diagonal maybe"}, {"start": 1989.8, "end": 1994.12, "text": " it it is actually diagonal and the forward the fully connected layer is just"}, {"start": 1994.12, "end": 2003.12, "text": " defined as something like Wt times x and but maybe this also depends on the"}, {"start": 2003.12, "end": 2009.24, "text": " random initialization but there is no inherent way why particular neuron would"}, {"start": 2009.24, "end": 2018.36, "text": " you know care about sending information to like the same height of neuron on the"}, {"start": 2018.36, "end": 2024.56, "text": " other side or is there I don't know I'm so is this a property of the"}, {"start": 2024.56, "end": 2031.0, "text": " evolutionary or the learning rules it seems not because the learning rules don't"}, {"start": 2031.0, "end": 2038.84, "text": " depend on the position I'm genuinely confused about this and maybe you know"}, {"start": 2038.84, "end": 2042.9199999999998, "text": " maybe they've written it somewhere and I've just overlooked it though I they"}, {"start": 2042.9199999999998, "end": 2046.72, "text": " do reference it they say oh there's this diagonal pattern appearing but I"}, {"start": 2046.72, "end": 2054.68, "text": " don't think they ever say why it is diagonal okay I might just be I might just"}, {"start": 2054.68, "end": 2060.0, "text": " be real dumb yeah so they also you know they do some more experiments they show"}, {"start": 2060.0, "end": 2065.3199999999997, "text": " for example that if you just have random heavy in coefficients then your"}, {"start": 2065.32, "end": 2071.36, "text": " algorithm just jumps around kind of in in weight space around the zero point"}, {"start": 2071.36, "end": 2074.44, "text": " however if you actually learn these heavy in coefficients as they do you have"}, {"start": 2074.44, "end": 2080.28, "text": " like this clear attractor here and you have these kind of oscillating curves"}, {"start": 2080.28, "end": 2086.1600000000003, "text": " when you know when you do that and you can see here in the different"}, {"start": 2086.1600000000003, "end": 2091.48, "text": " situations where things are damaged and so on so all in all I think it's a"}, {"start": 2091.48, "end": 2098.12, "text": " pretty interesting study and I think this neuroplasticity is it's a different"}, {"start": 2098.12, "end": 2102.12, "text": " way you know it's unclear to say if it will ever deliver the the performance that"}, {"start": 2102.12, "end": 2107.36, "text": " RL delivers but certainly there are situations where such plasticity is"}, {"start": 2107.36, "end": 2112.4, "text": " desired and if we can also combine this with greater generalization"}, {"start": 2112.4, "end": 2117.48, "text": " performance then you know we have agents that can quickly kind of reconfigure"}, {"start": 2117.48, "end": 2123.84, "text": " and a lot of work by these these kind of open-ended learning community also"}, {"start": 2123.84, "end": 2128.84, "text": " plays into this roles all in all pretty pretty cool non-standard way of"}, {"start": 2128.84, "end": 2134.4, "text": " doing things last thing the broader impact statement every now and then we'll"}, {"start": 2134.4, "end": 2137.92, "text": " look at a broader impact statement since these are new just to get kind of an"}, {"start": 2137.92, "end": 2141.04, "text": " overview of what they look like so they say the ethical and futures"}, {"start": 2141.04, "end": 2145.04, "text": " societal consequence of this work are hard to predict but likely similar to"}, {"start": 2145.04, "end": 2150.56, "text": " other work dealing with more adaptive agents and robots in particular by"}, {"start": 2150.56, "end": 2154.0, "text": " giving the robust ability to still function when injured could make it easier"}, {"start": 2154.0, "end": 2159.32, "text": " from them being deployed in areas that have both a positive and negative"}, {"start": 2159.32, "end": 2165.92, "text": " impact on society okay well again this it's it's not really giving robots the"}, {"start": 2165.92, "end": 2170.4, "text": " ability to still function when they're injured I first I thought first I thought"}, {"start": 2170.4, "end": 2176.76, "text": " okay they train it when it's fully functioning but then they damage it"}, {"start": 2176.76, "end": 2182.88, "text": " during test time but as I understand it as I understand the paper they already"}, {"start": 2182.88, "end": 2188.2400000000002, "text": " train it with the damaged versions they just don't tell the algorithm in which"}, {"start": 2188.2400000000002, "end": 2196.0, "text": " version it is right now so it's not the same as being able to work when"}, {"start": 2196.0, "end": 2200.72, "text": " injured unless you specifically trained for it in this case again I could be"}, {"start": 2200.72, "end": 2206.04, "text": " wrong about this yeah in the very long-term robots that can adapt could help in"}, {"start": 2206.04, "end": 2211.56, "text": " industrial automation or help to care for the elderly on the other hand more"}, {"start": 2211.56, "end": 2216.8, "text": " adaptive robots could also be more easily used for military applications the"}, {"start": 2216.8, "end": 2219.8, "text": " approach presented papers far from being deployed in these areas but it's"}, {"start": 2219.8, "end": 2225.4, "text": " important to discuss its potential long-term consequences early on now okay"}, {"start": 2225.4, "end": 2230.96, "text": " so let's evaluate the broader impact statement let's well the first check to do"}, {"start": 2230.96, "end": 2238.2000000000003, "text": " is always to simply replace whatever their method is with the word technology"}, {"start": 2238.2000000000003, "end": 2247.28, "text": " okay so let's do that in the very long-term technology could help in"}, {"start": 2247.28, "end": 2251.88, "text": " industrial automation or help to care for the elderly check on the other hand"}, {"start": 2251.88, "end": 2258.92, "text": " technology could also be more easily used for military application check technology"}, {"start": 2258.92, "end": 2264.04, "text": " is far from being deployed in these areas okay I guess some technology isn't"}, {"start": 2264.04, "end": 2271.0, "text": " but advanced technology yeah so again the rule for broader impact statement"}, {"start": 2271.0, "end": 2278.08, "text": " seem to be you take whatever your method is and you go up until you find you"}, {"start": 2278.08, "end": 2283.2, "text": " know you're basically at technology or something equivalent because no one"}, {"start": 2283.2, "end": 2287.16, "text": " actually I've never seen a broader impact statement that writes about the"}, {"start": 2287.16, "end": 2293.3199999999997, "text": " actual thing in the paper they always go up like one layer or two and then it"}, {"start": 2293.3199999999997, "end": 2300.2799999999997, "text": " basically regresses to technology even though very few papers actually would be"}, {"start": 2300.2799999999997, "end": 2306.92, "text": " able to discuss their particular thing but you know and that and then in terms"}, {"start": 2306.92, "end": 2310.7200000000003, "text": " of guidelines on broader impact statement this one is missing there's there's"}, {"start": 2310.7200000000003, "end": 2315.56, "text": " always this the holy trifecta so the holy trifecta is you go like a you know"}, {"start": 2315.56, "end": 2319.84, "text": " like you're a you're a Catholic you go with your finger to your head chest"}, {"start": 2319.84, "end": 2325.7200000000003, "text": " left and right and you say technology good technology bad technology biased"}, {"start": 2325.7200000000003, "end": 2330.28, "text": " okay so if you want to write a broader impact statement go up the layers"}, {"start": 2330.28, "end": 2338.88, "text": " technology good bad bias and we're missing the bias here so that's you know I'm"}, {"start": 2338.88, "end": 2342.32, "text": " just following what these guidelines to broader impact statements are I don't"}, {"start": 2342.32, "end": 2347.76, "text": " make the rules I'm sorry the the heavyens make the rules apparently I'm not"}, {"start": 2347.76, "end": 2353.5600000000004, "text": " heavy in okay I hope you've enjoyed this paper and this video let me know"}, {"start": 2353.5600000000004, "end": 2358.44, "text": " what you think check out the videos that they have I'll link them and with"}, {"start": 2358.44, "end": 2363.36, "text": " that I wish you a pleasant day bye bye"}] |
Yannic Kilcher | 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 Yannis Kepler University in Lins 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 achieved state of the art in a task that is specifically suited to this type of attention. All right, 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, you know, sharing it out and I hope you're enjoying this. All right, 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 artist's accord 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, one zero, one zero, zero, or one one zero, one zero. 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 one one zero. 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 one one zero, maybe this is one one zero. 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 one zero one 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 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 dimension of the patterns. And here I guess that would 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. Okay, 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 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 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. All right. 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 only two 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 psi 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 back prop or something to use gradient descent to 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 you have too many patterns stored, it might also fail. Alright. So they say what the update rules are 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 are 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, oh, I have something like this. It's this right here. Okay. So the connection to attention mechanism should become pretty, pretty obvious right now. But you know, 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 and 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 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 I 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 squared 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 transformers. 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, Sepho, I remember this saloon 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 or 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 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, then this outputs the adjective vector, then because the inner product between the two things is high, this will be routed here. So attention mechanism is 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 ask 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. But 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, this actually matches because my, well, my is also very important for cat. This, this is just an accident. I did not plan this. This here, this is also well, many things match, but in our example, we would just say that this last one, 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'm going to draw the old query in blue. So you see that it's, 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 hot field 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. In our 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 hot field 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. Right. And with each time, I refine, refine, refine until I decide on a pattern. The hot field 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 hot field 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 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 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? All right. So here you can see it in the diagram. The only thing differing this from a hotfield 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 multiplied the queries and the keys. Do you want to do multiple updates if yes. So if you're in this hotfield 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 somehow clear that the attention mechanism is simply a one step hotfield network pattern retrieval algorithm with a particular update rule that is, uh, 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, um, 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 hotfield networks and then this kind of discovered that it's like the transformer will maybe never find out. Okay. So, um, let's go. There are a couple of theorems. I believe there are four five theorems right here that show that kind of makes some points about this about this stuff. And we'll go through them. We 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 hotfield 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 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 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 that this convergence holds as t goes to infinity for some stationary point. Furthermore, this quantity here goes to zero. So, that means this is 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 converge. 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 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, basically saying that here we, oh, this is not the loss, I'm sorry, no, this is the domain. Never mind, I am 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 hotfield 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 just a space. Now they consider patterns of the, on the sphere, but we'll just conceptualize it as this, we'll have a space, and 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 xi is retrieved if the iteration equation 3 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 xi. This is the actual pattern, and you have xi star. This is the retrieved pattern. So, these hopefully, they don't always have to give you the same thing that you stored. That's part of the nature of continuous neural networks, well not. 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, wherever I want, it will always converge to a point that's inside the sphere. 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. 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 guarantee it. Now, there are going to be theorems that deal exactly with this retrieval error. But first, you can see that here, 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, 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 something in the middle. I converge to maybe this point right here. And that's going to be one of these meta-stable states. 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, or 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 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, 1 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 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 accept these constants, you know, in a particular fashion, such that this is given and so on. But they say, you know, examples here, are where c is something like three, and d is 20. And so, if you were to add a 21st dimension, then your, I guess, storage capacity would increase by a factor of three, which 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 will 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 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 re-way 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 force says, with query xi, 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 xi 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, it might be a bit of, 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 company, in paper, they do this multi-instance learning with giant sets on using these hotfield 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 have this input right here and you go through layer, layer, layer, layer, layer. And in each layer, there's contained in it in one of these attention mechanism, right? This entire thing is in this layer, okay? And now, if you interpret this as a hotfield 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, you know, 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 to it reads are apart. So, what you'll simply do is you'll measure that, and if that is small enough, then 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 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 hotfield network, because it's a well, in a hotfield network, you would do multiple steps. But wait, wait, we can actually prove that even if you interpret it as a hotfield network, it can it usually converges after one step. So, what you're actually doing in a transformer is applying a hotfield network update rule to convergence. So, yeah, I'm not, yeah, I might be big-crying on a high level here, luxury problems. Theorem 5 then says, so Theorem 4 is how fast does this converge? Theorem 5, the last Theorem right here says that the retrieval error of a pattern, then 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, if we go quickly through them, again, Theorem's 1 and 2 deal with the convergence of this algorithm and the fact that it actually minimizes the proposed energy, then Theorem 3 says you can store exponentially many patterns in terms of the dimension of your space. And Theorem's 4 and 5 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, 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 burped model. So they take a pre-trained burped model from, I guess, from Hanging Face and they run, they just run a dataset through it. And what they do is, so for each, for each query, I'm sorry, for each attention head, because if multiple ones of these attention heads, in each layer, so each layer you have multiple ones of these heads, for each head, they look at over the course of the whole dataset. How do these softmax distributions look like? So, when you believe that this is a hotfield 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 would 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 hotfield 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 percent? So, it depends a bit on the temperature of the softmax, which is hard coded in attention mechanism, ptbd1, this squared over d. So, they say how many do we need to add to get to 0.9 to 90 percent of the mass of this distribution? And if this is the hotfield 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 percent, 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 converges 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 word to deck, you know, assign each word of 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 reach the 90 percent, okay? And there is an in-between, and these are called these meta-stable states where, and 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 hotfield 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 the distribution, if we start here, writing, we converge to this, the distribution would look something like small, 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 asked the query. Okay, 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 Tis here, this seems 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 the 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, 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 we can sort of conclude, in this particular attention head, this is very specific, it looks at its input, it looks 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 averaging, it's 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, and median it collects information from 231 of them, okay? So you can see that this corresponds, this green and orange ones correspond to these meta-stable states, where there's kind of an implicit clustering done in the space of attention, whereas the blue ones they correspond to attention heads 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 bars to get to the 90% or any, you'd 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 bird model on the bottom of 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 you interpret this as you as you want, I'm going to leave this up to you, but it 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 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 must be a no way true, this is maybe thinking, and this here this might already be output again, because after that you have language modeling or classification, so this might already be like aggregating types of information, this is how I sort of interpret it, okay, so these experiments are pretty pretty interesting, and here they have, 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 gousians, but in this case they simply average, and they show that look if I replace layer one with just averaging, the perplexity doesn't rise that much, right, so it's pretty good, even if I replace an entire layer here with averaging, it perplexity goes more up, and you can see the correspondence if you remember the previous plot, the correspondence is pretty one to one with how much blue and green heads there are, as can 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 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 face transition right here, this is the blue line by the way, the blue training line, a face transition, where all of a sudden 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 a specializing, 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, is they 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 we need more attention heads for this, I don't know, it's just, I think this is just the beginning of kind of research in this direction, I think, just this kind of number K, 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 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 like spend one minute looking at it, so you have these set classification, 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, and then a different human has a difference, that 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, or like a combination, but you don't have labels for the individual ones, and you have different ones per human, then they are different lengths, all of this is just a giant task, and you have many of them, you have tens of thousands per human, right, so they build a system here where first they do these 1D convolutions to process the inside sequences, and then they do this Hopfield attention mechanism, or with learned queries over these things, and then they train on the output label, and surprisingly that actually works, even with tens of thousands of inside sequences, and only one label for all of them, and so 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 two convergence, is there something good about not running it to 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 enjoyed 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 it next time, bye bye. | [{"start": 0.0, "end": 5.72, "text": " Hi there. Today we'll look at Hopfield Networks is all you need by researchers from the"}, {"start": 5.72, "end": 12.68, "text": " Yannis Kepler University in Lins and the University of Oslo. So on high level this paper"}, {"start": 12.68, "end": 19.0, "text": " proposes a new type of Hopfield Networks that generalizes modern Hopfield Networks from"}, {"start": 19.0, "end": 26.0, "text": " binary patterns to continuous patterns and then shows that the retrieval update rule of"}, {"start": 26.0, "end": 32.24, "text": " these new Hopfield Networks is equivalent to the attention mechanism that's used in modern"}, {"start": 32.24, "end": 39.120000000000005, "text": " transformers. And it's actually a more general formulation of the attention mechanism and therefore"}, {"start": 39.120000000000005, "end": 46.92, "text": " it can be used to do kind of a variety of things to improve modern deep learning. And it also has a"}, {"start": 46.92, "end": 53.68, "text": " companion paper where it applies this to some kind of immunology research and gets achieved"}, {"start": 53.68, "end": 61.519999999999996, "text": " state of the art in a task that is specifically suited to this type of attention. All right, let's"}, {"start": 61.519999999999996, "end": 68.72, "text": " dive in together. We'll go over what this paper does, what it proposes and so on. If you like"}, {"start": 68.72, "end": 75.03999999999999, "text": " pay, if you like videos like this, consider subscribing, you know, sharing it out and I hope you're"}, {"start": 75.03999999999999, "end": 83.28, "text": " enjoying this. All right, also thanks to my Discord community for you know, very helpful bringing"}, {"start": 83.28, "end": 90.48, "text": " me up to speed on this paper. Super interesting discussions there. If you're not on the artist's"}, {"start": 90.48, "end": 100.16, "text": " accord yet, I invite you to join. It's fun. Okay, so what is a Hopfield Network? A Hopfield Network"}, {"start": 100.16, "end": 110.88, "text": " is a pretty kind of old style, old conceptualization of a neural network. So in a Hopfield Network,"}, {"start": 110.88, "end": 118.32, "text": " what your goal would be is you can conceptualize it as a bit of a neural network. So let's say we have"}, {"start": 119.03999999999999, "end": 125.28, "text": " five neurons or something like this. What your goal would be is to have a neural network where you"}, {"start": 125.28, "end": 133.92, "text": " can store so-called patterns. And a pattern in this case would be a binary string of size five."}, {"start": 133.92, "end": 142.07999999999998, "text": " So for example, one zero, one zero, zero, or one one zero, one zero. And you'd have a list of"}, {"start": 142.07999999999998, "end": 148.32, "text": " these patterns. And what your goal would be is to store these patterns in the neural network"}, {"start": 148.32, "end": 153.6, "text": " such that in here, you know, we'll just consider everything to be sort of connected to everything else."}, {"start": 154.39999999999998, "end": 162.88, "text": " And what your goal would be in this is that you can kind of store patterns inside this neural"}, {"start": 162.88, "end": 169.76, "text": " network and you adjust the weights somehow. So this was, as I said, this was this was this is kind"}, {"start": 169.76, "end": 177.04, "text": " of an old model. You store, you adapt the weights such that you store these patterns. And what does"}, {"start": 177.04, "end": 182.88, "text": " it mean for a pattern to be stored? If you have stored a pattern, you can you will then be able to"}, {"start": 182.88, "end": 190.64, "text": " retrieve it. And you retrieve a pattern in these kind of old style Hopfield Networks by providing a"}, {"start": 190.64, "end": 198.48, "text": " partial pattern. So what you'll say is, for example, I, I want a pattern that starts with one one zero."}, {"start": 198.48, "end": 204.23999999999998, "text": " And you give that to the network. And there would be a so called update rule. And the update rule is"}, {"start": 204.23999999999998, "end": 212.72, "text": " kind of an internal rule. So let's just go through this. So here this one one zero, maybe this is one"}, {"start": 212.72, "end": 220.07999999999998, "text": " one zero. And then they would kind of send messages around. So this update rule would somehow adjust"}, {"start": 220.08, "end": 227.92000000000002, "text": " the value of this and this neuron here to what's most compatible with the network weights. And if"}, {"start": 227.92000000000002, "end": 233.60000000000002, "text": " if the network weights have been adjusted correctly, this will turn out then at the end of applying"}, {"start": 233.60000000000002, "end": 240.88000000000002, "text": " this update rule that this is a one and this is a zero. And therefore this pattern here is"}, {"start": 240.88, "end": 250.07999999999998, "text": " retrieved. Now had I input one zero one at the beginning, then the outcome would be different. Hopefully"}, {"start": 250.07999999999998, "end": 256.96, "text": " this pattern here would have been retrieved. Okay. So you can see the applications of this like you"}, {"start": 256.96, "end": 262.88, "text": " can have the first three digits as sort of a database key. And then the last ones as sort of the"}, {"start": 262.88, "end": 268.0, "text": " value that you store along with it. And then you can simply provide the first few. You can also"}, {"start": 268.0, "end": 275.92, "text": " provide you don't always have to provide three. So this all depends. This is this is sort of an"}, {"start": 275.92, "end": 281.36, "text": " as I said, an old conceptualization of neural networks. So people were imagining that this is"}, {"start": 281.36, "end": 288.8, "text": " kind of how the brain works, you know, fire together, wire together. And also with research into"}, {"start": 288.8, "end": 294.24, "text": " this, it turns out that you know, you might think, you know, there's there's kind of five neurons."}, {"start": 294.24, "end": 299.36, "text": " So maybe I can store five different patterns, you know, accurately. Because if I store too many"}, {"start": 299.36, "end": 307.2, "text": " patterns, right, if I have many many many many patterns, then I can't expect to be able to"}, {"start": 307.2, "end": 313.92, "text": " retrieve all the patterns again, because some of them will just be so equal that, you know,"}, {"start": 313.92, "end": 321.76, "text": " many will start maybe with this. And I won't have a chance to to retrieve the one I want. Or the"}, {"start": 321.76, "end": 326.71999999999997, "text": " update rule will make a mistake. So you might think this might be like five because I five neurons"}, {"start": 326.71999999999997, "end": 333.59999999999997, "text": " or maybe 10 because I have 10 connections, but it turns out that in modern hopfield networks with"}, {"start": 333.59999999999997, "end": 340.88, "text": " the appropriate update rule, you can store exponentially many patterns in these networks,"}, {"start": 340.88, "end": 347.52, "text": " exponentially many in the in the dimension of the dimension of the patterns. And here I"}, {"start": 347.52, "end": 353.91999999999996, "text": " guess that would be the length of the pattern. So this is a little bit surprising, the kind of storage"}, {"start": 353.91999999999996, "end": 363.12, "text": " capacity of these networks. And we'll, this this paper here generalizes that to continuous"}, {"start": 364.15999999999997, "end": 370.32, "text": " to continuous states. So what do we mean with continuous states? I guess I mean continuous patterns."}, {"start": 370.32, "end": 378.08, "text": " So no longer is a pattern a binary string, but a pattern now is a string of floating point numbers."}, {"start": 378.08, "end": 385.84, "text": " Okay, like 0.5, 1.3 and so on. And you know, a string of floating or a sequence of floating point"}, {"start": 385.84, "end": 393.12, "text": " numbers is naturally depicted as a vector. Okay, so our patterns are going to be different vectors"}, {"start": 393.12, "end": 403.12, "text": " that we store. And you know, in high dimensions that the vectors will be kind of separated well"}, {"start": 403.12, "end": 410.4, "text": " from each other as long as we don't have too many. But this paper shows that all these properties"}, {"start": 410.4, "end": 416.32, "text": " for the modern hopfield networks that hold for binary strings still hold if you go to these kind"}, {"start": 416.32, "end": 425.04, "text": " of continuous to these vector patterns. That means you can store exponentially many patterns"}, {"start": 425.04, "end": 430.4, "text": " in the dimensions of the vector, which is pretty surprising, right? Because you think like, you know,"}, {"start": 430.4, "end": 437.6, "text": " after you have one vector per dimension that, you know, after that it might get a bit shaky,"}, {"start": 437.6, "end": 443.68, "text": " but no, you can actually store exponentially many. That's pretty surprising. And this paper is a"}, {"start": 443.68, "end": 450.0, "text": " lot about how to do that and the fact that that happens and so on. So we've talked about update"}, {"start": 450.0, "end": 457.28000000000003, "text": " rules for these kind of hopfield networks. And I haven't really specified what that is. I've just"}, {"start": 457.28000000000003, "end": 463.84000000000003, "text": " said that, you know, I enter a pattern and then the network does something and outcomes, outcomes"}, {"start": 463.84000000000003, "end": 470.8, "text": " the whatever the pattern that matches my query. So this here is called a query. You might already,"}, {"start": 470.8, "end": 476.64, "text": " this is on purpose, like the kind of overlap between the attention mechanism,"}, {"start": 477.6, "end": 483.68, "text": " lingo and the hopfield network, lingo. We're going to conflate the two to kind of make clear where"}, {"start": 483.68, "end": 489.04, "text": " the two overlap. If you don't know what an attention mechanism is or aren't familiar with it,"}, {"start": 489.04, "end": 495.2, "text": " watch my video on attention is all you need. Once you watch that, this video will make a lot more"}, {"start": 495.2, "end": 503.2, "text": " sense. All right. So in what the update rule does is specifically in the update rule that there"}, {"start": 503.2, "end": 508.88, "text": " isn't only one, right? There are many different proposals of hopfield networks and they only two"}, {"start": 508.88, "end": 514.96, "text": " different properties. But what an update rule does ultimately is it minimizes what's called an"}, {"start": 514.96, "end": 523.84, "text": " energy. So every type of hopfield network is associated with an energy function. And this the"}, {"start": 523.84, "end": 529.9200000000001, "text": " energy function of the modern hopfield network for binary strings is this energy function right here."}, {"start": 530.8000000000001, "end": 538.8000000000001, "text": " So with x, x is the pattern. The pattern, this is the kind of state of the hopfield network."}, {"start": 539.52, "end": 546.1600000000001, "text": " And these are the whatever is stored in the network. And then the psi here is the query that you"}, {"start": 546.16, "end": 555.8399999999999, "text": " enter into the network. And then the energy here tells you this quantity, you have to minimize this"}, {"start": 555.8399999999999, "end": 563.52, "text": " quantity in order to retrieve the pattern that you want. Okay. Now we are never directly working with"}, {"start": 563.52, "end": 569.8399999999999, "text": " the energy as such. So what you could do is, for example, use back prop or something to use"}, {"start": 569.84, "end": 578.5600000000001, "text": " gradient descent to decrease the energy. But usually along with an energy function comes an update"}, {"start": 578.5600000000001, "end": 583.44, "text": " function. And the update function is what I've talked about here. Like you do something and then the"}, {"start": 583.44, "end": 589.6, "text": " network does something and then you get the pattern out. What the network does is it minimizes"}, {"start": 589.6, "end": 595.9200000000001, "text": " its energy function. And the update rule is made such that the corresponding energy function is"}, {"start": 595.92, "end": 601.12, "text": " minimized. So the energy function is more like a theoretical consideration that you say, okay,"}, {"start": 601.12, "end": 608.3199999999999, "text": " here is my energy function of my hopfield network. And the there will be a corresponding update rule"}, {"start": 608.3199999999999, "end": 613.52, "text": " that minimizes that energy function. And if you use that update rule, maybe multiple times,"}, {"start": 614.0799999999999, "end": 620.0799999999999, "text": " then the energy function will be minimized and you will have retrieved your pattern. Or not,"}, {"start": 620.08, "end": 628.5600000000001, "text": " if you have too many patterns stored, it might also fail. Alright. So they say what the update rules"}, {"start": 628.5600000000001, "end": 635.2, "text": " are in the text here for the old hopfield networks. But we're not really interested in the old ones."}, {"start": 635.2, "end": 640.4000000000001, "text": " We're interested in the ones that this paper cares about. Namely, where are the patterns that you"}, {"start": 640.4000000000001, "end": 647.6800000000001, "text": " store in the hopfield network? Are these vectors over our vector patterns? And the query is also a"}, {"start": 647.68, "end": 653.8399999999999, "text": " vector pattern. So you want to store all of these patterns into the hopfield network. So I'm going"}, {"start": 653.8399999999999, "end": 660.7199999999999, "text": " to draw it like this here. I'm going to store it into the hopfield network. And then after that,"}, {"start": 660.7199999999999, "end": 668.4, "text": " you want to come up with a query. And the query is like this. And in the case of the binary strings,"}, {"start": 668.4, "end": 675.3599999999999, "text": " we had something like, well, I sort of know half of my binary string. Now in the vector"}, {"start": 675.36, "end": 683.12, "text": " hopfield network, it's more like, well, I sort of kind of know the direction that my vector should"}, {"start": 683.12, "end": 690.96, "text": " point in. Okay. And you will read what you want to retrieve is the vector that has kind of a"}, {"start": 690.96, "end": 697.52, "text": " large inner product. Okay. So if I enter this query into my hopfield network, what I hope is that"}, {"start": 697.52, "end": 703.28, "text": " this vector here is retrieved. Now you see it's not exactly the same vector like they do point if I"}, {"start": 703.28, "end": 710.3199999999999, "text": " translate that here by I it's maybe something like this. But so they are different. But"}, {"start": 711.36, "end": 716.3199999999999, "text": " you want to say, well, I kind of know what I want. I kind of want something like this. And then"}, {"start": 716.3199999999999, "end": 721.6, "text": " the hopfield network would answer with, oh, I have something like this. It's this right here. Okay."}, {"start": 721.6, "end": 729.1999999999999, "text": " So the connection to attention mechanism should become pretty, pretty obvious right now. But"}, {"start": 729.2, "end": 737.9200000000001, "text": " you know, the to actually establish this formally is the kind of the point of this paper. And"}, {"start": 737.9200000000001, "end": 744.48, "text": " you know, it's pretty cool to see. So they formulate this new energy right here. This is the energy"}, {"start": 744.48, "end": 752.24, "text": " of this new continuous hopfield network. Specifically, they have to have this term right here because"}, {"start": 752.24, "end": 758.08, "text": " they now have continuous states and continuous queries. This if you minimize the energy, it basically"}, {"start": 758.08, "end": 765.5200000000001, "text": " means that your query can never go to infinity because you have the query right here and the energy"}, {"start": 765.5200000000001, "end": 773.5200000000001, "text": " function. The update rule is this right here. And we'll look at that in a moment. But remember,"}, {"start": 774.32, "end": 783.5200000000001, "text": " the update rule is what you actually implement in code. So if I have a query right here,"}, {"start": 783.52, "end": 790.16, "text": " I plug it in here. This is the state of my hopfield network. And I apply this rule multiple times"}, {"start": 790.8, "end": 801.76, "text": " and out comes the kind of answer of the hopfield network to my question. So the I input this and"}, {"start": 801.76, "end": 809.04, "text": " the outcomes this after I update after I apply the update rule maybe multiple times right."}, {"start": 809.04, "end": 816.0799999999999, "text": " And interestingly, you can already see that this here, if you rewrite a bunch of these"}, {"start": 816.0799999999999, "end": 822.48, "text": " quantities, if you rewrite the beta here, which is the softmax temperature in a way to be one"}, {"start": 822.48, "end": 830.0799999999999, "text": " over squared of D. And if you take the query, the psi here to be the query matrix. And if you take"}, {"start": 830.0799999999999, "end": 837.68, "text": " the x here to be the key matrix, then this is equivalent to the update or sorry, the attention"}, {"start": 837.68, "end": 844.2399999999999, "text": " mechanism of a modern transformers. That's the point of the paper is that we can look at the"}, {"start": 844.2399999999999, "end": 852.3199999999999, "text": " transformer attention mechanism as a hopfield network. And they have this interesting,"}, {"start": 854.4, "end": 863.3599999999999, "text": " this interesting diagram at the end right here. So the appendix, you know, this is typical,"}, {"start": 863.36, "end": 872.0, "text": " I guess, Sepho, I remember this saloon paper had like 60 pages of machine proof appendix. This"}, {"start": 872.0, "end": 878.24, "text": " also, this has like 70 page appendix crazy. But at the end of the appendix, you'll find this"}, {"start": 878.24, "end": 886.96, "text": " diagram right here. Now, usually in an attention mechanism, you have whatever the input is. So you"}, {"start": 886.96, "end": 893.12, "text": " have an input right here. So this is attention mechanisms, or at least transformers, they work"}, {"start": 893.12, "end": 899.92, "text": " on sequences or sets of objects. And from these, you'll generate three things. You'll generate"}, {"start": 900.72, "end": 908.0, "text": " the, you'll generate the queries, the keys, and the values. Now, you can either generate the"}, {"start": 908.0, "end": 913.2, "text": " queries from the same objects, which would be self attention, or you can generate the queries from"}, {"start": 913.2, "end": 920.16, "text": " like a different object or here. It doesn't, it doesn't matter too much for our discussions."}, {"start": 920.16, "end": 927.4399999999999, "text": " But either you, you know, have a reference input or you have, you know, this kind of same input"}, {"start": 927.4399999999999, "end": 936.0799999999999, "text": " all the way. And then what you do is use three different heads or three different matrices to"}, {"start": 936.0799999999999, "end": 944.88, "text": " transform that input into queries, keys, and values. So I often conceptualize this as you have"}, {"start": 944.88, "end": 953.92, "text": " kind of your input set. And each of the input sets outputs a key. And also each one, which would"}, {"start": 953.92, "end": 963.04, "text": " be a vector. And also each one outputs a query. So I often draw this here, the same sequence."}, {"start": 963.76, "end": 971.84, "text": " And each one outputs a query. And the query sort of, the query is kind of a request for"}, {"start": 971.84, "end": 980.32, "text": " information. So the key exposes sort of what exposes something about the input here. So this could"}, {"start": 980.32, "end": 993.12, "text": " be a sentence down here. This could be my cat is very pretty. And the, the, the vector, the key vector"}, {"start": 993.12, "end": 999.44, "text": " right here could encode something like this is a noun, or this is an animal, or anything like this."}, {"start": 999.44, "end": 1009.36, "text": " Right. And the query here, it could ask for for other things. So for example, since this is cat,"}, {"start": 1009.36, "end": 1018.0, "text": " this vector right here, the query vector is generated from that, you know, token cat. Now it could"}, {"start": 1018.0, "end": 1026.0800000000002, "text": " recognize that cat is a noun. And it could ask the other nodes to basically say, are there any"}, {"start": 1026.08, "end": 1034.1599999999999, "text": " adjectives around here? Because, you know, adjectives, because it itself is a noun. It's the"}, {"start": 1034.1599999999999, "end": 1039.12, "text": " object of the sentence, right? It could ask, are there any kind of adjectives that describe the"}, {"start": 1039.12, "end": 1045.36, "text": " object? Because that would be naturally a thing to ask if you were the noun, you would want to know,"}, {"start": 1045.36, "end": 1052.96, "text": " are there any kind of modifiers for me? So it could output the query and the query here could mean,"}, {"start": 1052.96, "end": 1059.92, "text": " you know, this direction could mean adjectives. And you see here, the word pretty is an adjective."}, {"start": 1059.92, "end": 1069.68, "text": " So it itself would output a key that says, by the way, I'm an adjective, right? So if the cat asks,"}, {"start": 1069.68, "end": 1077.76, "text": " then if this node asks for an adjective, then this outputs the adjective vector, then because the"}, {"start": 1077.76, "end": 1083.92, "text": " inner product between the two things is high, this will be routed here. So attention mechanism"}, {"start": 1083.92, "end": 1089.52, "text": " is basically information routing. That's how I always describe it. But in this paper, we look at it"}, {"start": 1089.52, "end": 1098.8, "text": " more like these here are the patterns that are stored in a hopfield network. And I, by inputting"}, {"start": 1098.8, "end": 1105.36, "text": " a query and the dot product being the update rule of the hopfield network, I retrieve from the"}, {"start": 1105.36, "end": 1114.0, "text": " hopfield network, I retrieve the appropriate pattern that I ask for. Okay. And then, you know,"}, {"start": 1114.0, "end": 1120.4799999999998, "text": " the values, the values are simply a modification of the keys in this form, but a lot of people also"}, {"start": 1120.4799999999998, "end": 1128.32, "text": " do keys and values to be the same thing. But this routing of information happens here, where you"}, {"start": 1128.32, "end": 1136.24, "text": " multiply the queries and the keys, and then you put a softmax over them. Okay. So if you just"}, {"start": 1136.24, "end": 1144.1599999999999, "text": " look from the perspective of a single node, like this node here, this cat node, what it would do"}, {"start": 1144.1599999999999, "end": 1150.96, "text": " is it would inner product its own query vector with all of the key vectors, right? So it would build"}, {"start": 1150.96, "end": 1156.3999999999999, "text": " an inner product with all of these. And then it would normalize it would put it through a softmax,"}, {"start": 1156.4, "end": 1162.4, "text": " which will kind of give it a distribution. Right. So here would give it like, so this,"}, {"start": 1162.4, "end": 1168.3200000000002, "text": " this actually matches because my, well, my is also very important for cat. This, this is just an"}, {"start": 1168.3200000000002, "end": 1176.4, "text": " accident. I did not plan this. This here, this is also well, many things match, but in our example,"}, {"start": 1176.4, "end": 1185.1200000000001, "text": " we would just say that this last one, it's not only higher, it's also wider. It matches very well,"}, {"start": 1185.12, "end": 1194.3999999999999, "text": " right? And so the information routing would route mostly information from this pretty token to"}, {"start": 1194.3999999999999, "end": 1200.8, "text": " the cat token, which makes sense in our case, right? This is the attention mechanism. Now,"}, {"start": 1202.0, "end": 1210.6399999999999, "text": " since if we are interpreting this as a hopfield network, and the update rule here is the dot product,"}, {"start": 1210.64, "end": 1219.3600000000001, "text": " you can actually think of applying this rule multiple times. So what happens now if we, and this"}, {"start": 1219.3600000000001, "end": 1229.0400000000002, "text": " is where this update rule comes in, what happens if we take this distribution and we don't aggregate"}, {"start": 1229.0400000000002, "end": 1234.96, "text": " the values, like usually we would aggregate the values by this distribution. What if we aggregate"}, {"start": 1234.96, "end": 1241.28, "text": " the keys by this distribution? Okay. What comes out? Well, if we look at this, and you know,"}, {"start": 1241.28, "end": 1246.32, "text": " let's just assume that this key right here matches really well, but the others also match a little"}, {"start": 1246.32, "end": 1252.88, "text": " bit. What would come out would be a weighted average where a lot of weight is put on this particular"}, {"start": 1252.88, "end": 1259.52, "text": " key. So what will turn out would be something like something that's very close to that key, you can"}, {"start": 1259.52, "end": 1269.28, "text": " see. I'm going to draw the old key here in green, and I'm going to draw the old query in blue."}, {"start": 1270.4, "end": 1280.16, "text": " So you see that it's, whatever comes out is not the query, but it's also not that only key"}, {"start": 1280.16, "end": 1286.0, "text": " that matches, right? It's kind of a weighted average, but with that key dominating. Okay. Now,"}, {"start": 1286.0, "end": 1292.8, "text": " since, you know, in a hot field network, what we would do is we would go again. We would put this"}, {"start": 1292.8, "end": 1299.92, "text": " new thing, the red thing, instead of the query vector. Okay. So we would use this aggregated keys,"}, {"start": 1299.92, "end": 1306.64, "text": " this weighted average, as a new query vector for that node right here. So duplicate that node over"}, {"start": 1306.64, "end": 1313.12, "text": " here. I'll use that query vector again, and do the same thing again. Okay. In our product with all"}, {"start": 1313.12, "end": 1319.52, "text": " of the query vectors, and now since this is already an aggregate of the query vectors, what's going"}, {"start": 1319.52, "end": 1325.4399999999998, "text": " to happen? Of course, the distribution that's going to come out is going to be weighted even more"}, {"start": 1325.4399999999998, "end": 1334.56, "text": " heavily into the direction. So let's make it even wider into the direction of that key that matches."}, {"start": 1334.56, "end": 1343.28, "text": " Okay. And you can pretty clearly see if I do that iteratively, then that will lead to a situation"}, {"start": 1343.28, "end": 1351.2, "text": " where everything is like very low, except that one key will sort of dominate the distribution"}, {"start": 1351.2, "end": 1358.6399999999999, "text": " and ultra high and ultra wide. Okay. And that's how that's exactly how a hot field network works."}, {"start": 1358.6399999999999, "end": 1364.1599999999999, "text": " Right. I would input the query, which would be sort of what I want. Right. I kind of know what I"}, {"start": 1364.16, "end": 1371.6000000000001, "text": " want. Okay. And then I apply this rule multiple times. Right. And with each time, I refine, refine,"}, {"start": 1371.6000000000001, "end": 1377.92, "text": " refine until I decide on a pattern. The hot field network is made for pattern retrieval. And these"}, {"start": 1377.92, "end": 1383.92, "text": " here are the patterns that I want to retrieve. So here the patterns aren't kind of stored in the"}, {"start": 1383.92, "end": 1391.3600000000001, "text": " network beforehand, but the patterns are also generated like in an attention layer. So the keys"}, {"start": 1391.36, "end": 1397.76, "text": " are generated by the previous layer or by these matrices. But that doesn't matter for the hot"}, {"start": 1397.76, "end": 1403.6, "text": " field network update rule. So you see here that the attention mechanism can be interpreted as simply"}, {"start": 1403.6, "end": 1409.76, "text": " one step, making one step of this update rule. But you can think of making actually multiple"}, {"start": 1409.76, "end": 1417.04, "text": " steps and retrieving the particular key. So, you know, deciding on a sort of a hard routing"}, {"start": 1417.04, "end": 1428.1599999999999, "text": " of particular information. Now that only works if there are no other vectors that are close to"}, {"start": 1428.1599999999999, "end": 1433.52, "text": " that particular key. Right. So if the query is this and you know, the way I drew it here,"}, {"start": 1433.52, "end": 1439.36, "text": " you can see that there are many. There is this one and this one and this one that matches. So"}, {"start": 1439.36, "end": 1448.0, "text": " technically the way I drew it, what would happen most likely is no matter how many times you apply"}, {"start": 1448.0, "end": 1455.28, "text": " your update rule, it would sort of result in kind of the average of the three keys. Right. So"}, {"start": 1455.28, "end": 1461.9199999999998, "text": " because they're all matching and they would all contribute to that weighted average of the query"}, {"start": 1461.9199999999998, "end": 1466.8, "text": " in the next step. And then that means basically the conversions would be to something in the middle."}, {"start": 1466.8, "end": 1474.24, "text": " And that's going to be a central point of this paper in which situation we are. So they call the"}, {"start": 1474.24, "end": 1480.72, "text": " first part is retrieving a single pattern. And they call the second situation where you have multiple"}, {"start": 1480.72, "end": 1486.56, "text": " patterns that all match that are not well separated from each other. They call this a meta-stable"}, {"start": 1486.56, "end": 1493.68, "text": " state. And it's going to be pretty interesting to look at, transform like Bert language models and"}, {"start": 1493.68, "end": 1499.44, "text": " look at where they actually are. Are they actually operating in this single pattern retrieval mode?"}, {"start": 1499.44, "end": 1509.1200000000001, "text": " Or are they operating in the meta-stable state mode? All right. So here you can see it in the diagram."}, {"start": 1509.1200000000001, "end": 1514.88, "text": " The only thing differing this from a hotfield network, sorry from an attention mechanism,"}, {"start": 1514.88, "end": 1521.68, "text": " is this branch right here. So here you ask, do you want to do multiple updates after you've"}, {"start": 1521.68, "end": 1529.04, "text": " multiplied the queries and the keys. Do you want to do multiple updates if yes. So if you're in"}, {"start": 1529.04, "end": 1534.88, "text": " this hotfield network situation, you want to do multiple updates, then you go back as you can see."}, {"start": 1535.92, "end": 1544.96, "text": " And you do you use the keys together with the output of the softmax to generate a new query."}, {"start": 1544.96, "end": 1551.1200000000001, "text": " So this query queue here is now generated from the output here and the key. So the keys are the"}, {"start": 1551.12, "end": 1558.56, "text": " same. These are, this is the same thing. It's just put here twice. Okay. This is exactly what we"}, {"start": 1558.56, "end": 1567.28, "text": " discussed. Okay. I hope that's somehow clear that the attention mechanism is simply a one step"}, {"start": 1567.84, "end": 1575.6799999999998, "text": " hotfield network pattern retrieval algorithm with a particular update rule that is,"}, {"start": 1575.68, "end": 1582.16, "text": " uh, that is matches this energy function that they propose right here. Of course they do this,"}, {"start": 1582.16, "end": 1587.68, "text": " you know, particularly because the update rule that turns out is the transformer update rule."}, {"start": 1588.5600000000002, "end": 1593.6000000000001, "text": " But, um, I actually don't know if they backwards engineered the energy function to match the"}, {"start": 1593.6000000000001, "end": 1599.8400000000001, "text": " transformer or if they first came up with a continuous hotfield networks and then this kind of"}, {"start": 1599.84, "end": 1609.6799999999998, "text": " discovered that it's like the transformer will maybe never find out. Okay. So, um, let's go. There"}, {"start": 1609.6799999999998, "end": 1616.8, "text": " are a couple of theorems. I believe there are four five theorems right here that show that kind"}, {"start": 1616.8, "end": 1622.0, "text": " of makes some points about this about this stuff. And we'll go through them. We won't go through"}, {"start": 1622.0, "end": 1627.76, "text": " the proofs or any, you know, super in depth meaning, but it's pretty cool to go through them and"}, {"start": 1627.76, "end": 1633.28, "text": " they are proved very rigorously. As I said, there's a 70 page appendix. So, have a look at that if"}, {"start": 1633.28, "end": 1641.68, "text": " you're up for it. Okay. So, they say here we have an update rule. This is our update rule for our"}, {"start": 1641.68, "end": 1648.4, "text": " new hotfield networks. So, the first theorem they say is the update rule that we propose converges"}, {"start": 1648.4, "end": 1659.2, "text": " globally. If we apply the update rule repeatedly, the energy for t goes equals infinity and the"}, {"start": 1659.2, "end": 1665.92, "text": " energy will converge. Sorry. The energy will converge to a fixed point, this being a fixed point,"}, {"start": 1666.4, "end": 1673.44, "text": " for t equals sort of for t goes to infinity. Yeah. If this is a fixed point, basically saying that"}, {"start": 1673.44, "end": 1681.44, "text": " if I apply this update rule here over and over and over again, it will make this energy function"}, {"start": 1681.44, "end": 1688.24, "text": " converge to a fixed, it will make this energy function converge. Don't want to say anything"}, {"start": 1688.24, "end": 1695.8400000000001, "text": " mistakenly here or claim too much, but that basically connects the update rule to the energy."}, {"start": 1695.8400000000001, "end": 1701.3600000000001, "text": " Okay. So, just showing like this really is the update rule for that particular energy function."}, {"start": 1701.36, "end": 1710.9599999999998, "text": " Okay. Now, as itself, it's not super duper interesting yet, but now we get to theorem two."}, {"start": 1712.0, "end": 1717.1999999999998, "text": " So, theorem two for the iteration, that's the update rule that we just looked at."}, {"start": 1718.3999999999999, "end": 1726.56, "text": " We have that this convergence holds as t goes to infinity for some stationary point."}, {"start": 1726.56, "end": 1738.6399999999999, "text": " Furthermore, this quantity here goes to zero. So, that means this is the update at t plus one,"}, {"start": 1738.6399999999999, "end": 1746.0, "text": " and this is the update at t, and the difference between them goes to zero. So, that means not only"}, {"start": 1746.0, "end": 1752.32, "text": " does the energy converge, but the iterates themselves converge. So, the algorithm actually converges."}, {"start": 1752.32, "end": 1759.28, "text": " The individual updates of the algorithm, so this e new, at some point that will no longer change,"}, {"start": 1759.28, "end": 1766.56, "text": " because the norm between it and the previous one will go to zero. You can see that either the"}, {"start": 1766.56, "end": 1773.12, "text": " sequence here converges or in the other case, the set of limit points, yada, yada is a connecting"}, {"start": 1773.9199999999998, "end": 1780.96, "text": " subset. This is a bit over the top here. They say, okay, it can either converge to a point or"}, {"start": 1780.96, "end": 1788.96, "text": " it can converge to a connected subset, but if the loss is finite, then any sequence generated"}, {"start": 1788.96, "end": 1797.92, "text": " by the iteration equation three converges to some fixed point. So, basically saying that here we,"}, {"start": 1797.92, "end": 1806.16, "text": " oh, this is not the loss, I'm sorry, no, this is the domain. Never mind, I am an idiot."}, {"start": 1806.16, "end": 1815.52, "text": " This is basically saying that this algorithm will converge, okay. And they define here what it"}, {"start": 1815.52, "end": 1823.0400000000002, "text": " means for a pattern to be stored and retrieved, and that's for establishing what the kind of"}, {"start": 1823.0400000000002, "end": 1828.16, "text": " storage capacity of a hotfield network is. So, we've established that the update rule minimizes"}, {"start": 1828.16, "end": 1834.96, "text": " the appropriate energy, and the update rule will converge at some point, which means that we can,"}, {"start": 1834.96, "end": 1842.0, "text": " you know, if it converges, we can retrieve the pattern that it converges to. So, now we define"}, {"start": 1842.0, "end": 1846.88, "text": " how many patterns can we actually store? For that, we need to know what does it mean for a pattern"}, {"start": 1846.88, "end": 1853.8400000000001, "text": " to be stored. So, we assume that we have patterns, and these patterns are called x, okay. X i,"}, {"start": 1853.8400000000001, "end": 1860.8, "text": " we have n different patterns, each one is called x with a subscript. We assume that around every"}, {"start": 1860.8, "end": 1870.8799999999999, "text": " pattern a sphere is given. So, how do we imagine this? We have these patterns, and this is just a"}, {"start": 1870.8799999999999, "end": 1877.04, "text": " space. Now they consider patterns of the, on the sphere, but we'll just conceptualize it as this,"}, {"start": 1877.04, "end": 1881.68, "text": " we'll have a space, and there are patterns we want to store, okay. And we'll say around every"}, {"start": 1881.68, "end": 1890.48, "text": " pattern there is a sphere, okay, sphere like this. And naturally, the patterns are going to be,"}, {"start": 1890.48, "end": 1896.96, "text": " there's going to be a notion of well-separated patterns. And you can imagine this a little bit like"}, {"start": 1896.96, "end": 1902.16, "text": " these spheres won't be touching each other. If these spheres aren't touching each other,"}, {"start": 1902.16, "end": 1908.48, "text": " that means that the patterns are kind of well-separated. And that means that if we initialize the query,"}, {"start": 1908.48, "end": 1913.52, "text": " remember the query here is a vector that kind of sort of looks like a pattern, and that means"}, {"start": 1913.52, "end": 1919.04, "text": " the query is kind of close to the pattern in some notion of distance. So, if we initialize the"}, {"start": 1919.04, "end": 1931.36, "text": " query somewhere in that sphere, then it might, if it converges to that sphere, to that pattern,"}, {"start": 1931.36, "end": 1938.0, "text": " then we retrieve the pattern, okay. Now it gets a bit more complicated than this, but not much more."}, {"start": 1939.36, "end": 1947.04, "text": " We say a pattern is stored if there is a single fixed point inside the sphere, to which all points"}, {"start": 1947.04, "end": 1953.36, "text": " that start inside the sphere converge. And none of the spheres intersect. So, the sphere of"}, {"start": 1953.92, "end": 1959.52, "text": " point i doesn't intersect with the sphere of point j. So, that's where we say all these spheres are"}, {"start": 1960.24, "end": 1968.24, "text": " non-intersecting. We say xi is retrieved if the iteration equation 3 converged to the single fixed"}, {"start": 1968.24, "end": 1974.1599999999999, "text": " point in that sphere. The retrieval error is the distance. So, you'll notice you have two things."}, {"start": 1974.16, "end": 1980.3200000000002, "text": " You have xi. This is the actual pattern, and you have xi star. This is the retrieved pattern."}, {"start": 1980.3200000000002, "end": 1985.8400000000001, "text": " So, these hopefully, they don't always have to give you the same thing that you stored. That's"}, {"start": 1985.8400000000001, "end": 1993.76, "text": " part of the nature of continuous neural networks, well not. So, for every sphere, we say there is a"}, {"start": 1993.76, "end": 2003.52, "text": " pattern. There is a sphere. Now, we, as pattern is stored, if every, I can start wherever I want,"}, {"start": 2003.52, "end": 2009.68, "text": " in this sphere, wherever I want, it will always converge to a point that's inside the sphere."}, {"start": 2010.96, "end": 2015.04, "text": " And maybe that point isn't the pattern that I stored, but actually this point right here."}, {"start": 2015.04, "end": 2020.48, "text": " But wherever I start, I will always converge to that particular point. If that's the case,"}, {"start": 2020.48, "end": 2026.6399999999999, "text": " then I have stored this particular pattern. Now, the fact is I don't retrieve this particular"}, {"start": 2026.6399999999999, "end": 2031.92, "text": " pattern. I retrieve the blue thing, but I can then define the error of retrieval. The error of"}, {"start": 2031.92, "end": 2038.5600000000002, "text": " retrieval is simply the distance between the two things. Ideally, this distance is very small,"}, {"start": 2038.5600000000002, "end": 2043.8400000000001, "text": " right? But, you know, we can't guarantee it. Now, there are going to be theorems that deal"}, {"start": 2043.8400000000001, "end": 2055.2000000000003, "text": " exactly with this retrieval error. But first, you can see that here, if these spheres become larger,"}, {"start": 2055.2, "end": 2064.3199999999997, "text": " you can't accurately store a pattern anymore. So, this is the kind of ideal situation,"}, {"start": 2064.3199999999997, "end": 2069.3599999999997, "text": " but there are also situations where these spheres, if I have these patterns right here,"}, {"start": 2069.3599999999997, "end": 2076.16, "text": " these spheres are so large, kind of the attractions of the patterns are so large that if I start,"}, {"start": 2076.72, "end": 2082.96, "text": " let's say here, then I don't converge to either of these two patterns. I converge to"}, {"start": 2082.96, "end": 2088.8, "text": " something in the middle. I converge to maybe this point right here. And that's going to be one"}, {"start": 2088.8, "end": 2094.7200000000003, "text": " of these meta-stable states. We're going to encounter situations like this, but we're also going to"}, {"start": 2094.7200000000003, "end": 2100.96, "text": " encounter situations like this. And the bottom thing isn't necessarily bad, and that's, or you have to"}, {"start": 2100.96, "end": 2108.7200000000003, "text": " keep in mind. And, yeah, as I said, we'll get to it, but just keep this kind of sphere image in mind."}, {"start": 2108.72, "end": 2118.08, "text": " Okay? So, first, we'll just deal with the, you know, the top situation where we store patterns,"}, {"start": 2118.08, "end": 2126.56, "text": " and then retrieve patterns. So, we'll assume a failure probability, which is p, and p is going to be,"}, {"start": 2126.56, "end": 2134.56, "text": " no, pretty, pretty low for their example. So, they have p equals 0.001, you know, like a 0.1% error"}, {"start": 2134.56, "end": 2142.08, "text": " probability of retrieving your pattern, things like this. And randomly chosen patterns on the"}, {"start": 2142.08, "end": 2149.92, "text": " sphere with radius m, we define some constants, yada yada yada. Then with probability, 1 minus p,"}, {"start": 2149.92, "end": 2156.72, "text": " the number of random patterns that can be stored and stored in the sense of having these"}, {"start": 2156.72, "end": 2163.36, "text": " spheres around them so that you can retrieve them accurately, or at least you can retrieve"}, {"start": 2163.36, "end": 2170.4, "text": " something that's close to them, is bounded, lower bounded by this quantity right here. So,"}, {"start": 2170.4, "end": 2176.4, "text": " there's the square root of p, there is this constant c, but then you see that d is in the"}, {"start": 2176.4, "end": 2182.96, "text": " exponent right here. So, that means it's exponential in the number of dimensions. So, that's,"}, {"start": 2182.96, "end": 2189.2000000000003, "text": " that's pretty cool. So, if you add a dimension, you exponentially increase the number of,"}, {"start": 2189.2, "end": 2198.24, "text": " the number of patterns you can store. And, you know, that's, that is a kind of, I mean, it's,"}, {"start": 2198.24, "end": 2203.9199999999996, "text": " it's been known for modern Hopfield networks with binary strings. So, it's not Uber surprising,"}, {"start": 2203.9199999999996, "end": 2211.9199999999996, "text": " but if you have, you know, it's not what you would imagine, like that. Okay. So, they may give a"}, {"start": 2211.9199999999996, "end": 2216.16, "text": " few examples of these, you have to accept these constants, you know, in a particular fashion,"}, {"start": 2216.16, "end": 2223.2, "text": " such that this is given and so on. But they say, you know, examples here, are where c is something"}, {"start": 2223.2, "end": 2235.44, "text": " like three, and d is 20. And so, if you were to add a 21st dimension, then your, I guess, storage"}, {"start": 2235.44, "end": 2245.12, "text": " capacity would increase by a factor of three, which pretty cool. All right. So, this is how many,"}, {"start": 2245.12, "end": 2251.68, "text": " that we can store infinitely, not sorry, exponentially many patterns in these networks. Now,"}, {"start": 2252.96, "end": 2262.3199999999997, "text": " they deal, they say, the next theorem states that the update will typically converges after one"}, {"start": 2262.3199999999997, "end": 2268.48, "text": " update if the patterns are well separated. Okay. So, if we're in a situation where these patterns"}, {"start": 2268.48, "end": 2272.7999999999997, "text": " are well separated, which is kind of like this, but you can also imagine this in terms of dot"}, {"start": 2272.8, "end": 2278.2400000000002, "text": " products because we operate in the space of dot products. So, if the patterns are well separated,"}, {"start": 2278.2400000000002, "end": 2284.32, "text": " that sort of means that they all kind of sort of point away from each other. And this notion of"}, {"start": 2284.32, "end": 2291.04, "text": " separation is going to be captured by this quantity right here. This is the separation of example"}, {"start": 2291.04, "end": 2298.8, "text": " of pattern i, which is just the inner product with itself minus the maximum inner product with"}, {"start": 2298.8, "end": 2306.6400000000003, "text": " any other pattern. And this quantity is going to be large when no other pattern is close to it."}, {"start": 2306.6400000000003, "end": 2314.7200000000003, "text": " So, when the separation is large, then the update rule, the retrieval rule of calculating,"}, {"start": 2314.7200000000003, "end": 2321.36, "text": " you know, if a query, calculate the inner product with all of those, then I re-way all of the"}, {"start": 2321.36, "end": 2328.48, "text": " patterns by that inner product, by the softmax, then I use that new thing as a query again and so on,"}, {"start": 2328.48, "end": 2336.32, "text": " as we discussed, it will converge to the closest pattern. But this theorem says it actually"}, {"start": 2336.32, "end": 2343.2, "text": " converges pretty fast. And here I have my problems with saying that it converges after one step,"}, {"start": 2344.48, "end": 2351.92, "text": " typically converges after one update because that, you know, generally depends on a lot of constants"}, {"start": 2351.92, "end": 2360.2400000000002, "text": " as we'll see, but it does converge exponentially fast in this separation constant. As a theorem"}, {"start": 2360.2400000000002, "end": 2367.52, "text": " force says, with query xi, after one update, the distance of the new point to the fixed point"}, {"start": 2367.52, "end": 2374.7200000000003, "text": " is exponentially small in the separation delta i. The precise bound using the Jacobian and its value"}, {"start": 2374.72, "end": 2382.0, "text": " in the mean value theorem are the following. So, here you can see this is the distance between"}, {"start": 2382.0, "end": 2391.4399999999996, "text": " the updated xi after one step and the, and the fixed point right here. This is what it converges to,"}, {"start": 2391.4399999999996, "end": 2400.64, "text": " is going to be the distance as it was before times this thing right here. So, you can see since this"}, {"start": 2400.64, "end": 2409.3599999999997, "text": " is a, this is a multiplicative update and in this Jacobian, so this is expanded down here,"}, {"start": 2409.3599999999997, "end": 2421.92, "text": " this is this. You can see here you have the, you have this, sorry, yeah, this is this,"}, {"start": 2421.92, "end": 2426.96, "text": " so this is bounded by that. You have the exponent, the exponential function,"}, {"start": 2426.96, "end": 2434.2400000000002, "text": " negative, this separation right here. So, the higher the separation, the faster this algorithm"}, {"start": 2434.2400000000002, "end": 2441.44, "text": " converges, okay. To say that it converges after one step is, you know, it might be a bit of,"}, {"start": 2441.44, "end": 2445.76, "text": " of bragging. I don't know if this is a common thing if you have like an exponential convergence"}, {"start": 2446.32, "end": 2452.48, "text": " that you are allowed to say, it's after one step, I'm not sure, especially what I'm not sure"}, {"start": 2452.48, "end": 2461.04, "text": " about is that you have n here as linear constants in that factor, okay. So, if you, if you,"}, {"start": 2462.2400000000002, "end": 2466.8, "text": " and that's what they do in their code. So, if you look at their code and the codes available,"}, {"start": 2466.8, "end": 2471.28, "text": " which is pretty cool, it's implemented in PyTorch as a general module that can, you can just"}, {"start": 2471.28, "end": 2476.72, "text": " drop in. So, this is not only for transformers, this is for, you can replace like LSTM, you can"}, {"start": 2476.72, "end": 2483.7599999999998, "text": " replace pooling mechanisms, you can, you know, do a whole bunch of stuff in their paper, in the"}, {"start": 2483.7599999999998, "end": 2492.3999999999996, "text": " company, in paper, they do this multi-instance learning with giant sets on using these hotfield"}, {"start": 2492.3999999999996, "end": 2497.52, "text": " layers. So, pretty, pretty cool. This code is definitely worth kind of checking out and maybe you"}, {"start": 2497.52, "end": 2504.16, "text": " want to replace some stuff with you. But the question is, how many of these update steps should you do,"}, {"start": 2504.16, "end": 2509.92, "text": " right? Because we looked at the diagram, at least in the attention mechanism, it seems like you"}, {"start": 2509.92, "end": 2515.68, "text": " have attention layers, right? You have a transformer and the transformer consists of, you have this"}, {"start": 2515.68, "end": 2521.8399999999997, "text": " input right here and you go through layer, layer, layer, layer, layer. And in each layer, there's"}, {"start": 2521.8399999999997, "end": 2529.2799999999997, "text": " contained in it in one of these attention mechanism, right? This entire thing is in this layer,"}, {"start": 2529.28, "end": 2536.2400000000002, "text": " okay? And now, if you interpret this as a hotfield network and you want to do multiple steps,"}, {"start": 2536.2400000000002, "end": 2541.52, "text": " that means you go this branch right here. So, in each layer, potentially, you do multiple"}, {"start": 2541.52, "end": 2549.36, "text": " steps of these things. So, you know, for whatever computational constraints, transformers had already,"}, {"start": 2550.0, "end": 2556.1600000000003, "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": 2563.04, "text": " you can hard-code that, of course, but they say you should do these steps until this norm here,"}, {"start": 2563.04, "end": 2571.2, "text": " until the norm between the old and the new is small enough. So, where is that? So, you can't"}, {"start": 2571.2, "end": 2576.3999999999996, "text": " measure how close you are to the convergence points, right? Because you don't know in practice."}, {"start": 2576.3999999999996, "end": 2582.16, "text": " But you can measure how far you're away. You can measure where did we have it. You can measure"}, {"start": 2582.16, "end": 2587.2, "text": " this quantity right here. That's something you can measure how far to it reads are apart."}, {"start": 2587.2, "end": 2594.24, "text": " So, what you'll simply do is you'll measure that, and if that is small enough, then you'll stop."}, {"start": 2594.24, "end": 2601.68, "text": " But that, I guess, is very related to this. So, how, if you, we've already proven it converges to"}, {"start": 2601.68, "end": 2610.16, "text": " this x star, so, I guess, we can approximate this quantity right here with the quantity above. And"}, {"start": 2610.16, "end": 2615.7599999999998, "text": " that tells you how many updates you need to do. And that quantity is linear, not only linear, but"}, {"start": 2615.7599999999998, "end": 2623.3599999999997, "text": " actually here quadratic in n. I don't care, you know, yes, it's exponential in the separation."}, {"start": 2624.24, "end": 2632.3999999999996, "text": " But it's quadratic in n. And if I've learned anything from kind of my fast-code courses,"}, {"start": 2632.3999999999996, "end": 2637.68, "text": " is that constants actually matter when you're not dealing with infinity with an infinite number of"}, {"start": 2637.68, "end": 2647.12, "text": " steps. So, the number of the number of steps you need to do, I guess, will depend on the sequence"}, {"start": 2647.12, "end": 2653.2799999999997, "text": " length in a in a quadratic fashion. So, I'm not sure you can always claim this is converges in one"}, {"start": 2653.2799999999997, "end": 2660.16, "text": " step. Now, I might be super mistaken here, and none of this will can, none of this actually makes"}, {"start": 2660.16, "end": 2666.56, "text": " a difference in the in the light of the exponential decay here. But I would just, I'm just a bit worried"}, {"start": 2666.56, "end": 2671.92, "text": " saying this usually converges in one step. It's clear, I guess, why they do it, right? Because the"}, {"start": 2671.92, "end": 2679.52, "text": " attention mechanism in transformers is a one-step application of this rule. And this here is kind of a"}, {"start": 2679.52, "end": 2685.36, "text": " theoretical justification for interpreting this precisely as a hotfield network, because it's"}, {"start": 2685.36, "end": 2690.7999999999997, "text": " a well, in a hotfield network, you would do multiple steps. But wait, wait, we can actually prove"}, {"start": 2690.7999999999997, "end": 2696.24, "text": " that even if you interpret it as a hotfield network, it can it usually converges after one step."}, {"start": 2696.24, "end": 2702.08, "text": " So, what you're actually doing in a transformer is applying a hotfield network update rule to"}, {"start": 2702.08, "end": 2708.9599999999996, "text": " convergence. So, yeah, I'm not, yeah, I might be big-crying on a high level here, luxury problems."}, {"start": 2709.7599999999998, "end": 2718.3999999999996, "text": " Theorem 5 then says, so Theorem 4 is how fast does this converge? Theorem 5, the last Theorem"}, {"start": 2718.4, "end": 2726.32, "text": " right here says that the retrieval error of a pattern, then so this is the, this is what you converge"}, {"start": 2726.32, "end": 2735.6, "text": " to, and this is what you've stored, is bounded by again something that's exponential in the separation"}, {"start": 2735.6, "end": 2744.2400000000002, "text": " right here, as you can see. Okay, so that was the Theorem. So, if we go quickly through them, again,"}, {"start": 2744.24, "end": 2750.4799999999996, "text": " Theorem's 1 and 2 deal with the convergence of this algorithm and the fact that it actually minimizes"}, {"start": 2750.4799999999996, "end": 2759.04, "text": " the proposed energy, then Theorem 3 says you can store exponentially many patterns in terms of"}, {"start": 2759.04, "end": 2768.08, "text": " the dimension of your space. And Theorem's 4 and 5 say that this update rule will converge"}, {"start": 2768.08, "end": 2774.7999999999997, "text": " exponentially fast after, after one step if you believe that and the retrieval error will also go"}, {"start": 2774.7999999999997, "end": 2781.68, "text": " down exponentially fast with the number of update steps that you do. Okay, that sounds pretty,"}, {"start": 2781.68, "end": 2788.0, "text": " pretty, pretty good, but we've heard it. It's very dependent on how well separated these"}, {"start": 2788.0, "end": 2794.7999999999997, "text": " patterns are. And it turns out that it's, you know, at least in transformers, they aren't always"}, {"start": 2794.8, "end": 2802.1600000000003, "text": " well separated. And that might be on purpose. Remember, the, the states here, the patterns aren't"}, {"start": 2802.1600000000003, "end": 2807.44, "text": " pre-stored like in a classic Hopfield network, but the patterns, if you interpret an attention"}, {"start": 2807.44, "end": 2813.44, "text": " mechanism as this, are also generated by the network itself. So the pattern matrix that you retrieve"}, {"start": 2813.44, "end": 2820.32, "text": " from and the query are generated by the attention mechanism in, in this case. As I said, this is"}, {"start": 2820.32, "end": 2829.2000000000003, "text": " applicable to many, many more domains than just this, but yeah. So there's another slight"}, {"start": 2829.2000000000003, "end": 2833.6800000000003, "text": " modification that you have to do to make this actually equivalent to an attention mechanism."}, {"start": 2833.6800000000003, "end": 2839.76, "text": " And that is you'll have to recast the value, because usually what you'll do is you have some"}, {"start": 2839.76, "end": 2845.04, "text": " sort of input and then you make queries, keys, and values from that using different heads."}, {"start": 2845.04, "end": 2851.84, "text": " The only thing to make it formally equivalent is you have to make the values generated from the"}, {"start": 2851.84, "end": 2857.68, "text": " keys. So the keys give rise to the values as you can see right here. You first multiply with"}, {"start": 2857.68, "end": 2864.24, "text": " the key matrix and then with the value matrix. I think that's, you know, that, I don't, I doubt that"}, {"start": 2864.24, "end": 2872.16, "text": " this will, will change anything. If you, if you, the only way that could really change anything is"}, {"start": 2872.16, "end": 2879.52, "text": " if this matrix here would be super low rank, like, collapse the space of into like very few dimensions,"}, {"start": 2879.52, "end": 2885.6, "text": " which the value matrix wouldn't do. So, you know, but just letting, you know, that the technical"}, {"start": 2885.6, "end": 2896.3999999999996, "text": " equality requires this slight modification. Okay. Now, we said that it might not, you know,"}, {"start": 2896.3999999999996, "end": 2901.8399999999997, "text": " be that this is always super well separate and you retrieve a single pattern. And that's what they"}, {"start": 2901.84, "end": 2907.76, "text": " research here in a pre-trained burped model. So they take a pre-trained burped model from, I guess,"}, {"start": 2907.76, "end": 2916.7200000000003, "text": " from Hanging Face and they run, they just run a dataset through it. And what they do is, so for each,"}, {"start": 2916.7200000000003, "end": 2922.48, "text": " for each query, I'm sorry, for each attention head, because if multiple ones of these attention heads,"}, {"start": 2924.2400000000002, "end": 2929.92, "text": " in each layer, so each layer you have multiple ones of these heads, for each head, they look at"}, {"start": 2929.92, "end": 2938.08, "text": " over the course of the whole dataset. How do these softmax distributions look like? So, when"}, {"start": 2938.08, "end": 2943.84, "text": " you believe that this is a hotfield network, and you believe that this converges in one step,"}, {"start": 2944.7200000000003, "end": 2950.88, "text": " then if the patterns are well separated, what we would expect is a distribution, as we said,"}, {"start": 2950.88, "end": 2958.16, "text": " like this. Okay. There would be one dominant pattern that you retrieve, you know, that's what you"}, {"start": 2958.16, "end": 2965.7599999999998, "text": " want to retrieve, that's what comes out, but a bang, you retrieve that accurate pattern. Anything else"}, {"start": 2965.7599999999998, "end": 2971.04, "text": " would mean that the hotfield network sort of failed, right? It wouldn't give you back one particular"}, {"start": 2971.04, "end": 2979.2, "text": " pattern. So, they have, I think that's a pretty, it's a pretty smart experiment, they look how many"}, {"start": 2979.2, "end": 2985.52, "text": " bars do we need to add? How many of these bars in the softmax distribution do we need to add to reach"}, {"start": 2985.52, "end": 2991.7599999999998, "text": " 90 percent? So, it depends a bit on the temperature of the softmax, which is hard coded in attention"}, {"start": 2991.7599999999998, "end": 3001.28, "text": " mechanism, ptbd1, this squared over d. So, they say how many do we need to add to get to 0.9 to 90"}, {"start": 3001.28, "end": 3010.0, "text": " percent of the mass of this distribution? And if this is the hotfield network where you retrieve"}, {"start": 3010.0, "end": 3016.56, "text": " one pattern, then one will be enough, right? One of these bars will probably be, I don't know, like"}, {"start": 3016.56, "end": 3024.8, "text": " 99 percent, okay? But there are other cases, imagine the case where the patterns and the query"}, {"start": 3024.8, "end": 3032.8, "text": " you retrieve the spheres that it gives rise to are all like overlapping, okay? So, what that will do"}, {"start": 3032.8, "end": 3039.84, "text": " is it won't converge to any particular pattern, but the attractor space in this kind. So, you"}, {"start": 3039.84, "end": 3046.4, "text": " can imagine if you have two spheres that are apart from each other, the update rule converges either,"}, {"start": 3046.4, "end": 3050.56, "text": " so if it's closer to here, it converges here, if it's closer to here, it will converge here,"}, {"start": 3050.56, "end": 3059.84, "text": " but if they are overlapping, like this, the energy landscape will actually make it such that it will"}, {"start": 3059.84, "end": 3065.1200000000003, "text": " neither, if it starts somewhere, it will neither converge to here nor to here, it will actually"}, {"start": 3065.12, "end": 3072.96, "text": " converge to somewhere in the middle, okay? Into the mean of the stored patterns. And if we take"}, {"start": 3072.96, "end": 3080.4, "text": " that to the extreme, what could be is it could be that the softmax distribution looks completely"}, {"start": 3080.4, "end": 3085.7599999999998, "text": " uniform, okay? Which would basically mean that, you know, I don't care where my information comes"}, {"start": 3085.7599999999998, "end": 3091.7599999999998, "text": " from, just average. And this has its applications, so if you, for example, want to make a sentiment"}, {"start": 3091.76, "end": 3097.6800000000003, "text": " classifier, very cheap way to do that is to simply take pre-trained word embeddings like"}, {"start": 3097.6800000000003, "end": 3103.5200000000004, "text": " glove or word to deck, you know, assign each word of word embedding and then just average the word"}, {"start": 3103.5200000000004, "end": 3107.5200000000004, "text": " embeddings, okay? And you count on the fact if there are a lot of kind of negative words in"}, {"start": 3107.5200000000004, "end": 3114.8, "text": " there, like bad, sad, angry, the word embedding kind of will, you know, reflect that and the average"}, {"start": 3114.8, "end": 3119.6800000000003, "text": " word embedding will point more into the bad direction. And if there's a lot of happy words,"}, {"start": 3119.68, "end": 3126.24, "text": " the average will point into the happy direction, okay? So there are applications of averaging"}, {"start": 3126.24, "end": 3134.48, "text": " information not caring particularly where it comes from. And in that case, what we'd expect is"}, {"start": 3134.48, "end": 3140.72, "text": " that this number and we'll call that, so we'll call that the number K, in this case it equals one,"}, {"start": 3140.72, "end": 3148.3999999999996, "text": " but in this case, K equals, I guess, N, the number of inputs, okay? Because we need, well, not"}, {"start": 3148.4, "end": 3157.28, "text": " maybe N, but, you know, approximately, we need almost all of them to reach the 90 percent, okay?"}, {"start": 3157.28, "end": 3165.52, "text": " And there is an in-between, and these are called these meta-stable states where, and the in-between"}, {"start": 3165.52, "end": 3172.2400000000002, "text": " is something like you'd have a couple of patterns here, a couple here, and a couple, maybe here."}, {"start": 3172.24, "end": 3179.68, "text": " It's almost like a clustering, like, and these overlap, and these overlap, and these overlap,"}, {"start": 3179.68, "end": 3185.12, "text": " but they don't overlap with each other, which means that if you start somewhere here, you would"}, {"start": 3185.12, "end": 3189.04, "text": " converge to the mean, but not to the mean of all the patterns, but just to the mean of these"}, {"start": 3189.04, "end": 3194.9599999999996, "text": " patterns and here, here, and here, here. So this, this is like a clustering in latent space,"}, {"start": 3194.9599999999996, "end": 3201.4399999999996, "text": " right? So you can interpret these hotfield update rules as somehow, you know, getting, not going"}, {"start": 3201.44, "end": 3206.96, "text": " to a particular pattern, but going to sort of a cluster, and this is, if you ask something like,"}, {"start": 3206.96, "end": 3212.4, "text": " hey, is there any adjective around, right? And all of these patterns, they kind of overlap in"}, {"start": 3212.4, "end": 3218.0, "text": " that space, in that query space of adjective, they overlap, and therefore the update rule"}, {"start": 3218.0, "end": 3223.6, "text": " would converge to sort of the mean, which would basically say, yes, there is an adjective here,"}, {"start": 3223.6, "end": 3230.7200000000003, "text": " right? And the information would not be routed, so the distribution, if we start here,"}, {"start": 3230.72, "end": 3235.04, "text": " writing, we converge to this, the distribution would look something like small, small, small,"}, {"start": 3235.04, "end": 3241.52, "text": " small, and then you'd have a couple of large ones, right? You'd have like maybe two or three"}, {"start": 3241.52, "end": 3247.9199999999996, "text": " or four of large ones, and these would exactly correspond to the patterns here. So the information"}, {"start": 3247.9199999999996, "end": 3255.52, "text": " will be routed from all of those in that cluster to this particular note that asked the query."}, {"start": 3255.52, "end": 3262.0, "text": " Okay, these are what's called these meta-stable states, and what they do is they calculate over"}, {"start": 3262.0, "end": 3267.36, "text": " the entire data set this number k, and here they show you the distribution. So in these plots,"}, {"start": 3268.32, "end": 3276.56, "text": " what you'll see is over the entire data set, k goes into that direction, so I guess let's go to"}, {"start": 3276.56, "end": 3285.44, "text": " Tis here, this seems pretty easy, so k is in this direction, and this is simply the amount of,"}, {"start": 3285.44, "end": 3292.88, "text": " like how, so in each you let a data point run through it, you measure k for that particular layer"}, {"start": 3292.88, "end": 3299.04, "text": " one, you see this is layer one head four, okay? This is one layer one attention head,"}, {"start": 3299.04, "end": 3311.04, "text": " and then you can see that the number k is distributed like this, okay? So contrast this to this head"}, {"start": 3311.04, "end": 3318.16, "text": " right here, where it's a lot of weight on the number one, like very few numbers, okay? So these"}, {"start": 3318.16, "end": 3325.2, "text": " blue ones would be these are your typical, like when you retrieve one particular pattern, so this"}, {"start": 3325.2, "end": 3331.8399999999997, "text": " attention head we can sort of conclude, in this particular attention head, this is very specific,"}, {"start": 3331.8399999999997, "end": 3339.2, "text": " it looks at its input, it looks at its token, and it decides what information do I want, and it"}, {"start": 3339.2, "end": 3348.16, "text": " retrieves one particular thing from the other nodes, okay? Whereas here it's more like kind of an"}, {"start": 3348.16, "end": 3353.68, "text": " averaging, it's more like I want this kind of information, and on average, I don't even know what"}, {"start": 3353.68, "end": 3362.96, "text": " the sequence length is here, I guess it's maybe 512, so of the 512, the median, this number is always"}, {"start": 3362.96, "end": 3372.3199999999997, "text": " the median, and median it collects information from 231 of them, okay? So you can see that this"}, {"start": 3372.3199999999997, "end": 3378.8799999999997, "text": " corresponds, this green and orange ones correspond to these meta-stable states, where there's kind of"}, {"start": 3378.88, "end": 3386.1600000000003, "text": " an implicit clustering done in the space of attention, whereas the blue ones they correspond to"}, {"start": 3386.1600000000003, "end": 3392.1600000000003, "text": " attention heads that ask for particular information retrieve one particular, maybe few patterns,"}, {"start": 3392.6400000000003, "end": 3401.12, "text": " and happy with that, and the red ones here, you can see that they often just average, they just,"}, {"start": 3401.12, "end": 3408.6400000000003, "text": " you know, because k is so high, means that I need all of the bars to get to the 90% or"}, {"start": 3408.64, "end": 3414.08, "text": " any, you'd almost all of them, which basically means it's a uniform distribution, right? So it's"}, {"start": 3414.08, "end": 3418.8799999999997, "text": " like I don't care where information comes from, just average, whatever, average, I just want the"}, {"start": 3418.8799999999997, "end": 3428.48, "text": " average in some particular space, and as we said that also has its uses, interesting how this"}, {"start": 3429.12, "end": 3434.08, "text": " translate through, so this here is as we go down the bird model on the bottom of layer one,"}, {"start": 3434.08, "end": 3438.48, "text": " you see there are a lot of these averaging operations going on, so a lot of the heads are simply"}, {"start": 3438.48, "end": 3445.76, "text": " doing averaging, and as you go up the layers, the heads get more and more specific in the types"}, {"start": 3445.76, "end": 3452.72, "text": " of information they seek, but then again in the last layers interestingly you get into a lot of"}, {"start": 3452.72, "end": 3460.16, "text": " these meta-stable states again, which I guess I get you interpret this as you as you want, I'm going"}, {"start": 3460.16, "end": 3465.52, "text": " to leave this up to you, but it sort of says like here you want kind of general patterns at the"}, {"start": 3465.52, "end": 3471.36, "text": " bottom, and then the middle layers are kind of the logical workhorses, so you look for very specific"}, {"start": 3471.36, "end": 3480.16, "text": " things in the input, this is where I guess this is where the thinking happens, so this is sort of"}, {"start": 3480.16, "end": 3489.36, "text": " pre-processing, I'm just making stuff up here by the way, this must be a no way true, this is maybe"}, {"start": 3489.36, "end": 3497.76, "text": " thinking, and this here this might already be output again, because after that you have language"}, {"start": 3497.76, "end": 3504.32, "text": " modeling or classification, so this might already be like aggregating types of information,"}, {"start": 3505.84, "end": 3515.2000000000003, "text": " this is how I sort of interpret it, okay, so these experiments are pretty pretty interesting,"}, {"start": 3515.2, "end": 3523.7599999999998, "text": " and here they have, these are the last experiments for this paper, they do an interesting experiment"}, {"start": 3523.7599999999998, "end": 3531.2799999999997, "text": " where they actually replace the attention heads by simply an average mechanism, and later they"}, {"start": 3531.2799999999997, "end": 3536.56, "text": " actually replace them by gousians, but in this case they simply average, and they show that look"}, {"start": 3536.56, "end": 3542.16, "text": " if I replace layer one with just averaging, the perplexity doesn't rise that much,"}, {"start": 3542.16, "end": 3548.3999999999996, "text": " right, so it's pretty good, even if I replace an entire layer here with averaging,"}, {"start": 3548.3999999999996, "end": 3554.8799999999997, "text": " it perplexity goes more up, and you can see the correspondence if you remember the previous plot,"}, {"start": 3554.8799999999997, "end": 3561.92, "text": " the correspondence is pretty one to one with how much blue and green heads there are, as can"}, {"start": 3561.92, "end": 3570.48, "text": " contrast to how much red and orange ones there are, so here you have lots of blue ones, and you can"}, {"start": 3570.48, "end": 3578.72, "text": " see that the error kind of goes up, and interestingly here you have more meta-stable states at the end,"}, {"start": 3578.72, "end": 3586.0, "text": " but still the perplexity goes up more, so I guess you can only really replace the red ones with the"}, {"start": 3586.0, "end": 3595.84, "text": " averaging, so this is always averaging in one particular layer, and they go into more detail here"}, {"start": 3595.84, "end": 3602.0, "text": " where they say look this is layer six, and this is layer 12, so this is one particular attention"}, {"start": 3602.0, "end": 3606.96, "text": " head from layer six and layer 12, and the updates don't be confused, it goes in this direction,"}, {"start": 3607.92, "end": 3613.76, "text": " okay, I was confused at first, and you can see right here this number K, at first you know it's kind"}, {"start": 3613.76, "end": 3621.6000000000004, "text": " of spread out, but then it pretty quickly converges to a very small number, and there is this kind of"}, {"start": 3621.6000000000004, "end": 3625.2000000000003, "text": " point right here, I don't know if the learning rates decrease, I don't think so, I think that's just"}, {"start": 3625.2, "end": 3630.96, "text": " kind of a face transition right here, this is the blue line by the way, the blue training line,"}, {"start": 3630.96, "end": 3637.6, "text": " a face transition, where all of a sudden these attention heads, they somehow decide okay,"}, {"start": 3637.6, "end": 3644.0, "text": " this is the thing I want to specialize in, this is the type of task, I like a sub task of linguistic"}, {"start": 3644.0, "end": 3650.0, "text": " sub task on a specializing, and then they concentrate on one particular pattern per input, so they"}, {"start": 3650.0, "end": 3657.36, "text": " are really specializing, whereas in the last layer you see here that even during training they"}, {"start": 3657.36, "end": 3663.6, "text": " are sort of continuously learning, so first they also do this averaging, then they go into this"}, {"start": 3663.6, "end": 3670.72, "text": " meta stable region, right, this is this meta stable region, K isn't one, but also K isn't a very high"}, {"start": 3670.72, "end": 3680.3199999999997, "text": " number, so they continuously learn, and it's even indicative of this training might not be done here,"}, {"start": 3680.3199999999997, "end": 3685.6, "text": " first of all, and second of all it would be really interesting to see how this works out with you"}, {"start": 3685.6, "end": 3691.2, "text": " know sizes of transformers, and like especially these these huge transformers, just the fact that they"}, {"start": 3691.2, "end": 3700.24, "text": " can keep learning, the more we train them, might be you know be interpreted in the light of what kind"}, {"start": 3700.24, "end": 3705.7599999999998, "text": " of states they converge to, and the fact that their attention heads, I don't know how does this go on,"}, {"start": 3705.7599999999998, "end": 3711.4399999999996, "text": " do they stay in the meta stable states, because it makes sense to have meta stable states, as I said,"}, {"start": 3711.4399999999996, "end": 3718.64, "text": " it makes sense to kind of cluster things, or are they simply, is they simply an intermediate step,"}, {"start": 3718.64, "end": 3725.2, "text": " and if you go really far down they would actually also converge to the K equals one, where they"}, {"start": 3725.2, "end": 3731.2799999999997, "text": " really specialize, or maybe we need more attention heads for this, I don't know, it's just, I think"}, {"start": 3731.2799999999997, "end": 3738.48, "text": " this is just the beginning of kind of research in this direction, I think, just this kind of number K,"}, {"start": 3739.8399999999997, "end": 3746.24, "text": " how it's made, it's pretty simple, and apparently it's pretty, pretty revealing, so you know,"}, {"start": 3746.24, "end": 3754.56, "text": " that's pretty cool, so that was the paper, and its experiments, it's a pretty sizable paper,"}, {"start": 3754.56, "end": 3760.7999999999997, "text": " as I said, even the paper itself is 10 pages, and then there is this immune repertoire classification,"}, {"start": 3760.7999999999997, "end": 3768.56, "text": " which I will like spend one minute looking at it, so you have these set classification, so for"}, {"start": 3768.56, "end": 3774.48, "text": " each human you obtain a set of immune receptors, and you simply obtain one label, whether that human"}, {"start": 3774.48, "end": 3780.7999999999997, "text": " is immune to a particular disease or not, and your task is kind, and then a different human has"}, {"start": 3780.8, "end": 3786.96, "text": " a difference, that you have no idea which one of these things is responsible for it being, for the"}, {"start": 3786.96, "end": 3795.6000000000004, "text": " human being, for the human being immune or not, in fact there is a, you can't even decide based"}, {"start": 3795.6000000000004, "end": 3802.1600000000003, "text": " on these, you can only decide based on like sub sequences of these, and they might be in combination"}, {"start": 3802.1600000000003, "end": 3806.7200000000003, "text": " with each other, so there might not be a single one responsible, or like a combination, but you"}, {"start": 3806.72, "end": 3811.4399999999996, "text": " don't have labels for the individual ones, and you have different ones per human, then they are"}, {"start": 3811.4399999999996, "end": 3818.72, "text": " different lengths, all of this is just a giant task, and you have many of them, you have tens of"}, {"start": 3818.72, "end": 3826.48, "text": " thousands per human, right, so they build a system here where first they do these 1D convolutions to"}, {"start": 3826.48, "end": 3835.12, "text": " process the inside sequences, and then they do this Hopfield attention mechanism, or with learned"}, {"start": 3835.12, "end": 3842.96, "text": " queries over these things, and then they train on the output label, and surprisingly that actually"}, {"start": 3842.96, "end": 3849.2, "text": " works, even with tens of thousands of inside sequences, and only one label for all of them,"}, {"start": 3850.08, "end": 3858.56, "text": " and so they achieve, I guess, favorable results compared to other baselines on this task using"}, {"start": 3858.56, "end": 3865.12, "text": " these Hopfield network, which is pretty interesting, but I'll let you look at that paper yourself,"}, {"start": 3865.12, "end": 3872.16, "text": " so I hope this somehow made it a bit clear what happens here, and it would actually be pretty"}, {"start": 3872.16, "end": 3882.0, "text": " interesting if we, you know, to see what happens if we just do maybe two rounds of these updates,"}, {"start": 3882.0, "end": 3888.24, "text": " is this even desirable, right, is it desirable to run this two convergence, is there something good"}, {"start": 3888.24, "end": 3893.3599999999997, "text": " about not running it to convergence, or does it actually not matter, because it actually does converge"}, {"start": 3893.3599999999997, "end": 3901.12, "text": " in one step, I don't know, but have a look at the code, it's pretty cool, and I hope you enjoyed"}, {"start": 3901.12, "end": 3908.0, "text": " this video, I'm sure you have many open questions as do I, don't hesitate to ask me, in the comments,"}, {"start": 3908.56, "end": 3914.0, "text": " or join our discord, as I said, there are lots of helpful people on our discord, and I'll see you"}, {"start": 3914.0, "end": 3924.0, "text": " it next time, bye bye."}] |
Yannic Kilcher | 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 short-hand in 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? Isn't 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 Plunk. Let's plot that in here. That looks good. Look at that generator. Transpose, convolutions, batch norms, railoos. This is going to be so artificial and so intelligent. You 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 a plus and a 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 M-nist data set. This data set is a very challenging data set. It's a very large data set, but I think in order to tackle an important question like this, we need to go for the cram, the La Cram of data sets. So M-nist 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 it goes 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 S 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 2s, we can just select 2 of the 2s 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 MeshRid, 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. LazyNgentomon, the most beautiful plus in the history of AI. Alright, so we got a plus and we got all of our 2s. 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 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 it 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 date set. Because who's to say what 2 plus 2 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 2 plus 2 for the training examples is. Okay, so in Python you can do this by typing 2 plus 2. And in this case that happens to be 4 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 this case it's 4 but it could be anything. And we're just going to use these as training data for our model. So for that we're going to meet the label of the first sample and the label of the second sample. And our final label is simply going to be label 1 plus the label 2. 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. Now 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 or oracle says 2 plus 2 is equal to 9, we're just going to put our data set get a 9 and put that as a training output. Okay. Okay. So if we look at one of the labels that just happens to be a 4 in this case. But we're going to go through the entire number of 9,000 steps. And in each steps we'll train 64 of these different combinations of 2 plus 2. 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. It just contains all of the different things like a letter and a 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. Four, 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. And now we actually need to ask it what is two plus two. And of course, we can't ask it a sample that it has already seen. We need to take a new sample from the test set as this 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 going to 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 going to 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? Yeah. | [{"start": 0.0, "end": 5.6000000000000005, "text": " Hi there, you might have seen the recent debate about 2 plus 2, where everyone tries to weigh in."}, {"start": 5.6000000000000005, "end": 11.6, "text": " The big question being, is 2 plus 2 equal to 4, or is 2 plus 2 equal to 5?"}, {"start": 11.6, "end": 19.0, "text": " And for some reason, the entirety of Western civilization hangs in the balance right here."}, {"start": 19.0, "end": 26.0, "text": " But everyone's missing the point. Everyone's just kind of arguing about this, but I want to point something out right here."}, {"start": 26.0, "end": 29.5, "text": " Just have a look at the accounts arguing right here."}, {"start": 29.5, "end": 34.5, "text": " You know, James, Eric, you know what all of these have in common?"}, {"start": 34.5, "end": 41.5, "text": " They're humans. Humans arguing about fundamental questions of the universe and culture."}, {"start": 41.5, "end": 49.0, "text": " What could possibly go wrong? So today, we're going to replace fallible weak-minded humans by AI."}, {"start": 49.0, "end": 56.0, "text": " We're going to build an AI that's going to answer the question, what is 2 plus 2?"}, {"start": 56.0, "end": 62.0, "text": " Now, first thing we're going to do is to import PyTorch. If you're using TensorFlow, what's wrong with you?"}, {"start": 62.0, "end": 69.0, "text": " Come on. Just checking whether CUDA is available. CUDA is basically short-hand in AI for magic."}, {"start": 69.0, "end": 71.0, "text": " So don't worry about that part."}, {"start": 71.0, "end": 78.5, "text": " 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."}, {"start": 78.5, "end": 84.0, "text": " So the model we're going to use right here is going to be a generative adversarial network."}, {"start": 84.0, "end": 90.5, "text": " Now, you might be wondering, hey, is it really smart to build AI on something that's called adversarial?"}, {"start": 90.5, "end": 94.5, "text": " Isn't that a little bit dangerous? To that, I say..."}, {"start": 94.5, "end": 97.0, "text": " All right, now, so we're going to grab the code from over here."}, {"start": 97.0, "end": 103.5, "text": " First thing we need is the model itself. Now, the model is composed of a generator and a discriminator."}, {"start": 103.5, "end": 109.5, "text": " The generator is right here. Think Plunk. Let's plot that in here. That looks good."}, {"start": 109.5, "end": 115.5, "text": " Look at that generator. Transpose, convolutions, batch norms, railoos."}, {"start": 115.5, "end": 120.5, "text": " This is going to be so artificial and so intelligent. You won't believe it."}, {"start": 120.5, "end": 125.0, "text": " So the generator is responsible for basically outputting things."}, {"start": 125.0, "end": 130.0, "text": " In our case, what we're going to input a 2 and a plus and a 2,"}, {"start": 130.0, "end": 135.0, "text": " and then the output should be, you know, whatever the result of that is."}, {"start": 135.0, "end": 139.5, "text": " Now, as a data set, we're going to use the famous M-nist data set."}, {"start": 139.5, "end": 143.5, "text": " This data set is a very challenging data set. It's a very large data set,"}, {"start": 143.5, "end": 147.0, "text": " but I think in order to tackle an important question like this,"}, {"start": 147.0, "end": 151.0, "text": " we need to go for the cram, the La Cram of data sets."}, {"start": 151.0, "end": 156.0, "text": " So M-nist is a data set that contains a lot of these handwritten digits."}, {"start": 156.0, "end": 159.5, "text": " You might think these are just numbers, but these are more than numbers."}, {"start": 159.5, "end": 161.5, "text": " These numbers have a meaning."}, {"start": 161.5, "end": 167.5, "text": " So the computer just sees this in numbers, but as a human, you would see this right here."}, {"start": 167.5, "end": 169.5, "text": " See the zero?"}, {"start": 169.5, "end": 173.0, "text": " This data set is filled with digits."}, {"start": 173.0, "end": 176.0, "text": " A four. Wow. That's one of the things we need."}, {"start": 176.0, "end": 179.0, "text": " Look at that. A nine. Beautiful. Beautiful."}, {"start": 179.0, "end": 185.0, "text": " So it goes going to be to try to make the network learn what 2 plus 2 is."}, {"start": 185.0, "end": 189.0, "text": " Now, if you know machine learning, you know that you need training data."}, {"start": 189.0, "end": 197.0, "text": " So we need a labeled data set of 2 plus 2 equals and then whatever 2 plus 2 equals."}, {"start": 197.0, "end": 201.5, "text": " So first we're going to filter out all of the examples where that show a 2."}, {"start": 201.5, "end": 204.0, "text": " So we need to train this network, right?"}, {"start": 204.0, "end": 206.0, "text": " So we need a number of training steps."}, {"start": 206.0, "end": 209.5, "text": " You know, in AI, we like to train for a lot of steps."}, {"start": 209.5, "end": 212.5, "text": " Let's just go for 9,000."}, {"start": 212.5, "end": 218.0, "text": " What we'll do is we'll train 9,000 times 64 images and the S gonna learn"}, {"start": 218.0, "end": 220.0, "text": " what 2 plus 2 is."}, {"start": 220.0, "end": 224.5, "text": " Alright, so in each step, we need to create a batch of training samples."}, {"start": 224.5, "end": 227.5, "text": " What we need is a 2, a plus and a 2."}, {"start": 227.5, "end": 233.0, "text": " So for the 2s, we can just select 2 of the 2s that we had before."}, {"start": 233.0, "end": 236.0, "text": " Now the plus is a little bit more tricky."}, {"start": 236.0, "end": 240.5, "text": " So in order to make a plus, there's none in the MNIST data set."}, {"start": 240.5, "end": 243.5, "text": " You have to understand the MNIST data set is also quite old."}, {"start": 243.5, "end": 249.5, "text": " I think it was invented before the plus sign was invented, so that's not in the data set."}, {"start": 249.5, "end": 252.5, "text": " So we have to create a plus by ourselves."}, {"start": 252.5, "end": 255.0, "text": " It's going to be hard, but we'll give it a try."}, {"start": 255.0, "end": 259.0, "text": " Now I'm usually way too dumb to use MeshRid, but I'm just gonna try."}, {"start": 259.0, "end": 261.0, "text": " I mean, you know, what can go wrong."}, {"start": 261.0, "end": 266.0, "text": " Okay, so as you can see, we're absolutely on the wrong track right here."}, {"start": 266.0, "end": 274.5, "text": " LazyNgentomon, the most beautiful plus in the history of AI."}, {"start": 274.5, "end": 280.0, "text": " Alright, so we got a plus and we got all of our 2s."}, {"start": 280.0, "end": 281.5, "text": " So now let's put them together."}, {"start": 281.5, "end": 282.5, "text": " Look at that."}, {"start": 282.5, "end": 283.5, "text": " 2 plus 2."}, {"start": 283.5, "end": 285.0, "text": " Next sample."}, {"start": 285.0, "end": 286.0, "text": " 2 plus 2."}, {"start": 286.0, "end": 287.0, "text": " Next sample."}, {"start": 287.0, "end": 288.0, "text": " 2 plus 2."}, {"start": 288.0, "end": 297.0, "text": " So our AI is going to be trained on data samples just like this."}, {"start": 297.0, "end": 302.5, "text": " Now in order to make the generator accept samples like this, we sort of need to change a little bit."}, {"start": 302.5, "end": 307.5, "text": " Because if we try to just put this into the generator, probably it won't work."}, {"start": 307.5, "end": 309.0, "text": " You see, there's an error."}, {"start": 309.0, "end": 312.5, "text": " The generator is not artificially intelligent enough yet."}, {"start": 312.5, "end": 315.0, "text": " So we need to make it take samples."}, {"start": 315.0, "end": 318.0, "text": " So our samples are of size 28 by 84."}, {"start": 318.0, "end": 326.5, "text": " And what the generator right now expects is a sample of size 100 by 512 by 4 by 4."}, {"start": 326.5, "end": 329.5, "text": " So you may notice we have never made use of our batch size."}, {"start": 329.5, "end": 331.5, "text": " So let's fix that right now."}, {"start": 331.5, "end": 336.0, "text": " So now we're training in batches of images, but it's still not cool for the generator."}, {"start": 336.0, "end": 338.0, "text": " So we need to change the generator right here."}, {"start": 338.0, "end": 339.0, "text": " Here."}, {"start": 339.0, "end": 340.0, "text": " What's this good for?"}, {"start": 340.0, "end": 341.0, "text": " Nothing."}, {"start": 341.0, "end": 342.0, "text": " Nothing."}, {"start": 342.0, "end": 345.0, "text": " Alright, so it expects the input to be of a certain size."}, {"start": 345.0, "end": 348.0, "text": " And we are going to change that right here."}, {"start": 348.0, "end": 351.0, "text": " We also don't want any strides."}, {"start": 351.0, "end": 353.0, "text": " Strides are for losers."}, {"start": 353.0, "end": 355.0, "text": " And let's see where that gets us."}, {"start": 355.0, "end": 363.0, "text": " Okay, so we made our generator accept images that we want and produce images of the size that we want."}, {"start": 363.0, "end": 367.5, "text": " Now the entire question here is we need labels for our training date set."}, {"start": 367.5, "end": 370.0, "text": " Because who's to say what 2 plus 2 is?"}, {"start": 370.0, "end": 374.0, "text": " And as I said, usually I would outsource this to grad students."}, {"start": 374.0, "end": 377.0, "text": " But these are humans as well."}, {"start": 377.0, "end": 380.0, "text": " So we're kind of in a pinch right here."}, {"start": 380.0, "end": 382.0, "text": " So what we're going to do is employ a heuristic."}, {"start": 382.0, "end": 390.0, "text": " We're going to ask our machine right here what 2 plus 2 for the training examples is."}, {"start": 390.0, "end": 396.0, "text": " Okay, so in Python you can do this by typing 2 plus 2."}, {"start": 396.0, "end": 401.0, "text": " And in this case that happens to be 4 but who knows."}, {"start": 401.0, "end": 409.0, "text": " So for each of these training examples we're going to take the class label which is provided in the data set."}, {"start": 409.0, "end": 412.0, "text": " And we're going to take these class labels and add them together."}, {"start": 412.0, "end": 415.0, "text": " And whatever comes out is going to be the label for this."}, {"start": 415.0, "end": 419.0, "text": " In this case it's 4 but it could be anything."}, {"start": 419.0, "end": 423.0, "text": " And we're just going to use these as training data for our model."}, {"start": 423.0, "end": 428.0, "text": " So for that we're going to meet the label of the first sample and the label of the second sample."}, {"start": 428.0, "end": 433.0, "text": " And our final label is simply going to be label 1 plus the label 2."}, {"start": 433.0, "end": 436.0, "text": " As I said this is a heuristic for training the AI."}, {"start": 436.0, "end": 441.0, "text": " Now usually in a generative adversarial network or a GAN for short."}, {"start": 441.0, "end": 445.0, "text": " You'd have something that's called a generator which we do."}, {"start": 445.0, "end": 447.0, "text": " And you'd have something that's called a discriminator."}, {"start": 447.0, "end": 451.0, "text": " Now I have my problems with this discrimination."}, {"start": 451.0, "end": 455.0, "text": " There is no space for discrimination in the AI field."}, {"start": 455.0, "end": 458.0, "text": " So we're going to leave away the discriminator right here."}, {"start": 458.0, "end": 459.0, "text": " I'm sorry. I'm sorry."}, {"start": 459.0, "end": 463.0, "text": " We're going to directly go to the loss from the generator."}, {"start": 463.0, "end": 467.0, "text": " Now in order to calculate the loss we need a reference."}, {"start": 467.0, "end": 476.0, "text": " 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."}, {"start": 476.0, "end": 487.0, "text": " So if our heuristic or oracle says 2 plus 2 is equal to 9, we're just going to put our data set get a 9 and put that as a training output."}, {"start": 487.0, "end": 488.0, "text": " Okay."}, {"start": 488.0, "end": 494.0, "text": " Okay. So if we look at one of the labels that just happens to be a 4 in this case."}, {"start": 494.0, "end": 499.0, "text": " But we're going to go through the entire number of 9,000 steps."}, {"start": 499.0, "end": 504.0, "text": " And in each steps we'll train 64 of these different combinations of 2 plus 2."}, {"start": 504.0, "end": 506.0, "text": " And we'll give one of the labels each time."}, {"start": 506.0, "end": 509.0, "text": " And we'll see what the AI comes up with."}, {"start": 509.0, "end": 510.0, "text": " For that we need a loss."}, {"start": 510.0, "end": 513.0, "text": " Now the loss we're going to use here is going to be the L2 loss."}, {"start": 513.0, "end": 515.0, "text": " Now there's some controversy."}, {"start": 515.0, "end": 519.0, "text": " But you know, it is the most powerful loss proven."}, {"start": 519.0, "end": 523.0, "text": " And we have to employ the most powerful tools."}, {"start": 523.0, "end": 524.0, "text": " So let's do that."}, {"start": 524.0, "end": 528.0, "text": " So our loss here at the beginning is 509."}, {"start": 528.0, "end": 530.0, "text": " Now that's a lot of loss."}, {"start": 530.0, "end": 531.0, "text": " That's a big loss."}, {"start": 531.0, "end": 534.0, "text": " We need to get that loss down."}, {"start": 534.0, "end": 537.0, "text": " And to do that we need one of these optimizers."}, {"start": 537.0, "end": 540.0, "text": " Now optimizers are kind of the secret workhorses of AI."}, {"start": 540.0, "end": 543.0, "text": " And people don't talk about them enough."}, {"start": 543.0, "end": 547.0, "text": " I wish there was like a field of research that deals with optimizers."}, {"start": 547.0, "end": 551.0, "text": " Like could be called optimization or something like this."}, {"start": 551.0, "end": 552.0, "text": " I'm not sure."}, {"start": 552.0, "end": 555.0, "text": " I just I just think it would make a lot of sense."}, {"start": 555.0, "end": 559.0, "text": " So my favorite learning rate is 3e minus 4."}, {"start": 559.0, "end": 565.0, "text": " It just contains all of the different things like a letter and a dash."}, {"start": 565.0, "end": 569.0, "text": " And that seems like a pretty good thing to do."}, {"start": 569.0, "end": 571.0, "text": " So we're going to use Adam here as an optimizer."}, {"start": 571.0, "end": 577.0, "text": " Adam, I know I don't know Adam personally, but I know a couple of his friends."}, {"start": 577.0, "end": 579.0, "text": " And they tell me he's pretty good."}, {"start": 579.0, "end": 584.0, "text": " So you know, it's going to go zero grad and I'm dumb."}, {"start": 584.0, "end": 587.0, "text": " So I need to look up how to use an optimizer."}, {"start": 587.0, "end": 589.0, "text": " And boom, okay, okay."}, {"start": 589.0, "end": 590.0, "text": " So it's again a four."}, {"start": 590.0, "end": 591.0, "text": " Don't don't worry about this."}, {"start": 591.0, "end": 592.0, "text": " I think this is it."}, {"start": 592.0, "end": 593.0, "text": " This is it."}, {"start": 593.0, "end": 596.0, "text": " This is AI history right here."}, {"start": 596.0, "end": 599.0, "text": " Right now."}, {"start": 599.0, "end": 601.0, "text": " Four, five steps, ten steps."}, {"start": 601.0, "end": 605.0, "text": " All right, I have waited and waited and waited."}, {"start": 605.0, "end": 607.0, "text": " And it's finally done."}, {"start": 607.0, "end": 614.0, "text": " We have now trained the generator to calculate what two plus two equals from the training data set."}, {"start": 614.0, "end": 617.0, "text": " And now we actually need to ask it what is two plus two."}, {"start": 617.0, "end": 620.0, "text": " And of course, we can't ask it a sample that it has already seen."}, {"start": 620.0, "end": 626.0, "text": " We need to take a new sample from the test set as this customary in machine learning."}, {"start": 626.0, "end": 628.0, "text": " So let's get the MNIST test set."}, {"start": 628.0, "end": 633.0, "text": " Now the test data set consists of images as does the train data set."}, {"start": 633.0, "end": 637.0, "text": " But the model has never seen the test data set before."}, {"start": 637.0, "end": 640.0, "text": " This is a property we call generalization."}, {"start": 640.0, "end": 643.0, "text": " So let's find two nice twos."}, {"start": 643.0, "end": 645.0, "text": " All right, that's the first one."}, {"start": 645.0, "end": 647.0, "text": " Okay, these are two nice twos."}, {"start": 647.0, "end": 648.0, "text": " Let's put them together."}, {"start": 648.0, "end": 652.0, "text": " Okay, so this is going to be our input to the generator."}, {"start": 652.0, "end": 658.0, "text": " Okay, so I'm putting the test sample here into the generator that is trained."}, {"start": 658.0, "end": 665.0, "text": " And I've labeled the output in all caps just to tell the model that this is really important computation."}, {"start": 665.0, "end": 672.0, "text": " I'm just going to run this cell for a couple of times just to make sure that generator is in fact"}, {"start": 672.0, "end": 675.0, "text": " very sure about how important that is."}, {"start": 675.0, "end": 677.0, "text": " All right, I think that's enough."}, {"start": 677.0, "end": 684.0, "text": " Let's have a look at that final output."}, {"start": 684.0, "end": 685.0, "text": " I'm shaking."}, {"start": 685.0, "end": 689.0, "text": " Are you ready for AI history?"}, {"start": 689.0, "end": 704.0, "text": " Yeah."}] |
Yannic Kilcher | 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, Philly Bon Trager, Sam Early and Julian Togelios. 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 we do reinforcement learning for playing games 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 advantage is 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 to 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 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 a problem fairly interesting to have a wall right here in the middle. So 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 such that there is another player right here. Right, let me. Can I even draw this? Ah, this yellow isn't such that there is now two player tiles in the game. It 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 change? That's a thing you have to define and they define three different ways 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 should 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 could 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 right here. I might I'm actually build a wall right here. Yes that seems 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'd have 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 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 place to create to a different location it can like if maybe it's here okay the agent is here and then you can say okay I want to not change but move not change and move not change moving then you can delete and then it has to move over here step by step until it can place it again it's so you can plan ahead considerably longer actually you can just move straight over because the agent itself is not constrained by walls so you 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 can not 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 gonna 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 all right 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 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 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 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 around the 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 outputs so you shove this into a proximal policy optimization algorithm which is a standard reinforcement learning algorithm and you allow 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 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 it first needs to change this back and then it can change something else so you can do that so this constraints the agent and kind of teaches it that in order to get a higher reward it must sort of adjust the starting state to something that gets higher reward and that's one way of making the 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 I think 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 long or 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's sort of still adjust to the starting state right here so you can see that this it connects the the two dots on the top so the goal is to 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 or 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 hear 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 so-bacon 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 narrower representation here appears to be a bit less powerful than the others interestingly in so-bacon 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 the representation like the CNN is maybe misarchitectured 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 all right 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 discuss 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 gonna make the level more interesting but make it such that the level is still you know interesting and solvable and then the the agent can you know go across do some things that's gonna 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 this not gonna be the case that much 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 sort of evolve levels and agents at the same time I think it's sort of like this 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.2, "text": " Hi there. Have you ever wondered how video game levels are made? Yeah, me neither."}, {"start": 6.2, "end": 12.36, "text": " But this paper has. And in this paper you can see a reinforcement learning agent"}, {"start": 12.36, "end": 19.080000000000002, "text": " that has learned how to make video game levels in various ways. So this is"}, {"start": 19.080000000000002, "end": 23.56, "text": " implemented for this game here where the goal is simply to make the longest"}, {"start": 23.56, "end": 28.92, "text": " maze. This game here is an adaptation to the legend of Zelda where you have to"}, {"start": 28.92, "end": 34.440000000000005, "text": " get a key to the door. And this game here is called Sobocon where you have to"}, {"start": 34.440000000000005, "end": 39.92, "text": " put all of the crates onto the green squares in order to solve it. So it's a"}, {"start": 39.92, "end": 47.56, "text": " puzzle game. Alright, and this is done via reinforcement learning. So the paper"}, {"start": 47.56, "end": 52.08, "text": " we're going to look at is called PCGRL procedural content generation via"}, {"start": 52.08, "end": 57.160000000000004, "text": " reinforcement learning by Ahmed Khalifa, Philly Bon Trager, Sam Early and"}, {"start": 57.16, "end": 65.7, "text": " Julian Togelios. Now this paper is basically just a fun paper and I feel and it"}, {"start": 65.7, "end": 70.32, "text": " shows how to frame a problem in terms of reinforcement learning and then how to"}, {"start": 70.32, "end": 75.36, "text": " solve it. It's pretty straightforward, it's fairly short and I you know the"}, {"start": 75.36, "end": 83.4, "text": " codes available and all so you can go check it out yourself. They say we"}, {"start": 83.4, "end": 88.84, "text": " investigate how reinforcement learning can be used to train level designing"}, {"start": 88.84, "end": 95.96000000000001, "text": " agents. Okay, so usually usually we do reinforcement learning for playing"}, {"start": 95.96000000000001, "end": 103.0, "text": " games themselves. And now we use reinforcement learning to train an agent that"}, {"start": 103.0, "end": 108.76, "text": " can design a level. So we don't design the level itself straightforward. We"}, {"start": 108.76, "end": 114.44, "text": " design the agent that designs the level and what's the advantage here? The"}, {"start": 114.44, "end": 119.88000000000001, "text": " advantage is of course the agent could then potentially generate multiple"}, {"start": 119.88000000000001, "end": 125.44, "text": " different levels once we have trained it. I say this represents a new approach to"}, {"start": 125.44, "end": 130.52, "text": " procedural content generation in games where level design is framed as a game"}, {"start": 130.52, "end": 136.64000000000001, "text": " itself. So the design of the level is now the game. And the content generator"}, {"start": 136.64, "end": 141.44, "text": " itself is learned by seeing the design problem as a sequential task we can use"}, {"start": 141.44, "end": 146.16, "text": " reinforcement learning to learn how to take the next action so that the"}, {"start": 146.16, "end": 152.64, "text": " expected final level quality is maximized. This approach can be used when few or"}, {"start": 152.64, "end": 157.04, "text": " no examples exist to train from and the train generator is very very fast."}, {"start": 157.04, "end": 163.16, "text": " Okay, so this is the outset of the of the problem formulation. Now we're going"}, {"start": 163.16, "end": 167.96, "text": " to go through the steps you have to do in order to make this work. There are a"}, {"start": 167.96, "end": 173.8, "text": " few things that I think this paper does quite well. And so the first thing is"}, {"start": 173.8, "end": 178.28, "text": " you actually have to frame the problem in terms of reinforcement learning. So"}, {"start": 178.28, "end": 182.2, "text": " what is reinforcement learning is pretty simple in reinforcement learning. You"}, {"start": 182.2, "end": 187.4, "text": " have this agent environment split. Okay, so at each step the environment is"}, {"start": 187.4, "end": 191.84, "text": " going to send the agent an observation. So the environment is going to send an"}, {"start": 191.84, "end": 197.32, "text": " observation to the agent and the agent needs to take an action in response to"}, {"start": 197.32, "end": 204.12, "text": " that. Now something happens in here we don't we don't worry about that and the"}, {"start": 204.12, "end": 210.08, "text": " environment is going to send the next observation. Okay, that is a result from"}, {"start": 210.08, "end": 216.28, "text": " taking this action. And it is also going to send the reward for this action. So"}, {"start": 216.28, "end": 221.48000000000002, "text": " at each step the agent gets an observation and the reward for the last"}, {"start": 221.48, "end": 225.84, "text": " action took and it has to output the next action. Now the environment of course"}, {"start": 225.84, "end": 231.72, "text": " has to somehow decide how do I represent the observation. This is the"}, {"start": 231.72, "end": 237.2, "text": " representation. How do I transform one observation to the next observation"}, {"start": 237.2, "end": 242.44, "text": " given an action. Okay, the action comes in and transforms the last state to the"}, {"start": 242.44, "end": 247.67999999999998, "text": " next state. And then how do I give the reward? How do I calculate the reward? So"}, {"start": 247.68, "end": 253.0, "text": " these things are the things you have to decide on the observation space. The"}, {"start": 253.0, "end": 259.04, "text": " how the reward is calculated, the action space and how an action transforms"}, {"start": 259.04, "end": 264.96000000000004, "text": " one representation into the next representation. So this is what we're going to"}, {"start": 264.96000000000004, "end": 269.24, "text": " look at the different variants. We're not going to look at specifically how"}, {"start": 269.24, "end": 272.76, "text": " reinforcement learning is done because once you have an environment like this"}, {"start": 272.76, "end": 277.24, "text": " you can just plug it into a standard reinforcement learning algorithm and"}, {"start": 277.24, "end": 282.76, "text": " it will solve it for you. Okay, so that's the power of basically having"}, {"start": 282.76, "end": 290.28000000000003, "text": " standardized or representations. So the observation space of this problem is"}, {"start": 290.28000000000003, "end": 294.36, "text": " going to be pretty simple. All the games we're dealing with here are in this, oh"}, {"start": 294.36, "end": 302.08, "text": " I already did some drawings, are in this in this framework of this grid world"}, {"start": 302.08, "end": 307.71999999999997, "text": " game. Okay, so you have this grid, this level is subdivided into this grid and"}, {"start": 307.71999999999997, "end": 313.44, "text": " that naturally corresponds of course to a 2D matrix. Now each point in this"}, {"start": 313.44, "end": 318.44, "text": " matrix has a number and the number describes what type of tile this tile is."}, {"start": 318.44, "end": 323.91999999999996, "text": " So as you can see right here, the one is going to be a wall while the zero is"}, {"start": 323.91999999999996, "end": 330.32, "text": " going to be empty space. Three here is one of these crates and two is the"}, {"start": 330.32, "end": 335.84, "text": " player. So you get the point, right? Each number corresponds to a type of tile."}, {"start": 335.84, "end": 341.8, "text": " So far so good. That's the observation space. Now what is the action space?"}, {"start": 341.8, "end": 347.08, "text": " What is the what the agent can do? At each step they say the agent can change"}, {"start": 347.08, "end": 352.68, "text": " one of these tiles. Okay, so you can change one of these tiles. Let's say this one"}, {"start": 352.68, "end": 356.84, "text": " right here. It can change it to a different one or you can just leave it. So this"}, {"start": 356.84, "end": 360.08, "text": " is a wall right now and it makes a problem fairly interesting to have a wall"}, {"start": 360.08, "end": 364.56, "text": " right here in the middle. So since we're looking at this tile we might just"}, {"start": 364.56, "end": 368.47999999999996, "text": " want to leave this right there. We could also change it. We could actually"}, {"start": 368.47999999999996, "end": 373.28, "text": " change it such that to a to such that there is another player right here."}, {"start": 373.28, "end": 379.12, "text": " Right, let me. Can I even draw this? Ah, this yellow isn't such that there is now"}, {"start": 379.12, "end": 384.24, "text": " two player tiles in the game. It would of course be an invalid level and the"}, {"start": 384.24, "end": 387.91999999999996, "text": " reinforcement learning agent ultimately should learn to produce valid and"}, {"start": 387.92, "end": 394.52000000000004, "text": " good levels. Okay, so at each step you can change one tile and of course the goal"}, {"start": 394.52000000000004, "end": 399.8, "text": " is to make a better and better and better level over time. Now how how do you"}, {"start": 399.8, "end": 405.08000000000004, "text": " choose which tile to change? That's a thing you have to define and they define"}, {"start": 405.08000000000004, "end": 412.12, "text": " three different ways in which the agent can choose which tile to change. In the"}, {"start": 412.12, "end": 418.08, "text": " narrow formulation they themselves so the environment chooses the frame the"}, {"start": 418.08, "end": 423.28000000000003, "text": " the tile to change. So the environment will say now you can change this tile if"}, {"start": 423.28000000000003, "end": 427.48, "text": " you want. And then the next step it will say now you can change this one if you"}, {"start": 427.48, "end": 431.6, "text": " want. Now you can change this one if you want. Now this is completely random."}, {"start": 431.6, "end": 435.76, "text": " Okay, how the environment should actually doesn't have to be but the environment"}, {"start": 435.76, "end": 441.72, "text": " chooses and that is problematic for the agent because the agent cannot kind of"}, {"start": 441.72, "end": 447.08000000000004, "text": " predict which tile it could change next and therefore it cannot really plan ahead"}, {"start": 447.08000000000004, "end": 451.96000000000004, "text": " how it wants to change the level. It can only make very very local very greedy"}, {"start": 451.96000000000004, "end": 458.64000000000004, "text": " choices. It can be like oh I'm right here. I might I'm actually build a wall"}, {"start": 458.64000000000004, "end": 467.08000000000004, "text": " right here. Yes that seems good but it can't so an example is maybe you want to"}, {"start": 467.08, "end": 472.4, "text": " make the level more interesting. Maybe you think that the crate up here is a bit"}, {"start": 472.4, "end": 476.28, "text": " close to this field here. You have to push it onto this field and that's fairly"}, {"start": 476.28, "end": 481.2, "text": " easy right. So you just push it like up and then to the left. Actually it's not"}, {"start": 481.2, "end": 487.24, "text": " that easy because there's the wall right here and you have to go around. Actually"}, {"start": 487.24, "end": 490.68, "text": " you'd have probably have to push this down but let's say the level is too easy and"}, {"start": 490.68, "end": 497.88, "text": " you want to move the move the crate to a bit like let's say here in this in this"}, {"start": 497.88, "end": 503.44, "text": " framework where the environment tells you which which which tiles to change. You"}, {"start": 503.44, "end": 509.0, "text": " can basically once you come across this tile you can delete it okay but then"}, {"start": 509.0, "end": 516.08, "text": " you kind of have to wait and wait and wait and wait until at random this tile"}, {"start": 516.08, "end": 520.2, "text": " where you want to put it is selected and this might actually never happen because"}, {"start": 520.2, "end": 525.0, "text": " the episode might be over and if it never happens you are in an invalid level"}, {"start": 525.0, "end": 530.5200000000001, "text": " right. So the the agent here is basically forced to"}, {"start": 530.5200000000001, "end": 535.32, "text": " greedily make the level valid before it can make it interesting and then it can"}, {"start": 535.32, "end": 540.8000000000001, "text": " only make it interesting in sort of local ways. So the second way that the"}, {"start": 540.8000000000001, "end": 546.8000000000001, "text": " second formulation here is the turtle formulation. Now you might know this from"}, {"start": 546.8, "end": 552.64, "text": " the turtle graphics where basically you have this you have this little turtle"}, {"start": 552.64, "end": 558.7199999999999, "text": " thing and you can always move it either like you know down up left or right"}, {"start": 558.7199999999999, "end": 563.9599999999999, "text": " and then you can always put a dot or not put a dot and thereby you can like trace"}, {"start": 563.9599999999999, "end": 571.8399999999999, "text": " out things this is like intro to programming same here. So now the agent is"}, {"start": 571.8399999999999, "end": 576.1999999999999, "text": " given a starting square and it can choose to change it or not but it can also"}, {"start": 576.2, "end": 582.24, "text": " choose how to move to the next square so to the right up left or down it can"}, {"start": 582.24, "end": 586.24, "text": " so it can choose so you can go along and say okay now I'm here I want to change"}, {"start": 586.24, "end": 592.72, "text": " it to a two now I'm here I want to change it to a two now I'm here and so on"}, {"start": 592.72, "end": 598.72, "text": " so it can basically do things like build long walls and things like this so"}, {"start": 598.72, "end": 603.9200000000001, "text": " you can plan ahead more considerably but still if you regard the problem from"}, {"start": 603.92, "end": 610.12, "text": " before if it wants to place the place to create to a different location it can"}, {"start": 610.12, "end": 615.88, "text": " like if maybe it's here okay the agent is here and then you can say okay I want"}, {"start": 615.88, "end": 619.4399999999999, "text": " to not change but move not change and move not change moving then you can"}, {"start": 619.4399999999999, "end": 624.7199999999999, "text": " delete and then it has to move over here step by step until it can place it"}, {"start": 624.7199999999999, "end": 629.1999999999999, "text": " again it's so you can plan ahead considerably longer actually you can just"}, {"start": 629.2, "end": 635.32, "text": " move straight over because the agent itself is not constrained by walls so"}, {"start": 635.32, "end": 639.6400000000001, "text": " you can move ahead quite a bit but it's still kind of localized changes because"}, {"start": 639.6400000000001, "end": 644.8000000000001, "text": " it can move one tile at a time right and if in between the episode ends it's"}, {"start": 644.8000000000001, "end": 650.2, "text": " again an invalid level so the third formulation is the most powerful"}, {"start": 650.2, "end": 654.6400000000001, "text": " formulation it's called the wide formulation and this is where the agent at"}, {"start": 654.6400000000001, "end": 658.96, "text": " each time step can not only choose how to change the tile but can freely"}, {"start": 658.96, "end": 664.96, "text": " choose the next tile to change so it can it could say in one step it could say"}, {"start": 664.96, "end": 670.12, "text": " I want to delete this tile and then in the next step it could say I want to"}, {"start": 670.12, "end": 676.6800000000001, "text": " place it right here okay so this is so it can plan ahead considerably so how"}, {"start": 676.6800000000001, "end": 682.8000000000001, "text": " you design the action space is very important for how your agent or for what"}, {"start": 682.8000000000001, "end": 688.0400000000001, "text": " your agent can possibly learn and how easy it is for the agent to learn because"}, {"start": 688.04, "end": 691.68, "text": " it's gonna be pretty easy for this agent to learn to move crates like this"}, {"start": 691.68, "end": 696.9599999999999, "text": " where even though the other agent that moves one tile at a time can also do it"}, {"start": 696.9599999999999, "end": 701.3199999999999, "text": " it has to plan ahead for longer so it has to sort of invest more of the"}, {"start": 701.3199999999999, "end": 707.48, "text": " reinforcement learning power into doing these sorts of things but of course"}, {"start": 707.48, "end": 712.64, "text": " it's being more constrained also means you have less actions at your disposal"}, {"start": 712.64, "end": 716.92, "text": " like this last agent it has a lot of actions it can do it can choose any"}, {"start": 716.92, "end": 722.4799999999999, "text": " tile at once right so that can also introduce considerable exploration dilemma"}, {"start": 722.4799999999999, "end": 728.28, "text": " and you have to trade these things off when you design things like that all"}, {"start": 728.28, "end": 733.1999999999999, "text": " right so this is the action space now how the observation involves"}, {"start": 733.1999999999999, "end": 737.0799999999999, "text": " evolves into the next observation should be fairly clear I mean that's already"}, {"start": 737.0799999999999, "end": 741.8399999999999, "text": " given by the action space if you ask yourself if you're in this in this situation"}, {"start": 741.84, "end": 748.64, "text": " right here and the agent deletes the crate then the crate is no longer there"}, {"start": 748.64, "end": 755.0400000000001, "text": " then so if it changes this to a zero then it's just empty space now okay so"}, {"start": 755.0400000000001, "end": 758.6800000000001, "text": " that's that's fairly obvious here now the last thing we need to do is the"}, {"start": 758.6800000000001, "end": 764.4, "text": " reward calculation what reward do you give the agent and you can here you can"}, {"start": 764.4, "end": 769.36, "text": " give the agent the reward either let's say at the very end you cannot give it a"}, {"start": 769.36, "end": 773.72, "text": " reward for the entire episode and give it a reward at the very end reinforcement"}, {"start": 773.72, "end": 778.84, "text": " learning algorithms are able to deal with this to a certain degree you can also"}, {"start": 778.84, "end": 784.6800000000001, "text": " decide to give it at each step now the way they do it here I believe is they"}, {"start": 784.6800000000001, "end": 791.52, "text": " give it at the end and they have multiple components to the reward so the"}, {"start": 791.52, "end": 797.5600000000001, "text": " reward in this case is how well the level fulfills certain goals that the"}, {"start": 797.56, "end": 803.68, "text": " programmer sets so the goals in SoboCon are basically the rules of the game and"}, {"start": 803.68, "end": 810.88, "text": " that means there is only one player if there are two or none then the reward is"}, {"start": 810.88, "end": 817.2399999999999, "text": " less there are at least one crate and there are as many crates as green fields"}, {"start": 817.2399999999999, "end": 821.76, "text": " okay so here you can see there are only two crates but three green fields so the"}, {"start": 821.76, "end": 826.4799999999999, "text": " agent will get a penalty for producing a level like this and then the last thing"}, {"start": 826.48, "end": 835.44, "text": " is the level has to be solvable and for checking solvability the the authors of"}, {"start": 835.44, "end": 840.64, "text": " this paper simply employ a SoboCon solver they have a SoboCon solver that is"}, {"start": 840.64, "end": 844.72, "text": " like a tree search algorithm that tries to solve the level if it can't solve"}, {"start": 844.72, "end": 850.4, "text": " the level then the level is invalid and the agent gets a a worse reward than"}, {"start": 850.4, "end": 856.68, "text": " whenever the level is solvable okay so how you design the reward is also very"}, {"start": 856.68, "end": 861.8, "text": " important if you only give give like a one reward when all the goals are fulfilled"}, {"start": 861.8, "end": 866.0799999999999, "text": " and give a zero reward as soon as one of the goals is not fulfilled a"}, {"start": 866.0799999999999, "end": 870.56, "text": " reinforcement learning agent is going to have a very very much difficult time to"}, {"start": 870.56, "end": 874.92, "text": " learn that so you have to kind of design the reward such you help the agent"}, {"start": 874.92, "end": 879.52, "text": " realize what's important so maybe if there's only one crate missing but you know"}, {"start": 879.52, "end": 885.28, "text": " in fact the level is solvable except for that you know that maybe one green"}, {"start": 885.28, "end": 889.64, "text": " field is going to be empty then you could still give a fairly high reward but"}, {"start": 889.64, "end": 893.64, "text": " you could just give a higher reward when the level is actually solvable like"}, {"start": 893.64, "end": 899.4399999999999, "text": " or all the rules are fulfilled and there is a crate here okay the other thing"}, {"start": 899.4399999999999, "end": 904.0, "text": " to notice here is that in this case you actually do need a solver for the"}, {"start": 904.0, "end": 909.28, "text": " level since it's a puzzle game and that means your level your agent is only"}, {"start": 909.28, "end": 913.88, "text": " going to produce levels that are as difficult as your solver can solve so"}, {"start": 913.88, "end": 918.48, "text": " that's going to be a considerable problem but that's you know a limitation"}, {"start": 918.48, "end": 923.9599999999999, "text": " here but all of their rewards are hard coded so to say so there's the reward is"}, {"start": 923.9599999999999, "end": 930.04, "text": " given by the environment so now that we have observations which are these"}, {"start": 930.04, "end": 934.24, "text": " matrices right here we have actions which and we actually have three different"}, {"start": 934.24, "end": 939.0, "text": " ways of formulating actions and we have reward they can simply plug this into"}, {"start": 939.0, "end": 944.56, "text": " a standard reinforcement learning algorithm now they have one last thing that"}, {"start": 944.56, "end": 949.12, "text": " they have which is this change percentage parameter so what they say is they"}, {"start": 949.12, "end": 954.64, "text": " give the agent an initial state and then the agent is allowed to change it"}, {"start": 954.64, "end": 960.28, "text": " around like here so on the left you have this initial state okay this is sort of"}, {"start": 960.28, "end": 963.8, "text": " around the initial state and you allow the agent now to change it in this"}, {"start": 963.8, "end": 967.96, "text": " stepwise fashion and you always update the agent by the way the agent as you"}, {"start": 967.96, "end": 973.24, "text": " might imagine the agent takes this matrix right here and puts it shoves it"}, {"start": 973.24, "end": 979.64, "text": " through like a few convolutional layers and then decides on an action I almost"}, {"start": 979.64, "end": 985.2800000000001, "text": " forgetting that this this is so obvious by now that yeah the agent is like a"}, {"start": 985.2800000000001, "end": 990.88, "text": " standard deep learning taking in a 2d doing some convolutions and then having"}, {"start": 990.88, "end": 998.4, "text": " like a policy outputs so you shove this into a proximal policy optimization"}, {"start": 998.4, "end": 1001.64, "text": " algorithm which is a standard reinforcement learning algorithm and you allow"}, {"start": 1001.64, "end": 1007.16, "text": " to change these things now what they do is they only allow the agent to change"}, {"start": 1007.16, "end": 1012.08, "text": " the levels by so much because what they say is if we start out from these"}, {"start": 1012.08, "end": 1017.96, "text": " different states we would you can decide on two things either the you can train"}, {"start": 1017.96, "end": 1023.72, "text": " the agent to find you the best possible level ever right but then it would sort"}, {"start": 1023.72, "end": 1027.04, "text": " of ignore the starting state it would just learn which level gives me the"}, {"start": 1027.04, "end": 1031.96, "text": " highest reward and it would just change all the tiles always to that right"}, {"start": 1031.96, "end": 1036.8400000000001, "text": " it would just try to change the to always reach that best possible state and"}, {"start": 1036.8400000000001, "end": 1042.88, "text": " forget the start state so they say okay the the the last constraint is the agent"}, {"start": 1042.88, "end": 1049.24, "text": " can only change like 20% of the tiles at most and after after that we end the"}, {"start": 1049.24, "end": 1053.88, "text": " episode or we just don't allow the agent to change anything anymore it needs to"}, {"start": 1053.88, "end": 1058.96, "text": " first so if it changed this here to empty space and wants to change something"}, {"start": 1058.96, "end": 1062.3600000000001, "text": " else it first needs to change this back and then it can change something else"}, {"start": 1062.3600000000001, "end": 1066.8400000000001, "text": " so you can do that so this constraints the agent and kind of teaches it that"}, {"start": 1066.8400000000001, "end": 1071.68, "text": " in order to get a higher reward it must sort of adjust the starting state to"}, {"start": 1071.68, "end": 1078.5600000000002, "text": " something that gets higher reward and that's one way of making the the levels"}, {"start": 1078.5600000000002, "end": 1082.96, "text": " that you generate more diverse it's sort of a unique problem to this"}, {"start": 1082.96, "end": 1088.28, "text": " particular kind of reinforcement learning problem because all sometimes like"}, {"start": 1088.28, "end": 1093.04, "text": " most of the time you just want to find the highest reward whatever but here you"}, {"start": 1093.04, "end": 1097.48, "text": " also want to you know maximize diversity of the levels you generate and"}, {"start": 1097.48, "end": 1101.24, "text": " therefore you could say that's that's a pretty good you know that's a pretty"}, {"start": 1101.24, "end": 1106.0, "text": " good constraint to put into that so that's I think I like here about this"}, {"start": 1106.0, "end": 1112.24, "text": " paper this this change percentage constraint now at inference time you can"}, {"start": 1112.24, "end": 1117.3600000000001, "text": " change that so at training time you only change whatever 20% but at inference"}, {"start": 1117.3600000000001, "end": 1121.0, "text": " time you can technically let the agent run for long or as you can see I think"}, {"start": 1121.0, "end": 1125.44, "text": " here they just let it run until it you know find something good like this one"}, {"start": 1125.44, "end": 1129.64, "text": " right here fairly good from the starting state and you can see it's sort of"}, {"start": 1129.64, "end": 1134.8, "text": " still adjust to the starting state right here so you can see that this it"}, {"start": 1134.8, "end": 1139.8, "text": " connects the the two dots on the top so the goal is to to make the longest"}, {"start": 1139.8, "end": 1146.0800000000002, "text": " possible maze or a long maze so it connects these two you can see here also this"}, {"start": 1146.0800000000002, "end": 1153.96, "text": " one connects them so and then it goes out here and connects to this one so it's"}, {"start": 1153.96, "end": 1158.52, "text": " fairly good at relying on this starting state now you can see that these"}, {"start": 1158.52, "end": 1162.64, "text": " turtle and wide representations that can actually choose where to go and where"}, {"start": 1162.64, "end": 1168.3600000000001, "text": " to change something or considerably or you know more more powerful than this"}, {"start": 1168.3600000000001, "end": 1175.0, "text": " narrow thing especially if you look at this level right here which again is the"}, {"start": 1175.0, "end": 1181.16, "text": " importance of designing the action space well is going to directly affect the"}, {"start": 1181.16, "end": 1188.0400000000002, "text": " outcome that you're going to have all right and you see the same thing here for"}, {"start": 1188.0400000000002, "end": 1193.72, "text": " this Zelda game now here you can see the starting state often involves let's"}, {"start": 1193.72, "end": 1198.5600000000002, "text": " say here you have two players and you have three keys and that's an invalid"}, {"start": 1198.5600000000002, "end": 1203.6000000000001, "text": " starting state and sometimes the the door cannot be reached sometimes the door"}, {"start": 1203.6000000000001, "end": 1207.5600000000002, "text": " is actually not even there like here and you can see that the agent all of the"}, {"start": 1207.56, "end": 1212.72, "text": " agents sort of learn to make at least valid levels where you have the player"}, {"start": 1212.72, "end": 1220.2, "text": " and the door and the key right here being able to reach everything so that's"}, {"start": 1220.2, "end": 1225.32, "text": " you know fairly fairly cool because counting is one of these things that the"}, {"start": 1225.32, "end": 1231.0, "text": " neural networks aren't necessarily super good at so it's nice to see that you"}, {"start": 1231.0, "end": 1237.8, "text": " know they can they can hear they have two players and they they're deleting one"}, {"start": 1237.8, "end": 1242.56, "text": " of them here they have three crates and they actually make it such that the"}, {"start": 1242.56, "end": 1250.68, "text": " number of crates and the number of green tiles agree so you know that's that's"}, {"start": 1250.68, "end": 1255.56, "text": " fairly cool that this comes out and here you can see the different power of the"}, {"start": 1255.56, "end": 1261.1599999999999, "text": " algorithms so in this binary problem and this is the Zelda problem this is"}, {"start": 1261.1599999999999, "end": 1266.1599999999999, "text": " so-bacon problem you can see that as you allow the agent at inference time to"}, {"start": 1266.1599999999999, "end": 1271.76, "text": " change more and more of the level the percentage of levels where the agent"}, {"start": 1271.76, "end": 1279.04, "text": " gets a good gets a good level like succeeds in building a valid level goes up"}, {"start": 1279.04, "end": 1283.8799999999999, "text": " and up and now this as I already said this narrower representation here appears"}, {"start": 1283.88, "end": 1290.8400000000001, "text": " to be a bit less powerful than the others interestingly in so-bacon the best"}, {"start": 1290.8400000000001, "end": 1294.64, "text": " one is this turtle representation where you can only change one tile at a time"}, {"start": 1294.64, "end": 1300.8000000000002, "text": " and not the more powerful wide representation that's probably because I'm going"}, {"start": 1300.8000000000002, "end": 1305.1200000000001, "text": " to guess that's because the either the reinforcement learning algorithm was"}, {"start": 1305.1200000000001, "end": 1311.4, "text": " isn't you know powerful enough or the representation like the CNN is maybe"}, {"start": 1311.4, "end": 1317.96, "text": " misarchitectured a bit you know technically this representation should be able to"}, {"start": 1317.96, "end": 1323.88, "text": " achieve higher scores but not as easily because as I said the action space is"}, {"start": 1323.88, "end": 1330.3600000000001, "text": " so much higher so it's more difficult to learn but ultimately it should learn"}, {"start": 1330.3600000000001, "end": 1339.72, "text": " it better all right so this is this was this paper it's I think it's fairly"}, {"start": 1339.72, "end": 1344.04, "text": " cool and fairly fun to view it from this particular perspective and they"}, {"start": 1344.04, "end": 1348.84, "text": " discuss that the future could be that humans solve this together because"}, {"start": 1348.84, "end": 1353.52, "text": " usually when you have assisted level design you would have something some sort"}, {"start": 1353.52, "end": 1357.28, "text": " of like an optimizer running to optimize the level you're working on"}, {"start": 1357.28, "end": 1361.48, "text": " directly like it say okay make something here and it would sort of run for a"}, {"start": 1361.48, "end": 1367.0, "text": " while and that takes you know takes time now this here this agent at inference"}, {"start": 1367.0, "end": 1372.4, "text": " time is very very fast so it can you know work together with humans so the"}, {"start": 1372.4, "end": 1377.2, "text": " human would say for example oh here please make a wall right here because that's"}, {"start": 1377.2, "end": 1380.04, "text": " gonna make the level more interesting but make it such that the level is still"}, {"start": 1380.04, "end": 1384.6, "text": " you know interesting and solvable and then the the agent can you know go across"}, {"start": 1384.6, "end": 1389.64, "text": " do some things that's gonna be super fast and agents and humans could work"}, {"start": 1389.64, "end": 1395.56, "text": " together at this now one drawback of course is that in a puzzle game like"}, {"start": 1395.56, "end": 1401.0, "text": " sobocon you know you have to make sure the level is solvable and here"}, {"start": 1401.0, "end": 1407.04, "text": " luckily you can employ a solver but as the puzzles get more difficult that's"}, {"start": 1407.04, "end": 1412.76, "text": " not not super like this not gonna be the case that much also they remark that"}, {"start": 1412.76, "end": 1417.04, "text": " most of the levels generated are fairly easy because their reward only depends"}, {"start": 1417.04, "end": 1423.1599999999999, "text": " on whether or not the level is solvable by an easy solver right so you could"}, {"start": 1423.16, "end": 1427.64, "text": " give some reward for how difficult the level is but then again that depends on"}, {"start": 1427.64, "end": 1432.6000000000001, "text": " your solver so an interesting next step would be to evolve these or to train"}, {"start": 1432.6000000000001, "end": 1438.28, "text": " these as you train reinforcement learning agents to solve these kinds of"}, {"start": 1438.28, "end": 1442.6000000000001, "text": " games so kind of do a curriculum learning sort of a GAN setting between"}, {"start": 1442.6000000000001, "end": 1448.8400000000001, "text": " level generator and reinforcement learning algorithm like reinforcement"}, {"start": 1448.84, "end": 1455.0, "text": " learning game player to sort of evolve levels and agents at the same time I"}, {"start": 1455.0, "end": 1459.9599999999998, "text": " think it's sort of like this this poet approaches except you would directly"}, {"start": 1459.9599999999998, "end": 1465.76, "text": " learn I think that would be next nice direction for this work in any case the"}, {"start": 1465.76, "end": 1470.28, "text": " code is available you can even plug in your own games and make your own"}, {"start": 1470.28, "end": 1477.28, "text": " levels so check this out and with that I'll see you next time bye bye"}] |
Yannic Kilcher | 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 Maniel Zayer and Guru Garuganesh at 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 Bird 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 too incomplete and can 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 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 just go nuts. Alright so the basic 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 that I've done now 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 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 each token is represented by a vector at the beginning and each layer transforms this sequence as I said in to sort of a higher level or a 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 birth 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 Big Bird proposes by the way Big Bird another character from Sesame Street I guess we'll continue the naming here after Elmo and Bert I'm waiting for the model that's the count yeah that's gonna be a fun model but so Big Bird 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 well 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 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 2 random nodes then you don't have an n squared anymore but you'll have a 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're 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 would you would have to do that in the next layer so this formulation as a ran 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 the 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 throw 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 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 I 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 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 addition 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's 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 want to 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 all 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 a 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 tension mechanism is as sort of as powerful as the classic full 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 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 a 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's 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 the 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 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 transformer and that is the last one of their theoretical results right here so first they prove universal approximations and second they prove to ring completeness these two properties have been proven for full attention mechanisms and third they prove that there are tasks where you 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 and sort them and then put them like I send 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 a single step is just all of n so I have now an all 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 former 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 bird 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 bird and here if I look at the parameters of their thing and they have multiple experiments right here and I believe this is the the base version so 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 bird 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 4,000 and 96 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 bird because bird attends to as many tokens but has a smaller inputs sequence and you know I 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 you know 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 or that speeds up 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 gonna focus 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 roll 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's 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 R 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 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 not 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 a 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'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 longformer 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 then practice often ends up being you know fairly large-ish and also 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 death-set results using base size models for example where you can see they do outperform basic Roberto models they outperform longformer which may mean that the random attention is useful but you know in these things it's also always may just mean that you throw 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 like 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 that doesn't necessarily have to be state of the art but it can reach good numbers which tells me that okay probably 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 know 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 that we leave the papers about the architecture all right 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'll see you next time bye bye | [{"start": 0.0, "end": 5.28, "text": " Hi there. Today we'll look at Big Bird Transformers for longer sequences by"}, {"start": 5.28, "end": 10.74, "text": " Maniel Zayer and Guru Garuganesh at Al of Google Research. So this paper on a"}, {"start": 10.74, "end": 14.72, "text": " high-level proposes to replace the quadratic attention mechanism in"}, {"start": 14.72, "end": 22.240000000000002, "text": " transformers by a mix of random attention, windowed attention, and selective"}, {"start": 22.240000000000002, "end": 27.96, "text": " global attention. Therefore achieving a complexity of linear memory requirement"}, {"start": 27.96, "end": 32.96, "text": " instead of quadratic memory requirement. And as a result of that they can"}, {"start": 32.96, "end": 38.32, "text": " process longer sequences than traditional transformers like Bird and achieve"}, {"start": 38.32, "end": 44.16, "text": " better results in some NLP tasks and they also evaluate on genomics tasks. So"}, {"start": 44.16, "end": 48.400000000000006, "text": " we'll go through this paper a bit look a bit at the proof because they give a"}, {"start": 48.400000000000006, "end": 53.52, "text": " theoretical kind of guarantee that their random attention mechanism can still"}, {"start": 53.52, "end": 61.440000000000005, "text": " be too incomplete and can still achieve the same things as a full attention"}, {"start": 61.440000000000005, "end": 66.04, "text": " mechanism but we'll also look at the drawbacks. I sort of have mixed feelings"}, {"start": 66.04, "end": 71.28, "text": " about this paper and I think I'll voice my concerns as we go through here. But"}, {"start": 71.28, "end": 75.56, "text": " first let's look at the paper, let's look at the architecture and I think this"}, {"start": 75.56, "end": 80.64, "text": " is actually a pretty cool paper for the empirical progression of the field to"}, {"start": 80.64, "end": 86.76, "text": " to process longer sequences with transformers. As always if you like content like"}, {"start": 86.76, "end": 92.04, "text": " this feel free to share it around, leave a like and tell me in the comments what"}, {"start": 92.04, "end": 99.12, "text": " you think about the paper and about what I think whatever you just just go nuts."}, {"start": 99.12, "end": 107.14, "text": " Alright so the basic the basic premise right here is that the transformers"}, {"start": 107.14, "end": 112.28, "text": " they've been pretty impactful especially in NLP so they say transformer based"}, {"start": 112.28, "end": 116.52, "text": " models such as BERT have been one of the most successful deep learning models for"}, {"start": 116.52, "end": 121.52, "text": " NLP. Unfortunately one of their core limitations is the quadratic"}, {"start": 121.52, "end": 126.72, "text": " dependency mainly in terms of memory on the sequence length due to their full"}, {"start": 126.72, "end": 130.84, "text": " attention mechanism. So really briefly the full attention mechanism that I've"}, {"start": 130.84, "end": 135.64, "text": " done now numerous videos about attention mechanism BERT attention is all you"}, {"start": 135.64, "end": 139.67999999999998, "text": " need and so on. So if you want a detailed explanation of what that is just go"}, {"start": 139.67999999999998, "end": 145.92, "text": " look up the corresponding videos but briefly what you'll have in NLP is a set"}, {"start": 145.92, "end": 151.6, "text": " of tokens a sequence of tokens as an input and you want to transform them layer"}, {"start": 151.6, "end": 158.51999999999998, "text": " after layer into sort of a a higher order representation of that same"}, {"start": 158.51999999999998, "end": 163.95999999999998, "text": " sequence and for that you build these layers out of nodes and you have as many"}, {"start": 163.96, "end": 169.52, "text": " nodes usually as you have tokens in the sequence and the next set of each"}, {"start": 169.52, "end": 175.72, "text": " token is represented by a vector at the beginning and each layer transforms"}, {"start": 175.72, "end": 179.24, "text": " this sequence as I said in to sort of a higher level or a representation so you"}, {"start": 179.24, "end": 186.32, "text": " want the vector of this token right here to be a better representation than the"}, {"start": 186.32, "end": 191.68, "text": " vector was right here and you do that by incorporating information from all"}, {"start": 191.68, "end": 198.16, "text": " the other tokens into that particular vector. Now as I said this is called an"}, {"start": 198.16, "end": 202.20000000000002, "text": " attention mechanism and we don't actually have to go into how it works right"}, {"start": 202.20000000000002, "end": 207.32, "text": " here but you can see pretty clearly that if you want to do this for every token"}, {"start": 207.32, "end": 213.24, "text": " you need to have information routed from every token to every token like from"}, {"start": 213.24, "end": 218.72, "text": " here to here from here to here and so on and this is just one token and then you"}, {"start": 218.72, "end": 222.52, "text": " need to do it for this token and for this token and for this token so what"}, {"start": 222.52, "end": 226.64, "text": " you'll ultimately get if n is your sequence length you'll get some n squared"}, {"start": 226.64, "end": 232.0, "text": " amount of computation and memory requirements for this so this is a problem"}, {"start": 232.0, "end": 236.6, "text": " and usually this means that you know this sequence length in birth this is"}, {"start": 236.6, "end": 243.96, "text": " limited to something like 512 tokens which is okay for some applications but if"}, {"start": 243.96, "end": 248.96, "text": " you want to summarize you know entire articles entire books even or do"}, {"start": 248.96, "end": 253.88, "text": " question answering with lots of context it's not really enough so people have"}, {"start": 253.88, "end": 260.16, "text": " been thinking about how to scale this input how to scale this and of course the"}, {"start": 260.16, "end": 264.56, "text": " main culprit is this quadratic attention mechanism because if you you know"}, {"start": 264.56, "end": 269.64, "text": " double the 512 you need you know four times the amount of compute and memory"}, {"start": 269.64, "end": 276.12, "text": " so how does this paper go about reducing that quadratic dependency the goal"}, {"start": 276.12, "end": 282.76, "text": " right here is of course to get this to some O of n right because then as we"}, {"start": 282.76, "end": 287.32, "text": " double the input length we simply need to double the compute requirements and"}, {"start": 287.32, "end": 291.59999999999997, "text": " that would be fantastic and that's what this paper does and it does so without"}, {"start": 291.59999999999997, "end": 296.88, "text": " you know sacrificing the properties of the transformer so here's the"}, {"start": 296.88, "end": 303.48, "text": " architecture that Big Bird proposes by the way Big Bird another character from"}, {"start": 303.48, "end": 310.92, "text": " Sesame Street I guess we'll continue the naming here after Elmo and Bert"}, {"start": 310.92, "end": 318.52, "text": " I'm waiting for the model that's the count yeah that's gonna be a fun model but"}, {"start": 318.52, "end": 325.0, "text": " so Big Bird basically has three different types of attention here these are"}, {"start": 325.0, "end": 330.04, "text": " adjacency matrices in this attention mechanism so here is the input layer and"}, {"start": 330.04, "end": 336.56, "text": " the output layer is right here so that basically means that node I right here"}, {"start": 336.56, "end": 341.48, "text": " would be connected well sorry that's not a straight line would be connected to"}, {"start": 341.48, "end": 347.2, "text": " this particular node and also to this particular node so we're now trying if"}, {"start": 347.2, "end": 354.24, "text": " we have node I right here we're now trying to not connect it to all of these"}, {"start": 354.24, "end": 360.28000000000003, "text": " nodes but we'll say we'll just select some random and then connect it to that"}, {"start": 360.28000000000003, "end": 365.84000000000003, "text": " okay this is what we call random attention and you can pretty clearly see if"}, {"start": 365.84000000000003, "end": 372.92, "text": " you connect each of the I nodes to R equals 2 to 2 random nodes then you don't"}, {"start": 372.92, "end": 381.72, "text": " have an n squared anymore but you'll have a like an O of R times n which you know"}, {"start": 381.72, "end": 388.76000000000005, "text": " if R is a constant is an O of n attention mechanism okay so the main goal"}, {"start": 388.76000000000005, "end": 394.92, "text": " between the random attention mechanism is that for each query basically you"}, {"start": 394.92, "end": 401.44000000000005, "text": " select random tokens that you attend to and that random number is a fixed"}, {"start": 401.44000000000005, "end": 406.76000000000005, "text": " number that's not dependent on the sequence length and the paper is a little"}, {"start": 406.76, "end": 413.0, "text": " bit unclear about whether or not those random ones are the same for every"}, {"start": 413.0, "end": 417.68, "text": " sequence or are switched up or are the same for every layer or are switched up"}, {"start": 417.68, "end": 422.12, "text": " but they formulate all of this as sort of in sort of a graph in sort of a"}, {"start": 422.12, "end": 428.15999999999997, "text": " random graph so they're they formulate the attention mechanism in form of a"}, {"start": 428.15999999999997, "end": 434.36, "text": " graph so if we transform all of these nodes into a graph a full attention"}, {"start": 434.36, "end": 439.52000000000004, "text": " mechanism would mean that each graph each node is connected to each of the"}, {"start": 439.52000000000004, "end": 447.40000000000003, "text": " other nodes right fully connected graph I don't maybe that's it so that would"}, {"start": 447.40000000000003, "end": 453.52000000000004, "text": " be a full attention mechanism and then they say well if we just have random"}, {"start": 453.52000000000004, "end": 458.48, "text": " connections between these things then there are some theorems from graph theory"}, {"start": 458.48, "end": 464.96000000000004, "text": " that say that each random walk in this graph is going to so this graph is going"}, {"start": 464.96000000000004, "end": 469.24, "text": " to mix pretty quickly so I can get from each node to each other node by a"}, {"start": 469.24, "end": 476.0, "text": " random walk in a logarithmic time and this random walk which basically means"}, {"start": 476.0, "end": 481.40000000000003, "text": " that you go from here to here this would be one layer of the transformer and"}, {"start": 481.40000000000003, "end": 485.48, "text": " then if you want to go from here to here that would you would have to do that in"}, {"start": 485.48, "end": 490.76, "text": " the next layer so this formulation as a ran graph leads me to believe that"}, {"start": 490.76, "end": 497.12, "text": " layer after layer the random attention pattern is going to be the same but"}, {"start": 497.12, "end": 503.16, "text": " also the formulation of the paper leads me to believe that the this random"}, {"start": 503.16, "end": 507.68, "text": " attention differs from sequence to sequence so I believe what's happening is"}, {"start": 507.68, "end": 513.8000000000001, "text": " that they you know get a new sequence then they decide on this pattern right"}, {"start": 513.8, "end": 519.4799999999999, "text": " here once and then they use this layer after layer the same pattern again so you"}, {"start": 519.4799999999999, "end": 526.56, "text": " can see that in the traditional attention information can basically throw flow"}, {"start": 526.56, "end": 532.4, "text": " from each of the nodes to each other node in one single step right because each"}, {"start": 532.4, "end": 536.16, "text": " node is connected to each other node you see this in the graph right here"}, {"start": 536.16, "end": 543.52, "text": " however if we only select a subset then you know it needs to if if I want to go"}, {"start": 543.52, "end": 550.56, "text": " from as I said from here to here then I need to do it in two steps and therefore"}, {"start": 550.56, "end": 555.76, "text": " I need two layers and that's going to be the culprit of this method here and you"}, {"start": 555.76, "end": 560.72, "text": " know while it is mentioned in the paper it's sort of I feel at least that's my"}, {"start": 560.72, "end": 566.24, "text": " my assessment of this paper it's kind of swept under the rug a little bit I"}, {"start": 566.24, "end": 572.68, "text": " mean they do have a theorem that clearly says we can construct an example of a"}, {"start": 572.68, "end": 577.3599999999999, "text": " task that in the full attention setting can be solved with a single step so a"}, {"start": 577.3599999999999, "end": 583.8399999999999, "text": " single layer that in our random attention setting needs a lot of layers so a"}, {"start": 583.8399999999999, "end": 591.16, "text": " lot of steps but you know the rest of the paper is sort of shaky on on this"}, {"start": 591.16, "end": 596.8, "text": " thing but nevertheless you can see how the random attention can if you have"}, {"start": 596.8, "end": 602.8399999999999, "text": " enough layers do the same information routing as the full attention okay"}, {"start": 602.8399999999999, "end": 608.3199999999999, "text": " however this is not a property of the random attention and we'll see this in"}, {"start": 608.3199999999999, "end": 613.8, "text": " the next thing right here so the next ingredient that this paper uses is window"}, {"start": 613.8, "end": 618.04, "text": " attention and you can see over here that Big Bird is ultimately going to be a"}, {"start": 618.04, "end": 622.68, "text": " combination of the three types of attention which will which we are looking at"}, {"start": 622.68, "end": 629.64, "text": " here so window attention basically means that each each I each token at the"}, {"start": 629.64, "end": 636.12, "text": " eye of position is going to attend to itself of course so here is I but it is"}, {"start": 636.12, "end": 641.8, "text": " also going to attend to its neighbors so here is I minus one and here is I plus"}, {"start": 641.8, "end": 647.5999999999999, "text": " one and this is a you know this is a window size w that you can that is a"}, {"start": 647.6, "end": 654.32, "text": " parameter but also it is a constant and therefore you again go from n squared"}, {"start": 654.32, "end": 661.84, "text": " to w times n which you know is of n if w is a constant and this might be"}, {"start": 661.84, "end": 666.5600000000001, "text": " familiar to you because we've already seen this in the long-former papers I've"}, {"start": 666.5600000000001, "end": 673.6, "text": " made a video or I think even two videos on the long-former which used exactly"}, {"start": 673.6, "end": 679.48, "text": " the window attention in combination with the global attention and if you want"}, {"start": 679.48, "end": 683.64, "text": " to know more about that go watch these videos but the new thing in Big Bird"}, {"start": 683.64, "end": 692.88, "text": " right here is this addition of the random attention again the the window here"}, {"start": 692.88, "end": 699.24, "text": " is is has exactly the same properties as the random attention so you have"}, {"start": 699.24, "end": 705.72, "text": " instead of a fully connected graph you have a sparsely connected graph now if"}, {"start": 705.72, "end": 710.48, "text": " you have random attention the sparsely connected graph is like like the one on"}, {"start": 710.48, "end": 715.64, "text": " the right but if you have a windowed attention you can it is kind of not"}, {"start": 715.64, "end": 721.48, "text": " randomly connected but each node is connected to its neighbors like this and you"}, {"start": 721.48, "end": 726.72, "text": " can also see that if I want to go from this node to this node right here I can't"}, {"start": 726.72, "end": 733.32, "text": " do it in one step but I can do it in two steps I go here and I go here so in the"}, {"start": 733.32, "end": 741.72, "text": " terms of the attention layers if I want to go from node one to node three I have"}, {"start": 741.72, "end": 745.76, "text": " to do it in two steps because each node is only connected to its neighbors so"}, {"start": 745.76, "end": 753.36, "text": " the connection patterns would sort of look like this so I have to go from one to"}, {"start": 753.36, "end": 759.36, "text": " two and then in the next layer from two to three so the paper basically makes"}, {"start": 759.36, "end": 766.24, "text": " up for the lack of full attention by adding layers and you all also might"}, {"start": 766.24, "end": 771.48, "text": " recognize this from a convolution operation like this basically because it's"}, {"start": 771.48, "end": 777.12, "text": " a convolution operation right in a convolution each node a only aggregates"}, {"start": 777.12, "end": 782.36, "text": " input from its neighbors for the next layer and then we know that as we go up"}, {"start": 782.36, "end": 787.52, "text": " the layers the de facto window that each node looks at is going to be like a"}, {"start": 787.52, "end": 793.52, "text": " cone kind of like this so this is very similar to how a convolutional neural"}, {"start": 793.52, "end": 798.08, "text": " network works and the reasoning is very similar because the reasoning is well"}, {"start": 798.08, "end": 803.64, "text": " in a sentence the most important words for any given word are probably going to"}, {"start": 803.64, "end": 808.04, "text": " be its neighbors like the words around it and as you go up the layers you"}, {"start": 808.04, "end": 813.48, "text": " branch out more and more but ultimately the this neighborhood principle holds"}, {"start": 813.48, "end": 820.48, "text": " in NLP as well so again we already saw this in the long former but that's the"}, {"start": 820.48, "end": 824.04, "text": " reason behind the window attention and that's the second ingredient and then"}, {"start": 824.04, "end": 831.0799999999999, "text": " the third ingredient is this global attention now the global attention is selected"}, {"start": 831.0799999999999, "end": 837.56, "text": " tokens that are so important and that's you know fixed by the developers that"}, {"start": 837.56, "end": 844.4399999999999, "text": " are so important that they are they are connected to everything else so for"}, {"start": 844.4399999999999, "end": 848.8, "text": " example in these transformers you often have what's you know this kind of"}, {"start": 848.8, "end": 855.9599999999999, "text": " CLS token so this is a special token that you prepend to some piece of text"}, {"start": 855.9599999999999, "end": 860.8399999999999, "text": " and the output of this token is going to be your classification output because"}, {"start": 860.8399999999999, "end": 865.68, "text": " you don't want to bind your classification if you need to classify the entire"}, {"start": 865.68, "end": 870.8, "text": " sequence you don't want to bind that decision to one particular word what you"}, {"start": 870.8, "end": 875.4399999999999, "text": " want to do is you want to have an extra token and that's this CLS token that"}, {"start": 875.4399999999999, "end": 881.4399999999999, "text": " kind of aggregates information from all of this so layer after layer layer after"}, {"start": 881.4399999999999, "end": 886.9599999999999, "text": " layer you'll have so if we go here layer after layer we have this one special"}, {"start": 886.9599999999999, "end": 893.64, "text": " node and in each step every single other node is able to send information"}, {"start": 893.64, "end": 902.28, "text": " all right here to this node and receive information from this node okay so now"}, {"start": 902.28, "end": 911.04, "text": " as a result of this as you as you may be able to see every single every single path"}, {"start": 911.04, "end": 915.72, "text": " is kind of a maximum length of two because if I want to go from any node to any"}, {"start": 915.72, "end": 920.56, "text": " other node I can simply you know send information to this global node and then"}, {"start": 920.56, "end": 925.5999999999999, "text": " the global node in the next step can send information to whatever other node"}, {"start": 925.5999999999999, "end": 932.0, "text": " and that is a property that they use in their proof that this tension"}, {"start": 932.0, "end": 937.2399999999999, "text": " mechanism is as sort of as powerful as the classic full attention mechanism and"}, {"start": 937.2399999999999, "end": 942.52, "text": " we'll go through that in one second but first I hope this was clear that this"}, {"start": 942.52, "end": 949.1999999999999, "text": " combination of random attention window attention and global attention is what"}, {"start": 949.2, "end": 955.2, "text": " is called big bird okay they have some engineering tricks that go along with"}, {"start": 955.2, "end": 960.2, "text": " this but in concept you can imagine big bird being long former plus these"}, {"start": 960.2, "end": 966.1600000000001, "text": " random attention right here and you know as an engineer as an NLP engineer"}, {"start": 966.1600000000001, "end": 972.32, "text": " that makes kind of total sense I you know I totally believe that the introduction"}, {"start": 972.32, "end": 978.32, "text": " the addition of these random attention of these random attention patterns can"}, {"start": 978.32, "end": 985.0400000000001, "text": " absolutely help your classification or whatever your NLP tasks because you know"}, {"start": 985.0400000000001, "end": 990.7600000000001, "text": " more attention better and I also am completely willing to believe that you"}, {"start": 990.7600000000001, "end": 996.6, "text": " know using the full attention matrix while it is of course more accurate it"}, {"start": 996.6, "end": 1001.4000000000001, "text": " won't hurt too much to leave some of that attention away because essentially"}, {"start": 1001.4000000000001, "end": 1006.12, "text": " all the path lengths are just becoming two or even with the random attention are"}, {"start": 1006.12, "end": 1011.6, "text": " really short or logarithmic to route information from a node to some other"}, {"start": 1011.6, "end": 1018.6, "text": " node so the loss that you incur is kind of in a logarithmic scale in terms of"}, {"start": 1018.6, "end": 1024.16, "text": " performance while the gain that you make is sort of in a in a quadratic or like"}, {"start": 1024.16, "end": 1029.32, "text": " a linear scale you go from quadratic to linear and that seems to me like a good"}, {"start": 1029.32, "end": 1040.76, "text": " empirical trade-off all right however the the proofs here the proof of of how"}, {"start": 1040.76, "end": 1047.52, "text": " how these how these things are constructed are a little bit I don't know so"}, {"start": 1047.52, "end": 1053.56, "text": " what they do in the proof that this function can sort of a is a universal"}, {"start": 1053.56, "end": 1057.56, "text": " approximator people have already shown that full attention mechanisms are"}, {"start": 1057.56, "end": 1063.8, "text": " universal approximators so they show here that this sparse attention mechanism is"}, {"start": 1063.8, "end": 1069.08, "text": " also a universal approximator they make big use of star graphs what they say is"}, {"start": 1069.08, "end": 1074.32, "text": " okay if we have a star graph which is one node connected right here to every"}, {"start": 1074.32, "end": 1082.0, "text": " other node this is a star graph if we have a star graph we can achieve the same"}, {"start": 1082.0, "end": 1086.36, "text": " thing then with a full graph a full graph is where every node is connected to"}, {"start": 1086.36, "end": 1092.32, "text": " every other node but as I already said what they need for this is multiple layers"}, {"start": 1092.32, "end": 1096.9199999999998, "text": " of this star graph so and that has to do with the fact that if I want to route"}, {"start": 1096.9199999999998, "end": 1103.76, "text": " information I basically have to go via this middle node right here and there's"}, {"start": 1103.76, "end": 1107.8, "text": " an additional complication because this middle node in our case right here is"}, {"start": 1107.8, "end": 1114.52, "text": " only one node I can't route information at the same like I can't have this"}, {"start": 1114.52, "end": 1121.36, "text": " routing right here at the same time that I have this routing right here like"}, {"start": 1121.36, "end": 1126.12, "text": " going from here to here because I only have one middle node and I kind of this"}, {"start": 1126.12, "end": 1132.24, "text": " is not how the like this is very dumb math but maybe you have to imagine that"}, {"start": 1132.24, "end": 1138.84, "text": " there is one memory slot and you can only use that one memory slot at the"}, {"start": 1138.84, "end": 1143.92, "text": " same time for one of these things so essentially what you'll have to do is you'll"}, {"start": 1143.92, "end": 1148.0, "text": " have to do the green thing first and then in the next step you'll have to do the"}, {"start": 1148.0, "end": 1154.68, "text": " blue thing second and then so these are now pairwise routing between nodes but"}, {"start": 1154.68, "end": 1159.4, "text": " ultimately what an attention mechanism does is it does everything to everything"}, {"start": 1159.4, "end": 1162.8400000000001, "text": " right in a single layer it routes information from all the nodes to all the"}, {"start": 1162.8400000000001, "end": 1168.8000000000002, "text": " other nodes and to achieve that you need multiple rounds of this and it"}, {"start": 1168.8, "end": 1175.04, "text": " turns out that in the worst case you actually need n rounds of this so you"}, {"start": 1175.04, "end": 1182.12, "text": " know you trade off you go from n squared to n memory and compute requirements in"}, {"start": 1182.12, "end": 1189.08, "text": " a single layer but in the worst case you need n layers to recover the power of"}, {"start": 1189.08, "end": 1195.96, "text": " the full transformer and that is the last one of their theoretical results"}, {"start": 1195.96, "end": 1201.24, "text": " right here so first they prove universal approximations and second they"}, {"start": 1201.24, "end": 1205.3600000000001, "text": " prove to ring completeness these two properties have been proven for full"}, {"start": 1205.3600000000001, "end": 1210.16, "text": " attention mechanisms and third they prove that there are tasks where you"}, {"start": 1210.16, "end": 1219.8, "text": " actually do need n layers to solve them with their limited attention so you know"}, {"start": 1219.8, "end": 1228.24, "text": " I'm not sure but I feel you can make any sort of polynomial algorithm into a"}, {"start": 1228.24, "end": 1232.96, "text": " linear algorithm like this like I have a like a cool sorting algorithm right so"}, {"start": 1232.96, "end": 1238.12, "text": " if this is my sequence that I want to sort what I can do is I can simply you"}, {"start": 1238.12, "end": 1243.6399999999999, "text": " know take a random subset of them like this this and this and then kind of go"}, {"start": 1243.64, "end": 1249.6000000000001, "text": " and and sort them and then put them like I send them to the to the global memory"}, {"start": 1249.6000000000001, "end": 1258.0400000000002, "text": " like this I sort them and then I put them back right and if I do this for"}, {"start": 1258.0400000000002, "end": 1263.0800000000002, "text": " enough if I do this for enough rounds okay you know if I do this for enough"}, {"start": 1263.0800000000002, "end": 1268.1200000000001, "text": " rounds you know at the worst case I need n rounds to sort my or log n rounds"}, {"start": 1268.12, "end": 1274.8, "text": " if I do it smartly but you know in you know the single step here is a single"}, {"start": 1274.8, "end": 1281.1999999999998, "text": " step is just all of n so I have now an all of n sorting algorithm I you know"}, {"start": 1281.1999999999998, "end": 1290.6799999999998, "text": " I have my sort of a bit of wary to express things like that and yeah but you"}, {"start": 1290.6799999999998, "end": 1296.6, "text": " know it is from an empirical standpoint I absolutely believe that this this"}, {"start": 1296.6, "end": 1303.1999999999998, "text": " is enough now my second coral right here is that if you look at the proof"}, {"start": 1303.1999999999998, "end": 1308.52, "text": " first of all what it makes use is this star graph and the star graph corresponds"}, {"start": 1308.52, "end": 1312.8, "text": " to the global attention so that's not much to do with the random attention"}, {"start": 1312.8, "end": 1317.9199999999998, "text": " though they use the random attention in their proof but I at least believe"}, {"start": 1317.9199999999998, "end": 1324.48, "text": " that it would be possible with the global attention only and then the second"}, {"start": 1324.48, "end": 1331.28, "text": " thing is if you look at the parameters that they use for the for the experiments"}, {"start": 1331.28, "end": 1335.96, "text": " and I've already set this in the long former video so in the long former video"}, {"start": 1335.96, "end": 1341.92, "text": " it turned out that if you look at how big this window attention is it turns out"}, {"start": 1341.92, "end": 1348.6, "text": " that it you're still well you know the original bird attended to 512 tokens and"}, {"start": 1348.6, "end": 1353.76, "text": " then you look at the window and the window was still 512 tokens it's just that"}, {"start": 1353.76, "end": 1357.6, "text": " the global attention was even more so ultimately they ended up using more"}, {"start": 1357.6, "end": 1364.4, "text": " memory than the original bird and here if I look at the parameters of their"}, {"start": 1364.4, "end": 1369.2, "text": " thing and they have multiple experiments right here and I believe this is the"}, {"start": 1369.2, "end": 1374.8, "text": " the base version so this is the base version they also have this large"}, {"start": 1374.8, "end": 1381.84, "text": " version but here this is the 12 layer version and you can see they have this"}, {"start": 1381.84, "end": 1388.8, "text": " block length and we'll get into the block length in one second but then you can"}, {"start": 1388.8, "end": 1393.9199999999998, "text": " see that their window size is three times the block length the number of"}, {"start": 1393.9199999999998, "end": 1397.6399999999999, "text": " random tokens is three times the block length and the number of global"}, {"start": 1397.6399999999999, "end": 1403.12, "text": " tokens is two times the block length so that results in eight times B so eight"}, {"start": 1403.12, "end": 1418.2399999999998, "text": " times 64 is you know can I calculate this or am I stupid it's 512 yes I actually"}, {"start": 1418.2399999999998, "end": 1426.8799999999999, "text": " calculated this before so this is 512 tokens so you know you you go from from"}, {"start": 1426.88, "end": 1434.3200000000002, "text": " bird that has 512 tokens and attends to 512 tokens to also attending to 512"}, {"start": 1434.3200000000002, "end": 1440.92, "text": " tokens of course the advantage here is that they now have 4,000 and 96"}, {"start": 1440.92, "end": 1448.5200000000002, "text": " sequence length so they have the freedom to not attend to as many tokens as"}, {"start": 1448.5200000000002, "end": 1454.7600000000002, "text": " they have in the input length but you know to put it in perspective this here"}, {"start": 1454.76, "end": 1462.32, "text": " uses more memory and more compute on it on its face than bird because bird"}, {"start": 1462.32, "end": 1470.8799999999999, "text": " attends to as many tokens but has a smaller inputs sequence and you know I"}, {"start": 1470.8799999999999, "end": 1475.92, "text": " I there's sort of a thing where in order to make these sparse attention things"}, {"start": 1475.92, "end": 1481.28, "text": " work you have to go pretty pretty you know high in the number of things you"}, {"start": 1481.28, "end": 1485.6, "text": " attend to you can leave away some but it's not like you can you know scale up"}, {"start": 1485.6, "end": 1491.04, "text": " orders of magnitude of your input sequence length so that's the this"}, {"start": 1491.04, "end": 1495.84, "text": " promise of linear attention is sort of it's kind of fulfilled but not there yet"}, {"start": 1495.84, "end": 1501.12, "text": " the second thing I would like to point out is that in a lot of cases the number"}, {"start": 1501.12, "end": 1507.08, "text": " of random tokens is actually set to zero so really making use I believe of"}, {"start": 1507.08, "end": 1514.6799999999998, "text": " these of the of the global of the number of global tokens so it that seems a"}, {"start": 1514.6799999999998, "end": 1520.12, "text": " bit strange in that they continuously refer to their random attention"}, {"start": 1520.12, "end": 1524.8799999999999, "text": " mechanism but then in a lot of experiments they don't actually have a random"}, {"start": 1524.8799999999999, "end": 1529.96, "text": " attention mechanism I believe they have to do that because that's kind of what"}, {"start": 1529.96, "end": 1537.88, "text": " makes them different from the long former in principle but still yeah so the"}, {"start": 1537.88, "end": 1543.76, "text": " last novelty let's say is an engineering novelty in that they now always"}, {"start": 1543.76, "end": 1548.4, "text": " consider not single for example they don't consider single random attention"}, {"start": 1548.4, "end": 1552.4, "text": " they always consider these in blocks and that's because our current hardware is"}, {"start": 1552.4, "end": 1559.08, "text": " really bad at sparse stuff really bad at single indexing gathering single"}, {"start": 1559.08, "end": 1565.24, "text": " things so if you can do everything in blocks you basically get you get these"}, {"start": 1565.24, "end": 1570.52, "text": " blocks almost for free so it takes only marginally longer to retrieve this"}, {"start": 1570.52, "end": 1574.72, "text": " full two by two block right here than it would to retrieve the single"}, {"start": 1574.72, "end": 1579.8, "text": " instance right here of course that means you have you know four times you"}, {"start": 1579.8, "end": 1585.24, "text": " still use four times more memory but it is not four times slower than the"}, {"start": 1585.24, "end": 1590.56, "text": " original thing so you can use these blocks right here you can do it for the"}, {"start": 1590.56, "end": 1594.04, "text": " random attention you can do it for the window attention as you can see here so"}, {"start": 1594.04, "end": 1600.1200000000001, "text": " you break this window pattern a little bit into blocks and that makes it a lot"}, {"start": 1600.1200000000001, "end": 1606.4, "text": " faster or that speeds up get the speed up almost for free and then they make"}, {"start": 1606.4, "end": 1613.76, "text": " another approximation in that the way they do this windowing is and let's just"}, {"start": 1613.76, "end": 1622.92, "text": " go really briefly so you can see right here that it would be very cumbersome to"}, {"start": 1622.92, "end": 1629.44, "text": " gather so what we need we're just gonna focus this dotted thing right here is a"}, {"start": 1629.44, "end": 1636.4, "text": " bit confusing so you want to attend to these things and these you can just get"}, {"start": 1636.4, "end": 1641.2, "text": " out with a matrix slice really easy but then you want to attend to this kind of"}, {"start": 1641.2, "end": 1646.52, "text": " blocky thing right here from the window attention right like this thing and"}, {"start": 1646.52, "end": 1651.96, "text": " this is hard to get out because you'd have to kind of index each row"}, {"start": 1651.96, "end": 1657.0800000000002, "text": " individually and that's very slow so what they do there is this matrix roll"}, {"start": 1657.0800000000002, "end": 1662.04, "text": " operation where you can sort of roll the axis around so what you'll do is you'll"}, {"start": 1662.04, "end": 1667.24, "text": " take this thing right here and you put it to the left right here and you'll"}, {"start": 1667.24, "end": 1673.08, "text": " take for example this thing right here and you'll put it to the right or no"}, {"start": 1673.08, "end": 1677.96, "text": " like it's up and down but in essence that's what you do and you can you can"}, {"start": 1677.96, "end": 1685.16, "text": " fold all of this blue stuff into a rectangular matrix if you know if you can"}, {"start": 1685.16, "end": 1691.16, "text": " see right here so you kind of roll this back roll this back roll this forward and"}, {"start": 1691.16, "end": 1698.0800000000002, "text": " you replace whatever's missing by these now this again gives you some inaccuracies"}, {"start": 1698.0800000000002, "end": 1705.28, "text": " because this block right here was never intended to be attended to and all of a"}, {"start": 1705.28, "end": 1711.0800000000002, "text": " sudden you see you have the K6 in here so it gives you a bit of inaccuracies at"}, {"start": 1711.0800000000002, "end": 1716.68, "text": " the edges of the sequence but you can take that you know you can take that hit"}, {"start": 1716.68, "end": 1721.48, "text": " for the increased performance that you gain by now having a rectangular matrix"}, {"start": 1721.48, "end": 1728.0800000000002, "text": " TPUs are really efficient at this not as efficient at this and then the only"}, {"start": 1728.0800000000002, "end": 1733.48, "text": " thing that's really slow is gathering these random blocks right here but also"}, {"start": 1733.48, "end": 1738.64, "text": " by having the same amount of random blocks per input token what you'll do is"}, {"start": 1738.64, "end": 1743.8, "text": " you'll end up with just one of these columns right here or you know R of"}, {"start": 1743.8, "end": 1748.76, "text": " these columns and that again gives you a rectangular matrix so this thing right"}, {"start": 1748.76, "end": 1754.8, "text": " here you can process very very efficiently using a TPU and you know the mistakes"}, {"start": 1754.8, "end": 1760.44, "text": " you make are basically this thing right here and this thing right here because"}, {"start": 1760.44, "end": 1766.08, "text": " those weren't intended and are at the edges of the sequence so these were the"}, {"start": 1766.08, "end": 1774.76, "text": " the tricks of Big Bird to quickly summarize Big Bird is basically taking a"}, {"start": 1774.76, "end": 1780.32, "text": " transformer saying well why do we need all of this attention all of this full"}, {"start": 1780.32, "end": 1785.48, "text": " attention maybe we only need some of that and can already do a big job a good"}, {"start": 1785.48, "end": 1790.08, "text": " job especially not considering the attention mechanism goes over multiple"}, {"start": 1790.08, "end": 1795.56, "text": " layers so we don't need a routing from each token to each token we"}, {"start": 1795.56, "end": 1800.84, "text": " we can make up for not having a fully connected graph by simply running multiple"}, {"start": 1800.84, "end": 1808.1599999999999, "text": " layers so their sparsity is first of all you have this random attention which I"}, {"start": 1808.1599999999999, "end": 1813.6399999999999, "text": " believe changes from sequence to sequence but stays within or among the layers"}, {"start": 1813.6399999999999, "end": 1818.9199999999998, "text": " of the same sequence then you have the window attention with the reasoning so"}, {"start": 1818.9199999999998, "end": 1821.84, "text": " the reasoning behind the random attention is that if you have a randomly"}, {"start": 1821.84, "end": 1826.9199999999998, "text": " connected graph the path lengths are on average logarithmic so you can"}, {"start": 1826.9199999999998, "end": 1830.6799999999998, "text": " route information efficiently the reasoning behind the window attention is that"}, {"start": 1830.6799999999998, "end": 1836.1999999999998, "text": " probably a neighbor information is very important and that has been shown"}, {"start": 1836.1999999999998, "end": 1840.84, "text": " empirically and then the global attention the reasoning behind this is that some"}, {"start": 1840.84, "end": 1846.84, "text": " of the tokens that are fixed by the developers are so important that it's"}, {"start": 1846.84, "end": 1851.52, "text": " very beneficial that each other node is connected to them and that they are"}, {"start": 1851.52, "end": 1856.72, "text": " connected to each other node the result of that is the big bird attention"}, {"start": 1856.72, "end": 1861.6399999999999, "text": " mechanism which is basically longformer which already had these two plus the"}, {"start": 1861.6399999999999, "end": 1870.24, "text": " random attention this achieves a linear linear complexity in terms of of"}, {"start": 1870.24, "end": 1874.6, "text": " memory and compute though linear has to be qualified a bit because it's"}, {"start": 1874.6, "end": 1880.32, "text": " modified by the window size by the number of random attention tokens by the"}, {"start": 1880.32, "end": 1884.6799999999998, "text": " number of global tokens and then practice often ends up being you know fairly"}, {"start": 1884.6799999999998, "end": 1895.2, "text": " large-ish and also the theoretical guarantees now come with the fact that you"}, {"start": 1895.2, "end": 1899.8, "text": " need multiple layers in the worst case you need sequence length amount of"}, {"start": 1899.8, "end": 1904.1599999999999, "text": " layers which you know in the worst case would result right back into a"}, {"start": 1904.16, "end": 1911.48, "text": " quadratic requirement for memory and compute they do some engineering some"}, {"start": 1911.48, "end": 1918.96, "text": " engineering tricks right here and their results are pretty good so the results"}, {"start": 1918.96, "end": 1924.92, "text": " in various tasks and we'll we'll look at some of the tasks right here so these"}, {"start": 1924.92, "end": 1930.0800000000002, "text": " are death-set results using base size models for example where you can see"}, {"start": 1930.08, "end": 1937.04, "text": " they do outperform basic Roberto models they outperform longformer which may"}, {"start": 1937.04, "end": 1940.6799999999998, "text": " mean that the random attention is useful but you know in these things it's"}, {"start": 1940.6799999999998, "end": 1948.24, "text": " also always may just mean that you throw more compute at it at least I'm not"}, {"start": 1948.24, "end": 1951.8799999999999, "text": " really looking that they outperform the models because as you can see right"}, {"start": 1951.8799999999999, "end": 1955.8, "text": " here if they compare to state of the art and you know granted these are models"}, {"start": 1955.8, "end": 1960.1599999999999, "text": " that have been trained specifically for these tasks and are like you know"}, {"start": 1960.1599999999999, "end": 1966.9199999999998, "text": " crafted and engineered and Big Bird manages to Big Bird manages to hold itself"}, {"start": 1966.9199999999998, "end": 1971.8799999999999, "text": " against them in a lot of tasks and even get state of the art on some what I'm"}, {"start": 1971.8799999999999, "end": 1977.12, "text": " more interested in is that it you know it can reach good numbers that doesn't"}, {"start": 1977.12, "end": 1981.24, "text": " necessarily have to be state of the art but it can reach good numbers which"}, {"start": 1981.24, "end": 1988.28, "text": " tells me that okay probably the empirical hit that I take by not having the"}, {"start": 1988.28, "end": 1993.64, "text": " full attention is you know it's justifiable by the speed up and memory"}, {"start": 1993.64, "end": 2000.6, "text": " savings I do get yeah especially when result when you see results mixed like"}, {"start": 2000.6, "end": 2005.2, "text": " this you know sometimes the other model is good and sometimes the Big Bird is"}, {"start": 2005.2, "end": 2010.36, "text": " good on different variations and so on I would not you know I would not make a"}, {"start": 2010.36, "end": 2014.36, "text": " big deal out of the fact that it is state of the art I get that the authors have"}, {"start": 2014.36, "end": 2020.76, "text": " to do that I would do so as well but you know you know don't don't think that"}, {"start": 2020.76, "end": 2026.6799999999998, "text": " this is the like the best thing now it's very probable they just thrown also a"}, {"start": 2026.6799999999998, "end": 2032.9199999999998, "text": " lot of compute at it what is cool is they do some genomics experiments so not"}, {"start": 2032.9199999999998, "end": 2038.52, "text": " only do they have NLP state of the art but also they go into genomics and"}, {"start": 2038.52, "end": 2042.84, "text": " experiment with data there don't want to go into that because you know"}, {"start": 2042.84, "end": 2046.12, "text": " ultimately it's another task and that we leave the papers about the"}, {"start": 2046.12, "end": 2053.32, "text": " architecture all right so that was Big Bird I hope you enjoyed this video and"}, {"start": 2053.32, "end": 2059.44, "text": " learned I learned something certainly if you want to check out the proofs"}, {"start": 2059.44, "end": 2067.92, "text": " they're actually pretty entertaining to read and yeah I'll see you next time bye"}, {"start": 2067.92, "end": 2074.92, "text": " bye"}] |
Yannic Kilcher | 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 look at self-training with noisy student improves image net classification by Tidze Sier, Mintan Luang, Edward Havi and Quok Vile. So this paper takes an image net classifier that's been trained on the image net dataset 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 image net 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 there, 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 paper is about semi supervised learning 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 supervised learning? Usually in supervised learning you'll have some sort of dataset and the dataset will contain let's say it's an image net, it's image dataset. So the dataset 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 dataset 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 dataset. But very often in semi supervised learning, you still assume it's the same dataset. There is a slightly different set up here that's called transfer learning. So in transfer learning, what you'll have is you'll have your dataset 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 that 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 the small dataset, but I do have this giant other dataset over here. Now can't I, it's not the same. It's maybe they're not CT. So these are CT scans. Maybe these are x-rays, right? They're fairly similar. Similar technology. If you slice the CT, it'll give you sort of an x-ray. Can I you know, train my model, pre-trained 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 dataset, 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 dataset. But other than in this x-ray example, what we're going to look at is the small dataset is going to be our ImageNet 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 dataset we want to train on is fairly small. Here, you know, ImageNet 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 dataset. Now what we'll try to do is somehow incorporate this unlabeled dataset here into the training process to get better on the ImageNet dataset. Okay, so this is the the problem statement is you have the ImageNet dataset and you have a second much larger dataset 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. It's essentially sort of a transfer semi-supervised learning setting. But with the exception that usually in transfer learning you assume that the label dataset 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 dataset, right? Because that's the dataset that's sizable enough to allow you to train a really big model on it. And then you fine tune and you sort of hope that the information transfers over here. On the other hand, what we want to do is we start with the ImageNet dataset. 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 ImageNet models, right? So we can train this into a Teacher model that has a reasonable accuracy on the ImageNet dataset. Step two, we're going to take that big dataset 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 dataset 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 dataset, you train on this big dataset, and that's what you call your student model. And then the student model in this paper will see how can we make it such that the student is then better at the original ImageNet 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 at extra data and we use noise and augmentation on it is going to result in a student that can sort of learn more about the data than the teacher did know. Okay, 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 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 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 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 may, sorry, we'll step three over here, train an equal or a 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, the 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 random 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, 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, 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, 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, noise, 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 these 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. So that's, you use these augmentations to kind of heuristically tell the model what it should be invariant to. And that is, that is a very powerful technique to regularize basically to to robustify these deep, the deep methods, and this is used the same here. So already in the teacher model, we train with these noise, and then step two, use a normal IE not noise teacher model to generate soft or hard pseudo labels for the clean IE 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. 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 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-centropy loss unlabeled 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-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, noisy student, when the student is deliberately noise in its it is trained to be consistent to the teacher that is not noise when it generates the pseudo labels. In our experiments, we use two types of noise input noise and model noise. First data augmentation is an important noisy method in noisy 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 produce 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 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 at the same time. So 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 a bit of a weird formulation, but it's true like the teacher, the teacher will produce these same 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 first to approximate that teacher label with all of these different things. So you see that you put in 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, it's crazy. Like they describe exactly where you 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, date to 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 sets 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 a thousand classes here. There's no guarantee that these images fit into any of those classes. Yeah, 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 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 B7 on ImageNet as the teacher model. So you can see in the table right here what the B7 achieves. The efficient net B7 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 L2 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 0.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 with 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 B7 teacher model. So that's basically you can, it's a testament that 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 B7, that's the small model as a teacher model. Then by using the B7 model as the teacher, we trained an efficient net L2 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 this 14 times it's also it can be done because now you have more data. So you can also up the batch size. Then we trained a new efficient net L2 model with the efficient net L2 model as the teacher. Lastly, we iterated again and used an unlabeled batch size of 28 times the labeled 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 by simply uping 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 L2, you start it with the B7. 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 0.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. All right, 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 image net dataset. For example, image net 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 at 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. So 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 classified 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 L2s accuracy from 1.1% to 4.4%. I'm not this, 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 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 drop out, 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 situations improve. Here, you can see what is happening when you do not augment the student. When you do not date 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 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 insert 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 is 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'll 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 label data and unlabeled data outperforms the pipeline at first pre-trains with unlabeled data and then fine tunes on label 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 on unlabeled data 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 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 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 across 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": 4.6000000000000005, "text": " Hi there, today we look at self-training with noisy student improves image"}, {"start": 4.6000000000000005, "end": 12.0, "text": " net classification by Tidze Sier, Mintan Luang, Edward Havi and Quok Vile. So this"}, {"start": 12.0, "end": 16.6, "text": " paper takes an image net classifier that's been trained on the image net"}, {"start": 16.6, "end": 23.04, "text": " dataset and uses that classifier as a teacher model to label a whole bunch of"}, {"start": 23.04, "end": 28.28, "text": " unlabeled images. And then it trains a student model that is larger than the"}, {"start": 28.28, "end": 32.84, "text": " original teacher model on those teacher labeled images and that turns out to"}, {"start": 32.84, "end": 39.08, "text": " improve the classification on the image net validation set. Now that there is a"}, {"start": 39.08, "end": 46.2, "text": " couple of things that make this all work and today we're going to explore how"}, {"start": 46.2, "end": 52.8, "text": " this paper does it and what they say is important. If you enjoy content like"}, {"start": 52.8, "end": 57.32, "text": " this, as always, don't hesitate to share it out there, tell your friends about"}, {"start": 57.32, "end": 63.88, "text": " it and if you're not subscribed yet then do so. I would appreciate that and you'll"}, {"start": 63.88, "end": 72.4, "text": " get more content. So win win. So this paper is about semi supervised learning in"}, {"start": 72.4, "end": 76.6, "text": " effect. So it's at the intersection actually of semi supervised learning,"}, {"start": 76.6, "end": 81.68, "text": " knowledge distillation and transfer learning. So what do we mean by semi"}, {"start": 81.68, "end": 85.24000000000001, "text": " supervised learning? Usually in supervised learning you'll have some sort of"}, {"start": 85.24, "end": 90.19999999999999, "text": " dataset and the dataset will contain let's say it's an image net, it's image"}, {"start": 90.19999999999999, "end": 96.16, "text": " dataset. So the dataset will contain images. This is an image with like some sort"}, {"start": 96.16, "end": 104.39999999999999, "text": " of cat on it and it will contain the labels according to that. So cat. Now in"}, {"start": 104.39999999999999, "end": 110.47999999999999, "text": " semi supervised learning, you you assume that so this is supervised learning. In"}, {"start": 110.48, "end": 115.28, "text": " semi supervised learning, you assume that only part of your dataset has the"}, {"start": 115.28, "end": 121.64, "text": " labels. So like only this part down here has the labels and the upper part does"}, {"start": 121.64, "end": 126.04, "text": " not have the labels. So that's semi supervised learning. It's often the case"}, {"start": 126.04, "end": 130.32, "text": " when it's very expensive to get labels. So you can only get labels for a couple"}, {"start": 130.32, "end": 135.28, "text": " of images in your dataset. But very often in semi supervised learning, you still"}, {"start": 135.28, "end": 139.68, "text": " assume it's the same dataset. There is a slightly different set up here that's"}, {"start": 139.68, "end": 144.88, "text": " called transfer learning. So in transfer learning, what you'll have is you'll"}, {"start": 144.88, "end": 150.12, "text": " have your dataset that has the labels, but it's very small. So you'll notice I've"}, {"start": 150.12, "end": 154.76000000000002, "text": " drawn it smaller. That means you have very little. That is also the case when"}, {"start": 154.76000000000002, "end": 159.8, "text": " it's very expensive to get labels, but also it's expensive to get the data"}, {"start": 159.8, "end": 165.20000000000002, "text": " itself. This is often the case that say in medical data, where not only is it"}, {"start": 165.20000000000002, "end": 169.48000000000002, "text": " expensive to get labels for like a CT scan, it's actually expensive to get the"}, {"start": 169.48, "end": 177.44, "text": " CT scan. So what the goal in transfer learning is is to say, well, I do I do have"}, {"start": 177.44, "end": 183.35999999999999, "text": " only the small dataset, but I do have this giant other dataset over here. Now"}, {"start": 183.35999999999999, "end": 188.79999999999998, "text": " can't I, it's not the same. It's maybe they're not CT. So these are CT scans."}, {"start": 188.79999999999998, "end": 196.44, "text": " Maybe these are x-rays, right? They're fairly similar. Similar technology. If you"}, {"start": 196.44, "end": 201.88, "text": " slice the CT, it'll give you sort of an x-ray. Can I you know, train my model,"}, {"start": 201.88, "end": 208.6, "text": " pre-trained my model on x-ray data and then fine tune it on the CT data. So"}, {"start": 208.6, "end": 214.96, "text": " that's called transfer learning usually. Now this can be done with or without"}, {"start": 214.96, "end": 219.6, "text": " labels. So it can be that for the x-ray dataset, you do have the labels or you"}, {"start": 219.6, "end": 226.48, "text": " don't have the labels. There are techniques for all of those. Now what we're going"}, {"start": 226.48, "end": 231.28, "text": " to look at today is kind of the situation right here. It's the transfer learning"}, {"start": 231.28, "end": 239.12, "text": " situation where you do not have the labels for this x-ray dataset. But other than"}, {"start": 239.12, "end": 243.88, "text": " in this x-ray example, what we're going to look at is the small dataset is going"}, {"start": 243.88, "end": 251.35999999999999, "text": " to be our ImageNet database. So our original picture with label database. So"}, {"start": 251.35999999999999, "end": 255.28, "text": " you'll see immediately the difference here is that in the transfer learning"}, {"start": 255.28, "end": 260.44, "text": " setting, we usually assume that the dataset we want to train on is fairly small."}, {"start": 260.44, "end": 268.92, "text": " Here, you know, ImageNet is already sizable. But what we have is we have a much"}, {"start": 268.92, "end": 273.36, "text": " larger database of unlabeled images that we can just get from the internet."}, {"start": 273.36, "end": 278.56, "text": " So we can scrape the internet for any kind of pictures. And that will be our"}, {"start": 278.56, "end": 282.96000000000004, "text": " unlabeled dataset. Now what we'll try to do is somehow incorporate this"}, {"start": 282.96000000000004, "end": 287.68, "text": " unlabeled dataset here into the training process to get better on the ImageNet"}, {"start": 287.68, "end": 292.64, "text": " dataset. Okay, so this is the the problem statement is you have the ImageNet"}, {"start": 292.64, "end": 297.52000000000004, "text": " dataset and you have a second much larger dataset of unlabeled images. And"}, {"start": 297.52000000000004, "end": 301.52000000000004, "text": " you somehow want to make use of them. So I hope you see how this is sort of"}, {"start": 301.52, "end": 307.0, "text": " connected to the others. It's essentially sort of a transfer semi-supervised"}, {"start": 307.0, "end": 311.79999999999995, "text": " learning setting. But with the exception that usually in transfer learning you"}, {"start": 311.79999999999995, "end": 318.12, "text": " assume that the label dataset is like super small, which is not the case here."}, {"start": 318.12, "end": 322.32, "text": " And that's going to result in us being able to apply a different technique."}, {"start": 322.32, "end": 328.12, "text": " So this different technique is called the noisy student. Now usually what you"}, {"start": 328.12, "end": 331.96, "text": " might do in a transfer learning setting is you might want to start with that"}, {"start": 331.96, "end": 336.8, "text": " big dataset, right? Because that's the dataset that's sizable enough to allow"}, {"start": 336.8, "end": 341.2, "text": " you to train a really big model on it. And then you fine tune and you sort of"}, {"start": 341.2, "end": 345.84000000000003, "text": " hope that the information transfers over here. On the other hand, what we want"}, {"start": 345.84000000000003, "end": 351.56, "text": " to do is we start with the ImageNet dataset. So first we train this in a"}, {"start": 351.56, "end": 356.4, "text": " supervised learning fashion into our model. Now this model is going to be called"}, {"start": 356.4, "end": 360.96, "text": " the Teacher model. We know how to do this. We know how to train ImageNet models,"}, {"start": 360.96, "end": 366.59999999999997, "text": " right? So we can train this into a Teacher model that has a reasonable"}, {"start": 366.59999999999997, "end": 372.0, "text": " accuracy on the ImageNet dataset. Step two, we're going to take that big"}, {"start": 372.0, "end": 379.96, "text": " dataset over here and use the Teacher model to label the unlabeled images. So for"}, {"start": 379.96, "end": 386.96, "text": " each image, for each image coming in here, the Teacher, so maybe this is again"}, {"start": 386.96, "end": 394.35999999999996, "text": " another cat, the teacher will say, that's a cat. Okay, so that gives you the big"}, {"start": 394.35999999999996, "end": 400.84, "text": " dataset where now you have images along with labels. Just the labels aren't"}, {"start": 400.84, "end": 407.15999999999997, "text": " true labels, they're generated by the teacher. And then in the third step, you"}, {"start": 407.16, "end": 415.64000000000004, "text": " train this big dataset, you train on this big dataset, and that's what you"}, {"start": 415.64000000000004, "end": 421.0, "text": " call your student model. And then the student model in this paper will see how"}, {"start": 421.0, "end": 425.96000000000004, "text": " can we make it such that the student is then better at the original ImageNet"}, {"start": 425.96000000000004, "end": 430.6, "text": " task than the teacher ever was. Which seems counterintuitive at first, because"}, {"start": 430.6, "end": 434.24, "text": " all of the information that the student is trained from is basically what the"}, {"start": 434.24, "end": 438.56, "text": " teacher already knows, right? All the labels here come from the teacher."}, {"start": 438.56, "end": 445.96000000000004, "text": " Therefore, the student shouldn't be able to outperform the teacher. But in this"}, {"start": 445.96000000000004, "end": 450.48, "text": " case, the student will be able to outperform the teacher. And their argument"}, {"start": 450.48, "end": 455.2, "text": " here is that this is mainly due to the fact that you use noise in this"}, {"start": 455.2, "end": 460.72, "text": " training procedure. So when you train the student, what you'll do is you'll use"}, {"start": 460.72, "end": 466.0, "text": " noise. And one of the types of noise is that you severely augment this data"}, {"start": 466.0, "end": 471.20000000000005, "text": " right here in order to train the student. Now, we've known for a long time that"}, {"start": 471.20000000000005, "end": 475.96000000000004, "text": " data augmentation, for example, in the frameworks of self-supervised learning"}, {"start": 475.96000000000004, "end": 481.8, "text": " and so on, can have a very large benefit to training. And here, the fact that we"}, {"start": 481.8, "end": 488.36, "text": " incorporate this at extra data and we use noise and augmentation on it is going"}, {"start": 488.36, "end": 494.44, "text": " to result in a student that can sort of learn more about the data than the"}, {"start": 494.44, "end": 503.04, "text": " teacher did know. Okay, this is basically it. And as you can see, this is kind of"}, {"start": 503.04, "end": 508.64, "text": " their main final results, where they say on ImageNet, our top one accuracy"}, {"start": 508.64, "end": 515.4, "text": " sort of increases right here. And even on these kind of subsets of ImageNet,"}, {"start": 515.4, "end": 519.9599999999999, "text": " or these are sort of corrupted sets of ImageNet, they make even more"}, {"start": 519.9599999999999, "end": 524.72, "text": " substantial improvements as you can see here. Now, we'll go into what these"}, {"start": 524.72, "end": 531.12, "text": " corrupted subsets are, but you know, just for now, these here are very difficult"}, {"start": 531.12, "end": 537.24, "text": " variants of ImageNet. They can be severely corrupted or distorted and so on."}, {"start": 537.24, "end": 542.1999999999999, "text": " And you can see that the model improves severely over the previous state of the"}, {"start": 542.2, "end": 547.0400000000001, "text": " art, which basically means that this model is more robust and that's a direct"}, {"start": 547.0400000000001, "end": 552.2800000000001, "text": " consequence of the noise. Now, one last thing I should say is that the student"}, {"start": 552.2800000000001, "end": 557.2, "text": " here is also larger than the teacher. So that's also one thing that makes the"}, {"start": 557.2, "end": 562.4000000000001, "text": " student better. So what you will make is the student model is larger than the"}, {"start": 562.4000000000001, "end": 567.44, "text": " teacher model as a model, as the architecture. So in combination with the"}, {"start": 567.44, "end": 574.2, "text": " noise right here, with the noise, in combination, that means the student model"}, {"start": 574.2, "end": 578.8000000000001, "text": " is probably able to capture more of the variance of the data. It's larger, it"}, {"start": 578.8000000000001, "end": 583.8000000000001, "text": " has more parameters, it can learn more about the data. Together with the noise,"}, {"start": 583.8000000000001, "end": 589.1600000000001, "text": " it can probably be more robust. And that's what makes it generalize better."}, {"start": 589.1600000000001, "end": 594.12, "text": " And we'll also see, as we see here, it's more robust to these transformations."}, {"start": 594.12, "end": 599.72, "text": " And it's also going to be more robust to adversarial perturbations. So the"}, {"start": 599.72, "end": 606.24, "text": " technique again is illustrated here. As we said, it's pretty simple. First,"}, {"start": 606.24, "end": 613.32, "text": " so step one, step one, train the teacher model with labeled data as you would."}, {"start": 613.32, "end": 621.08, "text": " Step two, you infer the pseudo labels on unlabeled data. Step three, you make a"}, {"start": 621.08, "end": 627.9200000000001, "text": " student, you may, sorry, we'll step three over here, train an equal or a"}, {"start": 627.9200000000001, "end": 634.1600000000001, "text": " larger student model with combined data and noise injected. So they don't, they"}, {"start": 634.1600000000001, "end": 639.44, "text": " use the original labeled data here and the pseudo labeled data right here in"}, {"start": 639.44, "end": 643.48, "text": " order to train the student. But still, the student doesn't have more"}, {"start": 643.48, "end": 647.32, "text": " information, more label information than the teacher had. It simply has this"}, {"start": 647.32, "end": 655.9200000000001, "text": " teacher labeled, teacher labeled unlabeled data also to train on. Now, the"}, {"start": 655.9200000000001, "end": 660.24, "text": " crucial part here is, well, first of all, that the student can be larger and"}, {"start": 660.24, "end": 664.72, "text": " second of all, that there can be noise. And the noise comes in three different"}, {"start": 664.72, "end": 669.6, "text": " forms. So first of all, you use data augmentation, which we've already seen."}, {"start": 669.6, "end": 674.7600000000001, "text": " This is sort of like random cropping or mild rotations, color, jitter, whatever."}, {"start": 674.76, "end": 678.96, "text": " They use a random augment here, which is a specific technique to apply these"}, {"start": 678.96, "end": 684.8, "text": " augmentations. They use dropout, which is a fairly old technique where you, in"}, {"start": 684.8, "end": 688.84, "text": " the student model that you train, you randomly drop out connections, which makes"}, {"start": 688.84, "end": 694.4399999999999, "text": " it more robust and more generalizing. And then you also use stochastic depth."}, {"start": 694.4399999999999, "end": 698.88, "text": " Now, stochastic depth is a technique when you train a model, what you'll do"}, {"start": 698.88, "end": 703.8, "text": " during training instead of always passing your data forward through the layers"}, {"start": 703.8, "end": 709.52, "text": " like this. You use some sort of a dropout, but with entire layers. So what you'll"}, {"start": 709.52, "end": 715.24, "text": " do is you'll pass your data forward and then randomly you'll skip a layer and"}, {"start": 715.24, "end": 720.68, "text": " then pass it forward again. Now, these, these might seem weird first because,"}, {"start": 720.68, "end": 727.24, "text": " yeah, it might seem weird, but in, if you know that most models, especially"}, {"start": 727.24, "end": 732.0799999999999, "text": " computer vision models nowadays, are residual networks, which means that"}, {"start": 732.08, "end": 737.2800000000001, "text": " their layers look like. So you have the input, you have some computation, and then"}, {"start": 737.2800000000001, "end": 742.44, "text": " you have the output, and then there is already a residual connection that"}, {"start": 742.44, "end": 747.0400000000001, "text": " basically adds the original signal together to the result of the computation."}, {"start": 747.0400000000001, "end": 753.64, "text": " So all you do in this stochastic layer dropout or this stochastic depth right"}, {"start": 753.64, "end": 759.9200000000001, "text": " here is you basically disable, you disable this connection right here, and all"}, {"start": 759.92, "end": 764.2199999999999, "text": " the signal has to flow through here. If you read the residual, the"}, {"start": 764.2199999999999, "end": 768.36, "text": " resonant, original resonant paper, they make it pretty clear why the residual"}, {"start": 768.36, "end": 773.5999999999999, "text": " connection is a good idea. Basically, they say these computations here, they, if"}, {"start": 773.5999999999999, "end": 779.5999999999999, "text": " you have a very deep network, each layer only has to basically do very a little"}, {"start": 779.5999999999999, "end": 786.68, "text": " bit of computation that, that can be bypassed fairly efficiently for a lot of"}, {"start": 786.68, "end": 791.3599999999999, "text": " data points. So it's not that hurtful to bypass a layer, and in this case, they"}, {"start": 791.3599999999999, "end": 797.04, "text": " actually use it to just bypass some of these small computations and inject some"}, {"start": 797.04, "end": 803.0, "text": " more robustness into the student model. So with these three strategies to bring"}, {"start": 803.0, "end": 807.5999999999999, "text": " noise into the training process, one is on the data, and two is on the student"}, {"start": 807.5999999999999, "end": 813.64, "text": " model itself, they train the student model, and then fourth, and this is what we"}, {"start": 813.64, "end": 820.76, "text": " didn't have before, four, or maybe we put four here, make the student a new"}, {"start": 820.76, "end": 824.8, "text": " teacher. So now you can iterate, you can use the student model that you just"}, {"start": 824.8, "end": 830.76, "text": " trained to again label the unlabeled data, and then you can use another student"}, {"start": 830.76, "end": 836.16, "text": " model, again under the influence of noise to train from that student model, and"}, {"start": 836.16, "end": 840.2, "text": " so on, and you can go on, and they do up to like three iterations of this, where"}, {"start": 840.2, "end": 847.6400000000001, "text": " they always take the new, the student as the new teacher, and then use a new"}, {"start": 847.6400000000001, "end": 853.48, "text": " student model to train from that teacher, and they get better and better as they"}, {"start": 853.48, "end": 857.2800000000001, "text": " do this. Of course, there's like a diminishing returns, but it's pretty"}, {"start": 857.2800000000001, "end": 863.0, "text": " impressive that this even works, right? The new students in fact aren't even"}, {"start": 863.0, "end": 867.1600000000001, "text": " larger than the old students. It's just that the students are larger than the"}, {"start": 867.16, "end": 872.1999999999999, "text": " original teacher model in most of these cases. So here's the algorithm written"}, {"start": 872.1999999999999, "end": 878.0799999999999, "text": " down, you'll require labeled images right here, and unlabeled images, which are"}, {"start": 878.0799999999999, "end": 883.52, "text": " the ones with the tilde. So first you learn the teacher model, which minimizes"}, {"start": 883.52, "end": 889.3199999999999, "text": " the cross entropy on labeled images. This, we already know this, right? This is"}, {"start": 889.3199999999999, "end": 894.72, "text": " the label, this is the image according to the label, and you train the teacher"}, {"start": 894.72, "end": 899.24, "text": " model, which is this thing here, and you can see here, noise, so already in the"}, {"start": 899.24, "end": 902.88, "text": " teacher training process, you want to introduce this noise, you want to introduce"}, {"start": 902.88, "end": 906.64, "text": " these data augmentations. These are, as I said, these are standard techniques to"}, {"start": 906.64, "end": 914.08, "text": " make models more robust and therefore more generalizable. Yeah, we know from"}, {"start": 914.08, "end": 918.08, "text": " these, from these self-supervised papers that these augmentations are very"}, {"start": 918.08, "end": 923.52, "text": " powerful, and the way you design them, basically, if you, one of these"}, {"start": 923.52, "end": 927.56, "text": " augmentations is a random crop, which means if you have an image, you randomly"}, {"start": 927.56, "end": 931.68, "text": " crop out like part of that image, and then that's your training sample and"}, {"start": 931.68, "end": 938.84, "text": " not the entire thing. So by doing this, you basically teaching the model to"}, {"start": 938.84, "end": 944.12, "text": " ignore the exact location and scale of things on an image, and you can do this"}, {"start": 944.12, "end": 947.88, "text": " because you as a human know that, you know, I can zoom in, I can zoom out into"}, {"start": 947.88, "end": 954.24, "text": " something and it won't change what's on the picture. So that's, you use these"}, {"start": 954.24, "end": 957.72, "text": " augmentations to kind of heuristically tell the model what it should be"}, {"start": 957.72, "end": 963.72, "text": " invariant to. And that is, that is a very powerful technique to regularize"}, {"start": 963.72, "end": 969.48, "text": " basically to to robustify these deep, the deep methods, and this is used the"}, {"start": 969.48, "end": 975.56, "text": " same here. So already in the teacher model, we train with these noise, and then"}, {"start": 975.56, "end": 981.28, "text": " step two, use a normal IE not noise teacher model to generate soft or hard"}, {"start": 981.28, "end": 985.9599999999999, "text": " pseudo labels for the clean IE not distorted unlabeled images. And this is"}, {"start": 985.9599999999999, "end": 991.52, "text": " important, they stress this here that when you when you label the unlabeled"}, {"start": 991.52, "end": 997.4, "text": " images, you want to use the model that is without the noise, and you do it on"}, {"start": 997.4, "end": 1002.3199999999999, "text": " the not distorted unlabeled images. So when you infer the labels, it's very"}, {"start": 1002.32, "end": 1008.36, "text": " important that you have clean, accurate labels without any sort of noise in"}, {"start": 1008.36, "end": 1012.4000000000001, "text": " them. So label noise is not something that they have found to help in this"}, {"start": 1012.4000000000001, "end": 1018.2800000000001, "text": " case. So not label noise on the teacher that is. So you can see right here on"}, {"start": 1018.2800000000001, "end": 1024.04, "text": " the unlabeled images, we'll use that teacher model without the noise to infer"}, {"start": 1024.04, "end": 1030.2, "text": " the labels. Now they say these can be hard model hard labels or soft labels. So"}, {"start": 1030.2, "end": 1035.72, "text": " what does that mean? If we generate hard pseudo labels, that means that the Y"}, {"start": 1035.72, "end": 1040.96, "text": " here is simply going to be either zero or one or two or three and so on. So just"}, {"start": 1040.96, "end": 1044.8400000000001, "text": " the index of the class, whichever class is most likely, that's going to be our"}, {"start": 1044.8400000000001, "end": 1050.72, "text": " label. This is exactly how the supervised data sets come, right? So this is what"}, {"start": 1050.72, "end": 1056.0, "text": " you'll think first when you see that. However, soft pseudo labels means that the"}, {"start": 1056.0, "end": 1062.28, "text": " Y will be a distribution. So instead of being of class zero, it will be sort of,"}, {"start": 1062.28, "end": 1073.24, "text": " let's say, 90% of class zero, but also 5% class one and 5% class two. So you'll"}, {"start": 1073.24, "end": 1079.4, "text": " output the distribution instead of the just the label. And they have found that"}, {"start": 1079.4, "end": 1085.76, "text": " the soft pseudo labels work slightly, slightly better than the hard pseudo labels."}, {"start": 1085.76, "end": 1095.56, "text": " Okay, thanks. So they use the soft pseudo labels here because they work slightly"}, {"start": 1095.56, "end": 1099.64, "text": " better, but you can do it with hard or soft labels. The important thing is that"}, {"start": 1099.64, "end": 1105.2, "text": " you use the teacher to generate as accurate as possible labels for your"}, {"start": 1105.2, "end": 1111.24, "text": " unlabeled data. Then third, we've already seen this learn an equal or larger"}, {"start": 1111.24, "end": 1115.8, "text": " student model, which minimizes the cross-centropy loss unlabeled images and"}, {"start": 1115.8, "end": 1121.32, "text": " unlabeled images with noise added to the student model. So as you can see,"}, {"start": 1121.32, "end": 1127.36, "text": " labeled images and unlabeled images. So we're in this semi-supervised learning"}, {"start": 1127.36, "end": 1133.04, "text": " setting right now. You take in both together with noise and noise here is in"}, {"start": 1133.04, "end": 1138.1200000000001, "text": " bold, which means they stress it again. This is important. So you can see that the"}, {"start": 1138.12, "end": 1143.8, "text": " loss is composed of two different things. These are the true images of your"}, {"start": 1143.8, "end": 1151.28, "text": " original model. And you use that and this means you noise the student model. And"}, {"start": 1151.28, "end": 1157.12, "text": " that noise can be on the data or in the model itself. And here also the"}, {"start": 1157.12, "end": 1161.3999999999999, "text": " unlabeled images that you have labeled with the teacher, you do the exact"}, {"start": 1161.3999999999999, "end": 1166.84, "text": " same thing. So you train on both of these data sets. And step four is if you"}, {"start": 1166.84, "end": 1170.76, "text": " want to do iterative training, use the student as a teacher and go back to step"}, {"start": 1170.76, "end": 1177.6399999999999, "text": " two. Now they have some more tricks when they do this iterative training. They"}, {"start": 1177.6399999999999, "end": 1182.6, "text": " also up the batch size during the iterative training and so on. So they do a"}, {"start": 1182.6, "end": 1187.9199999999998, "text": " lot of things to make the student learn something more, something better than"}, {"start": 1187.9199999999998, "end": 1193.28, "text": " the teacher. And I think this the whole paper, it doesn't, it doesn't state it"}, {"start": 1193.28, "end": 1198.08, "text": " explicitly, but I think the whole paper, everything they do here is to kind of"}, {"start": 1198.08, "end": 1203.52, "text": " force or allow the student to become better than the teacher by by giving more"}, {"start": 1203.52, "end": 1208.16, "text": " noise, by making the student larger, by making the batch size for the student"}, {"start": 1208.16, "end": 1214.56, "text": " larger, and so on. So you want to sort of inject as much invariance as you can."}, {"start": 1214.56, "end": 1225.32, "text": " And that will make the student learn more. So they say here, noisy student, when"}, {"start": 1225.32, "end": 1231.24, "text": " the student is deliberately noise in its it is trained to be consistent to the"}, {"start": 1231.24, "end": 1236.32, "text": " teacher that is not noise when it generates the pseudo labels. In our"}, {"start": 1236.32, "end": 1246.32, "text": " experiments, we use two types of noise input noise and model noise. First data"}, {"start": 1246.32, "end": 1250.6799999999998, "text": " augmentation is an important noisy method in noisy student training because it"}, {"start": 1250.6799999999998, "end": 1255.12, "text": " forces the student to ensure prediction consistency across augmented"}, {"start": 1255.12, "end": 1259.48, "text": " versions of an image. Specifically in our method, the teacher produces high"}, {"start": 1259.48, "end": 1263.96, "text": " quality pseudo labels by reading in clean images, while the student is required"}, {"start": 1263.96, "end": 1270.72, "text": " to produce to reproduce those labels with augmented images as an input. Second,"}, {"start": 1270.72, "end": 1277.2, "text": " when dropout and stochastic depth function are used as noise, the teacher"}, {"start": 1277.2, "end": 1281.3600000000001, "text": " behaves like an ensemble at inference time when it generates pseudo labels,"}, {"start": 1281.3600000000001, "end": 1286.28, "text": " whereas the student behaves like a single model. In other words, the student is"}, {"start": 1286.28, "end": 1290.56, "text": " forced to mimic a more powerful ensemble model. We present an ablation study"}, {"start": 1290.56, "end": 1295.6, "text": " at the same time. So it's a bit weird what they say here. Don't be confused. You"}, {"start": 1295.6, "end": 1302.24, "text": " use the dropout and the stochastic depth on the student model. And they say"}, {"start": 1302.24, "end": 1307.48, "text": " here, if you do this, the teacher behaves like an ensemble at inference time,"}, {"start": 1307.48, "end": 1313.44, "text": " whereas the student behaves like a single model. And yeah, it's a bit of a"}, {"start": 1313.44, "end": 1318.2, "text": " weird formulation, but it's true like the teacher, the teacher will produce"}, {"start": 1318.2, "end": 1324.8, "text": " these same label for different pathways through the students if you use dropout"}, {"start": 1324.8, "end": 1330.68, "text": " and kind of stochastic depth. And therefore, the student is kind of required to"}, {"start": 1330.68, "end": 1335.2, "text": " approximate each time, each forward pass has a different forward pass through the"}, {"start": 1335.2, "end": 1339.0800000000002, "text": " layers, through the connections with dropout. And it's first to approximate that"}, {"start": 1339.0800000000002, "end": 1345.88, "text": " teacher label with all of these different things. So you see that you put in a"}, {"start": 1345.88, "end": 1352.5200000000002, "text": " lot of techniques. So they have even other techniques. There is one additional"}, {"start": 1352.5200000000002, "end": 1357.5600000000002, "text": " trick. And it's not and it's not one. Actually, they have so many tricks. And if you"}, {"start": 1357.5600000000002, "end": 1361.8400000000001, "text": " look at their experimental setup, it's crazy. Like they describe exactly"}, {"start": 1361.8400000000001, "end": 1365.2800000000002, "text": " where you reduce the learning rate like this and the batch size like this and so"}, {"start": 1365.2800000000002, "end": 1370.6000000000001, "text": " on. So to get state of the art on ImageNet, it's not enough to just have a good"}, {"start": 1370.6, "end": 1376.28, "text": " idea of a new thing to do what you you have to have the good idea and then execute"}, {"start": 1376.28, "end": 1382.6, "text": " it almost like really well because you have to regard all of these additional"}, {"start": 1382.6, "end": 1387.9599999999998, "text": " tricks that people have figured out over the years. In any case, they say it works"}, {"start": 1387.9599999999998, "end": 1393.36, "text": " better with an additional trick, date to filtering and balancing. Specifically, we"}, {"start": 1393.36, "end": 1397.4399999999998, "text": " filter images that the teacher model has low confidence on since they are"}, {"start": 1397.44, "end": 1402.48, "text": " usually out of domain images. So that goes to a point where if you see we have"}, {"start": 1402.48, "end": 1408.96, "text": " this ImageNet label data set, right? And we have the larger data set. Now, the"}, {"start": 1408.96, "end": 1412.88, "text": " larger data sets simply contains images. And there is no guarantee that the"}, {"start": 1412.88, "end": 1417.68, "text": " images are actually of the classes that we have in the ImageNet data set right"}, {"start": 1417.68, "end": 1422.3200000000002, "text": " here. We have a thousand classes here. There's no guarantee that these images"}, {"start": 1422.3200000000002, "end": 1427.28, "text": " fit into any of those classes. Yeah, we still ask the teacher model to put"}, {"start": 1427.28, "end": 1434.72, "text": " them in some of these classes. Now, you can filter out part of those images."}, {"start": 1434.72, "end": 1440.08, "text": " If you can look at the teacher model and you look at its confidence. So when it"}, {"start": 1440.08, "end": 1445.0, "text": " outputs a distribution, if there's just two labels, let's say, if it outputs a"}, {"start": 1445.0, "end": 1448.2, "text": " distribution like this, that's wildly different than if it outputs a"}, {"start": 1448.2, "end": 1455.0, "text": " distribution like this. Both are class one labels, but one is much more confident"}, {"start": 1455.0, "end": 1458.36, "text": " than the other. So what you want to do is you want to filter out these low"}, {"start": 1458.36, "end": 1463.88, "text": " confidence labels because you know, the model isn't really sure, but it has to"}, {"start": 1463.88, "end": 1468.72, "text": " assign a class. But that's usually an indication that it is an out of domain"}, {"start": 1468.72, "end": 1475.12, "text": " image. So if they filter this, it works better. And then also to ensure that the"}, {"start": 1475.12, "end": 1480.16, "text": " distribution of the unlabeled images match that of the training set, we also need"}, {"start": 1480.16, "end": 1484.72, "text": " to balance the number of unlabeled images for each class. As all classes in"}, {"start": 1484.72, "end": 1488.92, "text": " ImageNet have a similar number of labeled images. For this purpose, we duplicate"}, {"start": 1488.92, "end": 1493.44, "text": " images in classes where there are not enough images. For classes where we have"}, {"start": 1493.44, "end": 1500.32, "text": " too many images, we take the images with the highest confidence. Okay, so this is"}, {"start": 1500.32, "end": 1504.72, "text": " just another technique. This has basically nothing to do with their core idea,"}, {"start": 1504.72, "end": 1511.48, "text": " but this is just another thing where they say, okay, we can treat this big thing"}, {"start": 1511.48, "end": 1515.6, "text": " that we scrape from the internet. You know, we can somehow filter and balance it"}, {"start": 1515.6, "end": 1525.4, "text": " smartly and that will work even better. Alright, so let's go into the experiments."}, {"start": 1525.4, "end": 1533.28, "text": " Of course, they're... So what they do, I think, where is the graphic? What they do is"}, {"start": 1533.28, "end": 1543.96, "text": " they take an efficient net right here. And they train... They first train an"}, {"start": 1543.96, "end": 1550.32, "text": " efficient net, a smaller efficient net, as we said, for to be the teacher and"}, {"start": 1550.32, "end": 1560.6, "text": " then they train a larger efficient net for the student. The best model in our"}, {"start": 1560.6, "end": 1565.24, "text": " experiments is a result of three iterations of putting back the student as a new"}, {"start": 1565.24, "end": 1571.48, "text": " teacher. We first train an efficient net B7 on ImageNet as the teacher model. So"}, {"start": 1571.48, "end": 1576.76, "text": " you can see in the table right here what the B7 achieves. The efficient net B7"}, {"start": 1576.76, "end": 1581.0, "text": " here, you can see it has 66 million parameters, which is fairly small compared"}, {"start": 1581.0, "end": 1584.9599999999998, "text": " to these other kind of previous state-of-the-art methods on ImageNet."}, {"start": 1584.96, "end": 1590.92, "text": " Right, so they first train this and that will achieve something like an 85%"}, {"start": 1590.92, "end": 1596.24, "text": " accuracy. Now, if you just train a larger model, this efficient net L2 right here"}, {"start": 1596.24, "end": 1600.4, "text": " that has, you can see 480 million parameters. So a lot of more million"}, {"start": 1600.4, "end": 1605.04, "text": " parameters, but you just train it on the same data set on ImageNet. You will get"}, {"start": 1605.04, "end": 1612.56, "text": " a 0.5% improvement. And you can see that here with noisy student training with"}, {"start": 1612.56, "end": 1616.6, "text": " the exact same model. So it has the same amount of parameters. You'll actually"}, {"start": 1616.6, "end": 1623.8, "text": " get an 88.4. So I like a more than a 3% improvement. And that's with the same"}, {"start": 1623.8, "end": 1628.9199999999998, "text": " model, just with this different training procedure and inputting these 300"}, {"start": 1628.9199999999998, "end": 1634.12, "text": " million unlabeled images that you have laying around. But the all the"}, {"start": 1634.12, "end": 1640.56, "text": " information about all the label information comes from the ImageNet data set and"}, {"start": 1640.56, "end": 1647.3999999999999, "text": " comes from this efficient net B7 teacher model. So that's basically you can, it's a"}, {"start": 1647.3999999999999, "end": 1655.2, "text": " testament that out of this 85, you can make this 88 just by smartly using the"}, {"start": 1655.2, "end": 1658.9199999999998, "text": " information that the model that this model has learned about the data and"}, {"start": 1658.9199999999998, "end": 1665.8799999999999, "text": " transferring it to new data. So they train an efficient net B7, that's the small"}, {"start": 1665.88, "end": 1671.4, "text": " model as a teacher model. Then by using the B7 model as the teacher, we trained an"}, {"start": 1671.4, "end": 1677.5600000000002, "text": " efficient net L2 model with the unlabeled batch size set to 14 times the labeled"}, {"start": 1677.5600000000002, "end": 1682.2, "text": " batch size. And they stress that it's important that you up the batch size."}, {"start": 1682.2, "end": 1688.0, "text": " That's another thing that makes the student learn more than the teacher. Then we"}, {"start": 1688.0, "end": 1693.8000000000002, "text": " trained a new efficient net. So by the way, these this 14 times it's also it can be"}, {"start": 1693.8, "end": 1700.2, "text": " done because now you have more data. So you can also up the batch size. Then we"}, {"start": 1700.2, "end": 1705.24, "text": " trained a new efficient net L2 model with the efficient net L2 model as the"}, {"start": 1705.24, "end": 1710.3999999999999, "text": " teacher. Lastly, we iterated again and used an unlabeled batch size of 28 times"}, {"start": 1710.3999999999999, "end": 1714.08, "text": " the labeled batch size. The detailed result of the three iterations and so on."}, {"start": 1714.08, "end": 1718.76, "text": " Okay, so you can see that it's a fairly complicated procedure, but you can gain"}, {"start": 1718.76, "end": 1727.84, "text": " and gain and gain by simply up by simply uping the or iterating on this"}, {"start": 1727.84, "end": 1733.72, "text": " procedure. And I think they have it somewhere here. Yes, so as you can see if"}, {"start": 1733.72, "end": 1740.44, "text": " iteration one, you train the efficient net L2, you start it with the B7. You train"}, {"start": 1740.44, "end": 1745.04, "text": " the efficient at a two with a batch size 14 times larger. And you gain"}, {"start": 1745.04, "end": 1750.32, "text": " significantly, right? This gains about 2% over the original efficient net. Then"}, {"start": 1750.32, "end": 1758.24, "text": " you iterate again with the same batch size and you get like a 5.5% improvement"}, {"start": 1758.24, "end": 1761.92, "text": " and you iterate again with an even larger batch size and you get a 0.3%"}, {"start": 1761.92, "end": 1766.6, "text": " improvement. So there's diminishing returns, but still you can see that you know"}, {"start": 1766.6, "end": 1769.92, "text": " the more with the introduction of noise, with the introduction of the larger"}, {"start": 1769.92, "end": 1774.2, "text": " model, with the introduction of the larger batch size, these are all things that"}, {"start": 1774.2, "end": 1780.76, "text": " help the student basically become better than the teacher. All right, so they do a"}, {"start": 1780.76, "end": 1786.44, "text": " bunch of other experiments. So their main comparison is right here where they"}, {"start": 1786.44, "end": 1793.8400000000001, "text": " say, look, if we, if even if we train the same model with this noisy student"}, {"start": 1793.8400000000001, "end": 1800.04, "text": " training, we can make, you know, pretty large gains over the model over the same"}, {"start": 1800.04, "end": 1805.44, "text": " model where we do not train it with this noisy student training. So this really"}, {"start": 1805.44, "end": 1812.36, "text": " seems to help, you know, due to the noise, due to the additional data. They do a"}, {"start": 1812.36, "end": 1817.68, "text": " lot of ablation studies. So that's pretty interesting. And they also do these"}, {"start": 1817.68, "end": 1822.6399999999999, "text": " studies on this special image net dataset. For example, image net C, you can see"}, {"start": 1822.6399999999999, "end": 1826.04, "text": " that there are quite a bit of distortions right here. I don't even see if you"}, {"start": 1826.04, "end": 1832.24, "text": " can see it on this video, but this is a swing. So the swing right here is like"}, {"start": 1832.24, "end": 1838.96, "text": " something like this, but you almost can't see it. And you see that the bold on"}, {"start": 1838.96, "end": 1842.52, "text": " the left is always the prediction of their model, while the thing on the right"}, {"start": 1842.52, "end": 1848.0, "text": " is the prediction of the original model. So this model they claim is"}, {"start": 1848.0, "end": 1852.48, "text": " significantly more robust to these kinds of perturbations. And they do an"}, {"start": 1852.48, "end": 1861.76, "text": " analysis of this where they show, yes, in fact, it is. So I think we've already"}, {"start": 1861.76, "end": 1867.44, "text": " seen this at the beginning that the noisy student is significantly more robust"}, {"start": 1867.44, "end": 1871.44, "text": " to these perturbations. And they also test this to adversarial perturbations."}, {"start": 1871.44, "end": 1876.68, "text": " So right here, you can see that the original model drops pretty quickly as you"}, {"start": 1876.68, "end": 1880.32, "text": " increase the epsilon. The epsilon is kind of the strength of the adversarial"}, {"start": 1880.32, "end": 1886.2, "text": " perturbation. And the noisy at the original model drops very quickly to, you"}, {"start": 1886.2, "end": 1893.04, "text": " know, fairly low accuracy, while as the noisy student training drops much, much"}, {"start": 1893.04, "end": 1900.8799999999999, "text": " less quickly. Now, this is another testament to the fact that what you do, I"}, {"start": 1900.8799999999999, "end": 1905.56, "text": " think what's happening is you have your data space, right? And you have your"}, {"start": 1905.56, "end": 1912.6399999999999, "text": " data points in it. Now, when you do the like normal data augmentation, what you'll"}, {"start": 1912.6399999999999, "end": 1917.2, "text": " do is you not only force the model to predict those points correctly, but you'll"}, {"start": 1917.2, "end": 1922.0, "text": " sort of make a bit of a cloud around them. And you force the model to predict"}, {"start": 1922.0, "end": 1930.3999999999999, "text": " that cloud correctly. Now, if you introduce more data and you do even more"}, {"start": 1930.4, "end": 1936.48, "text": " noise, what you do is you'll make these clouds kind of larger. And that means"}, {"start": 1936.48, "end": 1941.48, "text": " the model is more robust to any sort of perturbations in these clouds, right? And"}, {"start": 1941.48, "end": 1945.24, "text": " and that means it's probably also going to be more robust to adversarial"}, {"start": 1945.24, "end": 1950.3600000000001, "text": " perturbations. So that's sort of how you can think of this, this introduction of"}, {"start": 1950.3600000000001, "end": 1955.24, "text": " noise, to make it more generalizable. So how does this generalize better? So if"}, {"start": 1955.24, "end": 1960.24, "text": " you think of this data point right here, if I'm looking to generalize, that"}, {"start": 1960.24, "end": 1965.76, "text": " means, you know, I have this IID data set. So probably my test data is going to be"}, {"start": 1965.76, "end": 1970.56, "text": " related to the training data. So I might get a data point that's fairly close"}, {"start": 1970.56, "end": 1976.8, "text": " to that data point. And generalizing means I classified correctly. Now, if this"}, {"start": 1976.8, "end": 1981.92, "text": " cloud is very small, like it is here, my decision boundary could be like here,"}, {"start": 1981.92, "end": 1987.6, "text": " right? And even though the test data set is fairly close to the original"}, {"start": 1987.6, "end": 1994.8799999999999, "text": " training data point, it won't be classified incorrectly. However, if my original"}, {"start": 1994.8799999999999, "end": 1999.52, "text": " cloud during training is larger, you can see if I train a model, it can maybe put"}, {"start": 1999.52, "end": 2005.4399999999998, "text": " the decision boundary here. And then my test data point will be included in on"}, {"start": 2005.4399999999998, "end": 2009.8, "text": " that same side. So that's kind of the idea behind generalizing better. Of course,"}, {"start": 2009.8, "end": 2016.08, "text": " that's a vast simplification. And also to say that this here is an FGSM attack."}, {"start": 2016.08, "end": 2020.8799999999999, "text": " So this is kind of the weakest attack in the adversarial perturbation"}, {"start": 2020.8799999999999, "end": 2028.3999999999999, "text": " spectrum. They do say under a stronger attack, PGD, which is a fairly strong"}, {"start": 2028.3999999999999, "end": 2032.8, "text": " attack with 10 iterations at epsilon equals 16, noisy student training improves"}, {"start": 2032.8, "end": 2042.24, "text": " efficient net L2s accuracy from 1.1% to 4.4%. I'm not this, like, you know,"}, {"start": 2042.24, "end": 2049.44, "text": " 1.1% really means the model is almost like dead. This is lower. This is like"}, {"start": 2049.44, "end": 2054.88, "text": " random performance. And 4.4% is still a bit above random performance. But"}, {"start": 2057.28, "end": 2062.96, "text": " yeah, you could probably, you could probably get there by simply using any sort of noise"}, {"start": 2062.96, "end": 2069.68, "text": " in that case. But still, you can see that it is more robust to, especially to natural"}, {"start": 2069.68, "end": 2077.3599999999997, "text": " distortions. And therefore, it generalizes better. As I said, they do quite a bit of drop,"}, {"start": 2077.3599999999997, "end": 2084.7999999999997, "text": " sorry, not drop out, ablation studies to figure out where exactly the performance comes from."}, {"start": 2084.7999999999997, "end": 2090.56, "text": " And the answer is it pretty much comes from all the things that they've described. So here,"}, {"start": 2090.56, "end": 2097.2, "text": " you can see the effect of that extra data set. And you can see pretty much with that extra"}, {"start": 2097.2, "end": 2105.04, "text": " data set, all the situations improve. Here, you can see what is happening when you do not"}, {"start": 2105.04, "end": 2110.72, "text": " augment the student. When you do not date augment, you can immediately see that the"}, {"start": 2110.72, "end": 2116.72, "text": " accuracy drops. And then when you do not augment and also don't use these model noises,"}, {"start": 2116.72, "end": 2123.4399999999996, "text": " then the performance drops again. And lastly, when you use the teacher, but you noise the teacher,"}, {"start": 2123.44, "end": 2130.48, "text": " you can see also here the performance is dropping from the original quite a bit. So all of these"}, {"start": 2130.48, "end": 2136.16, "text": " things kind of contribute. And they do much more ablations. And they have listed their findings"}, {"start": 2136.16, "end": 2142.96, "text": " here. So using a large teacher model with better performance leads to better result. So,"}, {"start": 2142.96, "end": 2149.6, "text": " you know, as the original teacher, you should use as good as possible a teacher model you can find."}, {"start": 2149.6, "end": 2157.92, "text": " Second, a large amount of unlabeled data is necessary for better performance."}, {"start": 2158.72, "end": 2165.2, "text": " Okay, so if you want to do this, you better get a large amount of extra data. Because that's"}, {"start": 2165.2, "end": 2172.16, "text": " one thing that makes the student perform better. Soft pseudo labels work better than hard pseudo"}, {"start": 2172.16, "end": 2180.3199999999997, "text": " labels for out of the main data insert cases. Fourth, a large student model is important to enable"}, {"start": 2180.3199999999997, "end": 2187.7599999999998, "text": " the student to learn a more powerful model. Okay, so because usually this knowledge distillation"}, {"start": 2187.7599999999998, "end": 2193.12, "text": " is what it is this is usually called knowledge distillation. If you use a teacher model to train"}, {"start": 2193.12, "end": 2198.3999999999996, "text": " a student model, and it is often used when the student model is smaller than the teacher because"}, {"start": 2198.4, "end": 2202.88, "text": " you want to kind of become more efficient to you from so the teacher is large. You'll make the"}, {"start": 2202.88, "end": 2209.12, "text": " student small and you usually sacrifice some accuracy. And here they say if you want to gain"}, {"start": 2209.12, "end": 2213.6, "text": " some accuracy, you need a large student model. It can't be like a small one."}, {"start": 2216.64, "end": 2223.2000000000003, "text": " Number five, data balancing is useful for small models. Number six, joint training on"}, {"start": 2223.2, "end": 2228.72, "text": " label data and unlabeled data outperforms the pipeline at first pre-trains with unlabeled data"}, {"start": 2228.72, "end": 2235.12, "text": " and then fine tunes on label data. So this is in contrast to like what people have done before in"}, {"start": 2235.12, "end": 2241.04, "text": " the self supervised learning and so on, where it's always kind of pre-training then fine tuning"}, {"start": 2241.04, "end": 2247.8399999999997, "text": " or in the in the transfer learning setting. Seven, using a large ratio between unlabeled batch size"}, {"start": 2247.84, "end": 2255.04, "text": " and label batch size enables models to train longer on unlabeled data to achieve a higher accuracy."}, {"start": 2255.92, "end": 2261.44, "text": " Okay, we've already seen that they have used that. And number eight, training the student from"}, {"start": 2261.44, "end": 2267.2000000000003, "text": " scratch is sometimes better than initializing the student with the teacher and the student initialized"}, {"start": 2267.2000000000003, "end": 2273.6800000000003, "text": " with the teacher still requires a large number of training epochs to perform well. This is fairly"}, {"start": 2273.68, "end": 2280.72, "text": " interesting because it kind of alludes to the fact that the minima in weight space, if so if"}, {"start": 2280.72, "end": 2285.7599999999998, "text": " this is of course the case if the student model is the same as the teacher model. So in like"}, {"start": 2285.7599999999998, "end": 2294.72, "text": " iteration two or three or whatnot, it means that in weight space if we look at you know you might"}, {"start": 2294.72, "end": 2302.3999999999996, "text": " want to start the student here and the minimum is right here. And you might want to think that"}, {"start": 2302.4, "end": 2308.08, "text": " if I learn the same thing then the minima are fairly close together right. So the the teacher's"}, {"start": 2308.08, "end": 2314.08, "text": " minima might be here and the student minima might be fairly close. So it might be beneficial if I"}, {"start": 2314.08, "end": 2320.2400000000002, "text": " if I start not over here, but actually start at the teacher's minimum. But this doesn't always"}, {"start": 2320.2400000000002, "end": 2325.44, "text": " seem to be the case. And that is a fairly interesting observation because it kind of means that we're"}, {"start": 2325.44, "end": 2331.04, "text": " talking about different minima here. We're talking about the student model learning different"}, {"start": 2331.04, "end": 2337.12, "text": " things and that's what we've discussed already. The student model kind of learns to be robust and"}, {"start": 2337.12, "end": 2343.84, "text": " that's probably a minimum that's fairly far away in weight space at least in in a sort of energy"}, {"start": 2343.84, "end": 2350.4, "text": " landscape weight space might be the case that it needs to actually overcome kind of a hill here"}, {"start": 2350.4, "end": 2356.48, "text": " even though the minimum might be close. There's lots of research in like how minima are distributed in"}, {"start": 2356.48, "end": 2362.4, "text": " these weight spaces. Which I don't want to go into right here, but it is a fairly interesting"}, {"start": 2362.4, "end": 2369.52, "text": " observation that it's not always helpful to initialize the teacher sorry the student at the teacher's"}, {"start": 2369.52, "end": 2378.88, "text": " optimum. Okay so this was the paper and you know this is this is the type of research where"}, {"start": 2378.88, "end": 2384.48, "text": " I do appreciate kind of the these large labs taking it on because they have the resources to do"}, {"start": 2384.48, "end": 2389.68, "text": " all of these ablations all of these different models across them with these giant data sets and"}, {"start": 2389.68, "end": 2398.2400000000002, "text": " so on. Which I guess university labs just would not have and this is a fairly thorough paper really"}, {"start": 2398.2400000000002, "end": 2405.36, "text": " investigating which parts of the pipeline you know do something and which ones don't and usually"}, {"start": 2405.36, "end": 2412.72, "text": " I I'm fairly critical of pipelines that have like 50 billion tricks because you never know where the"}, {"start": 2412.72, "end": 2418.8799999999997, "text": " improvement exactly is coming from but you can sort of mitigate that criticism by doing all of"}, {"start": 2418.8799999999997, "end": 2423.8399999999997, "text": " these kind of ablations on the different parts and really showing look this is important but this"}, {"start": 2423.8399999999997, "end": 2429.8399999999997, "text": " is also important but this is also important but this is also important so yeah that was my"}, {"start": 2429.84, "end": 2443.28, "text": " two cents to this paper I hope you enjoyed this and I'll see you next time bye bye"}] |
Yannic Kilcher | 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 at all 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, reinforcement learning was kind of this weird field of Markov decision process 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 7 Atari to any 600 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 Lattec savagery right here and here. Yeah, you know, it's just something. I'm not, I'm not OCD about that kind of stuff. I think we should ditch Lattec 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? These 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 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, 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 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 could be this you scored a goal. So that's zero most of the time. And sometimes it's one 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 this can go on for hundreds of steps or thousands 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 which of 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 what they say. We are the first deep learning model to successfully learn directly from high dimensional sensory input. 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 a thousand 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 have been demonstrated. So this is after things like Alex net, though before ResNet, 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 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 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 to tune them, which is an additional benefit. This would have been a cool paper, even if they had to sort of tune the algorithm to each of the seven games. But they didn't, which makes it even more impressive. It's kind of their point here that these reinforcement, deeper reinforcement learning can be some sort of a general learning mechanism. Of course, later there has been like a 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 it can learn general things. So yeah, that was, we're still not done with reinforcement learning. I guess 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 act, 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 we'll, we'll 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 lower case R. Now what you want to do formally is you want to maximize the reward that you get in time T. Sorry, you want to, that's the reward you get at time T prime. 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 will 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 an 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 here regardless 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. 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 and say what's Q of S and a one and the Q function would maybe say that's seven. And here you say what's the Q function of S and a two and it would maybe say that's four and here the same thing for a three and it maybe 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 worry much about 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? 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. And then you guarantee it because there could be a situation where you reward in a single step is going to be very high here, like a hundred and here zero zero. And you would be tempted to take that action right here, but after that it's just going to be zero zero zero. So your total reward is going to be 100. And 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 decisions we make in the future, but that's this policy pi right here. 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 outcomes this estimation of the reward, which we usually call Q. So the value Q 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's, it's 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 are 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 may be play this episode right here, right? It's 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 2,090 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 A1 and now I then got 2,090 reward. Cool. And in the next episode, you're going on playing and you maybe go down here and then you get a next training example. I was in state S. I, so you keep restarting the episode 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 theorem 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 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 in a state S and I'm wondering, what is my Q of my state S and 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 condition on the policy where after we perform the first. 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 with 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 supervigilous surprise learning. This here is going to be your F of X. And this here is going to be your Y. And we'll take the square loss between the two, except your input X is going to be which state, demion 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 performed 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. I'm going to assume some of your 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, so T plus one, until the end of the episode, okay? So T prime. So that's T prime equals T plus one, all right? So 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 network, though, be 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 tensor flow 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, 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. All right. 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 in 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, too, this mini batch has almost no variability in it. So if you had 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 bit 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 never re sample on average will be used four times. So 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 probably the 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 decoreulate 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, then this estimate gets better, then 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 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, 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 chance that this was due to this experience replay, which I believe they did not invent. I mean, this has of course 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 4 image produced by this. So this is the pre-processing. The first hidden layer convolves 16, 8 by 8 filters with stride 4 with the input image and applies the rectifier non-linearity. So the relu. The second hidden layer convolves 32, 4 by 4 filters with stride 2 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 4 and 18 on the games we considered. Okay, as you can see, the 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 AlexNet. 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. 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 queue 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 queue function, what the queue function says. Remember the queue 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 queue value because you can shoot enemies and that gives you reward. This is already so the enemy isn't shot yet by the simple appearance of the enemy, the queue function also like already jumps in value because it anticipates a future reward. 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 queue function is very sure that in the future, there's going to be a high reward. So then once the once the enemy is shot, then there's no more enemy to be shot and the queue 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 pretty interesting and you can see pretty directly that there is a correlation between what's happening in the game and this learned queue 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. So their method just takes R&GB 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 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 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 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, 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 into 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 QNet works figured out that strategy and you need to pull it off very precisely, which of course 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, a go explorer 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 nowhere yet. Yeah, if I'm allowed to say that. So I enjoyed reading this paper. 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 of how to think of RL. But apart from this, everything else is written incredibly well, easy, straightforward. And yeah, this was just a nice work of its time and I appreciate it for that. All right, I'll see you next time and I appreciate your time too. Bye. | [{"start": 0.0, "end": 5.42, "text": " Hi there, today we'll look at playing Atari with deep reinforcement learning by Vladimir"}, {"start": 5.42, "end": 8.1, "text": " Mni at all of DeepMind."}, {"start": 8.1, "end": 13.52, "text": " So this is another one of our series of impactful past papers."}, {"start": 13.52, "end": 19.06, "text": " This paper right here kicked off an entire revolution in reinforcement learning."}, {"start": 19.06, "end": 24.36, "text": " Specifically, it sort of started the deep reinforcement learning hype."}, {"start": 24.36, "end": 29.52, "text": " Before that, reinforcement learning was kind of this weird field of Markov decision"}, {"start": 29.52, "end": 31.0, "text": " process and so on."}, {"start": 31.0, "end": 37.12, "text": " Now I know there were successes and all and stuff was happening, but this really made a"}, {"start": 37.12, "end": 44.92, "text": " lot of waves because it brought the power of deep neural networks to reinforcement learning."}, {"start": 44.92, "end": 53.0, "text": " And with a pretty simple application of convolutional networks, managed to solve these reinforcement"}, {"start": 53.0, "end": 59.36, "text": " learning games where previous algorithms really couldn't either or were heavily reliant"}, {"start": 59.36, "end": 62.28, "text": " on hand engineered features."}, {"start": 62.28, "end": 68.56, "text": " So we'll take a look here and what people did back then, what was the state of the art"}, {"start": 68.56, "end": 74.48, "text": " and what they are telling us about that kind of set it in relation to today."}, {"start": 74.48, "end": 80.84, "text": " Alright, if you do like papers like this commentary, like this, share it out, leave a like"}, {"start": 80.84, "end": 83.44, "text": " and tell me in the comments what you think."}, {"start": 83.44, "end": 85.48, "text": " So let's dive in."}, {"start": 85.48, "end": 91.2, "text": " They say we present the first deep learning model to successfully learn control policies"}, {"start": 91.2, "end": 97.2, "text": " directly from high dimensional sensory input using reinforcement learning."}, {"start": 97.2, "end": 102.52000000000001, "text": " The model is a convolutional neural network trained with a variant of Q learning whose"}, {"start": 102.52000000000001, "end": 109.0, "text": " input is raw pixels and whose output is a value value function estimating future rewards."}, {"start": 109.0, "end": 115.12, "text": " We apply our method to 7 Atari to any 600 games from the arcade learning environment with"}, {"start": 115.12, "end": 118.76, "text": " no adjustment of the architecture or learning algorithm."}, {"start": 118.76, "end": 123.88, "text": " We find that it outperforms all approaches on six of the games and surpasses a human"}, {"start": 123.88, "end": 126.32, "text": " expert on three of them."}, {"start": 126.32, "end": 128.52, "text": " So there's a lot packed into this."}, {"start": 128.52, "end": 137.04, "text": " First of all, I wanted to recognize the absolute Lattec savagery right here and here."}, {"start": 137.04, "end": 141.67999999999998, "text": " Yeah, you know, it's just something."}, {"start": 141.67999999999998, "end": 143.95999999999998, "text": " I'm not, I'm not OCD about that kind of stuff."}, {"start": 143.95999999999998, "end": 147.16, "text": " I think we should ditch Lattec honestly."}, {"start": 147.16, "end": 152.51999999999998, "text": " But so there's a lot of information packed in this abstract right here."}, {"start": 152.51999999999998, "end": 158.51999999999998, "text": " So they say this is the first deep learning model to learn control policies."}, {"start": 158.51999999999998, "end": 164.72, "text": " So that's the task of these reinforcement learning algorithms directly from high dimensional"}, {"start": 164.72, "end": 168.32, "text": " sensory input using using reinforcement learning."}, {"start": 168.32, "end": 169.88, "text": " So what do they mean?"}, {"start": 169.88, "end": 171.56, "text": " These are called learning environment."}, {"start": 171.56, "end": 175.07999999999998, "text": " If you don't know what it is, it's basically these old games right here."}, {"start": 175.07999999999998, "end": 177.92, "text": " You can kind of emulate them and run them."}, {"start": 177.92, "end": 181.07999999999998, "text": " And the inputs are always sort of the same."}, {"start": 181.07999999999998, "end": 183.84, "text": " So you have one joystick, I believe."}, {"start": 183.84, "end": 188.0, "text": " So you have kind of this joystick and it can go into various directions like left, right"}, {"start": 188.0, "end": 191.28, "text": " up, down, and then also the intermediate directions."}, {"start": 191.28, "end": 196.32, "text": " And then you have a, I think also a button that you can push."}, {"start": 196.32, "end": 202.76, "text": " And that gives you a total of somewhere around 16 or 20 actions in each of the games."}, {"start": 202.76, "end": 207.24, "text": " So the good thing about this environment is that the actions are always the same."}, {"start": 207.24, "end": 210.12, "text": " But of course they mean different things in different games."}, {"start": 210.12, "end": 217.36, "text": " So the games here, you know, for example, Pong or this breakout, these games are kind"}, {"start": 217.36, "end": 222.08, "text": " of really low pixel games, as you can see."}, {"start": 222.08, "end": 223.96, "text": " And they come in form of an image, right?"}, {"start": 223.96, "end": 224.96, "text": " So this is an image."}, {"start": 224.96, "end": 229.60000000000002, "text": " This is like 180 pixels and this is like 150 pixels."}, {"start": 229.60000000000002, "end": 236.04000000000002, "text": " And the task here is to learn a policy, which means which buttons and directions you need"}, {"start": 236.04000000000002, "end": 242.64000000000001, "text": " to push, depending on the observation right here, these pixels and achieve the maximum"}, {"start": 242.64000000000001, "end": 244.12, "text": " amount of reward."}, {"start": 244.12, "end": 247.32000000000002, "text": " So reward is given in each game differently as well."}, {"start": 247.32, "end": 254.16, "text": " For example, in this Pong game, the reward is every time you score kind of a goal against"}, {"start": 254.16, "end": 260.68, "text": " your opponent in breakout, you get a reward every time you manage to hit or kill a one"}, {"start": 260.68, "end": 262.24, "text": " of these blocks and so on."}, {"start": 262.24, "end": 267.64, "text": " So reward is different, but your objective is always to maximize the reward."}, {"start": 267.64, "end": 273.0, "text": " In a formal framework, you have an agent and an environment."}, {"start": 273.0, "end": 279.4, "text": " And the environment would always give you an observation, which in this case, the observation"}, {"start": 279.4, "end": 282.36, "text": " is one of these images."}, {"start": 282.36, "end": 285.52, "text": " And the agent will give back an action."}, {"start": 285.52, "end": 293.76, "text": " So the action in this case would be the which button to press or which direction to move"}, {"start": 293.76, "end": 295.52, "text": " the joystick into."}, {"start": 295.52, "end": 299.88, "text": " And then the environment would get back, give back a reward."}, {"start": 299.88, "end": 306.2, "text": " So the reward could be this you scored a goal."}, {"start": 306.2, "end": 307.92, "text": " So that's zero most of the time."}, {"start": 307.92, "end": 311.44, "text": " And sometimes it's one or nine."}, {"start": 311.44, "end": 313.88, "text": " Or it could be like how long you're alive and so on."}, {"start": 313.88, "end": 316.64, "text": " This is very, very, very variable."}, {"start": 316.64, "end": 324.4, "text": " So the difficulty of reinforcement learning very often is that these episodes can go for"}, {"start": 324.4, "end": 325.4, "text": " a while."}, {"start": 325.4, "end": 328.76, "text": " So this whole process here will repeat over time."}, {"start": 328.76, "end": 334.88, "text": " And this can go on for hundreds of steps or thousands of steps until you're done, you"}, {"start": 334.88, "end": 339.76, "text": " know, playing a game like this, like this right here."}, {"start": 339.76, "end": 342.4, "text": " And the reward can be very sparse."}, {"start": 342.4, "end": 345.88, "text": " So you might only get a reward at the very end of the game."}, {"start": 345.88, "end": 350.68, "text": " Sometimes most often in these games you get one in between, but still there can be multiple"}, {"start": 350.68, "end": 353.24, "text": " time steps where you don't have a reward."}, {"start": 353.24, "end": 357.36, "text": " And your task is to figure out which of the actions were the good ones."}, {"start": 357.36, "end": 360.40000000000003, "text": " This is known as the credit assignment problem."}, {"start": 360.40000000000003, "end": 366.92, "text": " And to do the credit assignment problem just from pixels alone, that was unheard of at the"}, {"start": 366.92, "end": 368.96000000000004, "text": " time this paper came out."}, {"start": 368.96000000000004, "end": 369.96000000000004, "text": " That's what they say."}, {"start": 369.96000000000004, "end": 377.12, "text": " We are the first deep learning model to successfully learn directly from high dimensional sensory"}, {"start": 377.12, "end": 378.6, "text": " input."}, {"start": 378.6, "end": 383.72, "text": " So the power of deep learning they argue is that a deep neural network, a convolutional"}, {"start": 383.72, "end": 388.68, "text": " neural network can extract these high level features by itself."}, {"start": 388.68, "end": 395.32000000000005, "text": " However, at this time people only knew that it could do so for supervised learning, basically"}, {"start": 395.32000000000005, "end": 398.96000000000004, "text": " for every input of an image, you had a label."}, {"start": 398.96000000000004, "end": 402.48, "text": " And that's how you train these convolutional neural network."}, {"start": 402.48, "end": 404.44000000000005, "text": " Here it's very different."}, {"start": 404.44000000000005, "end": 407.88000000000005, "text": " Here you will get maybe a thousand of those images."}, {"start": 407.88000000000005, "end": 412.12, "text": " And you'll simply say, well, you got a score of 1100."}, {"start": 412.12, "end": 417.12, "text": " And somehow you need to figure out which ones of these were the ones that gave you the"}, {"start": 417.12, "end": 418.88, "text": " good score."}, {"start": 418.88, "end": 420.8, "text": " And how to generalize that."}, {"start": 420.8, "end": 426.36, "text": " So there are various difficulties here to apply convolutional neural networks to this"}, {"start": 426.36, "end": 427.36, "text": " problem."}, {"start": 427.36, "end": 432.08, "text": " And they have detail right here how they did it."}, {"start": 432.08, "end": 436.44, "text": " So they say the model is a convolutional neural network, which have been demonstrated."}, {"start": 436.44, "end": 443.64, "text": " So this is after things like Alex net, though before ResNet, trained with a variant of"}, {"start": 443.64, "end": 449.32, "text": " Q learning whose input is raw pixels and whose output is a value function estimating the"}, {"start": 449.32, "end": 450.32, "text": " future."}, {"start": 450.32, "end": 451.48, "text": " So we'll get into Q learning."}, {"start": 451.48, "end": 458.68, "text": " Q learning is a reinforcement learning algorithm that has been around for a long time, but"}, {"start": 458.68, "end": 462.24, "text": " just not combined with deep neural networks."}, {"start": 462.24, "end": 468.96000000000004, "text": " And yeah, then they say the last cool thing here is that they apply them to seven games"}, {"start": 468.96000000000004, "end": 472.96000000000004, "text": " with no adjustment of the architecture or learning algorithm."}, {"start": 472.96000000000004, "end": 480.12, "text": " So they apply the same algorithm, the same hyper parameters to all of the seven games."}, {"start": 480.12, "end": 484.88, "text": " And the model learns all of the seven games, not as a single model, but as seven different"}, {"start": 484.88, "end": 485.88, "text": " models."}, {"start": 485.88, "end": 487.92, "text": " However, they all have the same hyper parameters."}, {"start": 487.92, "end": 491.44, "text": " So they don't need to to tune them, which is an additional benefit."}, {"start": 491.44, "end": 497.2, "text": " This would have been a cool paper, even if they had to sort of tune the algorithm to each"}, {"start": 497.2, "end": 498.92, "text": " of the seven games."}, {"start": 498.92, "end": 502.8, "text": " But they didn't, which makes it even more impressive."}, {"start": 502.8, "end": 509.56, "text": " It's kind of their point here that these reinforcement, deeper reinforcement learning can be some"}, {"start": 509.56, "end": 512.8, "text": " sort of a general learning mechanism."}, {"start": 512.8, "end": 518.84, "text": " Of course, later there has been like a giant amount of development since this."}, {"start": 518.84, "end": 524.96, "text": " And people have come up with all kinds of giant architectures and whatever corrections"}, {"start": 524.96, "end": 529.84, "text": " of policy corrections seem to real, continuous control."}, {"start": 529.84, "end": 535.32, "text": " This is, this is, most of it is a derivation of this work right here."}, {"start": 535.32, "end": 541.24, "text": " And this work, it reads surprisingly simple, I have to say."}, {"start": 541.24, "end": 547.96, "text": " And it's almost like they had little idea what problems were to be tackled later in"}, {"start": 547.96, "end": 552.2800000000001, "text": " RL because it kind of reads like, you know, we have this thing and it can learn general"}, {"start": 552.2800000000001, "end": 553.2800000000001, "text": " things."}, {"start": 553.2800000000001, "end": 557.2, "text": " So yeah, that was, we're still not done with reinforcement learning."}, {"start": 557.2, "end": 559.88, "text": " I guess we've just started."}, {"start": 559.88, "end": 560.88, "text": " Okay."}, {"start": 560.88, "end": 567.0, "text": " So, in a bit of more formal setting, what you will have in reinforcement learning are these"}, {"start": 567.0, "end": 568.6800000000001, "text": " rewards, right?"}, {"start": 568.6800000000001, "end": 572.52, "text": " So at each time step, you perform an act, you're in a state."}, {"start": 572.52, "end": 575.96, "text": " So the, we said you get back an observation."}, {"start": 575.96, "end": 578.9200000000001, "text": " And we call the observation the state."}, {"start": 578.9200000000001, "end": 584.52, "text": " Now these two things aren't a, sorry, these two things aren't entirely the same thing."}, {"start": 584.52, "end": 589.0400000000001, "text": " So the observation is what you get back directly from the environment and then the state,"}, {"start": 589.0400000000001, "end": 592.1600000000001, "text": " it can be something more."}, {"start": 592.1600000000001, "end": 597.24, "text": " Like if you remember something from the last observation, that can be part of your state."}, {"start": 597.24, "end": 601.6800000000001, "text": " The state is basically what you base your decision on and the observation is the pure thing"}, {"start": 601.6800000000001, "end": 603.32, "text": " you get from the environment."}, {"start": 603.32, "end": 610.4000000000001, "text": " Now in this case, they do some processing, but essentially we'll, we'll regard them as"}, {"start": 610.4000000000001, "end": 611.4000000000001, "text": " the same thing."}, {"start": 611.4000000000001, "end": 615.2, "text": " So the state is what you see of the environment."}, {"start": 615.2, "end": 618.2, "text": " Then in each of these steps, you perform an action."}, {"start": 618.2, "end": 621.24, "text": " We'll call that this A thing right here."}, {"start": 621.24, "end": 626.2800000000001, "text": " And in each step, you also get a reward for the last action that you took."}, {"start": 626.2800000000001, "end": 629.6800000000001, "text": " And the reward is going to be lower case R."}, {"start": 629.68, "end": 638.56, "text": " Now what you want to do formally is you want to maximize the reward that you get in time"}, {"start": 638.56, "end": 640.3599999999999, "text": " T."}, {"start": 640.3599999999999, "end": 646.68, "text": " Sorry, you want to, that's the reward you get at time T prime."}, {"start": 646.68, "end": 652.04, "text": " What you want to do if you play an episode, you're here and you perform an action, you"}, {"start": 652.04, "end": 656.16, "text": " go here, you perform an action, you go here, you perform an action, you go here and then"}, {"start": 656.16, "end": 658.0, "text": " your episode is done."}, {"start": 658.0, "end": 662.68, "text": " For each action, you'll get a reward, reward one, reward two, reward three."}, {"start": 662.68, "end": 668.32, "text": " What you want to do is you want to maximize the total, the sum of all of these rewards."}, {"start": 668.32, "end": 673.32, "text": " So over the course of your episode, you want to collect as much reward as you can."}, {"start": 673.32, "end": 678.6, "text": " There is a discount factor right here, which is sort of saying that rewards that are very"}, {"start": 678.6, "end": 682.24, "text": " far in the future, they're not as important as rewards right now."}, {"start": 682.24, "end": 685.48, "text": " However, you can set this to one if you want."}, {"start": 685.48, "end": 692.2, "text": " So you see you want to maximize the future, the sum of future rewards, which is this thing"}, {"start": 692.2, "end": 693.2, "text": " right here."}, {"start": 693.2, "end": 694.2, "text": " Okay."}, {"start": 694.2, "end": 696.64, "text": " So how do you, how do you do this?"}, {"start": 696.64, "end": 701.32, "text": " There are two main methods in reinforcement learning."}, {"start": 701.32, "end": 708.28, "text": " The first one is called a policy gradient method and very briefly, a policy will call"}, {"start": 708.28, "end": 715.24, "text": " it pi takes in a state S and it gives you back an action."}, {"start": 715.24, "end": 716.24, "text": " Okay."}, {"start": 716.24, "end": 721.76, "text": " And I mean, this is the same for, for Q learning, but in a policy gradient method, which is"}, {"start": 721.76, "end": 726.5600000000001, "text": " not this paper, but it's like a little bit easier to understand, I believe, will simply"}, {"start": 726.5600000000001, "end": 731.0, "text": " say, well, we'll simply train an neural network to do that, right?"}, {"start": 731.0, "end": 737.64, "text": " And there is this, there's this policy gradient trick where you can back propagate even though"}, {"start": 737.64, "end": 741.0, "text": " the reward isn't back propagatable and so on."}, {"start": 741.0, "end": 745.48, "text": " You simply say we'll learn a neural network to give us the action that's best, right?"}, {"start": 745.48, "end": 750.8, "text": " So we'll have a neural network, the state goes in neural network and then we'll just have"}, {"start": 750.8, "end": 757.04, "text": " as many outputs as there are actions like action one, action two, action three, action"}, {"start": 757.04, "end": 760.64, "text": " four, and we'll treat it as a classification problem, right?"}, {"start": 760.64, "end": 767.64, "text": " So you simply train the network to pick the action that is best in this case and you are"}, {"start": 767.64, "end": 771.24, "text": " here regardless of how you know which action is best right now."}, {"start": 771.24, "end": 778.48, "text": " In Q learning, you do something else, namely you train this thing called the Q function."}, {"start": 778.48, "end": 787.4, "text": " The Q function is a function that takes in a state and an action and it gives you what"}, {"start": 787.4, "end": 794.52, "text": " the reward is going to be in the future if you are in this state and perform this action."}, {"start": 794.52, "end": 795.52, "text": " Okay."}, {"start": 795.52, "end": 800.48, "text": " You are in a given state, right? And you have three actions at your proposal."}, {"start": 800.48, "end": 801.48, "text": " Okay."}, {"start": 801.48, "end": 808.6, "text": " You have action one, action two, and action three and you are in state S. You what you"}, {"start": 808.6, "end": 811.36, "text": " would do is you would call the Q function."}, {"start": 811.36, "end": 815.1999999999999, "text": " If you had a perfect Q function, it could give you the reward."}, {"start": 815.1999999999999, "end": 817.72, "text": " You would call the Q function three times."}, {"start": 817.72, "end": 824.3199999999999, "text": " You would call the Q function first with a one and say what's Q of S and a one and the"}, {"start": 824.32, "end": 827.0, "text": " Q function would maybe say that's seven."}, {"start": 827.0, "end": 833.08, "text": " And here you say what's the Q function of S and a two and it would maybe say that's four"}, {"start": 833.08, "end": 837.84, "text": " and here the same thing for a three and it maybe say that's one."}, {"start": 837.84, "end": 844.8000000000001, "text": " Then you would know, aha, if I take action one, my reward from not only the reward for"}, {"start": 844.8000000000001, "end": 852.5200000000001, "text": " this step, but my reward from here on until the end of the episode is going to be seven."}, {"start": 852.52, "end": 855.16, "text": " That is if you had a perfect Q function."}, {"start": 855.16, "end": 859.6, "text": " Now the Q function is always of course conditioned on a policy right here."}, {"start": 859.6, "end": 867.24, "text": " So there is what it basically says if I take action a one right now and after that I follow"}, {"start": 867.24, "end": 871.84, "text": " policy pi, then I'm going to get the reward of seven."}, {"start": 871.84, "end": 878.84, "text": " It's a bit of a multi layered reasoning approach, but ultimately you don't have to worry"}, {"start": 878.84, "end": 885.32, "text": " much about this being conditioned on a policy."}, {"start": 885.32, "end": 890.5600000000001, "text": " Ultimately the Q function says if you take this action right now, what will the reward be"}, {"start": 890.5600000000001, "end": 893.84, "text": " for the entire rest of the episode?"}, {"start": 893.84, "end": 898.88, "text": " So if you had a perfect Q function, you could simply ask it about all the actions as we"}, {"start": 898.88, "end": 903.08, "text": " did here and then pick the action with the highest number."}, {"start": 903.08, "end": 912.0, "text": " And then you guarantee it because there could be a situation where you reward in a single"}, {"start": 912.0, "end": 917.32, "text": " step is going to be very high here, like a hundred and here zero zero."}, {"start": 917.32, "end": 922.24, "text": " And you would be tempted to take that action right here, but after that it's just going"}, {"start": 922.24, "end": 925.12, "text": " to be zero zero zero."}, {"start": 925.12, "end": 928.36, "text": " So your total reward is going to be 100."}, {"start": 928.36, "end": 933.76, "text": " And here even though it's zero now, it could be that after that it's 50 and then 40 and"}, {"start": 933.76, "end": 937.2, "text": " then 2000 and so on."}, {"start": 937.2, "end": 940.24, "text": " So your total reward is going to be much, much more."}, {"start": 940.24, "end": 945.4, "text": " If you were simply to train a function that tell you what's the reward in the next step,"}, {"start": 945.4, "end": 950.52, "text": " then you would lose because that function would not be able to look ahead sufficiently."}, {"start": 950.52, "end": 954.8000000000001, "text": " What we're trying to do with the Q function is we're trying to predict to train a function"}, {"start": 954.8, "end": 958.9599999999999, "text": " that will tell us not only what's the reward in the next step, but what is the reward"}, {"start": 958.9599999999999, "end": 962.64, "text": " in all the steps to come from here, right?"}, {"start": 962.64, "end": 967.64, "text": " Of course, conditioned on all the decisions we make in the future, but that's this policy"}, {"start": 967.64, "end": 969.5999999999999, "text": " pi right here."}, {"start": 969.5999999999999, "end": 972.68, "text": " I hope it's somewhat clear what a Q function is."}, {"start": 972.68, "end": 976.3599999999999, "text": " Interestingly, we can take the same network architecture for this."}, {"start": 976.3599999999999, "end": 981.3599999999999, "text": " So what you would do naively is you would build a neural network where you say, okay,"}, {"start": 981.36, "end": 986.16, "text": " a Q function takes a state and an action, so I'll put those into a neural network and"}, {"start": 986.16, "end": 993.76, "text": " then outcomes this estimation of the reward, which we usually call Q. So the value Q is"}, {"start": 993.76, "end": 999.16, "text": " this estimation of the future reward if you take this action in this state."}, {"start": 999.16, "end": 1004.5600000000001, "text": " Now the disadvantage here is that we have to call this neural network once for each"}, {"start": 1004.5600000000001, "end": 1006.32, "text": " action in every state that we're in."}, {"start": 1006.32, "end": 1010.0, "text": " So that's like, if there's 10 actions, that's like 10 forward passes."}, {"start": 1010.0, "end": 1015.48, "text": " What we could do is we could simply take the same neural network we had for our initial"}, {"start": 1015.48, "end": 1022.0, "text": " or very initial policy method and we use that and we simply input state and we'll train"}, {"start": 1022.0, "end": 1031.36, "text": " it to output the Q for action one and the Q, sorry for the state S and action one, the"}, {"start": 1031.36, "end": 1035.68, "text": " Q for the state S and action two and so on."}, {"start": 1035.68, "end": 1043.24, "text": " So there is going to be this kind of shared encoder and then that's, it's basically going"}, {"start": 1043.24, "end": 1048.96, "text": " to encode the state into a latent space and then classify for each of the actions how"}, {"start": 1048.96, "end": 1053.0, "text": " valuable this particular action would be in that state."}, {"start": 1053.0, "end": 1058.48, "text": " So this here is called a deep Q network."}, {"start": 1058.48, "end": 1065.3600000000001, "text": " Okay, it's a network that takes in a state and gives you back the Q value."}, {"start": 1065.36, "end": 1072.36, "text": " Now the problem right here is we, you know, here we said if we had a perfect Q function,"}, {"start": 1072.36, "end": 1076.8, "text": " a Q function that was always right, then the problem would be solved because we could"}, {"start": 1076.8, "end": 1078.8799999999999, "text": " just ask the Q function what to do."}, {"start": 1078.8799999999999, "end": 1081.9599999999998, "text": " Of course we don't have a perfect Q function, we need to train it."}, {"start": 1081.9599999999998, "end": 1087.4799999999998, "text": " So how do we train a Q function and the answer is surprisingly simple."}, {"start": 1087.4799999999998, "end": 1095.32, "text": " So what you want to do is you are in this state and you want to estimate, right?"}, {"start": 1095.32, "end": 1098.6, "text": " What your Q value is, you want to train your Q network."}, {"start": 1098.6, "end": 1104.1599999999999, "text": " What you can do is you can simply play an episode according to the Q function you have and"}, {"start": 1104.1599999999999, "end": 1107.12, "text": " you may be play this episode right here, right?"}, {"start": 1107.12, "end": 1110.72, "text": " It's like you go here and you collect all of this reward."}, {"start": 1110.72, "end": 1118.36, "text": " So this entire thing now goes into your data set and then you have a sample."}, {"start": 1118.36, "end": 1128.8, "text": " You know, I was here in this state as I took action one and I got in total 2,090 as a reward."}, {"start": 1128.8, "end": 1130.9199999999998, "text": " So that is going to be your labeled sample, right?"}, {"start": 1130.9199999999998, "end": 1140.1999999999998, "text": " Your labeled sample is going to be S. I was in S. I did A1 and now I then got 2,090 reward."}, {"start": 1140.1999999999998, "end": 1141.1999999999998, "text": " Cool."}, {"start": 1141.1999999999998, "end": 1146.7199999999998, "text": " And in the next episode, you're going on playing and you maybe go down here and then"}, {"start": 1146.72, "end": 1148.56, "text": " you get a next training example."}, {"start": 1148.56, "end": 1154.44, "text": " I was in state S. I, so you keep restarting the episode so you can get into the same state"}, {"start": 1154.44, "end": 1155.64, "text": " multiple times."}, {"start": 1155.64, "end": 1160.84, "text": " I performed a three and I got only 100 reward."}, {"start": 1160.84, "end": 1162.56, "text": " So that's another training sample."}, {"start": 1162.56, "end": 1166.28, "text": " So these training samples right here, you can use to train your Q function."}, {"start": 1166.28, "end": 1168.88, "text": " This is called online reinforcement learning."}, {"start": 1168.88, "end": 1174.84, "text": " You play the game at the same time as you train your neural network and you use that"}, {"start": 1174.84, "end": 1178.56, "text": " improved neural network to play more games."}, {"start": 1178.56, "end": 1186.52, "text": " And with time, there is this well known, there is a theorem around Q learning that say"}, {"start": 1186.52, "end": 1192.56, "text": " if you do that iteratively, then your Q function will converge to the optimal Q functions"}, {"start": 1192.56, "end": 1196.24, "text": " under some assumptions, which of course not given if this is a deep neural network,"}, {"start": 1196.24, "end": 1198.3999999999999, "text": " but who cares?"}, {"start": 1198.3999999999999, "end": 1199.3999999999999, "text": " Yeah."}, {"start": 1199.4, "end": 1206.92, "text": " So formally, your Q function, as you can see right here, is going to be, there is this"}, {"start": 1206.92, "end": 1212.6000000000001, "text": " Bellman recurrence kind of recurrence property of the Q function."}, {"start": 1212.6000000000001, "end": 1226.16, "text": " So if I am in a state S and I'm wondering, what is my Q of my state S and an action A?"}, {"start": 1226.16, "end": 1230.88, "text": " And I said with respect to a policy, which the star policy is going to be the policy where"}, {"start": 1230.88, "end": 1233.24, "text": " we always select the highest Q function."}, {"start": 1233.24, "end": 1240.1200000000001, "text": " So we'll basically say we're in state S, we select action A and after that, we'll just"}, {"start": 1240.1200000000001, "end": 1243.3200000000002, "text": " always select whatever the highest scoring action is."}, {"start": 1243.3200000000002, "end": 1248.0, "text": " Right, like right now action A might not be the highest scoring, but we'll take A right"}, {"start": 1248.0, "end": 1250.44, "text": " now and after that, the highest scoring."}, {"start": 1250.44, "end": 1251.64, "text": " That's Q star."}, {"start": 1251.64, "end": 1256.1200000000001, "text": " It's a Q function condition on the policy where after we perform the first."}, {"start": 1256.12, "end": 1261.28, "text": " The first action, which is A, will take always the best one according to the Q function."}, {"start": 1261.28, "end": 1263.08, "text": " Right, that's right here."}, {"start": 1263.08, "end": 1269.76, "text": " So we're in state S, we perform A and S prime is going to be the state that we are going"}, {"start": 1269.76, "end": 1270.76, "text": " to."}, {"start": 1270.76, "end": 1273.76, "text": " So we're in S, we perform A, we get to S prime."}, {"start": 1273.76, "end": 1278.1999999999998, "text": " So in S prime, which is a function of your environment, we're always going to take the"}, {"start": 1278.1999999999998, "end": 1282.6, "text": " maximum action and R is going to be the reward of the next step."}, {"start": 1282.6, "end": 1287.6799999999998, "text": " So you can see this recurrence equation right here, that Q star can be framed in terms"}, {"start": 1287.6799999999998, "end": 1289.48, "text": " of Q star."}, {"start": 1289.48, "end": 1294.8799999999999, "text": " So the Q star of this state is going to depend on the Q star of the next state."}, {"start": 1294.8799999999999, "end": 1299.84, "text": " And you can use that fact and you can, you know, prove that pretty with already done it"}, {"start": 1299.84, "end": 1300.84, "text": " basically."}, {"start": 1300.84, "end": 1306.8, "text": " You can use that fact to now train your neural network."}, {"start": 1306.8, "end": 1311.12, "text": " So your neural network loss function is going to be the following."}, {"start": 1311.12, "end": 1321.04, "text": " It's going to say, look, this here is the Q function for state S and action A."}, {"start": 1321.04, "end": 1325.32, "text": " That's my, and this is my neural network telling me how much that's worth."}, {"start": 1325.32, "end": 1327.52, "text": " And this is the label, right?"}, {"start": 1327.52, "end": 1331.52, "text": " So here you have to think in terms of back classic supervigilous surprise learning."}, {"start": 1331.52, "end": 1335.12, "text": " This here is going to be your F of X."}, {"start": 1335.12, "end": 1337.6, "text": " And this here is going to be your Y."}, {"start": 1337.6, "end": 1344.04, "text": " And we'll take the square loss between the two, except your input X is going to be which"}, {"start": 1344.04, "end": 1347.1599999999999, "text": " state, demion and which action am I taking."}, {"start": 1347.1599999999999, "end": 1353.0, "text": " And your label is going to be bootstrapped by your own Q function."}, {"start": 1353.0, "end": 1357.4399999999998, "text": " So your label is going to be the reward you got."}, {"start": 1357.4399999999998, "end": 1359.9599999999998, "text": " Remember this comes from a replay buffer."}, {"start": 1359.9599999999998, "end": 1366.04, "text": " We already played that game and we already know what happened after we performed this"}, {"start": 1366.04, "end": 1368.2, "text": " action, right?"}, {"start": 1368.2, "end": 1372.72, "text": " And what happened is we got this reward and we got into this state."}, {"start": 1372.72, "end": 1377.52, "text": " So we can simply ask our own Q function again."}, {"start": 1377.52, "end": 1382.08, "text": " What's the best action to take in this state and what reward would we get?"}, {"start": 1382.08, "end": 1384.48, "text": " And then we have our label, right?"}, {"start": 1384.48, "end": 1392.2, "text": " So our label Y is going to be, yeah, I was, I was, I was pretty confused when I learned"}, {"start": 1392.2, "end": 1393.2, "text": " this the first time."}, {"start": 1393.2, "end": 1397.32, "text": " I'm going to assume some of your confused as well."}, {"start": 1397.32, "end": 1405.32, "text": " So your Q function is supposed to tell you what's going to be the reward from here until"}, {"start": 1405.32, "end": 1408.96, "text": " the end of the episode, okay?"}, {"start": 1408.96, "end": 1415.16, "text": " That you can decompose in the reward that you get from this very next action plus the"}, {"start": 1415.16, "end": 1421.24, "text": " sum from then, so T plus one, until the end of the episode, okay?"}, {"start": 1421.24, "end": 1422.24, "text": " So T prime."}, {"start": 1422.24, "end": 1425.96, "text": " So that's T prime equals T plus one, all right?"}, {"start": 1425.96, "end": 1427.2, "text": " So pretty simple."}, {"start": 1427.2, "end": 1432.56, "text": " The total reward from now until the end, you can decompose in the reward now plus the"}, {"start": 1432.56, "end": 1435.6, "text": " reward after that until the end."}, {"start": 1435.6, "end": 1439.8, "text": " Now this here, we know we've played the episode."}, {"start": 1439.8, "end": 1441.32, "text": " We know what happened."}, {"start": 1441.32, "end": 1447.6, "text": " This here, we can simply ask our Q function again because we also know what state we got"}, {"start": 1447.6, "end": 1448.6, "text": " into."}, {"start": 1448.6, "end": 1453.76, "text": " And this, as you can see, is very much this, but just one step later."}, {"start": 1453.76, "end": 1458.8, "text": " So we can simply ask our own Q function, which might be imperfect, right?"}, {"start": 1458.8, "end": 1461.6, "text": " But it's certainly a good guess."}, {"start": 1461.6, "end": 1464.6399999999999, "text": " We say, okay."}, {"start": 1464.6399999999999, "end": 1470.9199999999998, "text": " This reward from now should be equal to the reward we got plus whatever we reward we get"}, {"start": 1470.9199999999998, "end": 1473.1999999999998, "text": " later."}, {"start": 1473.1999999999998, "end": 1478.56, "text": " And yes, you might be astounded by the fact that we are using our own neural network"}, {"start": 1478.56, "end": 1484.6799999999998, "text": " network, though, be with the parameters one time step ago in order to produce our label."}, {"start": 1484.6799999999998, "end": 1488.6, "text": " But that is exactly what these Q learning theorems are about."}, {"start": 1488.6, "end": 1494.6399999999999, "text": " They basically say under some assumptions, if you do this and you iterate, then this will"}, {"start": 1494.6399999999999, "end": 1498.76, "text": " converge to the optimal Q function."}, {"start": 1498.76, "end": 1504.08, "text": " So as you can see right here, this is the, this is the gradient of the loss."}, {"start": 1504.08, "end": 1508.08, "text": " It's astounding that back then they still wrote down the gradient of the loss, like almost"}, {"start": 1508.08, "end": 1509.8, "text": " no one does this now."}, {"start": 1509.8, "end": 1514.3999999999999, "text": " You just say, put this into tensor flow and go."}, {"start": 1514.3999999999999, "end": 1515.3999999999999, "text": " Yeah."}, {"start": 1515.3999999999999, "end": 1521.8, "text": " So they make some remarks here, namely that this algorithm is model free, right?"}, {"start": 1521.8, "end": 1523.1599999999999, "text": " There's no model of the environment."}, {"start": 1523.1599999999999, "end": 1529.8, "text": " You simply learn a function that for each state tells you the Q value for each action."}, {"start": 1529.8, "end": 1531.8, "text": " That's, that's all."}, {"start": 1531.8, "end": 1537.6799999999998, "text": " Everything, everything that, all the logic needs to be within the neural network itself."}, {"start": 1537.68, "end": 1540.0, "text": " So that's pretty cool."}, {"start": 1540.0, "end": 1542.92, "text": " And they say it's also off policy."}, {"start": 1542.92, "end": 1548.24, "text": " It learns about the greedy strategy while following a behavior distribution that ensures adequate"}, {"start": 1548.24, "end": 1550.0, "text": " exploration of the state space."}, {"start": 1550.0, "end": 1557.0, "text": " So while while training, they do this epsilon greedy strategy that follows the greedy strategy,"}, {"start": 1557.0, "end": 1561.72, "text": " which is where you always take the maximum with one minus epsilon selects a random action"}, {"start": 1561.72, "end": 1563.88, "text": " with probability epsilon."}, {"start": 1563.88, "end": 1569.7600000000002, "text": " So while you do your experience, you follow your Q function, you always ask the Q function,"}, {"start": 1569.7600000000002, "end": 1572.2, "text": " what's the best thing to do right here?"}, {"start": 1572.2, "end": 1577.0800000000002, "text": " But you know, that's, that gets you into too much of exploitation."}, {"start": 1577.0800000000002, "end": 1582.4, "text": " So in epsilon amount of time, you want to do a bit of exploration and just take a random"}, {"start": 1582.4, "end": 1583.4, "text": " action."}, {"start": 1583.4, "end": 1584.8000000000002, "text": " All right."}, {"start": 1584.8000000000002, "end": 1588.4, "text": " So that's basically the algorithm."}, {"start": 1588.4, "end": 1591.88, "text": " So the algorithm is right here and they have some tricks to get it to work."}, {"start": 1591.88, "end": 1597.88, "text": " And the biggest trick they got it to work is the so called replay buffer."}, {"start": 1597.88, "end": 1604.0400000000002, "text": " This experience replay because what happens if you play a game of Atari, right, of Pong"}, {"start": 1604.0400000000002, "end": 1609.0800000000002, "text": " specifically, then you know, you have this and you're here and your opponent is here"}, {"start": 1609.0800000000002, "end": 1610.44, "text": " and the ball is here."}, {"start": 1610.44, "end": 1617.72, "text": " And in the next frame, you are here again, your opponent might be a bit up and the ball"}, {"start": 1617.72, "end": 1618.72, "text": " is here."}, {"start": 1618.72, "end": 1619.72, "text": " Okay."}, {"start": 1619.72, "end": 1620.72, "text": " And so on."}, {"start": 1620.72, "end": 1625.24, "text": " So these samples here, they are all very, very correlated, right?"}, {"start": 1625.24, "end": 1629.0, "text": " The ones after another, especially if you now build mini batch, let's say, or mini batch"}, {"start": 1629.0, "end": 1632.76, "text": " sizes, too, this mini batch has almost no variability in it."}, {"start": 1632.76, "end": 1638.88, "text": " So if you had something like batch norm or whatnot, this, this will be like terrible because"}, {"start": 1638.88, "end": 1640.8, "text": " these data samples are correlated."}, {"start": 1640.8, "end": 1645.24, "text": " And we in supervised learning, we make a bit pretty big deal out of, you know, shuffling"}, {"start": 1645.24, "end": 1649.64, "text": " our data set and all of the data points being IID and so on."}, {"start": 1649.64, "end": 1656.2800000000002, "text": " So what they say is rather than using the data samples as we collect them, we put them"}, {"start": 1656.2800000000002, "end": 1660.0800000000002, "text": " into a big, big buffer, a big replay buffer."}, {"start": 1660.0800000000002, "end": 1664.3200000000002, "text": " And from that replay buffer, we basically sample at random."}, {"start": 1664.3200000000002, "end": 1665.3200000000002, "text": " Okay."}, {"start": 1665.3200000000002, "end": 1671.2, "text": " So that means that, you know, some samples can be used multiple times."}, {"start": 1671.2, "end": 1676.0, "text": " Other samples can be never sampled because there is a fixed size and the new ones will"}, {"start": 1676.0, "end": 1677.64, "text": " always kick out the oldest ones."}, {"start": 1677.64, "end": 1681.4, "text": " So some samples might not be used, some samples might be used twice or three times."}, {"start": 1681.4, "end": 1687.0400000000002, "text": " We can also learn, you know, four times as fast as we sample and then never re sample"}, {"start": 1687.0400000000002, "end": 1688.72, "text": " on average will be used four times."}, {"start": 1688.72, "end": 1695.8400000000001, "text": " So this experience replay proved very, very important for this algorithm to work."}, {"start": 1695.8400000000001, "end": 1699.44, "text": " That's why they say deep Q learning with experience replay."}, {"start": 1699.44, "end": 1704.0400000000002, "text": " So they have this replay memory, D right here, to capacity N."}, {"start": 1704.04, "end": 1711.0, "text": " And you initialize your Q function with random weights as you do with a neural network."}, {"start": 1711.0, "end": 1719.3999999999999, "text": " And then you play these episodes for each episode, you start out with S1, the state one,"}, {"start": 1719.3999999999999, "end": 1721.2, "text": " and you do pre-processing."}, {"start": 1721.2, "end": 1728.04, "text": " So in pre-process, they have some more tricks where they downscale the image, they concatenate"}, {"start": 1728.04, "end": 1733.36, "text": " four images in a row because sometimes in Atari get these flicker things."}, {"start": 1733.36, "end": 1738.3999999999999, "text": " And also if you concatenate four things in a row, you, for example, can tell it in which"}, {"start": 1738.3999999999999, "end": 1740.7199999999998, "text": " direction the ball is moving and so on."}, {"start": 1740.7199999999998, "end": 1743.12, "text": " So give a little bit of history."}, {"start": 1743.12, "end": 1746.28, "text": " So one sample technically would be four frames."}, {"start": 1746.28, "end": 1748.1599999999999, "text": " They also do sticky actions and so on."}, {"start": 1748.1599999999999, "end": 1753.6399999999999, "text": " All of these things that you can find today in these emulators that are almost default"}, {"start": 1753.6399999999999, "end": 1758.6399999999999, "text": " now like sticky actions, they invented right here."}, {"start": 1758.64, "end": 1764.0, "text": " So for the time steps within the episode, we want to, we've probably the epsilon select"}, {"start": 1764.0, "end": 1765.16, "text": " a random action."}, {"start": 1765.16, "end": 1769.6000000000001, "text": " Otherwise, just ask your Q function, what should I do right here?"}, {"start": 1769.6000000000001, "end": 1773.48, "text": " Give me the best action in this particular state."}, {"start": 1773.48, "end": 1778.6000000000001, "text": " Then you would execute that action and observe a reward and the next state."}, {"start": 1778.6000000000001, "end": 1782.92, "text": " So the next image right here."}, {"start": 1782.92, "end": 1787.1200000000001, "text": " You would set the next state to this transition."}, {"start": 1787.12, "end": 1791.36, "text": " Okay, so in the state there can be more, as I said, there can be more than the image"}, {"start": 1791.36, "end": 1794.2399999999998, "text": " like the previous state and the action you took."}, {"start": 1794.2399999999998, "end": 1801.1599999999999, "text": " But right here, I believe it's like purely the current last four frames."}, {"start": 1801.1599999999999, "end": 1807.08, "text": " And then you store that transition in the replay buffer."}, {"start": 1807.08, "end": 1811.08, "text": " After that, you sample a random mini batch of transitions from the replay buffer."}, {"start": 1811.08, "end": 1816.9599999999998, "text": " So here you can see this here is where we decoreulate the inputs because if we simply"}, {"start": 1816.96, "end": 1823.04, "text": " were to use our last transition for learning, then we would run into a problem."}, {"start": 1823.04, "end": 1828.6000000000001, "text": " But right here, we sample from that replay buffer."}, {"start": 1828.6000000000001, "end": 1831.3600000000001, "text": " So this is going to be your input."}, {"start": 1831.3600000000001, "end": 1836.76, "text": " This is going to be your X for your supervised learning of the deep neural network."}, {"start": 1836.76, "end": 1841.72, "text": " What's going to be your, sorry, without the reward, of course, what's going to be your"}, {"start": 1841.72, "end": 1843.76, "text": " Y, your Y."}, {"start": 1843.76, "end": 1847.72, "text": " If you're at the end of the episode, it's simply the reward that you got because there's"}, {"start": 1847.72, "end": 1849.08, "text": " no more reward coming."}, {"start": 1849.08, "end": 1854.56, "text": " However, if you're not at the end, it's the reward that you got from this last step."}, {"start": 1854.56, "end": 1859.16, "text": " Plus all of the reward that you're going to get in the future."}, {"start": 1859.16, "end": 1864.8, "text": " Now you aren't in the future yet, but you can ask yourself, you can ask your Q function."}, {"start": 1864.8, "end": 1868.04, "text": " What that reward is most likely going to be."}, {"start": 1868.04, "end": 1872.6, "text": " If your Q function gets better, then this estimate gets better, then your labels get better,"}, {"start": 1872.6, "end": 1876.76, "text": " then your Q function gets better, and so on in a big circle."}, {"start": 1876.76, "end": 1884.1599999999999, "text": " And then you perform a gradient descent step on this L2 loss between the label and your"}, {"start": 1884.1599999999999, "end": 1885.6799999999998, "text": " prediction."}, {"start": 1885.6799999999998, "end": 1892.9599999999998, "text": " Note that if you are in a deep learning framework, there is like a stop gradient on this label"}, {"start": 1892.9599999999998, "end": 1893.9599999999998, "text": " right here."}, {"start": 1893.9599999999998, "end": 1898.6, "text": " So the back propagation only happens with respect to this right here, which makes sense,"}, {"start": 1898.6, "end": 1906.84, "text": " so this is your X, this is your input, and F of X is usually what we back propagate into."}, {"start": 1906.84, "end": 1912.76, "text": " Okay, there's no notion yet of like a second Q network and so on, which proved very valuable"}, {"start": 1912.76, "end": 1914.4399999999998, "text": " in the future of this paper."}, {"start": 1914.4399999999998, "end": 1920.6399999999999, "text": " This paper simply applied kind of the most basic version of this, and they simply got"}, {"start": 1920.6399999999999, "end": 1921.9199999999998, "text": " it to work."}, {"start": 1921.9199999999998, "end": 1927.6399999999999, "text": " They just got deep neural networks to work with reinforcement learning, and yeah, there's"}, {"start": 1927.64, "end": 1937.2800000000002, "text": " a big chance that this was due to this experience replay, which I believe they did not invent."}, {"start": 1937.2800000000002, "end": 1945.8400000000001, "text": " I mean, this has of course been around before, but they were the ones to realize and combine"}, {"start": 1945.8400000000001, "end": 1947.3200000000002, "text": " and do that."}, {"start": 1947.3200000000002, "end": 1948.68, "text": " It's also pretty interesting."}, {"start": 1948.68, "end": 1956.4, "text": " The neural network that they actually used was like super duper small."}, {"start": 1956.4, "end": 1961.8000000000002, "text": " The input to the neural network consists of 84 by 84 by 4 image produced by this."}, {"start": 1961.8000000000002, "end": 1963.92, "text": " So this is the pre-processing."}, {"start": 1963.92, "end": 1970.16, "text": " The first hidden layer convolves 16, 8 by 8 filters with stride 4 with the input image"}, {"start": 1970.16, "end": 1973.76, "text": " and applies the rectifier non-linearity."}, {"start": 1973.76, "end": 1974.96, "text": " So the relu."}, {"start": 1974.96, "end": 1979.42, "text": " The second hidden layer convolves 32, 4 by 4 filters with stride 2 again, followed by"}, {"start": 1979.42, "end": 1981.96, "text": " rectifier non-linearity."}, {"start": 1981.96, "end": 1987.16, "text": " The final layer hidden layer is fully connected and consists of 256 rectifier units."}, {"start": 1987.16, "end": 1993.0, "text": " The output layer is a fully connected linear layer with single output for each valid action."}, {"start": 1993.0, "end": 1997.76, "text": " Number of valid actions is very between 4 and 18 on the games we considered."}, {"start": 1997.76, "end": 2001.76, "text": " Okay, as you can see, the neural network is pretty small."}, {"start": 2001.76, "end": 2007.92, "text": " It's two conv layers, and as was in fashion back then, you had like big filters."}, {"start": 2007.92, "end": 2012.24, "text": " So you know big filters from like AlexNet."}, {"start": 2012.24, "end": 2014.76, "text": " Big filters, but fewer than today."}, {"start": 2014.76, "end": 2020.72, "text": " So today the trend is more like deeper layers, more filters, but they are not as big."}, {"start": 2020.72, "end": 2023.48, "text": " They're like three by three filters today only."}, {"start": 2023.48, "end": 2027.8400000000001, "text": " Yeah, pretty interesting how they did it back then."}, {"start": 2027.8400000000001, "end": 2031.0800000000002, "text": " Interesting also, no max pooling and so on."}, {"start": 2031.0800000000002, "end": 2033.64, "text": " Pretty cool."}, {"start": 2033.64, "end": 2035.6000000000001, "text": " And here they go into experiments."}, {"start": 2035.6, "end": 2042.24, "text": " So they show that their average reward in these games is kind of noisy, but it improves"}, {"start": 2042.24, "end": 2048.56, "text": " over time, especially also if you look at the average queue of the max action, it continuously"}, {"start": 2048.56, "end": 2050.7999999999997, "text": " goes up during training."}, {"start": 2050.7999999999997, "end": 2057.3199999999997, "text": " So this is really a successful training, especially this investigative experiment they did"}, {"start": 2057.3199999999997, "end": 2062.52, "text": " right here where you can see one example of how the queue function, what the queue function"}, {"start": 2062.52, "end": 2063.52, "text": " says."}, {"start": 2063.52, "end": 2070.96, "text": " Remember the queue function gives us the whatever the future reward is going to be."}, {"start": 2070.96, "end": 2074.04, "text": " Okay, and here we always look at the max action."}, {"start": 2074.04, "end": 2080.24, "text": " So in this first frame, you can see this enemy had just appeared."}, {"start": 2080.24, "end": 2084.88, "text": " And you can see that from here to here, there's a spike in the queue value because you can"}, {"start": 2084.88, "end": 2089.96, "text": " shoot enemies and that gives you reward."}, {"start": 2089.96, "end": 2094.32, "text": " This is already so the enemy isn't shot yet by the simple appearance of the enemy, the"}, {"start": 2094.32, "end": 2102.7200000000003, "text": " queue function also like already jumps in value because it anticipates a future reward."}, {"start": 2102.7200000000003, "end": 2110.12, "text": " Then the the agent shoots and you can see here the shot is about to land at the enemy"}, {"start": 2110.12, "end": 2111.48, "text": " and that's when we're here."}, {"start": 2111.48, "end": 2116.32, "text": " So this now the queue function is very sure that in the future, there's going to be a high"}, {"start": 2116.32, "end": 2117.7200000000003, "text": " reward."}, {"start": 2117.72, "end": 2126.48, "text": " So then once the once the enemy is shot, then there's no more enemy to be shot and the"}, {"start": 2126.48, "end": 2133.7999999999997, "text": " queue function drops drastically because it doesn't see a future reward as being as likely"}, {"start": 2133.7999999999997, "end": 2138.2, "text": " as at the beginning when there was this new enemy to be shot."}, {"start": 2138.2, "end": 2143.9199999999996, "text": " So that's pretty interesting and you can see pretty directly that there is a correlation"}, {"start": 2143.92, "end": 2150.84, "text": " between what's happening in the game and this learned queue function."}, {"start": 2150.84, "end": 2156.6800000000003, "text": " If you compare this to other methods and they really say that these other methods, most"}, {"start": 2156.6800000000003, "end": 2162.32, "text": " of them have some kind of very special feature engineered."}, {"start": 2162.32, "end": 2166.48, "text": " So their method just takes R&GB but the other methods recognize that oh, in these Atari"}, {"start": 2166.48, "end": 2170.6, "text": " games, most of the time, you know, there are unique colors for the things."}, {"start": 2170.6, "end": 2176.12, "text": " So you know, the enemies are all like green and they make unique channels for those green"}, {"start": 2176.12, "end": 2182.16, "text": " enemies or they even have handcrafted object detectors and tell the algorithm where these"}, {"start": 2182.16, "end": 2183.48, "text": " objects are."}, {"start": 2183.48, "end": 2187.92, "text": " So the comparison really isn't fair yet."}, {"start": 2187.92, "end": 2195.2, "text": " The DQN outperform these others like almost everywhere and they also evaluated against"}, {"start": 2195.2, "end": 2198.0, "text": " a human."}, {"start": 2198.0, "end": 2202.12, "text": " And I don't actually know they just say an expert human."}, {"start": 2202.12, "end": 2203.64, "text": " I have no idea."}, {"start": 2203.64, "end": 2208.76, "text": " Maybe just put David Silver in front of computers like, okay, David, here you go."}, {"start": 2208.76, "end": 2213.32, "text": " And you can, you can, like what happened in Pong?"}, {"start": 2213.32, "end": 2217.24, "text": " Like, come on, David."}, {"start": 2217.24, "end": 2222.96, "text": " But you can see there were still problems where the humans were vastly superior and they"}, {"start": 2222.96, "end": 2226.96, "text": " mainly attribute this to the difficulty of the problem."}, {"start": 2226.96, "end": 2232.92, "text": " And it could also be because, for example, in breakout, there's this kind of the most"}, {"start": 2232.92, "end": 2241.04, "text": " famous example where the agent kind of figured out this strategy of shooting the ball, shooting"}, {"start": 2241.04, "end": 2246.64, "text": " like a hole into this wall that you have to break and then shooting the ball up here."}, {"start": 2246.64, "end": 2251.64, "text": " So the ball bounces up and down and basically you win from then on, you just watch the ball"}, {"start": 2251.64, "end": 2254.4, "text": " go and the agent does nothing anymore."}, {"start": 2254.4, "end": 2259.64, "text": " So this deep QNet works figured out that strategy and you need to pull it off very precisely,"}, {"start": 2259.64, "end": 2263.48, "text": " which of course the computer can do very well."}, {"start": 2263.48, "end": 2268.92, "text": " So it sometimes achieves these super high scores by pulling something off precisely."}, {"start": 2268.92, "end": 2275.28, "text": " But in games where they say where you have to plan ahead for longer, it kind of fails."}, {"start": 2275.28, "end": 2281.92, "text": " And we know that this long planning was about to be a problem for years to come and it's"}, {"start": 2281.92, "end": 2283.1600000000003, "text": " still not solved."}, {"start": 2283.16, "end": 2289.7999999999997, "text": " So still, a go explorer is highly controversial that can solve these kind of long exploration"}, {"start": 2289.7999999999997, "end": 2293.56, "text": " games and those are still games, right?"}, {"start": 2293.56, "end": 2300.2799999999997, "text": " So we are basically not, we are very much further than they were in this paper, but also"}, {"start": 2300.2799999999997, "end": 2304.0, "text": " we are basically nowhere yet."}, {"start": 2304.0, "end": 2308.48, "text": " Yeah, if I'm allowed to say that."}, {"start": 2308.48, "end": 2311.2, "text": " So I enjoyed reading this paper."}, {"start": 2311.2, "end": 2317.8799999999997, "text": " This is, it's very, it's very well written if you somehow know how to think about reinforcement"}, {"start": 2317.8799999999997, "end": 2324.04, "text": " learning, like this, this Q function, what the Q function means and why you would learn"}, {"start": 2324.04, "end": 2325.2, "text": " it in this way."}, {"start": 2325.2, "end": 2327.8799999999997, "text": " I find this is not super well described."}, {"start": 2327.8799999999997, "end": 2334.3599999999997, "text": " This kind of requires a bit of a knowledge of not of RL, but just of how to think of RL."}, {"start": 2334.3599999999997, "end": 2341.16, "text": " But apart from this, everything else is written incredibly well, easy, straightforward."}, {"start": 2341.16, "end": 2346.3199999999997, "text": " And yeah, this was just a nice work of its time and I appreciate it for that."}, {"start": 2346.3199999999997, "end": 2350.44, "text": " All right, I'll see you next time and I appreciate your time too."}, {"start": 2350.44, "end": 2379.44, "text": " Bye."}] |
Yannic Kilcher | 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 Krzyszewski, Ilya Satskyver and Jeffrey 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 developed 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 I 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 today, sort of what arbitrary choices that Alex Krzyszewski 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 essentially use of machine learning methods. This was also new, right object recognition wasn't always learned. The object recognizers, you could even do it in the indifferent 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. So we collect a 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 tens of thousands of images. So this is this especially at norb or here the c for 10 or c for 100, these are relatively small data sets with relatively small images as well like c for 10 is 32 by 32 pixels. 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 image net 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. Image net data set is actually much larger than we know that we when we talk of image net when we speak of image net we think of the image net that has a thousand classes and about one or one and a half million images. However, that's only a subset of the much much larger image net data set with in many, many more categories. It's just that the image net competitions were performed on this subset because I guess people thought well a thousand classes and a 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 thousands of objects from millions of images we need a model with a large learning capacity. However, the immense complexity of object recognition task means that this probably this problem cannot be specified even by data set as large as image net. So our model should also have lots of prior knowledge to compensate for all the data we don't have. So the their main argument for using neural networks is that the size of the data set is so large. Therefore we need a large model granted they already recognize the. The inherent the inherent connection between large models and a lot of complex data but in the 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 known to do anything I guess I guess they were used for handwritten digit recognition and so on and were 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 task because they have such a high capacity. However, neural networks feet forward neural networks are already too powerful they don't know anything about the data everything is 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 stationary of statistics and locality of pixel dependencies. 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 is 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 of course CNNs fit that very well. So they are going to 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 image and 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 don't overfit which is strange in itself like this double descent phenomenon and so on but overfitting was still 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 SVM 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 composing. 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 show 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 look at those and the end they say the networks 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 5 and 6 days to train on to 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 a big deal. This became these networks became better simply by increasing their depth and as you know then resonates came along increasing the depth by an order of magnitude and that gave another boost to computer vision. So they talk about the image net data set here and the main point in the image net data set right here is the fact that the images are plenty so there are over a million training images in this subset with a thousand classes which was you know a very big that was that was on like C for 10 had 10 classes if our 100 had 100 classes that was already a lot at 1000 classes. That is on like unheard of before this data set I guess not on heard 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. All right 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 is are these two different pipelines and Alex for cutting off this part right here I mean you just know like there's just has 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 admissions ruining yet another paper. All right but you can see there's this to this this to 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 to 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 invention of bigger GPUs made that sort of superfluous but just imagine the amount of code they had to write there was no tensor flow at this point there I don't think that's the right thing. I don't think there was even cafe around there was just kuda and yeah just this cross GPU memory writing I just imagine this to be so so ugly and big respect for writing all of this code. All right so they go through a number of important things and most of the things here aren't their invention let's 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 nonlinearity now of course relus nowadays all like abundant everyone uses relus nonlinearities but at that time it was still very important. 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, the 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 kind of curve where if the input rises above this border right here the action potential maybe I don't know what the English term is then if it rise above that then the neuron would start to spike. And if it's below that it wouldn't so people wanted to approximate this using some sort of a kind of differentiable but something that's very similar to this step function and that ultimately led to something like a sigmoid or a 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 nonlinearity so the hyperbolic tangent and the sigmoid are much slower than the non-sensuality. So we're then the non saturating nonlinearity this one following narendtinten we refer to neurons with this nonlinearity as rectified linear units so taken from this this other paper they say okay we use these relus these rectified linear units which are not exactly like real biological neurons but they train much faster right. And of course relus are used until this day. So you can see right here that this is on a c4 10 and they measure the time to reach 25% of the training error and this here is with the relus 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 relus. 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 he takes you a week to train one of these things you know you don't you you can't afford a six times slow down because that would mean you can only train like two models in the entire course of research and that would severely hindered 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 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 relus in you know here 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 examples 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. 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 to have where the kernels in layer four take input only from the kernel maps and layer three which reside on the same GPU. So very very interesting choice right here and they justify this here or they say the results this scheme reduces our top one top five air rates by 1.7 to 1.2% respectively as compared with a net with half as many kernels in each computational layer in each convolution 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 railroads 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 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 28 25% and here their best one is at 17% top five air 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 which is 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 but a boom I have 0.1% better 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 rate. By one percent this reduces the air 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 train on one GPU right and and then they thought you know maybe we can train an even bigger network by using two GPUs and then they realize what it's going to 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 observe that their network does better than everything that was previously to sit down and do the cross GPU thing experiment with OK when do we cross communicate and what not that is very 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 OK it's still like two months out this competition deadline I don't know but you know 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 have the improvement and did it anyway OK but multi GPU training didn't really 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 which is short 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 and 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 reddues so what they do is each response which is this alpha or this 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 though 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 predefined 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 term brightness normalization since we do not subtract the mean activity and 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 2 by 2 in the stride of 2 like we do today and you know pooled down to a smaller image what we can do instead is we can pool with overlapping windows in that case they pooled with a 3 by 3 window but they do always do stride of 2 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 4 at the beginning to reduce the size so at the beginning it's 2 24 by 2 24 and then it's 48 by sorry it's 55 by 55 that thing here 55 by 55 48 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 4 convolution here already employed in order to down sample 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 down sample image while convolving it what you also see here is that they thought that the feature map size should be 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 3 by 3 kernels from the very start and don't really care about you know also downsizing 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 very close to the architectures today right there hasn't changed that much like the difference between this and the VGG 16 VGG 19 or 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 all right 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 I think maybe they did and maybe it was actually overfitting but we now 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 they say our neural network of six and 60 million parameters although the thousand classes make each training example in post 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 a thousand classes how you know when do how many parameters per sample is that and so on how many bits of constraint we don't care about anymore 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 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 augmentation 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 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 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 and however we we we now focus much more on the fact that we crop it and that kind of have different sub images of the same images 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 attest 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 networks 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 image and training set to each training image we add multiples of the found principle components with magnitude 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 why this isn't work maybe because you need these stats over the entire day to set and the other things maybe working equivalently well but you you can simply apply them without knowing kind of your your principal components okay next thing drop out drop out 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 drop out some people still use it but most people I think don't use drop out 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 very efficient version of model combination that only costs about a factor of two during training so there's this technique called drop out then they explain it you said to zero the output of each hidden return with probability point five and people didn't know about drop out as they do know but they introduced this right here and they say it reduces their not sure they also don't say how they how much they by how much this reduces the training there but they say we use drop out in the first two fully connected layers without drop out our network exhibits substantial overfitting drop out 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 drop out 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 drop out 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 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 image net 2011 and fine tune then on the image net 2012 right here the image net 2011 and then fine tuning on the image net 2012 to reduce that error even further like pulling all the tricks all 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 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 is just not the class that the annotators assigned to this particular image as well as here the 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 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 the 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 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 already allude to the fact that depth is very important it is notable that our networks 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 resnets 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 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": 10.0, "text": " Hi there, today we'll look at ImageNet classification with deep convolutional neural networks by Alex Krzyszewski, Ilya Satskyver and Jeffrey Hinton."}, {"start": 10.0, "end": 27.0, "text": " 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 developed and so on."}, {"start": 27.0, "end": 39.0, "text": " 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."}, {"start": 39.0, "end": 49.0, "text": " 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."}, {"start": 49.0, "end": 65.0, "text": " 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."}, {"start": 65.0, "end": 77.0, "text": " So I 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."}, {"start": 77.0, "end": 80.0, "text": " This paper basically changed everything."}, {"start": 80.0, "end": 103.0, "text": " 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 today, sort of what arbitrary choices that Alex Krzyszewski made right here, are we still doing today and what have we learned since then."}, {"start": 103.0, "end": 119.0, "text": " 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."}, {"start": 119.0, "end": 134.0, "text": " And yeah, so they start off by saying that that current approaches to object recognition make essentially use of machine learning methods. This was also new, right object recognition wasn't always learned."}, {"start": 134.0, "end": 152.0, "text": " The object recognizers, you could even do it in the indifferent 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."}, {"start": 152.0, "end": 166.0, "text": " So we collect a 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 tens of thousands of images."}, {"start": 166.0, "end": 180.0, "text": " So this is this especially at norb or here the c for 10 or c for 100, these are relatively small data sets with relatively small images as well like c for 10 is 32 by 32 pixels."}, {"start": 180.0, "end": 196.0, "text": " 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."}, {"start": 196.0, "end": 225.0, "text": " 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 image net 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."}, {"start": 225.0, "end": 240.0, "text": " Image net data set is actually much larger than we know that we when we talk of image net when we speak of image net we think of the image net that has a thousand classes and about one or one and a half million images."}, {"start": 240.0, "end": 259.0, "text": " However, that's only a subset of the much much larger image net data set with in many, many more categories. It's just that the image net competitions were performed on this subset because I guess people thought well a thousand classes and a million images is already plenty."}, {"start": 259.0, "end": 273.0, "text": " So we'll do that. So that's I guess how that came to be. So their argument is right here to learn about thousands of objects from millions of images we need a model with a large learning capacity."}, {"start": 273.0, "end": 288.0, "text": " However, the immense complexity of object recognition task means that this probably this problem cannot be specified even by data set as large as image net. So our model should also have lots of prior knowledge to compensate for all the data we don't have."}, {"start": 288.0, "end": 301.0, "text": " So the their main argument for using neural networks is that the size of the data set is so large. Therefore we need a large model granted they already recognize the."}, {"start": 301.0, "end": 321.0, "text": " The inherent the inherent connection between large models and a lot of complex data but in the 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."}, {"start": 321.0, "end": 342.0, "text": " 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 known to do anything I guess I guess they were used for handwritten digit recognition and so on and were kind of on par with other methods."}, {"start": 342.0, "end": 359.0, "text": " 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 task because they have such a high capacity."}, {"start": 359.0, "end": 378.0, "text": " However, neural networks feet forward neural networks are already too powerful they don't know anything about the data everything is 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."}, {"start": 378.0, "end": 398.0, "text": " 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 stationary of statistics and locality of pixel dependencies."}, {"start": 398.0, "end": 415.0, "text": " 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."}, {"start": 415.0, "end": 430.0, "text": " It is 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 of course CNNs fit that very well."}, {"start": 430.0, "end": 445.0, "text": " So they are going to 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."}, {"start": 445.0, "end": 461.0, "text": " 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 image and contain enough labeled example to train such model without severe overfitting."}, {"start": 461.0, "end": 488.0, "text": " 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 don't overfit which is strange in itself like this double descent phenomenon and so on but overfitting was still a very much at the forefront of people's minds."}, {"start": 488.0, "end": 509.0, "text": " 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."}, {"start": 509.0, "end": 538.0, "text": " 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 SVM"}, {"start": 538.0, "end": 567.0, "text": " 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 composing."}, {"start": 567.0, "end": 595.0, "text": " 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 show 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."}, {"start": 595.0, "end": 622.0, "text": " 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 look at those and the end they say the networks 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."}, {"start": 622.0, "end": 651.0, "text": " Our network takes between 5 and 6 days to train on to 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 a big deal."}, {"start": 651.0, "end": 666.0, "text": " This became these networks became better simply by increasing their depth and as you know then resonates came along increasing the depth by an order of magnitude and that gave another boost to computer vision."}, {"start": 666.0, "end": 694.0, "text": " So they talk about the image net data set here and the main point in the image net data set right here is the fact that the images are plenty so there are over a million training images in this subset with a thousand classes which was you know a very big that was that was on like C for 10 had 10 classes if our 100 had 100 classes that was already a lot at 1000 classes."}, {"start": 694.0, "end": 718.0, "text": " That is on like unheard of before this data set I guess not on heard 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"}, {"start": 718.0, "end": 728.0, "text": " previous methods all were like 32 by 32 so definitely challenging data set even today it's a challenging data set."}, {"start": 728.0, "end": 747.0, "text": " All right 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."}, {"start": 747.0, "end": 775.0, "text": " 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 is are these two different pipelines and"}, {"start": 775.0, "end": 804.0, "text": " Alex for cutting off this part right here I mean you just know like there's just has 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 admissions ruining yet another paper."}, {"start": 804.0, "end": 827.0, "text": " All right but you can see there's this to this this to 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 to two GPUs with the occasional intercommunication right you can see here there's intercommunication between the two GPUs"}, {"start": 827.0, "end": 856.0, "text": " 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 invention of bigger GPUs made that sort of superfluous but just imagine the amount of code they had to write there was no tensor flow at this point there I don't think that's the right thing."}, {"start": 856.0, "end": 874.0, "text": " I don't think there was even cafe around there was just kuda and yeah just this cross GPU memory writing I just imagine this to be so so ugly and big respect for writing all of this code."}, {"start": 874.0, "end": 903.0, "text": " All right so they go through a number of important things and most of the things here aren't their invention let's 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 nonlinearity now of course relus nowadays all like abundant everyone uses relus nonlinearities but at that time it was still very important."}, {"start": 903.0, "end": 920.0, "text": " 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,"}, {"start": 920.0, "end": 949.0, "text": " the 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 kind of curve where if the input rises above this border right here the action potential maybe I don't know what the English term is then if it rise above that then the neuron would start to spike."}, {"start": 949.0, "end": 969.0, "text": " And if it's below that it wouldn't so people wanted to approximate this using some sort of a kind of differentiable but something that's very similar to this step function and that ultimately led to something like a sigmoid or a hyperbolic tangent."}, {"start": 969.0, "end": 998.0, "text": " 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 nonlinearity so the hyperbolic tangent and the sigmoid are much slower than the non-sensuality."}, {"start": 998.0, "end": 1024.0, "text": " So we're then the non saturating nonlinearity this one following narendtinten we refer to neurons with this nonlinearity as rectified linear units so taken from this this other paper they say okay we use these relus these rectified linear units which are not exactly like real biological neurons but they train much faster right."}, {"start": 1024.0, "end": 1053.0, "text": " And of course relus are used until this day. So you can see right here that this is on a c4 10 and they measure the time to reach 25% of the training error and this here is with the relus 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 relus."}, {"start": 1053.0, "end": 1070.0, "text": " 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."}, {"start": 1070.0, "end": 1091.0, "text": " So if you have a couple of months of time and he takes you a week to train one of these things you know you don't you you can't afford a six times slow down because that would mean you can only train like two models in the entire course of research and that would severely hindered your progress."}, {"start": 1091.0, "end": 1111.0, "text": " 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 kind of fixed it but we're not sure we couldn't restart because it was too expensive."}, {"start": 1111.0, "end": 1140.0, "text": " Maybe we're waiting for a moment I'm still saying we're waiting for the resonant moment in the transformers but yeah relus in you know here 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"}, {"start": 1140.0, "end": 1167.0, "text": " 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."}, {"start": 1167.0, "end": 1194.0, "text": " 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."}, {"start": 1194.0, "end": 1209.0, "text": " 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 examples are enough to train networks which are too big to fit on one GPU."}, {"start": 1209.0, "end": 1224.0, "text": " 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."}, {"start": 1224.0, "end": 1253.0, "text": " 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 to have where the kernels in layer four take input only from the kernel maps and layer three which reside on the same GPU."}, {"start": 1253.0, "end": 1276.0, "text": " So very very interesting choice right here and they justify this here or they say the results this scheme reduces our top one top five air rates by 1.7 to 1.2% respectively as compared with a net with half as many kernels in each computational layer in each convolution layer on one GPU."}, {"start": 1276.0, "end": 1294.0, "text": " 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 railroads and stuff and they were already better than previous because they're so just to go to the results."}, {"start": 1294.0, "end": 1316.0, "text": " The pre they beat the error rates of previous models by 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 28 25% and here their best one is at 17% top five air rate."}, {"start": 1316.0, "end": 1345.0, "text": " I'm going to imagine that they trained it first and we're already better than the 25% and I guess lots of people which is 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 but a boom I have 0.1% better 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 rate."}, {"start": 1345.0, "end": 1374.0, "text": " By one percent this reduces the air 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 train on one GPU right and and then they thought you know maybe we can train an even bigger network by using two GPUs and then they realize what it's going to take like a crap"}, {"start": 1374.0, "end": 1403.0, "text": " 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 observe that their network does better than everything that was previously to sit down and do the cross GPU thing experiment with OK when do we cross communicate and what not that is very very"}, {"start": 1403.0, "end": 1432.0, "text": " 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 OK it's still like two months out this competition deadline I don't know but you know 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"}, {"start": 1432.0, "end": 1448.0, "text": " 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 have the improvement and did it anyway OK but multi GPU training didn't really"}, {"start": 1448.0, "end": 1477.0, "text": " 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 which is short 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 and"}, {"start": 1477.0, "end": 1492.0, "text": " 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"}, {"start": 1492.0, "end": 1508.0, "text": " what they want to do is they want to kind of normalize the response of these of these reddues so what they do is each response which is this alpha or this a here is normalized by the following"}, {"start": 1508.0, "end": 1526.0, "text": " 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"}, {"start": 1526.0, "end": 1547.0, "text": " 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"}, {"start": 1547.0, "end": 1565.0, "text": " averaging by see here dividing by the average response of the channels around them right so let's maybe say the five channels though two channels in front of them and two channels behind them this is going to be they take the average"}, {"start": 1565.0, "end": 1586.0, "text": " 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"}, {"start": 1586.0, "end": 1606.0, "text": " like layer normalization that simply averages across all of the channels or they have group normalization that predefined 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"}, {"start": 1606.0, "end": 1624.0, "text": " 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"}, {"start": 1624.0, "end": 1637.0, "text": " 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 term brightness normalization since we do not subtract the mean activity"}, {"start": 1637.0, "end": 1653.0, "text": " and 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"}, {"start": 1653.0, "end": 1674.0, "text": " 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"}, {"start": 1674.0, "end": 1692.0, "text": " 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"}, {"start": 1692.0, "end": 1712.0, "text": " okay instead of having a pooling layer so if this is your image and instead of pooling 2 by 2 in the stride of 2 like we do today and you know pooled down to a smaller image what we can do instead is we can pool with overlapping windows"}, {"start": 1712.0, "end": 1730.0, "text": " in that case they pooled with a 3 by 3 window but they do always do stride of 2 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"}, {"start": 1730.0, "end": 1748.0, "text": " 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"}, {"start": 1748.0, "end": 1766.0, "text": " 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 4 at the beginning to reduce the size so at the beginning"}, {"start": 1766.0, "end": 1790.0, "text": " it's 2 24 by 2 24 and then it's 48 by sorry it's 55 by 55 that thing here 55 by 55 48 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"}, {"start": 1790.0, "end": 1810.0, "text": " the stride of 4 convolution here already employed in order to down sample 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 down sample image while convolving it"}, {"start": 1810.0, "end": 1830.0, "text": " what you also see here is that they thought that the feature map size should be 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"}, {"start": 1830.0, "end": 1848.0, "text": " this didn't really come through until today as you know most architectures today they just go with like 3 by 3 kernels from the very start and don't really care about you know also downsizing their filters"}, {"start": 1848.0, "end": 1868.0, "text": " 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"}, {"start": 1868.0, "end": 1896.0, "text": " 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 very close to the architectures today right there hasn't changed that much like the difference between this and the VGG 16 VGG 19 or is just depth"}, {"start": 1896.0, "end": 1910.0, "text": " 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"}, {"start": 1910.0, "end": 1920.0, "text": " 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"}, {"start": 1920.0, "end": 1936.0, "text": " 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"}, {"start": 1936.0, "end": 1944.0, "text": " so if you get rid of one of those dense layers you can like get many many more convolutional layers"}, {"start": 1944.0, "end": 1960.0, "text": " all right 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"}, {"start": 1960.0, "end": 1970.0, "text": " I think maybe they did and maybe it was actually overfitting but we now we don't care about overfitting too much anymore"}, {"start": 1970.0, "end": 1982.0, "text": " 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"}, {"start": 1982.0, "end": 1994.0, "text": " 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"}, {"start": 1994.0, "end": 2010.0, "text": " they say our neural network of six and 60 million parameters although the thousand classes make each training example in post 10 bits of constraints on the mapping from image to label this turns out to be insufficient to learn many parameters without considerable overfitting"}, {"start": 2010.0, "end": 2018.0, "text": " below we describe two primary ways in which we combat overfitting again there's no one today no one today makes this argument anymore"}, {"start": 2018.0, "end": 2038.0, "text": " 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 a thousand classes how you know when do how many parameters per sample is that and so on how many bits of constraint"}, {"start": 2038.0, "end": 2050.0, "text": " we don't care about anymore we're fine with having like a billion times more parameters than training samples we we don't worry about it anymore"}, {"start": 2050.0, "end": 2064.0, "text": " 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 combination is just so cool in this paper"}, {"start": 2064.0, "end": 2084.0, "text": " 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"}, {"start": 2084.0, "end": 2100.0, "text": " 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"}, {"start": 2100.0, "end": 2126.0, "text": " okay so random so this was already this these are the most valuable data augmentation 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"}, {"start": 2126.0, "end": 2146.0, "text": " 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 next thing improves"}, {"start": 2146.0, "end": 2166.0, "text": " 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 they would you know translation was the important part and so they focused on generating image translations"}, {"start": 2166.0, "end": 2185.0, "text": " and to generate an image translation from a single image naturally you have to crop it and however we we we now focus much more on the fact that we crop it and that kind of have different sub images of the same images especially in you know self supervised learning and things like this we know that"}, {"start": 2185.0, "end": 2213.0, "text": " 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 attest 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 networks softmax layer on the 10 patches"}, {"start": 2213.0, "end": 2239.0, "text": " 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"}, {"start": 2239.0, "end": 2258.0, "text": " 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 image and training set to each training image we add multiples of the found principle components with magnitude"}, {"start": 2258.0, "end": 2282.0, "text": " 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"}, {"start": 2282.0, "end": 2309.0, "text": " image augmentation right here anymore they say this scheme reduces the top one error rate by over 1% I wonder why why this isn't work maybe because you need these stats over the entire day to set and the other things maybe working equivalently well but you you can simply apply them without knowing kind of your your principal components"}, {"start": 2309.0, "end": 2338.0, "text": " okay next thing drop out drop out 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 drop out some people still use it but most people I think don't use drop out 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"}, {"start": 2338.0, "end": 2367.5, "text": " 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 very efficient version of model combination that only costs about a factor of two during training so there's this technique called drop out then they explain it you said to zero the output of each hidden"}, {"start": 2367.5, "end": 2389.5, "text": " return with probability point five and people didn't know about drop out as they do know but they introduced this right here and they say it reduces their not sure they also don't say how they how much they by how much this reduces the training"}, {"start": 2389.5, "end": 2418.5, "text": " there but they say we use drop out in the first two fully connected layers without drop out our network exhibits substantial overfitting drop out 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 drop out 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"}, {"start": 2418.5, "end": 2436.5, "text": " maybe because we do more augmentation I don't I don't know or maybe drop out 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"}, {"start": 2436.5, "end": 2463.5, "text": " 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 image net 2011 and fine tune then on the image net 2012 right here the image net 2011"}, {"start": 2463.5, "end": 2486.5, "text": " and then fine tuning on the image net 2012 to reduce that error even further like pulling all the tricks all 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"}, {"start": 2486.5, "end": 2513.5, "text": " 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 very cool investigation where they look at examples"}, {"start": 2513.5, "end": 2537.5, "text": " 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"}, {"start": 2537.5, "end": 2549.5, "text": " you can see here grill and it assigns convertible which you know by all means is correct is just not the class that the annotators assigned to this particular image as well as here"}, {"start": 2549.5, "end": 2567.5, "text": " the 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 you know forgivable let's say"}, {"start": 2567.5, "end": 2588.5, "text": " 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"}, {"start": 2588.5, "end": 2606.5, "text": " and they look at the last layers feature vector and the five nearest the 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"}, {"start": 2606.5, "end": 2628.5, "text": " 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"}, {"start": 2628.5, "end": 2648.5, "text": " yeah so that's their that's their paper they they already allude to the fact that depth is very important it is notable that our networks performance degrades if a single convolutional layer is removed for example"}, {"start": 2648.5, "end": 2669.5, "text": " 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"}, {"start": 2669.5, "end": 2689.5, "text": " resnets 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"}, {"start": 2689.5, "end": 2701.5, "text": " 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"}, {"start": 2701.5, "end": 2722.5, "text": " 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 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"}, {"start": 2722.5, "end": 2739.5, "text": " 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"}, {"start": 2739.5, "end": 2759.5, "text": " 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"}, {"start": 2759.5, "end": 2766.5, "text": " so that was it for Alex net let me know what you think in the comments and I'll see you next time bye"}] |
Yannic Kilcher | 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 Miller, Jack Turner, Amastorkee and Elliott J. Crowley. On a high level this paper performs neural architecture search by looking at the correlation matrices of the Jacobian of the of the data when you pass it through the network and it does also at initialization. So you pass the data, 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 a 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 C410 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 the specifications but gives the lowest possible loss or the so 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 gonna go with you know first like three convolutional layers each one having like a relune on 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 down sample 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 or like a VGG style architecture. Someone has come up with those at some point with each of those discover 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 truth is that there might be much better architectures that were 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 combinatorical 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 area but they are mostly costly 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 and 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 hundred thousand 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 a 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 the see here the controller would be the agent the percentages here the accuracies would be the reward and the 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 ginormously slow and resource intensive and that of course blocks a lot of research because you know we 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 networks 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 will will 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 way to construct architectures and they took those architectures and they ranked them by how well they score on c4 10 so they're 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 look 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 is pretty easy they compute the linear map around each data point so what is that if you imagine a neural network as a non-linear function which I guess you should because it is and so that's imagine it as like an non-linear 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 observe 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 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 still in your 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 the way that it fluctuates tells me that all of the different parameters must have some sort of effect right because it's of 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 be 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 this so somehow the signal doesn't get through right so that's I they don't explicitly say 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 you 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 if 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 all right 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 a particular entry here like the entry i j 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 this correlation histogram of the correlations between local linear maps across all pairs of items in a mini batch of c for 10 training data each hypothesis is gram 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 they sort of say this but 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 the 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 overexpressive 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 this skeleton and in this skeleton there is this block and it's always repeated and your basic 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 thousand six hundred and 25 possible cells okay so the NAS bench mark contains 15 thousand six hundred and 25 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 sort of from from these experiments what you'll get is like this sort of feeling what they're gonna 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 image net which is the most difficult one of course so and this is C for 100 which is more difficult than C for 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 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 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 than 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 a 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 their it influences their score right 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're fine what you find is a property of the network itself and the fact that it is 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 evaluate 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 bench mark this bench mark 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 C410 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 rip it up okay move this anymore hello okay they say that this linear relationship still sort of holds it doesn't 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 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 called 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 c4 10 where as 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 c4 10 which is no it's at least not degenerate it's a 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 as 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 accuracy are averaged over 500 runs for weight sharing methods accuracy are reported over three runs with the exception of gdas our method is able to perform 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 c4 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 simply crap it seems they're simply 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 c4 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 a good method to maybe get you like let's say 90% 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 you're 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 ones 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 by removing 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 the good ones are either way over here or here and there's is almost at 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": 5.78, "text": " Hi there. Today we're looking at neural architecture search without training by Joseph"}, {"start": 5.78, "end": 12.24, "text": " Miller, Jack Turner, Amastorkee and Elliott J. Crowley. On a high level this paper"}, {"start": 12.24, "end": 18.44, "text": " performs neural architecture search by looking at the correlation matrices of the"}, {"start": 18.44, "end": 25.44, "text": " Jacobian of the of the data when you pass it through the network and it does"}, {"start": 25.44, "end": 31.200000000000003, "text": " also at initialization. So you pass the data, look at the Jacobian and if it's"}, {"start": 31.200000000000003, "end": 36.72, "text": " very correlated then the network is bad and if it's very uncorrelated then the"}, {"start": 36.72, "end": 42.08, "text": " network is good. And by simply observing that they can already achieve a very"}, {"start": 42.08, "end": 47.16, "text": " good score on a neural architecture search benchmark. Alright that was the"}, {"start": 47.16, "end": 51.6, "text": " high level and maybe a bit too simplified but that's sort of what's going on."}, {"start": 51.6, "end": 57.0, "text": " Okay let's dive in. So what's neural architecture search? Neural architecture"}, {"start": 57.0, "end": 63.120000000000005, "text": " search is the discipline of you are given a data set. Let's say here we have a"}, {"start": 63.120000000000005, "end": 69.52000000000001, "text": " data set which could be something like C410 which is an image data set and you"}, {"start": 69.52000000000001, "end": 78.0, "text": " are given a sort of a training procedure. Let's say Adam or SGD for 100,000"}, {"start": 78.0, "end": 83.28, "text": " steps or something like this with many batches of size 64. Okay and you're"}, {"start": 83.28, "end": 88.24, "text": " given a loss function which the loss function here could be the cross entropy"}, {"start": 88.24, "end": 95.48, "text": " between the outputs of the network which we'll call L and the label Y. And your"}, {"start": 95.48, "end": 101.4, "text": " task is now to find a neural network architecture that conforms to the"}, {"start": 101.4, "end": 106.68, "text": " specifications but gives the lowest possible loss or the so the highest possible"}, {"start": 106.68, "end": 112.4, "text": " validation accuracy in this case. So this here would be like the train and then"}, {"start": 112.4, "end": 116.96000000000001, "text": " you'd have the test accuracy or the validation accuracy. Okay so you could"}, {"start": 116.96000000000001, "end": 122.0, "text": " decide well I'm gonna go with you know first like three convolutional layers"}, {"start": 122.0, "end": 127.48, "text": " each one having like a relune on linearity but you could also say well I'm"}, {"start": 127.48, "end": 132.12, "text": " going to build like a skip connection from here to here. You could also say that"}, {"start": 132.12, "end": 137.36, "text": " I'm going to down sample by two you could have maybe a bigger stride and so on."}, {"start": 137.36, "end": 142.56, "text": " So the kernel size of the convolution you can vary until now people have done"}, {"start": 142.56, "end": 148.72, "text": " this by hand right. In effect we all use like the same 10 to 20 different"}, {"start": 148.72, "end": 152.56, "text": " architectures so if it's an image problem we tend to go for like a"}, {"start": 152.56, "end": 160.0, "text": " ResNet or a wide ResNet or like a VGG style architecture. Someone has come up"}, {"start": 160.0, "end": 165.04, "text": " with those at some point with each of those discover that it works well and we"}, {"start": 165.04, "end": 170.36, "text": " don't really do much exploration we simply kind of use the same things over and"}, {"start": 170.36, "end": 177.12, "text": " over and the truth is that there might be much better architectures that were"}, {"start": 177.12, "end": 181.48, "text": " simply not exploring right there might be much better building plans for"}, {"start": 181.48, "end": 186.32, "text": " networks that we don't know of that might perform a lot better with the same"}, {"start": 186.32, "end": 191.12, "text": " data and the same training. So neural architecture searches the process of"}, {"start": 191.12, "end": 194.95999999999998, "text": " automatically searching for these better architectures of course that's a"}, {"start": 194.95999999999998, "end": 203.12, "text": " combinatorical problem but the idea is that you know you can actually learn to"}, {"start": 203.12, "end": 208.51999999999998, "text": " construct good architectures and by doing so you can you can sort of speed up"}, {"start": 208.51999999999998, "end": 213.84, "text": " this process that is manual otherwise and the idea behind it is there some"}, {"start": 213.84, "end": 217.20000000000002, "text": " regularity of when an architecture is good there's some like high level pattern"}, {"start": 217.20000000000002, "end": 222.52, "text": " that you as a human maybe cannot really grasp but like a machine can figure out"}, {"start": 222.52, "end": 226.88, "text": " which architectures are good and which ones aren't. So there have been a few"}, {"start": 226.88, "end": 234.16, "text": " inventions in this area but they are mostly costly that's what they say here"}, {"start": 234.16, "end": 238.56, "text": " the time and effort involved in hand designing deep neural networks is immense"}, {"start": 238.56, "end": 243.4, "text": " this has prompted the development of neural architecture search techniques to"}, {"start": 243.4, "end": 248.88, "text": " automate this design however neural architecture search algorithms tend to be"}, {"start": 248.88, "end": 253.84, "text": " extremely slow and expensive they need to train vast numbers of candidate"}, {"start": 253.84, "end": 259.28000000000003, "text": " networks to inform the search process. So what neural architecture search"}, {"start": 259.28000000000003, "end": 264.0, "text": " methods do is what they'll have is they'll have something like a controller"}, {"start": 264.0, "end": 268.6, "text": " and the controller itself of course is going to be a neural network so there"}, {"start": 268.6, "end": 273.88, "text": " will be this thing that will be the controller and the controller will emit like a"}, {"start": 273.88, "end": 279.20000000000005, "text": " building plan. So the controller will emit like a building plan for this network"}, {"start": 279.20000000000005, "end": 284.20000000000005, "text": " right here and then you train the entire thing once through for the entire"}, {"start": 284.20000000000005, "end": 288.44, "text": " hundred thousand steps and then you observe the final validation accuracy"}, {"start": 288.44, "end": 294.44, "text": " which might be something like 80% and then you know okay this is 80% so you"}, {"start": 294.44, "end": 299.68, "text": " feed the 80% into your controller and the controller outputs the next building"}, {"start": 299.68, "end": 304.48, "text": " plan that it thinks will score higher and then you train the entire thing again"}, {"start": 304.48, "end": 310.56, "text": " and you maybe observe a 70% accuracy you again feed that in right and the"}, {"start": 310.56, "end": 314.84, "text": " controller realizes oh I may have done something wrong let me try something else"}, {"start": 314.84, "end": 319.6, "text": " and does again if this looks like reinforcement learning to you that's because"}, {"start": 319.6, "end": 326.08000000000004, "text": " this is reinforcement learning so the the see here the controller would be the"}, {"start": 326.08000000000004, "end": 331.44, "text": " agent the percentages here the accuracies would be the reward and the"}, {"start": 331.44, "end": 337.64000000000004, "text": " the observations would be basically this thing here this thing would be the"}, {"start": 337.64000000000004, "end": 341.20000000000005, "text": " actions but sometimes it's the observations and you need to score the"}, {"start": 341.20000000000005, "end": 347.40000000000003, "text": " different things okay so the problem of course with this is that the"}, {"start": 347.4, "end": 352.44, "text": " reinforcement learning requires a lot of data it requires a lot of steps to"}, {"start": 352.44, "end": 356.88, "text": " converge because the signal from the reward is just so weak you simply get one"}, {"start": 356.88, "end": 362.44, "text": " number for your action and you don't know what you can change to make it better"}, {"start": 362.44, "end": 367.88, "text": " you simply have to try so you need a lot of steps but this thing here is mighty"}, {"start": 367.88, "end": 372.84, "text": " slow because each each single step in your reinforcement learning procedure"}, {"start": 372.84, "end": 379.64, "text": " involves training an entire neural network for like this many steps okay so all"}, {"start": 379.64, "end": 385.03999999999996, "text": " of this is ginormously slow and resource intensive and that of course blocks"}, {"start": 385.03999999999996, "end": 391.0, "text": " a lot of research because you know we we started with the plan to automate"}, {"start": 391.0, "end": 397.15999999999997, "text": " this part right here but automating it itself is super expensive so they go for"}, {"start": 397.16, "end": 404.88000000000005, "text": " a different solution they say this could be remedied if we could infer at net"}, {"start": 404.88000000000005, "end": 410.96000000000004, "text": " sorry if we could infer a network's trained accuracy from its initial state"}, {"start": 410.96000000000004, "end": 416.64000000000004, "text": " okay it seems a bit out there but let's let's give them benefit of the"}, {"start": 416.64000000000004, "end": 421.8, "text": " doubt in this work we examine how the linear maps induced by data points"}, {"start": 421.8, "end": 427.72, "text": " correlate for untrained network architectures in the NAS bench 201 search space and"}, {"start": 427.72, "end": 434.04, "text": " motivate how this can be used to give a measure of modeling flexibility which"}, {"start": 434.04, "end": 439.48, "text": " is highly indicative of a networks trained performance we incorporate this"}, {"start": 439.48, "end": 443.92, "text": " measure into a simple algorithm that allows us to search for powerful networks"}, {"start": 443.92, "end": 449.48, "text": " without any training in a matter of seconds on a single GPU okay and they have"}, {"start": 449.48, "end": 454.76, "text": " the code available right here if you want to go and check that out so let's go"}, {"start": 454.76, "end": 460.52000000000004, "text": " in let's go into that the claims are pretty big and the reasoning behind the"}, {"start": 460.52000000000004, "end": 465.44, "text": " claims is the following observation you can already sort of see in this"}, {"start": 465.44, "end": 470.20000000000005, "text": " graphic right here will will go over what it means in one second but what they"}, {"start": 470.20000000000005, "end": 475.44, "text": " do is they take different networks in this search space and the search space in"}, {"start": 475.44, "end": 481.24, "text": " this case is given by this benchmark so this benchmark basically has a long"}, {"start": 481.24, "end": 488.0, "text": " list I think of architectures that you could consider actually so it's a"}, {"start": 488.0, "end": 491.24, "text": " it's a constructive list so they don't actually give you the list but they give"}, {"start": 491.24, "end": 498.04, "text": " you like a way to construct architectures and they took those architectures and"}, {"start": 498.04, "end": 502.88, "text": " they ranked them by how well they score on c4 10 so they're very good"}, {"start": 502.88, "end": 507.44, "text": " architectures which are here there are good ones there are mediocre ones and then"}, {"start": 507.44, "end": 512.72, "text": " the bad ones okay and you can see that the histograms here of whatever they"}, {"start": 512.72, "end": 517.36, "text": " measure they look quite different so the histograms with the good ones they all"}, {"start": 517.36, "end": 522.8, "text": " look kind of spiky around zero and the histograms of the bad ones all sort of"}, {"start": 522.8, "end": 527.72, "text": " look spread out so this is the measure that they're going to propose is they have"}, {"start": 527.72, "end": 532.28, "text": " some sort of number some sort of histogram that they produce and if the"}, {"start": 532.28, "end": 538.0, "text": " histogram is very spiky and close together around zero then they conclude that"}, {"start": 538.0, "end": 543.3199999999999, "text": " this network is good and if the histogram is very spread out like this they"}, {"start": 543.3199999999999, "end": 550.0799999999999, "text": " conclude that the network is bad now these histograms as you might expect they"}, {"start": 550.0799999999999, "end": 555.4, "text": " are computed not from the final trained network but they are computed from the"}, {"start": 555.4, "end": 562.24, "text": " initial network so here they show at least you know in this case it seems to"}, {"start": 562.24, "end": 567.52, "text": " be that there is a general correlation between the trained accuracy and how"}, {"start": 567.52, "end": 576.72, "text": " this histogram looks and we're going to explore what they do so it's essentially"}, {"start": 576.72, "end": 582.4, "text": " is pretty easy they compute the linear map around each data point so what is"}, {"start": 582.4, "end": 588.28, "text": " that if you imagine a neural network as a non-linear function which I guess"}, {"start": 588.28, "end": 592.8399999999999, "text": " you should because it is and so that's imagine it as like an"}, {"start": 592.8399999999999, "end": 599.68, "text": " non-linear function from x to y what they'll do is simply they'll look at a"}, {"start": 599.68, "end": 604.24, "text": " given date training data point which could be here right this could be the x"}, {"start": 604.24, "end": 611.3199999999999, "text": " and this could be the the y and in fact let's look at it in loss landscape not"}, {"start": 611.3199999999999, "end": 616.4399999999999, "text": " even in y but in L in terms of the loss because we don't need necessarily a"}, {"start": 616.44, "end": 620.2800000000001, "text": " single label this could be for unsupervised this could be for anything okay so it"}, {"start": 620.2800000000001, "end": 626.72, "text": " maps a data point to a loss now what we'll do is we'll simply linearize the"}, {"start": 626.72, "end": 632.0, "text": " function around that point which means we'll just freeze all the non-linearities"}, {"start": 632.0, "end": 637.36, "text": " in place and that will give us this linear function right here okay we just"}, {"start": 637.36, "end": 642.5200000000001, "text": " observe that this linear function can exist it's the tangent to the loss"}, {"start": 642.52, "end": 646.72, "text": " landscape and it's at a particular data point right it's in data space not in"}, {"start": 646.72, "end": 652.0799999999999, "text": " in weight space then we look at a different data point so we look at this data"}, {"start": 652.0799999999999, "end": 655.52, "text": " point right here another data point what's still in your function around this"}, {"start": 655.52, "end": 664.72, "text": " one is sort of like whoops D is like that and then around this one is like this"}, {"start": 664.72, "end": 669.52, "text": " okay so this is one function now let's look at a different function right here so"}, {"start": 669.52, "end": 679.72, "text": " L x and we'll look at this function the linear function okay so for some"}, {"start": 679.72, "end": 688.72, "text": " reason this is like this and if we consider two data points their linearization"}, {"start": 688.72, "end": 697.4, "text": " is very similar now imagine that these two have been produced by the same"}, {"start": 697.4, "end": 701.9599999999999, "text": " sort of neural networks it's just the architecture is a little different but"}, {"start": 701.9599999999999, "end": 705.16, "text": " they have been produced like they have the same number of parameters in the"}, {"start": 705.16, "end": 710.64, "text": " neural network which neural network would you prefer remember you can in by"}, {"start": 710.64, "end": 714.52, "text": " training the neural network you can actually shape this loss function you can"}, {"start": 714.52, "end": 720.28, "text": " kind of shape that around so which one would you prefer I personally would"}, {"start": 720.28, "end": 725.88, "text": " prefer the top one because the top one already tells me that hey you know I"}, {"start": 725.88, "end": 729.84, "text": " might have 10 parameters here and this already sort of looks like each of the"}, {"start": 729.84, "end": 734.72, "text": " 10 parameters is doing something so if I then go into my 10 parameters and I"}, {"start": 734.72, "end": 739.6, "text": " you know turn this knob right here then I might you know up this bump or down"}, {"start": 739.6, "end": 745.88, "text": " this bump or do something with it but the sort of frequency curvature the"}, {"start": 745.88, "end": 751.36, "text": " randomness of the function the the way that it fluctuates tells me that all of"}, {"start": 751.36, "end": 755.84, "text": " the different parameters must have some sort of effect right because it's of"}, {"start": 755.84, "end": 760.16, "text": " quite an expressive function whereas if I have the same number of parameters for"}, {"start": 760.16, "end": 766.92, "text": " a function like this this sort of tells me well maybe only one of the when"}, {"start": 766.92, "end": 770.8000000000001, "text": " be only one of the weights is actually doing something maybe only one of the"}, {"start": 770.8000000000001, "end": 774.8000000000001, "text": " dimensions is doing something this seems odd right that even though I've"}, {"start": 774.8000000000001, "end": 780.44, "text": " initialized it randomly a super regular function like this comes out so maybe all"}, {"start": 780.44, "end": 786.32, "text": " of the all of these parameters down here they don't do anything or this so"}, {"start": 786.32, "end": 792.7600000000001, "text": " somehow the signal doesn't get through right so that's I they don't explicitly"}, {"start": 792.7600000000001, "end": 797.48, "text": " say in these terms but this is how I make sense of this what they're saying is"}, {"start": 797.48, "end": 805.1600000000001, "text": " that if you look at the linearizations of the functions and you look at the the"}, {"start": 805.16, "end": 811.04, "text": " angle right here so the angle in this case is that and in this case is that and"}, {"start": 811.04, "end": 816.9599999999999, "text": " in this case is that so you look at the slope here and the slope is basically"}, {"start": 816.9599999999999, "end": 822.16, "text": " the gradient of these linearized functions and what you want to do is you want"}, {"start": 822.16, "end": 826.92, "text": " to look at the correlation between those of the different data points so here"}, {"start": 826.92, "end": 836.52, "text": " you have three angles one is very short one is very bit longer like this and or"}, {"start": 836.52, "end": 844.1999999999999, "text": " no even like this and one is even over 90 degrees like that they are not"}, {"start": 844.1999999999999, "end": 848.0, "text": " correlated at all right they're all very different however the angles here"}, {"start": 848.0, "end": 855.64, "text": " they're all quite the same as you can see so what they propose is the following"}, {"start": 855.64, "end": 861.4, "text": " let's send all the data points or in that case all the data points in a"}, {"start": 861.4, "end": 865.84, "text": " particular mini batch let's send them through the function and let's calculate"}, {"start": 865.84, "end": 871.6, "text": " their linearizations so the linearization is nothing else than you send them"}, {"start": 871.6, "end": 876.56, "text": " through the network to obtain the f value for the x value and then you calculate"}, {"start": 876.56, "end": 880.8, "text": " the gradient with respect to the input right now you have to get used to this a"}, {"start": 880.8, "end": 885.2, "text": " bit because usually we calculate the gradient with respect to the weight but now"}, {"start": 885.2, "end": 889.6400000000001, "text": " we calculate the gradient with respect to the input which if this is a linear"}, {"start": 889.6400000000001, "end": 896.6400000000001, "text": " function so if you have a if f of x equals w x like a linear function then this"}, {"start": 896.6400000000001, "end": 903.8000000000001, "text": " gradient del f del x would just give you the w will give you the slope of the"}, {"start": 903.8000000000001, "end": 909.2800000000001, "text": " linear function and the same in the neural network when you linearize it all"}, {"start": 909.2800000000001, "end": 913.9200000000001, "text": " right so we're going to obtain all these linearizations and that gives us the"}, {"start": 913.92, "end": 920.7199999999999, "text": " this matrix j right here and what we can do is we can then observe the"}, {"start": 920.7199999999999, "end": 927.16, "text": " covariance matrix of j of all these linearizations the covariance matrix"}, {"start": 927.16, "end": 933.0, "text": " simply tells you how two data points vary with each other and in fact they"}, {"start": 933.0, "end": 936.76, "text": " don't look at the covariance matrix but they look at the correlation matrix"}, {"start": 936.76, "end": 941.76, "text": " which is simply the scaled covariance matrix so one entry in this covariance"}, {"start": 941.76, "end": 947.64, "text": " matrix so you have n data points and this gives you a matrix that's n by n and"}, {"start": 947.64, "end": 954.12, "text": " a particular entry here like the entry i j would simply state how does the"}, {"start": 954.12, "end": 962.24, "text": " angle of data point i correlate with the angle of data point j okay that's the"}, {"start": 962.24, "end": 970.24, "text": " that's the covariance matrix and now the hypothesis is if all of these"}, {"start": 970.24, "end": 974.92, "text": " data points are sort of independent like in our very expressive function here"}, {"start": 974.92, "end": 979.48, "text": " then the these correlations they should not be high in fact most data points"}, {"start": 979.48, "end": 986.12, "text": " should be rather uncorrelated however in this case right here if the function is"}, {"start": 986.12, "end": 991.88, "text": " sort of kind of degenerative or something not very expressive then all of"}, {"start": 991.88, "end": 996.36, "text": " these all of these angles or of these linearizations should be highly correlated"}, {"start": 996.36, "end": 1004.5600000000001, "text": " and that's what you see in this graph right here this right here now is this"}, {"start": 1004.5600000000001, "end": 1010.04, "text": " correlation histogram of the correlations between local linear maps across"}, {"start": 1010.04, "end": 1015.96, "text": " all pairs of items in a mini batch of c for 10 training data each hypothesis is"}, {"start": 1015.96, "end": 1020.6800000000001, "text": " gram for a single untrained NAS bench 201 architecture so remember the"}, {"start": 1020.6800000000001, "end": 1025.3600000000001, "text": " expressivity is important because we want to train that function and therefore"}, {"start": 1025.36, "end": 1029.84, "text": " it's important that every parameter does something and if it's degenerate we"}, {"start": 1029.84, "end": 1034.24, "text": " can't train it well and that's I find that's the reasoning they they sort of say"}, {"start": 1034.24, "end": 1041.8, "text": " this but I might make I might make the wrong sense out of it here but it seems to"}, {"start": 1041.8, "end": 1046.28, "text": " me like that's what's actually going on so you can see this is simply these"}, {"start": 1046.28, "end": 1050.9599999999998, "text": " matrix values rolled out and then plotted as a histogram so what does it mean"}, {"start": 1050.96, "end": 1055.44, "text": " when the histogram is like super spread out like this it means that there are a"}, {"start": 1055.44, "end": 1059.92, "text": " lot and I think down here are axes yes there are a lot of data points that"}, {"start": 1059.92, "end": 1066.28, "text": " correlate highly or anti correlate highly with each other okay which means that"}, {"start": 1066.28, "end": 1072.52, "text": " exactly this degeneracy happens so either too high or too negative high"}, {"start": 1072.52, "end": 1077.32, "text": " correlation means that they're very much they're kind of the same thing so"}, {"start": 1077.32, "end": 1082.96, "text": " there is if you have as many parameters as data points that means that one"}, {"start": 1082.96, "end": 1088.76, "text": " parameter can potentially serve these two data points or these two that are"}, {"start": 1088.76, "end": 1092.12, "text": " correlated by one or negative one you don't need both parameters and"}, {"start": 1092.12, "end": 1096.52, "text": " therefore you have a lot of parameters doing nothing whereas over here with the"}, {"start": 1096.52, "end": 1101.72, "text": " good networks you can see that this spikes around zero meaning that the"}, {"start": 1101.72, "end": 1107.92, "text": " data points are not correlated or the linearizations around the data points are"}, {"start": 1107.92, "end": 1112.08, "text": " not correlated and therefore you can sort of shape the function around each"}, {"start": 1112.08, "end": 1118.04, "text": " data point however you want which we sort of know that neural networks what they"}, {"start": 1118.04, "end": 1122.44, "text": " do is they're so overexpressive that they're actually able to shape the"}, {"start": 1122.44, "end": 1127.08, "text": " functions around the data points without necessarily looking at other data"}, {"start": 1127.08, "end": 1133.08, "text": " points nearby and that expressivity is what what you want and that"}, {"start": 1133.08, "end": 1140.3999999999999, "text": " expressivity is what this in part measures okay so they make a they have some"}, {"start": 1140.3999999999999, "end": 1144.8799999999999, "text": " experiments here where they validate this so for all these architectures in this"}, {"start": 1144.8799999999999, "end": 1148.72, "text": " benchmark and maybe I should tell you what show you what the benchmark looks"}, {"start": 1148.72, "end": 1153.9199999999998, "text": " like so the benchmark has this particular form this particular form there's"}, {"start": 1153.92, "end": 1158.8000000000002, "text": " this skeleton and in this skeleton there is this block and it's always repeated"}, {"start": 1158.8000000000002, "end": 1163.44, "text": " and your basic your task is to determine what this block should be so this"}, {"start": 1163.44, "end": 1168.2, "text": " block has an input node a and an output node d and two intermediate nodes and"}, {"start": 1168.2, "end": 1172.1200000000001, "text": " what you have to do is basically you have to determine these connections right"}, {"start": 1172.1200000000001, "end": 1177.64, "text": " here so there are six connections and for each one you have the option of"}, {"start": 1177.64, "end": 1181.52, "text": " putting different things there like you can see you put can put a convolution"}, {"start": 1181.52, "end": 1185.8, "text": " you can put the identity function which is a skip connection zero wise I'm I"}, {"start": 1185.8, "end": 1190.6, "text": " don't maybe that's the zero function so it basically means nothing I'm not so"}, {"start": 1190.6, "end": 1197.0, "text": " sure honestly but you could technically put a convolution here and here right"}, {"start": 1197.0, "end": 1204.84, "text": " or and or different convolutions or things like this so there are these 15"}, {"start": 1204.84, "end": 1211.6399999999999, "text": " thousand six hundred and 25 possible cells okay so the NAS bench mark contains"}, {"start": 1211.6399999999999, "end": 1216.8799999999999, "text": " 15 thousand six hundred and 25 possible architectures that you'll have to"}, {"start": 1216.8799999999999, "end": 1223.6399999999999, "text": " search and they take these architectures and they plot now they plot for each"}, {"start": 1223.6399999999999, "end": 1228.52, "text": " architecture the validation accuracy after training and the training protocol is"}, {"start": 1228.52, "end": 1233.48, "text": " standardized you don't have to care about that right and the score that they"}, {"start": 1233.48, "end": 1237.48, "text": " measure at the beginning of training and what you can see is that there is a"}, {"start": 1237.48, "end": 1244.04, "text": " linear relationship sort of like sort of from from these experiments what you'll"}, {"start": 1244.04, "end": 1250.2, "text": " get is like this sort of feeling what they're gonna propose is that you should"}, {"start": 1250.2, "end": 1258.44, "text": " take that score as a as a measure and here again also sort of sort sort of"}, {"start": 1258.44, "end": 1265.6000000000001, "text": " there is a there is a clear trend as you can see right here though yeah though"}, {"start": 1265.6000000000001, "end": 1269.8400000000001, "text": " this as you can see this sort of spreads out and the most right one is"}, {"start": 1269.8400000000001, "end": 1277.96, "text": " image net which is the most difficult one of course so and this is C for 100"}, {"start": 1277.96, "end": 1282.4, "text": " which is more difficult than C for 10 so we can see that this sort of"}, {"start": 1282.4, "end": 1288.0, "text": " relationship at the top it doesn't really hold anymore if the task gets"}, {"start": 1288.0, "end": 1291.8, "text": " difficult and this is so what I think is happening this is kind of an"}, {"start": 1291.8, "end": 1297.52, "text": " interjection of my own opinion what's happening here is that this score that"}, {"start": 1297.52, "end": 1302.96, "text": " they discover allows them pretty efficiently to see which networks are just"}, {"start": 1302.96, "end": 1307.6, "text": " degenerate and and cannot be trained like if you try to train them they just"}, {"start": 1307.6, "end": 1314.36, "text": " perform really poorly okay that it's probably a very good score for weeding"}, {"start": 1314.36, "end": 1319.04, "text": " those out and that would mean if you kind of barrier here somewhere right you"}, {"start": 1319.04, "end": 1323.52, "text": " could just discard a whole lot of this crap or even even here right you could"}, {"start": 1323.52, "end": 1329.1599999999999, "text": " just discard a whole lot of this crap and also now here just you know all of"}, {"start": 1329.1599999999999, "end": 1335.9199999999998, "text": " this crap yeah whereas here as you can see some this score sometimes it's"}, {"start": 1335.9199999999998, "end": 1340.1599999999999, "text": " higher than these ones even though they perform better and again you could"}, {"start": 1340.16, "end": 1345.44, "text": " probably discard a lot of the crap but it's not as distinctive for the"}, {"start": 1345.44, "end": 1350.3600000000001, "text": " well-performing networks because these here are all not the degenerate version"}, {"start": 1350.3600000000001, "end": 1354.8000000000002, "text": " right they're not degenerate in the sense that they're they have some fundamental"}, {"start": 1354.8000000000002, "end": 1359.48, "text": " flaw where the function lacks now expressivity from the very start so you can't"}, {"start": 1359.48, "end": 1365.0, "text": " train it and then probably other factors come into play other factors than you"}, {"start": 1365.0, "end": 1370.52, "text": " can simply determine with this particular score but you know there is this"}, {"start": 1370.52, "end": 1377.36, "text": " relationship that's that's you know you can see that and they do some"}, {"start": 1377.36, "end": 1382.24, "text": " ablations on this here for example are your scores a proxy for a number of"}, {"start": 1382.24, "end": 1388.4, "text": " parameters and they say no the number of parameters works way worse than this"}, {"start": 1388.4, "end": 1393.48, "text": " particular score which you know is a is a cool thing then how important is"}, {"start": 1393.48, "end": 1399.72, "text": " a specific mini batch and initialization and they say look right here we for some"}, {"start": 1399.72, "end": 1404.72, "text": " architectures we do different mini batch sizes and you can see each of those"}, {"start": 1404.72, "end": 1409.92, "text": " groups they don't vary too much in how their it influences their score right"}, {"start": 1409.92, "end": 1413.76, "text": " this is I believe this is the same architecture so it's always an architecture"}, {"start": 1413.76, "end": 1418.84, "text": " that achieves in this case for example wow that's not a straight line"}, {"start": 1418.84, "end": 1424.6, "text": " 77% or so and you can see if you go for different mini batches the score"}, {"start": 1424.6, "end": 1432.56, "text": " varies only minimally initialization is a bigger variance inducing thing but"}, {"start": 1432.56, "end": 1437.6799999999998, "text": " also here the scores don't vary too much but it is interesting that the"}, {"start": 1437.6799999999998, "end": 1442.04, "text": " different initialization to get you to different score because it would"}, {"start": 1442.04, "end": 1447.08, "text": " directly support kind of my hypothesis that what's going on here is that you"}, {"start": 1447.08, "end": 1453.12, "text": " sort of measure initial degeneracies and you can sort of make up for these"}, {"start": 1453.12, "end": 1457.36, "text": " initial degeneracies in the architecture sometimes with sort of a different"}, {"start": 1457.36, "end": 1462.6799999999998, "text": " initialization so the different initializations give you differently performing"}, {"start": 1462.6799999999998, "end": 1466.0, "text": " networks we already know this from things like you know lottery ticket"}, {"start": 1466.0, "end": 1471.24, "text": " hypothesis and so on that the initialization can matter to some degree in these"}, {"start": 1471.24, "end": 1476.48, "text": " types of things now that being said they always train to the same it seems but"}, {"start": 1476.48, "end": 1482.0, "text": " their their score varies so I might be backwards correct here or not correct"}, {"start": 1482.0, "end": 1490.24, "text": " but in any case the initialization here matters more but also you can still see"}, {"start": 1490.24, "end": 1496.76, "text": " this linear relationship and this is particularly interesting this is even the"}, {"start": 1496.76, "end": 1501.8, "text": " case when you just input white noise so instead of the data you measure that"}, {"start": 1501.8, "end": 1506.96, "text": " score by just inputting noise that I guess has some sort of the same magnitude"}, {"start": 1506.96, "end": 1511.3999999999999, "text": " as the data would have but it's just noise and you can still sort of see this"}, {"start": 1511.3999999999999, "end": 1516.8, "text": " linear relationship which is very interesting and that I think also shows some"}, {"start": 1516.8, "end": 1523.0, "text": " that you what you're fine what you find is a property of the network itself and"}, {"start": 1523.0, "end": 1528.68, "text": " the fact that it is it is initialized and built in such a way that it allows"}, {"start": 1528.68, "end": 1537.3600000000001, "text": " you to train it in a very in a sort of a benign manner it has no degeneracies"}, {"start": 1537.3600000000001, "end": 1549.1200000000001, "text": " okay so in last experiment they go here and they say we evaluate the score on"}, {"start": 1549.1200000000001, "end": 1553.92, "text": " initialized networks in the PyTorch CV library so they go to this library that"}, {"start": 1553.92, "end": 1558.1200000000001, "text": " has a lot of these networks but these networks are not the same as this bench"}, {"start": 1558.12, "end": 1561.9199999999998, "text": " mark this bench mark is specifically designed to do architecture search now the"}, {"start": 1561.9199999999998, "end": 1567.1599999999999, "text": " networks in this library they are all designed to perform really well some are"}, {"start": 1567.1599999999999, "end": 1571.4799999999998, "text": " designed to be quite small some are designed to be quite fast and so on but in"}, {"start": 1571.4799999999998, "end": 1576.28, "text": " general they are all of their goal is to perform well and they have been sort of"}, {"start": 1576.28, "end": 1581.84, "text": " found by humans to perform well so they take now these networks on C410 and"}, {"start": 1581.84, "end": 1587.28, "text": " they test them so as you can see here here is the test accuracy again and here is"}, {"start": 1587.28, "end": 1595.08, "text": " their score that they give it and they say rip it up okay move this anymore"}, {"start": 1595.08, "end": 1608.08, "text": " hello okay they say that this linear relationship still sort of holds it"}, {"start": 1608.08, "end": 1613.16, "text": " doesn't it doesn't hold super super well but you can still sort of if you"}, {"start": 1613.16, "end": 1621.0800000000002, "text": " squint if you squint hard you can see that it sort of goes upward though you"}, {"start": 1621.0800000000002, "end": 1627.16, "text": " really have to squint hard like what are these things right here and what again"}, {"start": 1627.16, "end": 1632.64, "text": " what's the case is that if the score is low you will sort of be able to cut off"}, {"start": 1632.64, "end": 1639.3200000000002, "text": " the cut off the worst performing ones but really at the top here it doesn't"}, {"start": 1639.32, "end": 1646.8799999999999, "text": " seem like there is a particular relation between between these networks and"}, {"start": 1646.8799999999999, "end": 1652.24, "text": " this initial score which sort of strengthens my hypothesis that what this"}, {"start": 1652.24, "end": 1658.6, "text": " does is just kind of weed out the bad ones but it's pretty cool because you can"}, {"start": 1658.6, "end": 1662.84, "text": " weed out the bad ones without any training right you simply forward prop"}, {"start": 1662.84, "end": 1669.08, "text": " backward prop there you have it so cool now they come they here is the experiment"}, {"start": 1669.08, "end": 1674.12, "text": " where they now really do this NAS benchmark and they compare with other"}, {"start": 1674.12, "end": 1679.3999999999999, "text": " methods so some of these other methods are designed to do the called weight"}, {"start": 1679.3999999999999, "end": 1683.36, "text": " sharing which basically is a technique where you can sort of speed up the"}, {"start": 1683.36, "end": 1688.52, "text": " speed up the algorithm as compared to non-weight sharing and the non-weight"}, {"start": 1688.52, "end": 1693.4399999999998, "text": " sharing that's one of these we have discussed initially that was my"}, {"start": 1693.4399999999998, "end": 1697.9199999999998, "text": " initial example with the controller and so on where it takes super long so"}, {"start": 1697.92, "end": 1705.4, "text": " here you see the method and how long each method takes now the best ones as"}, {"start": 1705.4, "end": 1713.72, "text": " you can see already the best ones here or these these methods right here are"}, {"start": 1713.72, "end": 1720.2, "text": " the best ones they score somewhat like a 93.9 or so on c4 10 where as these"}, {"start": 1720.2, "end": 1724.3600000000001, "text": " weight sharing ones they don't perform too well except this one seems to"}, {"start": 1724.36, "end": 1731.76, "text": " perform quite well and in this hours case they perform worse than that but they"}, {"start": 1731.76, "end": 1736.6, "text": " still perform better than a lot of the weight sharing ones so what their point"}, {"start": 1736.6, "end": 1744.4399999999998, "text": " is basically is that they get a pretty good score which is a 91.5 on c4 10 which"}, {"start": 1744.4399999999998, "end": 1751.12, "text": " is no it's at least not degenerate it's a it's a good accuracy they score that"}, {"start": 1751.12, "end": 1759.1999999999998, "text": " with simply evaluating 10 architectures right and as N goes up as they"}, {"start": 1759.1999999999998, "end": 1766.08, "text": " evaluate more and more architectures they do they do get better but not much so"}, {"start": 1766.08, "end": 1773.32, "text": " they have a discussion here I'm having trouble moving this all right so we'll"}, {"start": 1773.32, "end": 1778.4399999999998, "text": " sort of go through the discussion we report results yada yada yada as the"}, {"start": 1778.44, "end": 1782.88, "text": " non-weight sharing methods are given a time budget of 12,000 seconds for our"}, {"start": 1782.88, "end": 1787.2, "text": " method and the non-weight sharing methods are averaged accuracy are averaged"}, {"start": 1787.2, "end": 1791.72, "text": " over 500 runs for weight sharing methods accuracy are reported over three"}, {"start": 1791.72, "end": 1798.6000000000001, "text": " runs with the exception of gdas our method is able to perform all the"}, {"start": 1798.6000000000001, "end": 1802.4, "text": " weight sharing methods while requiring a fraction of the search time and that"}, {"start": 1802.4, "end": 1806.0, "text": " you may see at the table this is the real I mean this is the real deal here"}, {"start": 1806.0, "end": 1812.0, "text": " they only use here 1.7 seconds compared to the 12,000 seconds of the other"}, {"start": 1812.0, "end": 1818.48, "text": " methods and you reach almost the same accuracy now to be said 2% in this"}, {"start": 1818.48, "end": 1823.44, "text": " particular regime on c4 10 is still a sizable difference and that's the same"}, {"start": 1823.44, "end": 1828.36, "text": " benchmark right with the same sort of the same training schedule and so on so"}, {"start": 1828.36, "end": 1832.36, "text": " there's not too much room to tune here you simply have to find a better"}, {"start": 1832.36, "end": 1840.8799999999999, "text": " architecture so these things are still sizably ahead of this and what it"}, {"start": 1840.8799999999999, "end": 1845.3999999999999, "text": " appears to me that these methods here that don't perform well they're"}, {"start": 1845.3999999999999, "end": 1851.52, "text": " simply crap it seems they're simply I don't know but they might be trying out"}, {"start": 1851.52, "end": 1858.6799999999998, "text": " something or you know doing something researchy or whatnot but it seems like"}, {"start": 1858.68, "end": 1864.16, "text": " if you're well able to weed out the bad architectures you might be getting to a"}, {"start": 1864.16, "end": 1871.16, "text": " score like this and then if you are actually performing a search to find the"}, {"start": 1871.16, "end": 1876.24, "text": " best one then you might be getting to somewhere like this and you can see this"}, {"start": 1876.24, "end": 1883.04, "text": " here throughout so in c4 100 they achieve a better score than these things but a"}, {"start": 1883.04, "end": 1889.56, "text": " worse score than the non-weight sharing method and in ImageNet it gets even the"}, {"start": 1889.56, "end": 1897.3999999999999, "text": " difference is even larger so again what I can see here is that there's a good"}, {"start": 1897.3999999999999, "end": 1905.24, "text": " method to maybe get you like let's say 90% of the way you want to go and"}, {"start": 1905.24, "end": 1910.6399999999999, "text": " what's interesting is that here they say we also show the effect of sample size"}, {"start": 1910.64, "end": 1914.2, "text": " we showed accuracy of the networks chosen by our method for each end so that's"}, {"start": 1914.2, "end": 1919.0800000000002, "text": " the sample size we list the optimal accuracy for sample sizes 10 and 100 and"}, {"start": 1919.0800000000002, "end": 1925.16, "text": " random selection over the whole benchmark so in this case they have the the"}, {"start": 1925.16, "end": 1929.16, "text": " optimal one which I guess they just draw 10 samples and then take the best one"}, {"start": 1929.16, "end": 1932.8400000000001, "text": " so they train all of them and then take the best one you can see that already"}, {"start": 1932.84, "end": 1940.8, "text": " gets you to the 93 and whereas in their case sometimes when they add more they"}, {"start": 1940.8, "end": 1945.3999999999999, "text": " get worse so here they get better but then they get worse again so they comment on"}, {"start": 1945.3999999999999, "end": 1952.1599999999999, "text": " this right here we observe that the sample size does not have a large effect on"}, {"start": 1952.1599999999999, "end": 1955.9199999999998, "text": " the accuracy of our method but note that as sample size increases our method"}, {"start": 1955.9199999999998, "end": 1960.56, "text": " suffers from a small amount of noise increasing the gap between our score and"}, {"start": 1960.56, "end": 1968.3999999999999, "text": " the optimal result and of course the key practical benefit is execution time so"}, {"start": 1968.3999999999999, "end": 1974.36, "text": " again they are massively faster than the other methods but to me it seems you"}, {"start": 1974.36, "end": 1980.04, "text": " could just think of combining these methods right you combine this with this"}, {"start": 1980.04, "end": 1985.3999999999999, "text": " in that what you want to do is actually actively search for the best ones but"}, {"start": 1985.3999999999999, "end": 1990.32, "text": " by doing so you could if you could pretty quickly weed out the bad ones using"}, {"start": 1990.32, "end": 1996.6399999999999, "text": " this method down here you might already have like a big speed up because again"}, {"start": 1996.6399999999999, "end": 2002.12, "text": " with comparison to this random ones what appears to happen is that they get good"}, {"start": 2002.12, "end": 2008.3999999999999, "text": " at finding you know you're 90% architecture but then they fail to differentiate"}, {"start": 2008.3999999999999, "end": 2013.6, "text": " the top performance performers from each other where you'd really have to"}, {"start": 2013.6, "end": 2022.76, "text": " train the network to find out what's you know which ones better so yeah here"}, {"start": 2022.76, "end": 2027.1599999999999, "text": " they say they visualize the trade-off between search time and accuracy for C410"}, {"start": 2027.1599999999999, "end": 2031.6399999999999, "text": " for different NES algorithms on the NES benchmark by removing the need for"}, {"start": 2031.6399999999999, "end": 2035.28, "text": " training our method is able to find accurate networks in seconds instead of"}, {"start": 2035.28, "end": 2040.1999999999998, "text": " hours and here you can see the accuracy and here you can see the time and all the"}, {"start": 2040.2, "end": 2047.92, "text": " the good ones are either way over here or here and there's is almost at at"}, {"start": 2047.92, "end": 2055.8, "text": " zero while being quite close to the accuracy of the other ones all right yeah"}, {"start": 2055.8, "end": 2062.48, "text": " that was that was this paper again I think this is pretty valuable if you are"}, {"start": 2062.48, "end": 2067.36, "text": " especially if you're in a new domain where you might not know what kind of"}, {"start": 2067.36, "end": 2071.56, "text": " network to build you might just be able to write a little script that generates"}, {"start": 2071.56, "end": 2075.76, "text": " networks run it through this algorithm and at least you get an idea of which"}, {"start": 2075.76, "end": 2080.56, "text": " ones are certainly not worth considering and then you can simply select one of"}, {"start": 2080.56, "end": 2084.6800000000003, "text": " the other ones it doesn't you know often it doesn't need to be the best ones"}, {"start": 2084.6800000000003, "end": 2088.7200000000003, "text": " and you can then tweak it a little bit manually the ones you found maybe you see"}, {"start": 2088.7200000000003, "end": 2093.76, "text": " some regularity and yeah that was my two cents on this paper I hope you liked it"}, {"start": 2093.76, "end": 2098.2400000000002, "text": " if you did consider sharing it out and telling your friends about it and"}, {"start": 2098.2400000000002, "end": 2104.6000000000004, "text": " subscribing liking and leave a comment if you agree or disagree that was it bye"}, {"start": 2104.6, "end": 2134.48, "text": " bye"}] |
Yannic Kilcher | 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 ENJ Goodfellow at all. 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 Nurips or back then Nips in 2016, and every other paper was about Gans. It was, there was also this famous Schmidt Hooper, 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 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 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 was the first paper that made something like this really work for data. So to have a discriminator, 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 than coming from the database. So you want a 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 counterfeiter, like from this generator G. And it's supposed to say whether it's data fixed. So you train the D model as a simple image classifier. So people already knew how to build image classifiers. This was shortly as you can see before ResNet came on the scene. So people already 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 VEC was kind of coming up, but they would still be doing RNNs using these were to VEC vectors for generating language. In images, this 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 are the factory. And there are also approaches like deep belief networks and so on, but they had their own problems. So there wasn't really a satisfactory way to do image generation that resulted in here 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. This has been evident in these since AlexNet. So for two years, this was evident how to build really good image classifiers. And the question here is to say that rather than also building really good generators, can't we harness the power of building really good classifiers for training a generator? Right. And 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. 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 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. So the generator's task now isn't to match any sort of data point. The generator's task is to produce images that the discriminator would classify as data. And you can do that by simply backpropagating through the discriminator to the generator. Okay. So I think 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 mini max to 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? If you were to say, you would be like, yeah, so I can understand the motivation here to really convince people that, you know, something good is happening also 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 perceptron, the entire system can be trained with back propagation. There is no need for any mark of 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 B. And this is 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 are kind of adversarial and they pump each other up and so on. And this here was much more into the direction of kind of 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 have, there is 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 the 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. So if 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 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 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 terms right here. However, the generator only appears right here. Okay. And 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 class of 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 1 minus D, also instead of log 1 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, gang 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. Maybe 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 seem to 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. So this strategy is analogous to other things. Training maintains samples from a mark of chain from one learning step in the next order to avoid burning in a mark of chain in another loop of learning. Sorry. Okay. This is from another paper. But it's analogous to other papers that use these mark of 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 minimization over G. This has already been around the fact that you kind of have to have these optimizations in lock step but the difference here is you don't need any sort of like a mark of 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, for example, 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 maximize D the discriminator and that gives you this blue line right here. So 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 we first trained the discriminator and now in a second step, we optimise the generator. So now we shift this green curve over in order to 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, discreet. 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 peak at the training data. But also, 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 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 GAN, 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 form because it penalizes different errors differently. So of course, people have come up with ways 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 pretty much what we used today. The early days of GAN were still like how much do I need to discriminate per generator and so on. Nowadays, everyone is just using one step here, one step there, or even training it jointly works in some cases. So you want to sample a mini batch of noise samples. And you want to sample a mini batch of M examples from training data generation. So from this data, you want to update the discriminator by ascending 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 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 we just put it here. But this was not clear at all. This was kind of an invention of this paper because you could 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 almost train the discriminator in the inner loop. And that's simply the consequence of this, of a point wise. This is true point wise, 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 4. 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 4. Now if you then plug that into the other equation, you'll see that the training criteria here, and ends up being negative log 4 plus twice the gents and 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 4. And therefore, the negative log 4 is the optimum. Okay. That's, the proof 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 converges 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 their minimum. However, in practice adversarial nets represent a limited family of distributions via the function. And we optimize the parameters rather than the distribution itself using a multilayer perceptron to define g introduces multiple critical points in parameter space. However, the excellent performance of the multilayer perceptrons in practice suggests that they are a reasonable model to use despite their lack of theoretical guarantees. So they say if we could optimize this 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 these probability distributions with a reasonable degree of freedom and the neural networks provide that reasonable degree of freedom and give us good hope that in practice, it will work. So they apply this to datasets, namely, MNIST, the Toronto Face Database and C410. The generator nets use the mixture of rectifier linear activations and sigmoid activations, while the discriminator net used max out activations. That was still a thing. Dropout was applied in training and the discriminator net, while our theoretical framework, 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? We have these inception distances and so on, but then we estimate probability of the test set under p on the regenerated data by fitting a Gaussian parsing 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 how to evaluate such models. They were absolutely right in this. There was a lot of research into how to evaluate these models. However, it is my opinion that we still have very, very limited methods of evaluating models like this. 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, 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 who are kind of popular at the time. You can see the samples right here were in no way comparable to samples that you get from the modern GANS, but this was already very, very, very good, especially the MNZ. And then here you could actually recognize. So once what 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, 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. But the last one was a convolutional discriminator and a deconvoluitional generator. So already using kind of deconvolutions that are used everywhere today. So they are used in GANS and whatnot. The VAE is to up sample anything if you want to do pixel wise classification, you use deconvolutions. So again, 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 we still use them. So legit, they were the first GANS paper to use deconvolutions. Ha ha. 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. No. Doesn't work anymore. I'm sorry. Yours has always has to be better than everything else nowadays. Otherwise, it's a weak rejecter experimental evidence 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 GANS paper had interpolations in the GANS spike. And it came all came from here. So already, this is just like every GANS paper then had rows of these interpolations. I should know if I read the paper on it and introduced right here. Who knows if they hadn't done this, I guess it's kind of an obvious thing, but still 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 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 was used to obtain gradients. No inferences needed during learning. And a wide variety of functions can be incorporated into the model. This, you know, I hadn't read this paper in a while and I just have to laugh nowadays. Because 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 sample or somewhere. You're like, no, the point was to get rid of it. And like no inferences 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 funny to see people kind of trying 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 straight forward. Learned 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, so if you have the G network producing some producing at X and then the D network discriminating that you also have like a encoder right here to produce back the Z noise to give you the latent encoding, sort of like a variation order encoder, 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 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, you know, dropping this on the world. Absolutely cool. Mad respect. So yeah, this was kind of my take on general, yeah, it is generative adversarial nets. And yeah, 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 from me. I wish you a nice day. Bye bye. | [{"start": 0.0, "end": 7.12, "text": " Hi there, today we'll look at Generative Adversarial Nets by ENJ Goodfellow at all."}, {"start": 7.12, "end": 13.36, "text": " So this one is another installment in our series of historical papers that had great impact."}, {"start": 13.36, "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 Nurips 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 Schmidt Hooper, Goodfellow moment at the tutorial."}, {"start": 49.2, "end": 55.040000000000006, "text": " It was a wild time, and this is the paper that started it all."}, {"start": 55.04, "end": 58.56, "text": " And the paper is quite well written."}, {"start": 58.56, "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.84, "text": " that it doesn't just do wild things."}, {"start": 69.84, "end": 76.4, "text": " And also it is already quite, has a lot of the, it has a lot of sort of the modern tricks"}, {"start": 76.4, "end": 79.44, "text": " for Gans already sort of built into it."}, {"start": 79.44, "end": 85.88, "text": " So astounding how much foresight there was already in this paper, but of course, Gans"}, {"start": 85.88, "end": 89.92, "text": " have come like a super long way since then."}, {"start": 89.92, "end": 95.12, "text": " And today we'll just go through the paper and look at how it looked back then and what"}, {"start": 95.12, "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": 109.52, "text": " This is not going to be like a beginner's tutorial in Gans."}, {"start": 109.52, "end": 112.32, "text": " This is really going to be, we'll go through the paper."}, {"start": 112.32, "end": 117.2, "text": " You'll see right here the paper is from 2014."}, {"start": 117.2, "end": 123.8, "text": " So it would still be another like two years or so until Gans really take off from this"}, {"start": 123.8, "end": 129.16, "text": " point on, but the introduction of course was really important."}, {"start": 129.16, "end": 131.88, "text": " Okay, so abstract."}, {"start": 131.88, "end": 132.96, "text": " Here we go."}, {"start": 132.96, "end": 139.08, "text": " We propose a new framework for estimating generative models via an adversarial process"}, {"start": 139.08, "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": 154.68, "text": " came from the training data rather than G."}, {"start": 154.68, "end": 156.64000000000001, "text": " Okay, this was sort of a new thing."}, {"start": 156.64000000000001, "end": 162.28, "text": " Now I know, I know people disagree with this being a new thing, but this was a new thing."}, {"start": 162.28, "end": 168.48, "text": " And specifically this was the first paper that made something like this really work for"}, {"start": 168.48, "end": 169.48, "text": " data."}, {"start": 169.48, "end": 176.28, "text": " So to have a discriminator, and the words generator and discriminator were also introduced"}, {"start": 176.28, "end": 177.68, "text": " in this paper."}, {"start": 177.68, "end": 183.68, "text": " So you train this D model, which is the discriminator, and the D model basically decides whether or"}, {"start": 183.68, "end": 192.26, "text": " not a given data point comes from data or comes from the fake distribution."}, {"start": 192.26, "end": 200.07999999999998, "text": " And then you have a generative model G that is supposed to just create this data X rather"}, {"start": 200.07999999999998, "end": 202.23999999999998, "text": " than coming from the database."}, {"start": 202.23999999999998, "end": 207.76, "text": " So you want a sample, a couple of times from the data, and sometimes you sample from this"}, {"start": 207.76, "end": 213.76, "text": " model G, and then the discriminator is supposed to decide whether or not it comes from the"}, {"start": 213.76, "end": 222.79999999999998, "text": " data set or from your counterfeiter, like from this generator G."}, {"start": 222.79999999999998, "end": 225.67999999999998, "text": " And it's supposed to say whether it's data fixed."}, {"start": 225.67999999999998, "end": 229.48, "text": " So you train the D model as a simple image classifier."}, {"start": 229.48, "end": 232.84, "text": " So people already knew how to build image classifiers."}, {"start": 232.84, "end": 238.92, "text": " This was shortly as you can see before ResNet came on the scene."}, {"start": 238.92, "end": 244.48, "text": " So people already knew how to build CNNs, build really good image classifiers."}, {"start": 244.48, "end": 251.07999999999998, "text": " And the thought here was really, generative models weren't really a thing until then."}, {"start": 251.07999999999998, "end": 256.59999999999997, "text": " So people were in language models, were to VEC was kind of coming up, but they would"}, {"start": 256.59999999999997, "end": 262.96, "text": " still be doing RNNs using these were to VEC vectors for generating language."}, {"start": 262.96, "end": 267.4, "text": " In images, this generative models weren't really much of a thing."}, {"start": 267.4, "end": 273.32, "text": " So you would do like compositional models or you would do auto encoders, which were just"}, {"start": 273.32, "end": 278.59999999999997, "text": " either really blurry or really, really are the factory."}, {"start": 278.59999999999997, "end": 283.12, "text": " And there are also approaches like deep belief networks and so on, but they had their own"}, {"start": 283.12, "end": 284.12, "text": " problems."}, {"start": 284.12, "end": 289.56, "text": " So there wasn't really a satisfactory way to do image generation that resulted in here"}, {"start": 289.56, "end": 292.96, "text": " really high quality images."}, {"start": 292.96, "end": 297.35999999999996, "text": " Now here, I think the entire thought and this is not really spelled out, but the entire"}, {"start": 297.36, "end": 305.56, "text": " thought here is that, hey, we know how to train really, really good image classifiers."}, {"start": 305.56, "end": 309.44, "text": " This has been evident in these since AlexNet."}, {"start": 309.44, "end": 314.0, "text": " So for two years, this was evident how to build really good image classifiers."}, {"start": 314.0, "end": 319.92, "text": " And the question here is to say that rather than also building really good generators,"}, {"start": 319.92, "end": 327.12, "text": " can't we harness the power of building really good classifiers for training a generator?"}, {"start": 327.12, "end": 328.12, "text": " Right."}, {"start": 328.12, "end": 329.52, "text": " And this is this idea right here."}, {"start": 329.52, "end": 330.72, "text": " This wasn't the one before."}, {"start": 330.72, "end": 335.88, "text": " As you know, in like an auto encoder, what you do is you input a sample into some kind"}, {"start": 335.88, "end": 338.76, "text": " of auto bottleneck thing, whatever."}, {"start": 338.76, "end": 345.96, "text": " And then at the end, you train your output sample to match the input sample as close as possible."}, {"start": 345.96, "end": 350.64, "text": " And then in here, after you've trained this, this part here is your generative model."}, {"start": 350.64, "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": 372.96, "text": " So you would somehow say, ah, the output here should probably match the input in some way"}, {"start": 372.96, "end": 377.72, "text": " or in some at least distributional way."}, {"start": 377.72, "end": 378.64, "text": " This was a new thing."}, {"start": 378.64, "end": 385.08, "text": " As you can see right here, there is no direct connection between the data and the generator."}, {"start": 385.08, "end": 391.15999999999997, "text": " And I think this was the success of this model, the fact that the generator did not."}, {"start": 391.15999999999997, "end": 392.91999999999996, "text": " It wasn't trained from the data."}, {"start": 392.91999999999996, "end": 395.91999999999996, "text": " Like you would do if you were just approaching this problem."}, {"start": 395.91999999999996, "end": 402.68, "text": " But the philosophy here is, let's use the power of discriminative models, which we know"}, {"start": 402.68, "end": 406.84, "text": " how to build in order to train this generator."}, {"start": 406.84, "end": 411.0, "text": " So the generator's task now isn't to match any sort of data point."}, {"start": 411.0, "end": 417.64, "text": " The generator's task is to produce images that the discriminator would classify as data."}, {"start": 417.64, "end": 423.8, "text": " And you can do that by simply backpropagating through the discriminator to the generator."}, {"start": 423.8, "end": 424.56, "text": " Okay."}, {"start": 424.56, "end": 430.12, "text": " So I think that's the only thing that's kind of unstated in this paper."}, {"start": 430.12, "end": 435.28, "text": " The reasoning behind why this is new, why this might work."}, {"start": 435.28, "end": 439.48, "text": " But everything else is spelled out very well in this paper."}, {"start": 439.48, "end": 442.20000000000005, "text": " I have to say if you read through it."}, {"start": 442.20000000000005, "end": 450.48, "text": " So the training procedure for G is to maximize the probability of D making a mistake."}, {"start": 450.48, "end": 453.92, "text": " This framework corresponds to a mini max to player game."}, {"start": 453.92, "end": 457.88, "text": " So as I said, the paper is very much focused on convincing you that there's something"}, {"start": 457.88, "end": 459.08000000000004, "text": " sound happening here."}, {"start": 459.08000000000004, "end": 463.56, "text": " Because at that time, if you were to look at this, you would say something like, there"}, {"start": 463.56, "end": 465.04, "text": " is no way."}, {"start": 465.04, "end": 466.04, "text": " Right?"}, {"start": 466.04, "end": 473.88, "text": " If you were to say, you would be like, yeah, so I can understand the motivation here to"}, {"start": 473.88, "end": 480.84000000000003, "text": " really convince people that, you know, something good is happening also on the theoretical side."}, {"start": 480.84000000000003, "end": 486.52000000000004, "text": " In the space, sorry, in the space of arbitrary functions, G and D, a unique solution exists"}, {"start": 486.52000000000004, "end": 491.92, "text": " with G recovering the training data distribution, D equals to one half everywhere."}, {"start": 491.92, "end": 495.96000000000004, "text": " In the case where G and D are defined by multi layer perceptron, the entire system can"}, {"start": 495.96000000000004, "end": 497.72, "text": " be trained with back propagation."}, {"start": 497.72, "end": 502.72, "text": " There is no need for any mark of chains or unrolled approximate inference networks during"}, {"start": 502.72, "end": 505.84000000000003, "text": " either training or generation of samples."}, {"start": 505.84000000000003, "end": 506.84000000000003, "text": " Okay."}, {"start": 506.84000000000003, "end": 513.76, "text": " So the point here is that it's much easier than current methods of producing of generative"}, {"start": 513.76, "end": 514.76, "text": " models."}, {"start": 514.76, "end": 518.9200000000001, "text": " And also it does something sound."}, {"start": 518.92, "end": 525.04, "text": " Now let's jump into the loss function right here."}, {"start": 525.04, "end": 533.1999999999999, "text": " So they say G and D play the following two player mini max game with value function B."}, {"start": 533.1999999999999, "end": 542.0, "text": " And this is still understood until today that it was already like, if this was a pure"}, {"start": 542.0, "end": 545.8399999999999, "text": " engineering paper, they could simply build the architecture and say, oh, we let these"}, {"start": 545.84, "end": 552.96, "text": " networks fight and they are kind of adversarial and they pump each other up and so on."}, {"start": 552.96, "end": 559.0400000000001, "text": " And this here was much more into the direction of kind of a theoretical reasoning into why"}, {"start": 559.0400000000001, "end": 560.76, "text": " something like this would work."}, {"start": 560.76, "end": 566.1600000000001, "text": " Of course, there are still a lot of engineering going on to actually make it work."}, {"start": 566.1600000000001, "end": 571.2, "text": " So they have, there is this value function right here."}, {"start": 571.2, "end": 572.2, "text": " Okay."}, {"start": 572.2, "end": 574.24, "text": " And the value function is the following."}, {"start": 574.24, "end": 583.72, "text": " So what you have is you have the log probability of data and you have one, the log one minus"}, {"start": 583.72, "end": 586.28, "text": " the of the generated samples."}, {"start": 586.28, "end": 588.6, "text": " So here you can see and this was introduced."}, {"start": 588.6, "end": 591.0, "text": " This seems also obvious now, right."}, {"start": 591.0, "end": 596.4, "text": " But you have a prior on what this is called the noise distribution."}, {"start": 596.4, "end": 597.4, "text": " Okay."}, {"start": 597.4, "end": 602.72, "text": " So if a prior on your input noise to the generator, because the generator is supposed"}, {"start": 602.72, "end": 606.4, "text": " to come up with very many different data points."}, {"start": 606.4, "end": 614.0400000000001, "text": " And if it is a, if it is a non-stochastic function like a neural network, then you need some"}, {"start": 614.0400000000001, "end": 617.0, "text": " way to make to produce different images."}, {"start": 617.0, "end": 621.0, "text": " So there is this prior distribution over the noise."}, {"start": 621.0, "end": 623.52, "text": " You feed that noise into the generator."}, {"start": 623.52, "end": 625.88, "text": " The generator will produce an output."}, {"start": 625.88, "end": 628.48, "text": " You put that into the discriminator."}, {"start": 628.48, "end": 633.5600000000001, "text": " And then this right here, as you can see, the discriminator is trying to maximize this"}, {"start": 633.5600000000001, "end": 635.04, "text": " objective."}, {"start": 635.04, "end": 640.28, "text": " So the discriminator is trying to maximize the probability of real data and it is trying"}, {"start": 640.28, "end": 644.2, "text": " to minimize the probability of fake data."}, {"start": 644.2, "end": 645.6800000000001, "text": " Okay."}, {"start": 645.6800000000001, "end": 650.72, "text": " It is, this is simply a two way classification problem."}, {"start": 650.72, "end": 656.0, "text": " At the same time, the generator, as you can see, is trying to minimize the objective."}, {"start": 656.0, "end": 659.12, "text": " In fact, the order here is quite important."}, {"start": 659.12, "end": 667.56, "text": " So the generator, as you can see, is trying to minimize whatever this here is."}, {"start": 667.56, "end": 673.32, "text": " So the generator sort of is trying to minimize against the best possible discriminator."}, {"start": 673.32, "end": 679.44, "text": " And so this is one observation right here, is that the formulation is always with respect"}, {"start": 679.44, "end": 681.96, "text": " to a perfect discriminator."}, {"start": 681.96, "end": 686.24, "text": " Now we know that this doesn't work because if you have a perfect discriminator, then generator"}, {"start": 686.24, "end": 691.44, "text": " cannot catch up because you have insufficient gradients and so on."}, {"start": 691.44, "end": 694.48, "text": " And this was already recognized in this paper as well."}, {"start": 694.48, "end": 701.84, "text": " But the formulation is with respect to a min max game and not a max min game."}, {"start": 701.84, "end": 708.9200000000001, "text": " So the other point I want to make here is that you can see the discriminator appears in"}, {"start": 708.9200000000001, "end": 711.36, "text": " both terms right here."}, {"start": 711.36, "end": 715.2, "text": " However, the generator only appears right here."}, {"start": 715.2, "end": 716.2, "text": " Okay."}, {"start": 716.2, "end": 721.72, "text": " And this basically means that the objective for the generator is only this part here because"}, {"start": 721.72, "end": 723.76, "text": " the other part is constant."}, {"start": 723.76, "end": 730.8000000000001, "text": " So the generator is just trying to make the discriminator think that fake data is real."}, {"start": 730.8000000000001, "end": 737.5600000000001, "text": " So it is trying to make the discriminator the class of fake data as small as possible"}, {"start": 737.56, "end": 745.04, "text": " for the data that it outputs, while the discriminator is trying to make the class of fake data"}, {"start": 745.04, "end": 748.5999999999999, "text": " more than the class of sorry, real data."}, {"start": 748.5999999999999, "end": 754.8, "text": " Yeah, it's trying to make it's trying to class of fake data as fake and real data as real."}, {"start": 754.8, "end": 757.28, "text": " Whereas the generator has only this part on the right."}, {"start": 757.28, "end": 761.5999999999999, "text": " This is, I feel this is, it's quite important."}, {"start": 761.5999999999999, "end": 762.5999999999999, "text": " Why?"}, {"start": 762.6, "end": 768.36, "text": " Because already in this paper they recognize that this might not be the best practical objective"}, {"start": 768.36, "end": 774.28, "text": " and for the generator, they can actually exchange this part here on the right to simply"}, {"start": 774.28, "end": 783.96, "text": " say we want to, so we want to instead of 1 minus D, also instead of log 1 minus D, we"}, {"start": 783.96, "end": 789.6800000000001, "text": " simply want to use minus log D as an objective for the generator."}, {"start": 789.68, "end": 793.4799999999999, "text": " So you can kind of play around with this and as you know, lots of formulations have played"}, {"start": 793.4799999999999, "end": 796.2399999999999, "text": " around with this loss right here."}, {"start": 796.2399999999999, "end": 802.4, "text": " And yeah, that's why we have like a billion, billion, billion, billion, gang variations."}, {"start": 802.4, "end": 805.8399999999999, "text": " They introduced the reasoning behind this."}, {"start": 805.8399999999999, "end": 809.64, "text": " So there's an intuition right here."}, {"start": 809.64, "end": 815.24, "text": " And you can see already in practice equation one may not provide sufficient gradient for G"}, {"start": 815.24, "end": 816.9599999999999, "text": " to learn well."}, {"start": 816.96, "end": 820.36, "text": " Maybe in learning when G is poor, D can reject samples with high confidence because they're"}, {"start": 820.36, "end": 822.2800000000001, "text": " clearly different from the training data."}, {"start": 822.2800000000001, "end": 828.12, "text": " In this case, this saturates rather than training G to minimize that, we can train G to"}, {"start": 828.12, "end": 830.52, "text": " maximize log D."}, {"start": 830.52, "end": 834.1600000000001, "text": " This objective function results in the same fixed point for the dynamic, but provides"}, {"start": 834.1600000000001, "end": 839.6, "text": " much stronger gradients in early, much stronger gradients early in learning."}, {"start": 839.6, "end": 844.44, "text": " This is in contrast to like other papers that seem to say, oh, we do this and they at least"}, {"start": 844.44, "end": 847.6800000000001, "text": " say it provides the same fixed point, right?"}, {"start": 847.6800000000001, "end": 848.6800000000001, "text": " Yeah."}, {"start": 848.6800000000001, "end": 853.0400000000001, "text": " So again, they're trying to convince you that this is doing something useful and that this"}, {"start": 853.0400000000001, "end": 855.32, "text": " is easier."}, {"start": 855.32, "end": 859.24, "text": " So this strategy is analogous to other things."}, {"start": 859.24, "end": 865.08, "text": " Training maintains samples from a mark of chain from one learning step in the next order"}, {"start": 865.08, "end": 869.0, "text": " to avoid burning in a mark of chain in another loop of learning."}, {"start": 869.0, "end": 870.0, "text": " Sorry."}, {"start": 870.0, "end": 871.0, "text": " Okay."}, {"start": 871.0, "end": 872.0, "text": " This is from another paper."}, {"start": 872.0, "end": 879.0, "text": " But it's analogous to other papers that use these mark of chains where you always do one"}, {"start": 879.0, "end": 885.92, "text": " step in G and one step in D. We alternate between K steps of optimizing D and one step of optimizing"}, {"start": 885.92, "end": 892.76, "text": " G because you have this inner maximization over D and then the outer minimization over"}, {"start": 892.76, "end": 893.76, "text": " G."}, {"start": 893.76, "end": 898.28, "text": " This has already been around the fact that you kind of have to have these optimizations"}, {"start": 898.28, "end": 904.0799999999999, "text": " in lock step but the difference here is you don't need any sort of like a mark of chain"}, {"start": 904.0799999999999, "end": 905.48, "text": " in the inner loop and so on."}, {"start": 905.48, "end": 908.16, "text": " You simply need back propagation."}, {"start": 908.16, "end": 911.64, "text": " So here's an illustration of how that might work."}, {"start": 911.64, "end": 917.0799999999999, "text": " So at the beginning here, you have your Z space and this is always, for example, uniformly"}, {"start": 917.0799999999999, "end": 918.8, "text": " as you can see right here."}, {"start": 918.8, "end": 922.8399999999999, "text": " This is from a prior distribution and through the mapping."}, {"start": 922.8399999999999, "end": 926.8399999999999, "text": " So this here is from Z to X is G."}, {"start": 926.84, "end": 931.0400000000001, "text": " So this is the mapping G. You can see that the uniform distribution is now mapped to"}, {"start": 931.0400000000001, "end": 935.52, "text": " something non-uniform which results in the green thing."}, {"start": 935.52, "end": 937.76, "text": " So G is the green line."}, {"start": 937.76, "end": 943.5600000000001, "text": " While as this is data, the black dots are data."}, {"start": 943.5600000000001, "end": 950.4, "text": " And if you have a discriminator, the discriminator is supposed to tell you where there's data"}, {"start": 950.4, "end": 952.6800000000001, "text": " and where there's fake data."}, {"start": 952.6800000000001, "end": 955.64, "text": " Now, so green here is fake."}, {"start": 955.64, "end": 960.64, "text": " Now, this blue line is sort of a half-trained discriminator."}, {"start": 960.64, "end": 962.56, "text": " Now you train D, right?"}, {"start": 962.56, "end": 969.3199999999999, "text": " You maximize D the discriminator and that gives you this blue line right here."}, {"start": 969.3199999999999, "end": 975.16, "text": " So this is a perfect discriminator for these two data distributions."}, {"start": 975.16, "end": 980.96, "text": " It tells you it's basically the ratio of green to black at each point."}, {"start": 980.96, "end": 985.2800000000001, "text": " And now you train the generator according to this."}, {"start": 985.2800000000001, "end": 992.2, "text": " And you can see that the gradient of the discriminator is, so the gradient of the discriminator"}, {"start": 992.2, "end": 994.2, "text": " is in this direction."}, {"start": 994.2, "end": 995.2, "text": " Okay?"}, {"start": 995.2, "end": 997.4000000000001, "text": " So it's like up this hill."}, {"start": 997.4000000000001, "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.0400000000001, "text": " of the discriminator."}, {"start": 1005.04, "end": 1014.92, "text": " Note that we first trained the discriminator and now in a second step, we optimise the"}, {"start": 1014.92, "end": 1016.4, "text": " generator."}, {"start": 1016.4, "end": 1024.96, "text": " So now we shift this green curve over in order to along the gradient of the blue curve."}, {"start": 1024.96, "end": 1029.72, "text": " So it's important the green curve doesn't see the black curve ever."}, {"start": 1029.72, "end": 1031.44, "text": " The generator doesn't see the data."}, {"start": 1031.44, "end": 1037.0, "text": " The generator simply sees that blue curve and it goes along the gradient of that blue"}, {"start": 1037.0, "end": 1038.88, "text": " curve of the discriminator."}, {"start": 1038.88, "end": 1039.88, "text": " Okay?"}, {"start": 1039.88, "end": 1044.76, "text": " And then if you do this many, many steps, actually there are dots right here."}, {"start": 1044.76, "end": 1050.2, "text": " You will end up with a discriminator that has no clue what's where."}, {"start": 1050.2, "end": 1053.8, "text": " This is one half probability everywhere because the ratio is the same."}, {"start": 1053.8, "end": 1061.6399999999999, "text": " And you will end up with the probability of data equal to the probability of the output"}, {"start": 1061.6399999999999, "end": 1064.2, "text": " generated samples."}, {"start": 1064.2, "end": 1069.48, "text": " And this can happen if the generator simply remembers the training data, but there are"}, {"start": 1069.48, "end": 1071.68, "text": " a number of things that counter that."}, {"start": 1071.68, "end": 1079.0, "text": " For example, the generator is continuous while the training data is, of course, discreet."}, {"start": 1079.0, "end": 1085.28, "text": " So there is this in between things right here where there is no training data."}, {"start": 1085.28, "end": 1089.64, "text": " In fact, to hit exactly training data is very, very unlikely."}, {"start": 1089.64, "end": 1094.04, "text": " But of course, you can still peak at the training data."}, {"start": 1094.04, "end": 1099.92, "text": " But also, I think there are two things why the generator doesn't simply remember the"}, {"start": 1099.92, "end": 1104.88, "text": " training data first because it doesn't ever see the training data directly."}, {"start": 1104.88, "end": 1108.8000000000002, "text": " So it can only see it through the discriminator."}, {"start": 1108.8000000000002, "end": 1113.8000000000002, "text": " And second of all, because it is built as these multi-layer neural networks, it doesn't"}, {"start": 1113.8000000000002, "end": 1122.2, "text": " have the power to just remember this because as there is kind of this notion of continuous"}, {"start": 1122.2, "end": 1123.2800000000002, "text": " function."}, {"start": 1123.2800000000002, "end": 1128.1200000000001, "text": " So and these neural networks are rather smooth functions often."}, {"start": 1128.1200000000001, "end": 1133.72, "text": " And therefore, I think that is something that helps the generator avoid remembering the"}, {"start": 1133.72, "end": 1134.92, "text": " training data."}, {"start": 1134.92, "end": 1138.92, "text": " Of course, there is still this problem of mode collapse that was really big in GAN, so"}, {"start": 1138.92, "end": 1143.52, "text": " even if it doesn't remember the training data, it might focus on the easiest part of the"}, {"start": 1143.52, "end": 1146.44, "text": " training data and forget all other parts."}, {"start": 1146.44, "end": 1151.72, "text": " And that was a direct result actually of this objective."}, {"start": 1151.72, "end": 1153.56, "text": " So where was it?"}, {"start": 1153.56, "end": 1162.28, "text": " So this objective directly led to mode collapse in some form because it penalizes different"}, {"start": 1162.28, "end": 1164.04, "text": " errors differently."}, {"start": 1164.04, "end": 1170.04, "text": " So of course, people have come up with ways to solve that."}, {"start": 1170.04, "end": 1171.04, "text": " Okay."}, {"start": 1171.04, "end": 1173.96, "text": " Now, here is the algorithm."}, {"start": 1173.96, "end": 1181.72, "text": " As you can see, this was already quite, this was already quite the algorithm we use nowadays."}, {"start": 1181.72, "end": 1184.36, "text": " So for K steps, this is the inner maximization."}, {"start": 1184.36, "end": 1187.6, "text": " And here they say that we use K equals one."}, {"start": 1187.6, "end": 1190.32, "text": " So all this is pretty much what we used today."}, {"start": 1190.32, "end": 1195.28, "text": " The early days of GAN were still like how much do I need to discriminate per generator"}, {"start": 1195.28, "end": 1196.48, "text": " and so on."}, {"start": 1196.48, "end": 1202.28, "text": " Nowadays, everyone is just using one step here, one step there, or even training it jointly"}, {"start": 1202.28, "end": 1204.48, "text": " works in some cases."}, {"start": 1204.48, "end": 1207.6799999999998, "text": " So you want to sample a mini batch of noise samples."}, {"start": 1207.6799999999998, "end": 1214.28, "text": " And you want to sample a mini batch of M examples from training data generation."}, {"start": 1214.28, "end": 1218.8799999999999, "text": " So from this data, you want to update the discriminator by ascending its stochastic"}, {"start": 1218.88, "end": 1220.3600000000001, "text": " gradient."}, {"start": 1220.3600000000001, "end": 1222.8000000000002, "text": " And this is simply the gradient of the objective."}, {"start": 1222.8000000000002, "end": 1227.72, "text": " And then after those K steps, you want to sample another mini batch of noise samples and"}, {"start": 1227.72, "end": 1231.2800000000002, "text": " update the generator by descending its stochastic gradient."}, {"start": 1231.2800000000002, "end": 1236.3200000000002, "text": " And you can see right here already there is this reduced objective that doesn't include"}, {"start": 1236.3200000000002, "end": 1242.1200000000001, "text": " this because it falls away in the gradient, right?"}, {"start": 1242.1200000000001, "end": 1245.88, "text": " And they say the gradient based up this can use any standard learning based rule."}, {"start": 1245.88, "end": 1250.16, "text": " We use momentum in our experiments, very cool."}, {"start": 1250.16, "end": 1259.0400000000002, "text": " So I believe they already also say that it is somewhere here."}, {"start": 1259.0400000000002, "end": 1265.0800000000002, "text": " It's pretty fun that they say, oh, in our generator, we only input noise at the lowest"}, {"start": 1265.0800000000002, "end": 1266.0800000000002, "text": " layer."}, {"start": 1266.0800000000002, "end": 1272.16, "text": " This is also something that if you think that G here is a multi-layer network, so it's"}, {"start": 1272.16, "end": 1276.76, "text": " kind of a multi-layer network that outputs an image, right?"}, {"start": 1276.76, "end": 1281.0400000000002, "text": " And if you ask yourself, if I have noise, how would I input that into there?"}, {"start": 1281.0400000000002, "end": 1284.96, "text": " It's so clear nowadays that we just put it here."}, {"start": 1284.96, "end": 1286.64, "text": " But this was not clear at all."}, {"start": 1286.64, "end": 1292.0400000000002, "text": " This was kind of an invention of this paper because you could put it pretty much at all"}, {"start": 1292.0400000000002, "end": 1294.68, "text": " layers, you could distribute it and so on."}, {"start": 1294.68, "end": 1298.48, "text": " You could add some right here."}, {"start": 1298.48, "end": 1302.96, "text": " It was this paper that already established the fact that we input noise kind of as a"}, {"start": 1302.96, "end": 1308.04, "text": " vector at the very beginning and then just let the neural network produce the image from"}, {"start": 1308.04, "end": 1309.04, "text": " that."}, {"start": 1309.04, "end": 1311.6, "text": " So, yeah, pretty, pretty cool."}, {"start": 1311.6, "end": 1317.16, "text": " It's pretty sneaky how many things are hidden in these initial papers, how many decisions"}, {"start": 1317.16, "end": 1320.2, "text": " that are made there, then are just taken over."}, {"start": 1320.2, "end": 1324.2, "text": " And, you know, this one I guess turned out to be fairly, fairly good."}, {"start": 1324.2, "end": 1325.2, "text": " Okay."}, {"start": 1325.2, "end": 1331.72, "text": " So here they go for some theoretical analysis and the first they want to convince you that"}, {"start": 1331.72, "end": 1339.3600000000001, "text": " if the generator, if this all works well, if this, if both parties, this generator and"}, {"start": 1339.3600000000001, "end": 1347.8400000000001, "text": " the discriminator optimize their objective to the optimum, then the generator will have"}, {"start": 1347.8400000000001, "end": 1349.96, "text": " captured the data distribution."}, {"start": 1349.96, "end": 1353.6000000000001, "text": " So the global optimality of this."}, {"start": 1353.6, "end": 1356.32, "text": " And they go about convincing you of that."}, {"start": 1356.32, "end": 1362.7199999999998, "text": " So the first thing that they convince you of is that if you fix the generator, the optimal"}, {"start": 1362.7199999999998, "end": 1366.9599999999998, "text": " discriminator is this and we've already seen this in this drawing right here."}, {"start": 1366.9599999999998, "end": 1375.8799999999999, "text": " So the optimal discriminator is simply the ratio of the data of the likelihood of data"}, {"start": 1375.8799999999999, "end": 1379.3999999999999, "text": " versus the likelihood of the generated data."}, {"start": 1379.3999999999999, "end": 1380.3999999999999, "text": " Okay."}, {"start": 1380.4, "end": 1387.1200000000001, "text": " So you train, you almost train the discriminator in the inner loop."}, {"start": 1387.1200000000001, "end": 1391.24, "text": " And that's simply the consequence of this, of a point wise."}, {"start": 1391.24, "end": 1397.44, "text": " This is true point wise, therefore it's true over the entire data distribution."}, {"start": 1397.44, "end": 1405.0, "text": " In the next thing, they convince you that the global minimum of the virtual training"}, {"start": 1405.0, "end": 1410.2800000000002, "text": " criterion, and this is the value function, this min max game, is achieved if and"}, {"start": 1410.28, "end": 1412.92, "text": " only if this holds."}, {"start": 1412.92, "end": 1419.08, "text": " At that point, the training criterion achieves the value of negative log 4."}, {"start": 1419.08, "end": 1426.68, "text": " And this, again, this was already already here, the fact that this has a global minimum"}, {"start": 1426.68, "end": 1432.36, "text": " and it is achieved when the generator matches the data distribution, which is pretty cool."}, {"start": 1432.36, "end": 1438.3999999999999, "text": " So in the proof, it's pretty simple, actually, they first say, look, if this is the case,"}, {"start": 1438.4, "end": 1443.68, "text": " we just simply plug that in, this, the discriminator will be confused."}, {"start": 1443.68, "end": 1449.0, "text": " So if the generator exactly captures the data, the discriminator will have no clue what's"}, {"start": 1449.0, "end": 1450.92, "text": " going on, right?"}, {"start": 1450.92, "end": 1453.2, "text": " Because it can't, because they're equal."}, {"start": 1453.2, "end": 1457.88, "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 4."}, {"start": 1462.44, "end": 1468.3600000000001, "text": " Now if you then plug that into the other equation, you'll see that the training criteria"}, {"start": 1468.36, "end": 1473.4399999999998, "text": " here, and ends up being negative log 4 plus twice the gents and Shannon divergence between"}, {"start": 1473.4399999999998, "end": 1477.12, "text": " the data and the generated distribution."}, {"start": 1477.12, "end": 1483.1999999999998, "text": " And since this term here is always positive, that means that this thing here can never"}, {"start": 1483.1999999999998, "end": 1486.36, "text": " be less than negative log 4."}, {"start": 1486.36, "end": 1490.1999999999998, "text": " And therefore, the negative log 4 is the optimum."}, {"start": 1490.1999999999998, "end": 1491.1999999999998, "text": " Okay."}, {"start": 1491.1999999999998, "end": 1495.04, "text": " That's, the proof is pretty cool."}, {"start": 1495.04, "end": 1502.1599999999999, "text": " I have to say to show that this has the optimum at that place."}, {"start": 1502.1599999999999, "end": 1507.36, "text": " And the last thing they convince you of is that this algorithm actually converges."}, {"start": 1507.36, "end": 1513.0, "text": " And the converges is simply predicated on the fact that if you look at each of these problems"}, {"start": 1513.0, "end": 1515.6, "text": " individually, they are convex."}, {"start": 1515.6, "end": 1523.44, "text": " So like here is convex in x for every alpha."}, {"start": 1523.44, "end": 1532.6000000000001, "text": " So each of these are sort of convex problems, and then it will naturally converge to their"}, {"start": 1532.6000000000001, "end": 1534.0, "text": " minimum."}, {"start": 1534.0, "end": 1539.64, "text": " However, in practice adversarial nets represent a limited family of distributions via the"}, {"start": 1539.64, "end": 1540.64, "text": " function."}, {"start": 1540.64, "end": 1545.48, "text": " And we optimize the parameters rather than the distribution itself using a multilayer"}, {"start": 1545.48, "end": 1550.1200000000001, "text": " perceptron to define g introduces multiple critical points in parameter space."}, {"start": 1550.12, "end": 1554.2399999999998, "text": " However, the excellent performance of the multilayer perceptrons in practice suggests that"}, {"start": 1554.2399999999998, "end": 1559.08, "text": " they are a reasonable model to use despite their lack of theoretical guarantees."}, {"start": 1559.08, "end": 1565.1999999999998, "text": " So they say if we could optimize this probability distribution directly, it is a convex problem"}, {"start": 1565.1999999999998, "end": 1567.08, "text": " and we will always converge."}, {"start": 1567.08, "end": 1574.08, "text": " But in practice, of course, we only optimize the parameters of an MLP or a CNN and that"}, {"start": 1574.08, "end": 1580.36, "text": " doesn't always converge, but we have reasonable hopes that it will converge."}, {"start": 1580.36, "end": 1586.4399999999998, "text": " Okay, so again, it's very much focused on convincing me that this is doing something sensible,"}, {"start": 1586.4399999999998, "end": 1588.36, "text": " which I hope now you are convinced."}, {"start": 1588.36, "end": 1591.56, "text": " So there is a global optimum point."}, {"start": 1591.56, "end": 1597.8799999999999, "text": " It's when the generator captures the data distribution perfectly."}, {"start": 1597.88, "end": 1607.2800000000002, "text": " This is, this can be achieved and will be achieved if you can optimize these probability"}, {"start": 1607.2800000000002, "end": 1612.7600000000002, "text": " distributions with a reasonable degree of freedom and the neural networks provide that reasonable"}, {"start": 1612.7600000000002, "end": 1618.48, "text": " degree of freedom and give us good hope that in practice, it will work."}, {"start": 1618.48, "end": 1627.8400000000001, "text": " So they apply this to datasets, namely, MNIST, the Toronto Face Database and C410."}, {"start": 1627.84, "end": 1633.8799999999999, "text": " The generator nets use the mixture of rectifier linear activations and sigmoid activations,"}, {"start": 1633.8799999999999, "end": 1636.76, "text": " while the discriminator net used max out activations."}, {"start": 1636.76, "end": 1638.6799999999998, "text": " That was still a thing."}, {"start": 1638.6799999999998, "end": 1647.3999999999999, "text": " Dropout was applied in training and the discriminator net, while our theoretical framework, yeah,"}, {"start": 1647.3999999999999, "end": 1651.9199999999998, "text": " while our theoretical framework permits the use of dropout and other noise at intermediate"}, {"start": 1651.92, "end": 1658.96, "text": " layers of the generator, we used noise as the input to only the bottom-most layer of the"}, {"start": 1658.96, "end": 1660.24, "text": " generator network."}, {"start": 1660.24, "end": 1666.3600000000001, "text": " Again, this wasn't kind of clear at the beginning and also the fact that to leave out dropout"}, {"start": 1666.3600000000001, "end": 1673.16, "text": " and so on in the generator was, I guess they found that empirically."}, {"start": 1673.16, "end": 1677.92, "text": " And then there was of course no way to evaluate these things, like how do we evaluate generative"}, {"start": 1677.92, "end": 1678.92, "text": " models?"}, {"start": 1678.92, "end": 1685.04, "text": " We have these inception distances and so on, but then we estimate probability of the test"}, {"start": 1685.04, "end": 1691.88, "text": " set under p on the regenerated data by fitting a Gaussian parsing window to the samples generated"}, {"start": 1691.88, "end": 1695.76, "text": " with g and reporting the log likelihood under this distribution."}, {"start": 1695.76, "end": 1701.96, "text": " The theta parameter, yada yada yada, results are reported."}, {"start": 1701.96, "end": 1706.6000000000001, "text": " This method of estimating the likelihood has somewhat high variance and does not perform"}, {"start": 1706.6, "end": 1712.52, "text": " well in high-dimensional spaces, but it is the best method available to our knowledge."}, {"start": 1712.52, "end": 1717.0, "text": " Advances in generative models that can sample but not estimate likelihood directly, motivate"}, {"start": 1717.0, "end": 1721.1999999999998, "text": " further research into how to evaluate such models."}, {"start": 1721.1999999999998, "end": 1724.6799999999998, "text": " They were absolutely right in this."}, {"start": 1724.6799999999998, "end": 1729.08, "text": " There was a lot of research into how to evaluate these models."}, {"start": 1729.08, "end": 1736.0, "text": " However, it is my opinion that we still have very, very limited methods of evaluating"}, {"start": 1736.0, "end": 1737.92, "text": " models like this."}, {"start": 1737.92, "end": 1747.56, "text": " We have better methods, but it's not really satisfactory how it is right now."}, {"start": 1747.56, "end": 1753.16, "text": " So you see that these models, these adversarial nets, by the way, they're always called adversarial"}, {"start": 1753.16, "end": 1759.56, "text": " nets right here, where I think we call them, like most people would call them adversarial"}, {"start": 1759.56, "end": 1765.68, "text": " networks, but it's just interesting to see the nets."}, {"start": 1765.68, "end": 1769.44, "text": " Also in the title, it says, I think it says nets, does it?"}, {"start": 1769.44, "end": 1770.44, "text": " I think it does."}, {"start": 1770.44, "end": 1772.44, "text": " We'll look at it after."}, {"start": 1772.44, "end": 1781.0, "text": " So they outperform these other models, especially these belief networks who are kind of popular"}, {"start": 1781.0, "end": 1782.52, "text": " at the time."}, {"start": 1782.52, "end": 1789.24, "text": " You can see the samples right here were in no way comparable to samples that you get from"}, {"start": 1789.24, "end": 1795.5600000000002, "text": " the modern GANS, but this was already very, very, very good, especially the MNZ."}, {"start": 1795.56, "end": 1798.36, "text": " And then here you could actually recognize."}, {"start": 1798.36, "end": 1803.12, "text": " So once what the yellow are always from the training data set, they're like the nearest"}, {"start": 1803.12, "end": 1806.48, "text": " neighbors of the things on the left."}, {"start": 1806.48, "end": 1810.44, "text": " So they want to show that it doesn't simply remember the training data."}, {"start": 1810.44, "end": 1815.8799999999999, "text": " Though I'm not so sure, this seems like it has some sort of somehow remembered the training"}, {"start": 1815.8799999999999, "end": 1818.56, "text": " data a little bit."}, {"start": 1818.56, "end": 1821.56, "text": " Also this one right here."}, {"start": 1821.56, "end": 1824.48, "text": " And there was already a way."}, {"start": 1824.48, "end": 1826.2, "text": " So this was also very foresighted."}, {"start": 1826.2, "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.88, "text": " moderately well."}, {"start": 1835.88, "end": 1842.52, "text": " But the last one was a convolutional discriminator and a deconvoluitional generator."}, {"start": 1842.52, "end": 1848.4, "text": " So already using kind of deconvolutions that are used everywhere today."}, {"start": 1848.4, "end": 1851.4, "text": " So they are used in GANS and whatnot."}, {"start": 1851.4, "end": 1859.4, "text": " The VAE is to up sample anything if you want to do pixel wise classification, you use deconvolutions."}, {"start": 1859.4, "end": 1868.44, "text": " So again, this paper sort of introduced a lot of things that later that we still use in"}, {"start": 1868.44, "end": 1869.8000000000002, "text": " GANS today."}, {"start": 1869.8000000000002, "end": 1876.8000000000002, "text": " Now I'm sure deconvolutions weren't invented here, but we still use them."}, {"start": 1876.8, "end": 1881.8, "text": " So legit, they were the first GANS paper to use deconvolutions."}, {"start": 1881.8, "end": 1882.8, "text": " Ha ha."}, {"start": 1882.8, "end": 1885.08, "text": " Yeah."}, {"start": 1885.08, "end": 1890.6399999999999, "text": " They also say we make no claim that these samples are better than samples generated by"}, {"start": 1890.6399999999999, "end": 1891.9199999999998, "text": " existing methods."}, {"start": 1891.9199999999998, "end": 1896.12, "text": " We believe that these samples are at least competitive with the better generative models"}, {"start": 1896.12, "end": 1899.52, "text": " in the literature and highlight the potential of the adversarial framework."}, {"start": 1899.52, "end": 1902.52, "text": " Today, this paper would be so rejected."}, {"start": 1902.52, "end": 1905.3999999999999, "text": " Like, wait, you're not better."}, {"start": 1905.3999999999999, "end": 1906.3999999999999, "text": " Get out of here."}, {"start": 1906.4, "end": 1907.4, "text": " You can't claim."}, {"start": 1907.4, "end": 1909.4, "text": " You can't claim this anymore."}, {"start": 1909.4, "end": 1910.4, "text": " No."}, {"start": 1910.4, "end": 1911.4, "text": " Doesn't work anymore."}, {"start": 1911.4, "end": 1912.4, "text": " I'm sorry."}, {"start": 1912.4, "end": 1916.1200000000001, "text": " Yours has always has to be better than everything else nowadays."}, {"start": 1916.1200000000001, "end": 1924.16, "text": " Otherwise, it's a weak rejecter experimental evidence doesn't convince me."}, {"start": 1924.16, "end": 1926.48, "text": " You can't simply say something's cool."}, {"start": 1926.48, "end": 1931.5600000000002, "text": " Also already introduced in this paper, digits obtained by linearly interpolating between"}, {"start": 1931.56, "end": 1937.1599999999999, "text": " coordinates in Z space of the full model, like this thing here, every single GANS paper"}, {"start": 1937.1599999999999, "end": 1942.04, "text": " had interpolations in the GANS spike."}, {"start": 1942.04, "end": 1944.44, "text": " And it came all came from here."}, {"start": 1944.44, "end": 1953.28, "text": " So already, this is just like every GANS paper then had rows of these interpolations."}, {"start": 1953.28, "end": 1959.6, "text": " I should know if I read the paper on it and introduced right here."}, {"start": 1959.6, "end": 1966.6799999999998, "text": " Who knows if they hadn't done this, I guess it's kind of an obvious thing, but still very,"}, {"start": 1966.6799999999998, "end": 1969.84, "text": " very cool to see that this was already done."}, {"start": 1969.84, "end": 1976.84, "text": " And here GANS compared to other different methods like deep-directed graphical models,"}, {"start": 1976.84, "end": 1981.56, "text": " generative auto encoders, and compared in very many ways."}, {"start": 1981.56, "end": 1986.32, "text": " So this is a good reference if you want to learn about these different kinds of models."}, {"start": 1986.32, "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": 2009.52, "text": " So there is no explicit representation of this probability distribution."}, {"start": 2009.52, "end": 2011.8799999999999, "text": " You never build the data distribution."}, {"start": 2011.8799999999999, "end": 2014.36, "text": " You can only sample from it."}, {"start": 2014.36, "end": 2019.1999999999998, "text": " However, the advantages are that Markov chains are never needed."}, {"start": 2019.1999999999998, "end": 2021.0, "text": " Only backprop was used to obtain gradients."}, {"start": 2021.0, "end": 2023.32, "text": " No inferences needed during learning."}, {"start": 2023.32, "end": 2026.84, "text": " And a wide variety of functions can be incorporated into the model."}, {"start": 2026.84, "end": 2033.84, "text": " This, you know, I hadn't read this paper in a while and I just have to laugh nowadays."}, {"start": 2033.84, "end": 2039.4399999999998, "text": " Because now all the people are trying to reintroduce."}, {"start": 2039.44, "end": 2044.4, "text": " Like there are as many papers like reintroducing Markov chains into GANS."}, {"start": 2044.4, "end": 2049.7200000000003, "text": " Being like, oh, GANS would be so much better if they had an MCMC sample or somewhere."}, {"start": 2049.7200000000003, "end": 2053.56, "text": " You're like, no, the point was to get rid of it."}, {"start": 2053.56, "end": 2058.0, "text": " And like no inferences needed during learning."}, {"start": 2058.0, "end": 2064.48, "text": " Which, you know, for some of these other models, you actually need an inference during training."}, {"start": 2064.48, "end": 2065.48, "text": " Right?"}, {"start": 2065.48, "end": 2068.0, "text": " So this is very, very costly."}, {"start": 2068.0, "end": 2073.4, "text": " How many models are there nowadays where it's like, oh, if we just do this inference during"}, {"start": 2073.4, "end": 2075.2, "text": " training."}, {"start": 2075.2, "end": 2076.36, "text": " Yeah."}, {"start": 2076.36, "end": 2084.92, "text": " So it's quite funny to see people kind of trying to just combine everything with everything."}, {"start": 2084.92, "end": 2091.56, "text": " And in the process, sort of reverse, reverse whatever these methods were originally meant"}, {"start": 2091.56, "end": 2092.56, "text": " to get rid of."}, {"start": 2092.56, "end": 2098.88, "text": " Now, not saying anything against these methods, but it's just kind of funny."}, {"start": 2098.88, "end": 2099.88, "text": " Yeah."}, {"start": 2099.88, "end": 2104.08, "text": " 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 straight forward."}, {"start": 2110.52, "end": 2114.32, "text": " Learned approximate inference can be performed by training an auxiliary network to predict"}, {"start": 2114.32, "end": 2115.32, "text": " Z given X."}, {"start": 2115.32, "end": 2120.12, "text": " And this, of course, as you know, has come, you know, has come to fruit very often."}, {"start": 2120.12, "end": 2128.12, "text": " Early papers already introduced the, so if you have the G network producing some producing"}, {"start": 2128.12, "end": 2136.3199999999997, "text": " at X and then the D network discriminating that you also have like a encoder right here"}, {"start": 2136.3199999999997, "end": 2143.08, "text": " to produce back the Z noise to give you the latent encoding, sort of like a variation"}, {"start": 2143.08, "end": 2144.44, "text": " order encoder, but not really."}, {"start": 2144.44, "end": 2147.64, "text": " It's more like a reverse generator."}, {"start": 2147.64, "end": 2154.6, "text": " You know, this models nowadays are big by GAN and things like this that employ this"}, {"start": 2154.6, "end": 2158.44, "text": " exact thing that was sort of predicted right here."}, {"start": 2158.44, "end": 2161.8399999999997, "text": " Of course, they're much earlier models also using this."}, {"start": 2161.8399999999997, "end": 2170.3199999999997, "text": " As long as I can remember, people have attempted to bring encoders into GANS."}, {"start": 2170.3199999999997, "end": 2173.68, "text": " They have a bunch of other things like semi-supervised learning."}, {"start": 2173.68, "end": 2179.48, "text": " You can use this to do, 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 foresight in this papers is pretty cool."}, {"start": 2184.68, "end": 2187.2799999999997, "text": " And the coolest thing, look at that."}, {"start": 2187.2799999999997, "end": 2192.68, "text": " Savages, good fellow, not even using the full eight pages, just, you know, dropping"}, {"start": 2192.68, "end": 2194.48, "text": " this on the world."}, {"start": 2194.48, "end": 2196.08, "text": " Absolutely cool."}, {"start": 2196.08, "end": 2199.3199999999997, "text": " Mad respect."}, {"start": 2199.32, "end": 2208.0, "text": " So yeah, this was kind of my take on general, yeah, it is generative adversarial nets."}, {"start": 2208.0, "end": 2212.8, "text": " And yeah, please tell me if you like historic paper overviews."}, {"start": 2212.8, "end": 2217.44, "text": " It's more kind of a rant than it really is a paper explanation, but I do enjoy going"}, {"start": 2217.44, "end": 2220.28, "text": " through this papers and kind of looking at them in hindsight."}, {"start": 2220.28, "end": 2221.88, "text": " All right, that was it from me."}, {"start": 2221.88, "end": 2223.2000000000003, "text": " I wish you a nice day."}, {"start": 2223.2, "end": 2237.9199999999996, "text": " Bye bye."}] |
Yannic Kilcher | 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, Eliasotskyvur, Kai Chen, Greg Karato and Jeffrey Dean. This is another historical paper. It's one of three papers, it's the middle one that introduces the original word to vec algorithm. And if you, as you might know, word to vec 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 well-enhanced PowerPoint presentation of how we're to vec works. We're going to look at the paper and read it together. If you like 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 many people might already know what these things are. So yeah. Okay. Let's go through the paper and pick up their ideas and kind of put them in context. They say, 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. So the skip-gram 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, word to vec is a series of papers. I don't think there is a paper called word to vec rather. They here have released the code along with the paper in the code was called word to vec. So the skip-gram model was introduced previously, but it is replicated right here. So in the skip-gram 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 the two, what might might be mapped to, I don't know, 0.10, 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 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 1,000-dimensional skip-gram vector. So the vectors they obtain, they can do things like this where they can show that in these 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 they're 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 believe 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 queen, actually, you have to exclude the original word king. People quickly discovered that if you don't exclude the original word, you know, the result of this kind of arithmetic will almost always lead back to the original word. 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 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 basically says that, you know, two, the word two is going to be mapped to this vector, point one, 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 two learn word and representations. So this you construct four different training examples where you have an X and a 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 and is as you can see, no, you can't see right here, but the classification task is you have the input word and you classified 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 a thousand classes, but in these, that's already a lot. But in these tasks, you're going to have a hundred thousand classes because there are a hundred thousand words in the English language that you 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 like a super duper duper lot of a 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 tests. And that's what they discovered. So their skipgram 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 skipgram objective. What you want to do is the objective of the skipgram 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 an 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 5 to 10 to the 7 terms. So many like tens 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 of capillaries. 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 introduce this hierarchical softmax which is kind of a distraction. It's kind of a here is what we do. Here is 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 a thousand classes. Instead of classifying a thousand 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, a thousand is like two to the 10. So we need approximately 10 layers of this before we are actually arriving at a thousand 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 it's vector. And then we classify it for each of these nodes. So your output isn't going to be a thousand a thousand log probabilities. Your output is going to be a log probability. I 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 with you having to predict less. Now of course you are constrained. You impose a very big prior on the class distribution classes aren't independently anymore. Mainly 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 a rather 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 word to veck but negative sampling is one of the you know cornerstones of the current trend in self supervised learning in 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. 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 graph 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 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 trying 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 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 word that's not in the context window okay. So here is my word negative and here is my word sampling and I want these to be close and if I sample another word like here this is the word cake. If I, sorry 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 ten thousand 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 word and 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 word 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 a self supervised learning where you want to have the same image augmented twice. I 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 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 vocabulary with this this has turned out to be very very influential. As I said now with the rise of birth and so on where to back 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 where they index their n-grams so the word I don't know so the word hello is id1 the word hello there is id2 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'd 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 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 uniggram these are two different things they're there 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 uniggram distribution raised to the three quarter power i.e uniggram to the three quarter outperformed significantly the uniggram 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 assume 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 right and what you want to do is in this case you want to sample these words here more but they they appear so much more often than if you simply sample according to their uniggram 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 or a such words usually provide less information value than the rare words for example while the skip-crem 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-occurst frequently within 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 then 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 throw t is a chosen threshold we chose this sub sampling formula because it aggressively sub samples words whose frequency is 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 the experimented around they found this works well and then everybody ended up 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 contrast of 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 there's 36 minutes for and they I think they have like a huge corpus that they train on these were tovec code turned out to be really really efficient code and that's why I 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 in 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 now this it it is a very cool paper a 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 I mean 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": 5.6000000000000005, "text": " Hi there, today we'll look at distributed representations of words and phrases and their"}, {"start": 5.6000000000000005, "end": 12.64, "text": " compositionality by Thomas Mikolov, Eliasotskyvur, Kai Chen, Greg Karato and Jeffrey Dean."}, {"start": 12.64, "end": 18.2, "text": " This is another historical paper. It's one of three papers, it's the middle one that introduces"}, {"start": 18.2, "end": 25.36, "text": " the original word to vec algorithm. And if you, as you might know, word to vec was extremely"}, {"start": 25.36, "end": 32.2, "text": " influential in NLP since this paper basically until recently where it's sort of gone out"}, {"start": 32.2, "end": 38.480000000000004, "text": " of fashion a bit in research with the rise of things like Elmo and Bert, but it's still"}, {"start": 38.480000000000004, "end": 44.120000000000005, "text": " very, very relevant. So we'll look at this historical paper today with kind of the hindsight"}, {"start": 44.120000000000005, "end": 49.56, "text": " of being a couple years into the future. In fact, as you see right here, this was released"}, {"start": 49.56, "end": 57.440000000000005, "text": " in 2013. So it's seven years later now and we'll look back and we'll see what they said"}, {"start": 57.440000000000005, "end": 63.480000000000004, "text": " back then about the system. This is not going to be like a very well-enhanced PowerPoint"}, {"start": 63.480000000000004, "end": 70.56, "text": " presentation of how we're to vec works. We're going to look at the paper and read it together."}, {"start": 70.56, "end": 75.72, "text": " If you like content like this, if you like historical paper readings, let me know in the"}, {"start": 75.72, "end": 82.36, "text": " comments, share it out if you do like it, and of course, subscribe. Because this kind"}, {"start": 82.36, "end": 88.28, "text": " of historical papers, I enjoy them, but many people might already know what these things"}, {"start": 88.28, "end": 97.4, "text": " are. So yeah. Okay. Let's go through the paper and pick up their ideas and kind of put"}, {"start": 97.4, "end": 102.64, "text": " them in context. They say, the recently introduced continuous skip-gram model is an efficient"}, {"start": 102.64, "end": 107.32, "text": " method for learning high quality distributed vector representations that capture a large"}, {"start": 107.32, "end": 113.08, "text": " number of precise syntactic and semantic word relationships. So the skip-gram model was"}, {"start": 113.08, "end": 118.04, "text": " already introduced by Miklov in an earlier paper that came out, I believe not like one"}, {"start": 118.04, "end": 124.12, "text": " or two months prior to this one. As I said, word to vec is a series of papers. I don't"}, {"start": 124.12, "end": 129.8, "text": " think there is a paper called word to vec rather. They here have released the code along"}, {"start": 129.8, "end": 136.92000000000002, "text": " with the paper in the code was called word to vec. So the skip-gram model was introduced"}, {"start": 136.92000000000002, "end": 143.04000000000002, "text": " previously, but it is replicated right here. So in the skip-gram model, what you're trying"}, {"start": 143.04000000000002, "end": 149.28, "text": " to do is you're trying to get a distributed word representation. So what does that mean?"}, {"start": 149.28, "end": 154.36, "text": " That means that for each word in your language, let's take these words right here. For each"}, {"start": 154.36, "end": 159.32000000000002, "text": " word in the language you want to come up with a vector that somehow describes that word"}, {"start": 159.32, "end": 165.4, "text": " in a continuous fashion. So with in the two, what might might be mapped to, I don't know,"}, {"start": 165.4, "end": 175.76, "text": " 0.10, 0.9 and 0.3, learn might be mapped to negative 0.5 and so on. So each word gets"}, {"start": 175.76, "end": 181.92, "text": " assigned a vector in the same dimensional space. And what the previous paper kind of discovered"}, {"start": 181.92, "end": 187.72, "text": " is that if you do this correctly, then these vectors, they have some kind of properties."}, {"start": 187.72, "end": 194.08, "text": " And we can already kind of jump ahead because this was already a bit, a bit researched in"}, {"start": 194.08, "end": 200.32, "text": " the last paper. The semantics of these vectors will be something like this. So here they"}, {"start": 200.32, "end": 207.04, "text": " have a two-dimensional PCA. So these are the first two dimensions of the 1,000-dimensional"}, {"start": 207.04, "end": 211.72, "text": " skip-gram vector. So the vectors they obtain, they can do things like this where they can"}, {"start": 211.72, "end": 220.2, "text": " show that in these spaces, for example, there appears to be a vector direction that characterizes"}, {"start": 220.2, "end": 226.64, "text": " the capital of a country. So if you take a few countries and they're capitals and you"}, {"start": 226.64, "end": 234.4, "text": " average that vector, you get a kind of a direction for capitalness of a city given a country."}, {"start": 234.4, "end": 241.0, "text": " You can see that there is a pretty clear relation here. Now some of these things have later"}, {"start": 241.0, "end": 248.12, "text": " been revised to such that they are ultimately ended up being not that impressive. For example,"}, {"start": 248.12, "end": 256.28, "text": " there was always this kind of math with vectors. And I believe this might not be in this."}, {"start": 256.28, "end": 262.52, "text": " This is in the last paper where they discovered that if you take the vector for king and you"}, {"start": 262.52, "end": 272.44, "text": " subtract the vector for man and you add the vector for woman, then that would result in the"}, {"start": 272.44, "end": 281.4, "text": " vector for queen. So the way they did it was basically they did this calculation right here."}, {"start": 281.4, "end": 285.15999999999997, "text": " And then they searched, in the point they ended up, they searched for the nearest neighbor"}, {"start": 285.15999999999997, "end": 291.79999999999995, "text": " in their vocabulary. And that turned out to be queen. But in order to make it queen, actually,"}, {"start": 291.8, "end": 298.36, "text": " you have to exclude the original word king. People quickly discovered that if you don't"}, {"start": 298.36, "end": 303.64, "text": " exclude the original word, you know, the result of this kind of arithmetic will almost always"}, {"start": 303.64, "end": 310.44, "text": " lead back to the original word. And then a lot of these analogy tasks are simply the result of you"}, {"start": 310.44, "end": 315.8, "text": " then discarding that word during the nearest neighbor search. And then queen just happens to be"}, {"start": 315.8, "end": 323.24, "text": " one of the closest words. And it's sort of much less dependent on which exact calculation you do"}, {"start": 323.24, "end": 328.76, "text": " here. So there's been a lot of follow up work kind of analyzing, criticizing these vector"}, {"start": 328.76, "end": 334.52, "text": " maths. But definitely we know that these word vectors turned out to be extremely, extremely"}, {"start": 334.52, "end": 341.32, "text": " helpful and syntactically and semantically relevant in downstream tasks because they have performed"}, {"start": 341.32, "end": 350.84, "text": " very, very well. So how does the skip gram model work? How does it assign vectors to each"}, {"start": 350.84, "end": 360.84, "text": " to each word? So first of all, it has a dictionary. So there is a word, an input word. And for each"}, {"start": 360.84, "end": 367.64, "text": " word, you have a big dictionary. And the dictionary basically says that, you know, two, the word"}, {"start": 367.64, "end": 373.24, "text": " two is going to be mapped to this vector, point one, da, da, da, da, da, and so on. The word"}, {"start": 373.24, "end": 381.0, "text": " learn is going to be mapped to that vector. And then you also have these output vectors"}, {"start": 382.12, "end": 389.47999999999996, "text": " right here. And what you're trying to do is you're trying to take a phrase from the data set"}, {"start": 389.48, "end": 398.36, "text": " like this one right here. And you take out one word like this word vector right here. And"}, {"start": 401.08000000000004, "end": 408.04, "text": " you're trying to frame this as a prediction task. So you're trying to frame this as in this"}, {"start": 408.04, "end": 414.20000000000005, "text": " case, four different prediction tasks. So you're telling your machine, I give you the word vector."}, {"start": 414.2, "end": 421.56, "text": " And which other words are around the word vector? You just tell it that you don't tell it anything"}, {"start": 421.56, "end": 428.12, "text": " else. You just say which other words are around the word vector. And the correct answers in this"}, {"start": 428.12, "end": 436.68, "text": " case would be two learn word and representations. So this you construct four different training"}, {"start": 436.68, "end": 445.8, "text": " examples where you have an X and a Y. So the X is always vector and the Y is two. And then the"}, {"start": 445.8, "end": 455.24, "text": " next training sample the X is vector and the Y is learn and and so on. Okay. So this here,"}, {"start": 455.24, "end": 463.56, "text": " each training sample is a classification task right. And the classification task is and is as you"}, {"start": 463.56, "end": 470.44, "text": " can see, no, you can't see right here, but the classification task is you have the input word"}, {"start": 471.24, "end": 478.92, "text": " and you classified into one of many, many, many, many, many, many classes. Namely, there are as many"}, {"start": 478.92, "end": 487.08, "text": " classes as you have words in the dictionary. So each word in the dictionary will have a class"}, {"start": 487.08, "end": 492.04, "text": " associated with it. Right. So in ImageNet, you have like a thousand classes, but in these,"}, {"start": 492.04, "end": 496.84000000000003, "text": " that's already a lot. But in these tasks, you're going to have a hundred thousand classes because"}, {"start": 496.84000000000003, "end": 502.68, "text": " there are a hundred thousand words in the English language that you want to treat. And there are"}, {"start": 502.68, "end": 508.12, "text": " many more, but in this case, they leave away all the words that appear less than five times in"}, {"start": 508.12, "end": 514.6800000000001, "text": " their corpus. That's still a lot of words. So it's like a super duper duper lot of a classification"}, {"start": 514.68, "end": 522.28, "text": " task. But ultimately, if you do something like this, then the origin, so the representation that"}, {"start": 522.28, "end": 527.8, "text": " you end up with is going to be very, very good at doing these kind of downstream tests. And that's"}, {"start": 527.8, "end": 535.9599999999999, "text": " what they discovered. So their skipgram model is nothing else than taking a word and predicting"}, {"start": 535.9599999999999, "end": 544.04, "text": " the surrounding words from that word. And this is what it means. This is the formal statement of"}, {"start": 544.04, "end": 550.8399999999999, "text": " the skipgram objective. What you want to do is the objective of the skipgram model is to maximize"}, {"start": 550.8399999999999, "end": 557.4, "text": " the average log probability. This one. So for the word we're considering the word t,"}, {"start": 558.68, "end": 567.9599999999999, "text": " we want to maximize the log probability of each word w that is in around the word c,"}, {"start": 567.9599999999999, "end": 573.48, "text": " sorry, around the word w in a context window of c. That's exactly what we did before."}, {"start": 573.48, "end": 580.44, "text": " Take a word like this model right here. And from it, we predict all of the words around it"}, {"start": 581.24, "end": 589.08, "text": " in a given window, right? That's all. That's the entire objective. And that will give you very"}, {"start": 589.08, "end": 597.8000000000001, "text": " good representations. And this is how you would implement that. So what you'll have is you'll have"}, {"start": 597.8, "end": 604.4399999999999, "text": " these vector representation v that comes from your original dictionary. Those are the things you"}, {"start": 604.4399999999999, "end": 610.76, "text": " learn. And then because you have like an 30,000 way classifier, you know that a classification"}, {"start": 610.76, "end": 617.16, "text": " layer is nothing else than a linear layer followed by a softmax operation. And that linear layer"}, {"start": 617.16, "end": 623.4, "text": " also has parameters. These are the v primes. Okay. So first you have the lookup in the dictionary"}, {"start": 623.4, "end": 631.0, "text": " for the word vector right here. And this is the vector of the classification layer. Now there"}, {"start": 631.0, "end": 635.64, "text": " are modifications where you can use like the same vectors and so on. Or you can also make use of"}, {"start": 635.64, "end": 643.0, "text": " these vectors. But ultimately you care about these vectors right here. And the vectors here are"}, {"start": 643.0, "end": 650.28, "text": " simply the classification layers weights. So here you can see that there is what you're trying to"}, {"start": 650.28, "end": 660.4399999999999, "text": " maximize is the inner product between the word that you're considering and the words around that word."}, {"start": 662.04, "end": 669.24, "text": " And you're trying to do a classification task. So you need to normalize. Now this is the normalization"}, {"start": 669.24, "end": 677.8, "text": " constant. And it goes over all of your vocabulary. So that's what they tackle here. They say"}, {"start": 677.8, "end": 685.56, "text": " W is the number of words in the vocabulary. This formulation is impractical because the cost of"}, {"start": 685.56, "end": 693.0, "text": " computing the gradient is proportional to W which is often large. And that's 10 to the 5 to 10 to"}, {"start": 693.0, "end": 700.8399999999999, "text": " the 7 terms. So many like tens of millions of terms in your vocabulary. That's just not feasible."}, {"start": 700.8399999999999, "end": 707.24, "text": " Right. So people have been you know sort of trying different ways to get around very, very large"}, {"start": 707.24, "end": 712.6800000000001, "text": " number of classes. And here it seems that that is really our bottleneck. In the previous paper"}, {"start": 712.6800000000001, "end": 718.12, "text": " they've already shown that this objective can give you very good word representation. But now we"}, {"start": 718.12, "end": 723.48, "text": " need to get around the fact that we have such large of capillaries. So the first idea here is"}, {"start": 723.48, "end": 729.48, "text": " hierarchical softmax. And this is kind of a tangent. I find this paper by the way it's sort of hard"}, {"start": 729.48, "end": 737.0, "text": " to read because it's like a half engineering paper. But yeah. So first they introduce this hierarchical"}, {"start": 737.0, "end": 744.12, "text": " softmax which is kind of a distraction. It's kind of a here is what we do. Here is what we considered"}, {"start": 744.12, "end": 750.84, "text": " first. But then didn't end up using really. They do compare with it. But the flow of text is sort of"}, {"start": 750.84, "end": 756.84, "text": " that you expect this to be part of the final model which it isn't. So in the hierarchical softmax"}, {"start": 756.84, "end": 764.2, "text": " what you do instead of having this giant multi-class classification task right here. You take all of"}, {"start": 764.2, "end": 771.6400000000001, "text": " these classes right here and you put them in a sort of a tree. Okay. So you take this and you put"}, {"start": 771.6400000000001, "end": 777.1600000000001, "text": " them into a tree. So instead of classifying, you know, let's say we have a thousand classes. Instead"}, {"start": 777.1600000000001, "end": 784.36, "text": " of classifying a thousand ways we first classify in two ways. And then we classify in two ways again"}, {"start": 785.32, "end": 790.2, "text": " from each one. And then we classify in two ways again. As you know, a thousand is like two to"}, {"start": 790.2, "end": 799.0, "text": " the 10. So we need approximately 10 layers of this before we are actually arriving at a thousand"}, {"start": 799.0, "end": 807.32, "text": " classes. But it also means that we only have two way classifications each time. So in the hierarchical"}, {"start": 807.32, "end": 814.36, "text": " softmax we build trees like this. And then we so we have a word we look up its vector sorry it's"}, {"start": 814.36, "end": 821.72, "text": " vector. And then we classify it for each of these nodes. So your output isn't going to be a thousand"}, {"start": 823.48, "end": 830.84, "text": " a thousand log probabilities. Your output is going to be a log probability. I binary log probability"}, {"start": 830.84, "end": 837.88, "text": " for each of the nodes right here. So you want to know okay here is it in the upper half or the lower"}, {"start": 837.88, "end": 842.9200000000001, "text": " half of my classes. Okay cool it's in the upper half. Okay here is in the upper half or the lower"}, {"start": 842.92, "end": 848.8399999999999, "text": " half and so on. And you learn all to predict all of these junctions right here. And that's going to"}, {"start": 848.8399999999999, "end": 856.76, "text": " end up with you having to predict less. Now of course you are constrained. You impose a very big"}, {"start": 856.76, "end": 862.36, "text": " prior on the class distribution classes aren't independently anymore. Mainly if two classes here"}, {"start": 862.36, "end": 868.68, "text": " are in the same subtree that means that they are going to be predicted. Their predictions are going"}, {"start": 868.68, "end": 878.92, "text": " to be correlated because the path to them is the same partially. So how you arrange the classes"}, {"start": 878.92, "end": 885.0, "text": " here is very important. And there has been a lot of work in this but as I said this is a rather"}, {"start": 886.12, "end": 892.8399999999999, "text": " distraction right here. Hierarchical softmax is a way to solve this however they went with a"}, {"start": 892.84, "end": 899.8000000000001, "text": " different way right here. They went with this approach called negative sampling. Negative sampling"}, {"start": 899.8000000000001, "end": 908.2, "text": " has been it's been very influential. Not only in word to veck but negative sampling is one of the"}, {"start": 908.2, "end": 914.76, "text": " you know cornerstones of the current trend in self supervised learning in contrastive estimation"}, {"start": 914.76, "end": 923.48, "text": " and so on. So this all of this you know it pops up in unlikely ways in other fields and it sort of"}, {"start": 924.12, "end": 931.16, "text": " I'm not going to say it originated here but definitely it was introduced into the popular deep"}, {"start": 931.16, "end": 938.28, "text": " learning world right here. So they say an alternative to hierarchical softmax is noise contrastive"}, {"start": 938.28, "end": 946.04, "text": " estimation. So in noise contrastive estimation posits that a good model should be able to differentiate"}, {"start": 946.04, "end": 952.28, "text": " data from noise by means of logistic regression. You know that seems very reasonable. This is similar"}, {"start": 952.28, "end": 959.9599999999999, "text": " to the hinge loss and so on. While NCE can be shown to approximately maximize the log probability"}, {"start": 959.9599999999999, "end": 965.48, "text": " of the softmax the skip graph model is only concerned with learning high quality vector representations."}, {"start": 965.48, "end": 971.24, "text": " So we are free to simplify noise contrastive estimation as long as the vector representations"}, {"start": 971.24, "end": 977.32, "text": " retain their quality. We define negative sampling by this following objective. So this is very"}, {"start": 977.32, "end": 983.48, "text": " interesting they see okay noise contrastive estimation you know it approximately maximizes the"}, {"start": 983.48, "end": 989.96, "text": " log probability. So the noise contrastive estimation would actually be the correct way to approximate"}, {"start": 989.96, "end": 996.84, "text": " their problem. However they say well as long as you know as long as something reasonable comes out"}, {"start": 996.84, "end": 1002.9200000000001, "text": " we're free to change that up a bit. So they go with this negative sampling approach right here"}, {"start": 1003.96, "end": 1011.5600000000001, "text": " and you can see that this is this is almost the same. So it's written a bit differently from the"}, {"start": 1011.5600000000001, "end": 1017.48, "text": " original softmax thing because the original softmax thing was written as a fraction and here it's"}, {"start": 1017.48, "end": 1023.8000000000001, "text": " as a sum but what you're trying to do in the noise in the negative sampling framework is you"}, {"start": 1023.8000000000001, "end": 1030.2, "text": " trying to maximize the following. You're trying to maximize the inner product of the word you're"}, {"start": 1030.2, "end": 1038.04, "text": " considering and the words around them okay. So you're trying to still predict the words around you"}, {"start": 1038.04, "end": 1046.52, "text": " but now instead of having this prediction softmax over all of the classes you only have the softmax"}, {"start": 1046.52, "end": 1056.44, "text": " over a subset of classes. So what you'll do is you sample words from your vocabulary at random"}, {"start": 1056.44, "end": 1064.52, "text": " and you sample K of them and you're simply trying to minimize the inner product between those words"}, {"start": 1064.52, "end": 1072.44, "text": " and your word okay. So what does that ultimately lead to? It ultimately leads to the following."}, {"start": 1072.44, "end": 1080.1200000000001, "text": " You have a word like this word here negative and what you're trying to do is you're not trying"}, {"start": 1080.1200000000001, "end": 1085.64, "text": " that much to predict the word sampling. What you're trying to do is you're trying to say that in my"}, {"start": 1085.64, "end": 1094.92, "text": " space right here I simply want sampling to be closer than any other word that's not in the context"}, {"start": 1094.92, "end": 1104.44, "text": " window okay. So here is my word negative and here is my word sampling and I want these to be close"}, {"start": 1104.44, "end": 1112.1200000000001, "text": " and if I sample another word like here this is the word cake. If I, sorry if I sample that I simply"}, {"start": 1112.1200000000001, "end": 1120.44, "text": " want that to be far away farther than the word sampling okay. So this is now a comparative."}, {"start": 1120.44, "end": 1126.52, "text": " It's not I classify sampling as the highest class. It's simply I want to classify the word"}, {"start": 1126.52, "end": 1136.76, "text": " sampling against the other classes higher. All right. So and this is now much much easier. So"}, {"start": 1136.76, "end": 1142.28, "text": " instead of a thousand or ten thousand or a million way classification I now maybe have I have a"}, {"start": 1142.28, "end": 1151.24, "text": " k plus one way classification right. Pretty easy right. I simply sample k other word and I assume"}, {"start": 1151.24, "end": 1157.3999999999999, "text": " because I have so many words chances that I actually sample one that's in my context window is"}, {"start": 1157.3999999999999, "end": 1162.6, "text": " very small right. So I simply sample other word and I say well these other words are random."}, {"start": 1162.6, "end": 1169.72, "text": " They have nothing to do with the current frame that I'm looking at. So they should be you know"}, {"start": 1169.72, "end": 1175.0, "text": " they can be whatever they want but at least they should be farther away than the words that are"}, {"start": 1175.0, "end": 1184.1200000000001, "text": " actually in my in my context. And that is negative sampling the process of sampling negatives"}, {"start": 1184.1200000000001, "end": 1191.64, "text": " this right here and then making sure that the positives which are these here in this case the"}, {"start": 1191.64, "end": 1199.24, "text": " words in the context are classified with a higher probability than the negatives for a given input"}, {"start": 1199.24, "end": 1208.1200000000001, "text": " word right. This here is the input word. That's it that's negative sampling and of course yeah as"}, {"start": 1208.1200000000001, "end": 1215.88, "text": " I said you recognize this from current things like a self supervised learning where you want to"}, {"start": 1215.88, "end": 1222.36, "text": " have the same image augmented twice. I go through the pipeline you know you augment the put a little"}, {"start": 1222.36, "end": 1228.1200000000001, "text": " bit of different noise and then you have a different image and at the end you say these two should"}, {"start": 1228.12, "end": 1234.6799999999998, "text": " be close together while this other one should be far apart. It's the exact same thing here except"}, {"start": 1234.6799999999998, "end": 1242.28, "text": " that you have a different way of obtaining the positive and the negative samples. In this case positive"}, {"start": 1242.28, "end": 1248.6799999999998, "text": " samples are everything that's in the context negative samples are just randomly sampled from the"}, {"start": 1248.68, "end": 1257.48, "text": " data set. And that you know works of course that works much much much faster and you can see that"}, {"start": 1257.16, "end": 1266.1200000000001, "text": " this this turns out to give you vectors that are pretty good and you can train with higher vectors"}, {"start": 1266.1200000000001, "end": 1270.92, "text": " sorry with higher dimensional vectors you can train with bigger vocabulary with this this has"}, {"start": 1270.92, "end": 1277.0800000000002, "text": " turned out to be very very influential. As I said now with the rise of birth and so on"}, {"start": 1277.08, "end": 1285.96, "text": " where to back is kind of getting forgotten but this was a revolution and distributed vectors so"}, {"start": 1285.96, "end": 1292.04, "text": " it wasn't a thing really it kind of was a thing before that but it wasn't really a thing that people"}, {"start": 1292.04, "end": 1298.12, "text": " used what people would do is still they would do n-gram models before that so they would kind of"}, {"start": 1298.12, "end": 1305.24, "text": " just they would sort of chunk up their sentences into n-grams into overlapping n-grams and then have"}, {"start": 1305.24, "end": 1313.48, "text": " a big giant table for where they index their n-grams so the word I don't know so the word hello"}, {"start": 1314.52, "end": 1324.36, "text": " is id1 the word hello there is id2 and so on so you have a big table for all the n-grams and then"}, {"start": 1324.36, "end": 1329.0, "text": " what we would try to do is you would try to do this kind of bag of words estimation where"}, {"start": 1329.96, "end": 1334.6, "text": " you would take a you know whatever n-grams appeared in your sentence and you would have this"}, {"start": 1334.6, "end": 1341.24, "text": " big you know classification where you'd associate the n-grams with each other and so on so"}, {"start": 1341.24, "end": 1346.84, "text": " distributed word representations were kind of a revolution at that point especially distributed"}, {"start": 1346.84, "end": 1354.28, "text": " representation that actually outperformed these old n-gram methods so there are a number of"}, {"start": 1354.28, "end": 1361.24, "text": " tricks right here that are I think not understood until this day for example the question is how do"}, {"start": 1361.24, "end": 1371.4, "text": " you sample these negative samples right right here this basically says get k words from your vocabulary"}, {"start": 1371.4, "end": 1377.4, "text": " at random according to this distribution right here now how are you going to do that basically"}, {"start": 1377.4, "end": 1384.36, "text": " you have a spectrum of options the one side of the spectrum is going to be completely uniform"}, {"start": 1385.0, "end": 1390.92, "text": " okay we sample each word with the same probability and the other side of the spectrum is"}, {"start": 1390.92, "end": 1397.5600000000002, "text": " something like sample this according to their uniggram these are two different things"}, {"start": 1398.44, "end": 1406.2, "text": " they're there opposites in this in this fashion so here you say hey some words appear way way"}, {"start": 1406.2, "end": 1412.68, "text": " way more often than other words shouldn't we prefer them when we sample right shouldn't we if we"}, {"start": 1412.68, "end": 1421.4, "text": " have a corpus and shouldn't we sample from the corpus and if in the corpus one word appears"}, {"start": 1421.4, "end": 1426.52, "text": " 50 times more than the other word then shouldn't we sample that 50 times more as a negative because"}, {"start": 1426.52, "end": 1431.88, "text": " it's you know so abundant and it should give a higher classification accuracy whereas on the"}, {"start": 1431.88, "end": 1436.2, "text": " other hand you could say no no no we should simply sample every word in our dictionary uniformly"}, {"start": 1436.2, "end": 1446.6000000000001, "text": " they came up with something in between which they say both NC and negative sampling have noise"}, {"start": 1446.6000000000001, "end": 1452.1200000000001, "text": " distribution as a free parameter we investigated a number of choices and found that the uniggram"}, {"start": 1452.1200000000001, "end": 1460.28, "text": " distribution raised to the three quarter power i.e uniggram to the three quarter outperformed"}, {"start": 1460.28, "end": 1467.0, "text": " significantly the uniggram and uniform distributions for both NC and neg on every task we tried"}, {"start": 1467.0, "end": 1473.6399999999999, "text": " including language modeling this i think is a mystery until today and it actually turned out"}, {"start": 1473.6399999999999, "end": 1480.28, "text": " that this exponent right here is magically much better than like the exponent of one or even"}, {"start": 1480.28, "end": 1486.44, "text": " the exponent of one half like you might be reasonably assume that the square root you know might"}, {"start": 1486.44, "end": 1493.16, "text": " be something but the three quarters i think turned out to be very good and very mystical so what does"}, {"start": 1493.16, "end": 1498.44, "text": " it what does it mean it means that you have kind of a balance between words that appear often"}, {"start": 1498.44, "end": 1503.88, "text": " words that don't appear often usually in these kind of things you have a power law where we have"}, {"start": 1503.88, "end": 1509.0, "text": " very few words that appear very often and then you have okay that's the tail shouldn't go up but"}, {"start": 1509.0, "end": 1515.64, "text": " you have a very long tail of words right and what you want to do is in this case you want to sample"}, {"start": 1515.64, "end": 1521.3200000000002, "text": " these words here more but they they appear so much more often than if you simply sample according"}, {"start": 1521.3200000000002, "end": 1527.0, "text": " to their uniggram distribution you'll basically not regard these words right here you'll forget about"}, {"start": 1527.0, "end": 1532.8400000000001, "text": " them and your performance will suffer because they do appear every now and then so what you want to"}, {"start": 1532.8400000000001, "end": 1539.96, "text": " do is you want to push that those down a little bit and the optimal amount for the little bit turns"}, {"start": 1539.96, "end": 1549.8, "text": " out to be to raise it the you raise it to the three quarters strange but you know turned out to work"}, {"start": 1549.8, "end": 1558.92, "text": " well the other thing they do is they do the they do a sub sampling of frequent words so again this"}, {"start": 1558.92, "end": 1565.08, "text": " is a way to kind of push down the often appearing words where they say the most frequent words can"}, {"start": 1565.08, "end": 1570.9199999999998, "text": " easily occur hundreds of millions of times like in the or a such words usually provide less"}, {"start": 1570.9199999999998, "end": 1576.52, "text": " information value than the rare words for example while the skip-crem model benefits from observing"}, {"start": 1576.52, "end": 1581.96, "text": " the co-occurrences of France and Paris it benefits much less from observing the frequent co-occurrences"}, {"start": 1581.96, "end": 1590.4399999999998, "text": " of France and the as nearly every word co-occurst frequently within a sentence with the so they do"}, {"start": 1590.44, "end": 1596.28, "text": " another trick here to counter this imbalance between rare and frequent words use a simple"}, {"start": 1596.28, "end": 1602.52, "text": " sub sampling approach each word in the training set is discarded with probability computed by that"}, {"start": 1602.52, "end": 1610.76, "text": " formula right so they have a formula right here and you might be asking again why why this formula"}, {"start": 1610.76, "end": 1619.16, "text": " so this is the sampling probability of a word and it goes with one over t t is a temperature"}, {"start": 1619.16, "end": 1626.52, "text": " parameter and f is the frequency with which the word appears in the corpus so as you can see as the"}, {"start": 1626.52, "end": 1635.0800000000002, "text": " word appears more in the in the corpus then so this is the frequency as the word appears more"}, {"start": 1635.0800000000002, "end": 1642.68, "text": " then this thing goes down then this thing goes up so it's discarded with this probability so it's"}, {"start": 1642.68, "end": 1650.76, "text": " discarded with a higher probability if it appears more often where f is frequency of a word t is a"}, {"start": 1650.76, "end": 1656.28, "text": " throw t is a chosen threshold we chose this sub sampling formula because it aggressively"}, {"start": 1656.28, "end": 1662.44, "text": " sub samples words whose frequency is greater than t while preserving the ranking of the frequencies"}, {"start": 1663.0800000000002, "end": 1667.88, "text": " although this sub sampling formula was chosen heuristically we found it to work well in practice"}, {"start": 1667.88, "end": 1672.52, "text": " it accelerates learning and even significantly improves the accuracy of the learned vectors"}, {"start": 1672.52, "end": 1679.72, "text": " of the rare words as will be shown in the following sections so again something sort of arbitrary"}, {"start": 1679.72, "end": 1684.76, "text": " it's it's more understandable than the three quarters but still it's sort of arbitrary the experimented"}, {"start": 1684.76, "end": 1691.96, "text": " around they found this works well and then everybody ended up using that so that's how this kind of"}, {"start": 1691.96, "end": 1700.68, "text": " stuff happens okay so now we get into the empirical results and the empirical results in this case"}, {"start": 1700.68, "end": 1708.68, "text": " were already sort of given in the previous paper but here they have these the analogical reasoning"}, {"start": 1708.68, "end": 1718.04, "text": " task where you can see that the negative sampling did outperform the others by quite a bit"}, {"start": 1718.04, "end": 1723.64, "text": " right here so the negative sampling approaches outperformed the hierarchical softmax and the"}, {"start": 1723.64, "end": 1729.0800000000002, "text": " noise contrast of estimation and in the previous paper they also compared with other baselines and"}, {"start": 1729.08, "end": 1740.52, "text": " saw that it also outperforms those while being quite time time efficient so you can see that"}, {"start": 1740.52, "end": 1748.6, "text": " especially with the sub sampling approaches the time here there's 36 minutes for and they I think"}, {"start": 1748.6, "end": 1755.24, "text": " they have like a huge corpus that they train on these were tovec code turned out to be really"}, {"start": 1755.24, "end": 1763.16, "text": " really efficient code and that's why I got so popular as well they did the same thing for phrases"}, {"start": 1763.16, "end": 1772.2, "text": " right here so for phrases like New York Times and so on but this was kind of more of a this was"}, {"start": 1772.2, "end": 1780.92, "text": " more of a side thing the phrase vectors turned out to be you know rather a side thing from the"}, {"start": 1780.92, "end": 1791.48, "text": " actual code right here so yeah as as I said this paper is very different from other research papers"}, {"start": 1791.48, "end": 1796.76, "text": " in that it's it's sort of half an engineering paper and all of these papers are they're kind"}, {"start": 1796.76, "end": 1805.0800000000002, "text": " of hard to read because they just kind of state some things in the order is kind of weird sometimes"}, {"start": 1805.08, "end": 1811.48, "text": " why they do things is kind of weird sometimes but you can't you know you can't deny that it had"}, {"start": 1811.48, "end": 1819.72, "text": " the quite the effect on the community and now this it it is a very cool paper a very cool"}, {"start": 1819.72, "end": 1826.1999999999998, "text": " series of papers and it's very cool that actually they released the code and they made the code such"}, {"start": 1826.1999999999998, "end": 1833.56, "text": " that it is super duper efficient even like on a single machine and that was very cool because"}, {"start": 1833.56, "end": 1840.52, "text": " you know being Google they could have just released code that is very efficient on a distributed"}, {"start": 1840.52, "end": 1849.6399999999999, "text": " data center and they didn't do that so that this is it's sort of not really like today anymore like"}, {"start": 1849.6399999999999, "end": 1857.0, "text": " today when they release code it's always you need you need like 50 cloud TPUs to do it I mean"}, {"start": 1857.0, "end": 1863.96, "text": " it's still cool that they release code but this was this was really a step into kind of democratizing"}, {"start": 1864.68, "end": 1873.08, "text": " AI and yeah so that was my rant about Word2vec I hope you enjoyed this I hope this still was"}, {"start": 1873.08, "end": 1880.52, "text": " useful to you even though most of you probably already knew Word2vec and yeah so I'll see you next"}, {"start": 1880.52, "end": 1889.24, "text": " time bye bye"}] |
Yannic Kilcher | 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 Kaimin He, Xiang Yu Chang, Xiao Qing Ran 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 the time when after Alex and that people were trying to build bigger and bigger networks and every time someone managed to build a bigger network, the accuracy on ImageNet dataset 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 our 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 generalize 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 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 would 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 Jan 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 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. I'm going to 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, 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 abstractive features, and we already knew that these neural network, 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. So 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 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. So if we are able to learn this, we should be able to train this network to at least the same accuracy, that is what this paper argues because 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. This is, I think if you read the entire text here, it is 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 why don't they learn the identity function? Well because we initialize most weights 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, L2 regularization, all of these things, 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. Identity function, convolutional filter is actually pretty difficult to learn because if I have my 3x3 filter, where is my, nope, nope, this, ahh, z, if I have my 3x3 filter, the identity function is like a one here and zero is everywhere else. 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. We 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 build 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 desire 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 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 a non-linear function in total, the network in total. But the default for the individual blocks here is the identity. 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 and 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. 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, the resenets 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 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 go 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, will 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 is 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. There are these one by one convolutions that simply up, 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 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. And 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 realized 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. Also, when I read this first, I particularly enjoyed this paragraph right here. Let's read it together. Our implementation for ImageNet follows the practice in the da da da da. Image is resized with the shorter randomly sampled in this. For scale augmentation, this crop is randomly sampled from the image or it's horizontal flip with the purpose, so as means subtracted. This nanorcolor augmentation is used. We adopt the batch normalization right after each convolution before activation. This, an age old discussion was born when to use batch normalization before the activation or after the activation. I still 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 da da da da da da. The learning rate starts from this is divided by then. So here in this paragraph, they detail basically all the training procedure and all the tricks that they use. And I remember specifically that 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 thought it was rather funny. So you can see right here the results of this. If you look at the left, these are the plain 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 use 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, 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 this 18 layers, this is sort of a VGG 19 depth network. Well, 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, these residual connections, all of a sudden, make it a lot, a lot better. You can see that it's not that we can't train the 34 layers, but the residual connections just help a lot more. And most of a sudden, most importantly, they don't degrade the performance from the shallower network. So they explore the different options right here and compare it to others. And 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. Well, option C doesn't give you that much of a boost, introduces many more parameters. And overall, 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, these numbers, they were unheard of. Like even 50 layer deep neural network was bombastic, but 152 layers. 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 computationally intensive than the three by three convolutions. 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 101152, they are still staples today. 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 made it a long way. Here you can see the number of parameters in these residual networks. This was the absolute craziest thing right here. 1,202 layers. So you can see still until here, ResNet 110. Now this is on C410 right here, not on ImageNet anymore. But you can see that even 110 layers still had less parameters, or actually the same order of parameters than these previous networks that were only 19 layers deep. This was unheard of, and much more unheard of 1,2002 layer network to train on C410. 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 end themselves as they went deeper and deeper and deeper. However, once you go to 1,000 and 2 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 ask 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 1,200 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 here they conclude. Now we are overfitting. They don't use like the biggest data augmentation like we used 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 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 and the dash lines are significantly above the residual network. And that's not a function of the depth because if the depth was actually equal here, you would expect that the dash lines would would stretch like this. They would kind of stretch out however exactly the opposite is happening. You can see that the residual networks, even at the beginning, the responses are very much smaller. And this is kind of what I like about this paper. 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 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. I, 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. I'll see you next time. | [{"start": 0.0, "end": 6.4, "text": " Hi there, today we'll look at deep residual learning for image recognition by Kaimin He,"}, {"start": 6.4, "end": 11.36, "text": " Xiang Yu Chang, Xiao Qing Ran and Jian Sun."}, {"start": 11.36, "end": 15.68, "text": " So this, you know it, this is an old paper."}, {"start": 15.68, "end": 22.32, "text": " It is from 2015, but I thought we'd still look at it because this not only is it one of"}, {"start": 22.32, "end": 29.88, "text": " the most influential papers in modern deep learning, it is also a very well written paper"}, {"start": 29.88, "end": 35.96, "text": " and I remember it like it was yesterday when this came out, this was like a bomb."}, {"start": 35.96, "end": 42.36, "text": " So, around that time, this meme was going around."}, {"start": 42.36, "end": 48.68, "text": " I was winning ImageNet, but then someone made a deeper net."}, {"start": 48.68, "end": 55.44, "text": " This was a, this was the time when after Alex and that people were trying to build bigger"}, {"start": 55.44, "end": 62.68, "text": " and bigger networks and every time someone managed to build a bigger network, the accuracy"}, {"start": 62.68, "end": 66.64, "text": " on ImageNet dataset would increase."}, {"start": 66.64, "end": 72.08, "text": " Pretty much in lockstep with how much bigger the network was, but people got to the limit"}, {"start": 72.08, "end": 78.12, "text": " of building big networks and then this paper drops and changed everything."}, {"start": 78.12, "end": 83.4, "text": " And our residual connections are everywhere, not only in image recognition, they are in"}, {"start": 83.4, "end": 89.84, "text": " transformers, they are in whatever, wherever you go, you'll probably find some residual"}, {"start": 89.84, "end": 93.84, "text": " connections somewhere in there."}, {"start": 93.84, "end": 101.32000000000001, "text": " So yeah, let's, let's look at this paper and let's revisit what kind of problems people"}, {"start": 101.32000000000001, "end": 104.32000000000001, "text": " had then and how they solved it."}, {"start": 104.32000000000001, "end": 113.28, "text": " So here they go directly into, into this problem of deep neural networks and the problem"}, {"start": 113.28, "end": 121.16, "text": " that people had was they knew that if you can increase the, if you can increase the depth"}, {"start": 121.16, "end": 126.24000000000001, "text": " of a neural network, you can make it perform better, you can make it generalize better,"}, {"start": 126.24000000000001, "end": 131.8, "text": " you can reach lower training loss, but optimizing it was hard."}, {"start": 131.8, "end": 134.68, "text": " Specifically, this was a phenomenon that people observed."}, {"start": 134.68, "end": 138.8, "text": " So if you have a 20 layer neural network, you could train it and you know, there's this"}, {"start": 138.8, "end": 144.08, "text": " learning rate drop, people have already figured out that you need to drop, drop the learning"}, {"start": 144.08, "end": 147.96, "text": " 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": 158.88000000000002, "text": " However, if, after a certain point, if they increase the depth even more, the training"}, {"start": 158.88000000000002, "end": 161.44, "text": " error would actually go up again."}, {"start": 161.44, "end": 163.64000000000001, "text": " And so would the test error."}, {"start": 163.64000000000001, "end": 168.60000000000002, "text": " And this is not a problem of overfitting because overfitting would be when the training"}, {"start": 168.6, "end": 173.6, "text": " error is lower or as low and then the test error went up."}, {"start": 173.6, "end": 174.56, "text": " So this is the first thing."}, {"start": 174.56, "end": 178.24, "text": " This is not a phenomenon of overfitting of too many parameters."}, {"start": 178.24, "end": 182.16, "text": " So why can't we train bigger layers?"}, {"start": 182.16, "end": 188.44, "text": " Networks, until that time, have very much followed kind of the original network design that"}, {"start": 188.44, "end": 196.12, "text": " was envisioned by sort of people like Jan LeCun and also Alex Net and the most popular"}, {"start": 196.12, "end": 198.48, "text": " ones were these VGG nets."}, {"start": 198.48, "end": 203.64, "text": " And they were very much of the philosophy that you'd have like some, you have the image"}, {"start": 203.64, "end": 213.23999999999998, "text": " here and you input that into convolutional layers which first would kind of keep a big"}, {"start": 213.23999999999998, "end": 219.44, "text": " resolution but would increase the channel size by you know, some amount."}, {"start": 219.44, "end": 225.92, "text": " And then you would sort of downscale the image as you increase the number of filters."}, {"start": 225.92, "end": 228.44, "text": " So you would stack more and more filters."}, {"start": 228.44, "end": 230.39999999999998, "text": " I'm going to draw more filters."}, {"start": 230.39999999999998, "end": 236.76, "text": " You would stack more and more filters while downscaling the resolution of the image."}, {"start": 236.76, "end": 244.6, "text": " The reasoning was that if you do image classification, right, then you know, where on this, maybe"}, {"start": 244.6, "end": 251.23999999999998, "text": " you want to classify this into a Lego tower or whatever that is."}, {"start": 251.23999999999998, "end": 253.35999999999999, "text": " It's not that important where it is."}, {"start": 253.36, "end": 259.32, "text": " So on the lower levels, you would want to parse out like very low layer features like edges"}, {"start": 259.32, "end": 260.40000000000003, "text": " and so on."}, {"start": 260.40000000000003, "end": 264.52000000000004, "text": " And these are still important where they are, right, the fact that here's an edge, here's"}, {"start": 264.52000000000004, "end": 266.08000000000004, "text": " an edge, here's an edge."}, {"start": 266.08000000000004, "end": 271.0, "text": " But then as you go higher up and go to more and more abstractive features, and we already"}, {"start": 271.0, "end": 276.2, "text": " knew that these neural network, they tend to learn more and more abstract features as"}, {"start": 276.2, "end": 277.48, "text": " you go up the layers."}, {"start": 277.48, "end": 283.08000000000004, "text": " The hypothesis was that the exact localization of these abstract features would be less and"}, {"start": 283.08, "end": 284.32, "text": " 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.71999999999997, "text": " the fact that there are edges."}, {"start": 303.71999999999997, "end": 308.52, "text": " And then the intermediate layers would recognize the geometric shapes of maybe here, the wheels"}, {"start": 308.52, "end": 310.36, "text": " and these bodies."}, {"start": 310.36, "end": 314.36, "text": " So it's not that important where exactly they are and then the higher layers would learn"}, {"start": 314.36, "end": 319.44, "text": " to combine the individual parts to each other."}, {"start": 319.44, "end": 325.6, "text": " And again, it becomes less and less important where these things are and more and more important"}, {"start": 325.6, "end": 327.56, "text": " that you build more expressive features."}, {"start": 327.56, "end": 331.84000000000003, "text": " So people would downscale the resolution upscale the number of filters."}, {"start": 331.84000000000003, "end": 340.2, "text": " Now that's a good heuristic, but this is basically the architecture of these networks."}, {"start": 340.2, "end": 347.4, "text": " And we would question why would, if we increase the number of layers, so if we instead of one"}, {"start": 347.4, "end": 350.84, "text": " here, we have two of these layers, right?"}, {"start": 350.84, "end": 356.03999999999996, "text": " We simply have two of these layers and here we have two of these layers."}, {"start": 356.03999999999996, "end": 360.71999999999997, "text": " Why does it get worse?"}, {"start": 360.71999999999997, "end": 365.84, "text": " Especially this paper here makes an interesting observation."}, {"start": 365.84, "end": 375.71999999999997, "text": " So it is not caused by overfitting and adding more layers leads to a higher training error."}, {"start": 375.71999999999997, "end": 381.35999999999996, "text": " The degradation indicates that is not all systems are similarly easy to optimize."}, {"start": 381.35999999999996, "end": 385.47999999999996, "text": " Let us consider a shallower architecture and its deeper counterparts that adds more layers"}, {"start": 385.47999999999996, "end": 387.15999999999997, "text": " onto it."}, {"start": 387.15999999999997, "end": 390.59999999999997, "text": " There exists a solution by construction to the deeper model."}, {"start": 390.59999999999997, "end": 394.96, "text": " The added layers are identity mapping and the other layers are copied from the learned"}, {"start": 394.96, "end": 396.52, "text": " shallower model."}, {"start": 396.52, "end": 403.4, "text": " So pretty easy if you have a shallow model like five layers that learns a particular function,"}, {"start": 403.4, "end": 409.03999999999996, "text": " I can pretty easily prove that there is a deep model that learns the same function by"}, {"start": 409.03999999999996, "end": 417.0, "text": " simply copying over these five layers and having these here learn the identity function."}, {"start": 417.0, "end": 422.91999999999996, "text": " So if we are able to learn this, we should be able to train this network to at least"}, {"start": 422.92, "end": 428.6, "text": " the same accuracy, that is what this paper argues because these layers can simply learn"}, {"start": 428.6, "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": 438.92, "text": " with overfitting."}, {"start": 438.92, "end": 444.24, "text": " This is, I think if you read the entire text here, it is very, very clear."}, {"start": 444.24, "end": 449.92, "text": " If you read it, they lead you through this reasoning saying that look, all these layers"}, {"start": 449.92, "end": 455.92, "text": " have to do is learn the identity function and then we could at least get the same accuracy."}, {"start": 455.92, "end": 460.88, "text": " So why don't they learn the identity function?"}, {"start": 460.88, "end": 467.52000000000004, "text": " Well because we initialize most weights towards zero, we initialize them randomly but mostly"}, {"start": 467.52000000000004, "end": 469.20000000000005, "text": " we initialize them around zero."}, {"start": 469.20000000000005, "end": 475.0, "text": " Our initialization procedure, usually sample from some Gaussian with some kind of a standard"}, {"start": 475.0, "end": 479.68, "text": " deviation but around the mean of zero."}, {"start": 479.68, "end": 486.6, "text": " And also if we use things like weight decay, L2 regularization, all of these things, they"}, {"start": 486.6, "end": 489.12, "text": " bias the weights towards zero."}, {"start": 489.12, "end": 495.08, "text": " So if there is any natural thing that these networks are good at is they learn the zero"}, {"start": 495.08, "end": 497.12, "text": " function really well."}, {"start": 497.12, "end": 502.36, "text": " Learning the identity function is as difficult as learning any other function."}, {"start": 502.36, "end": 508.4, "text": " Identity function, convolutional filter is actually pretty difficult to learn because"}, {"start": 508.4, "end": 519.0799999999999, "text": " if I have my 3x3 filter, where is my, nope, nope, this, ahh, z, if I have my 3x3 filter,"}, {"start": 519.0799999999999, "end": 523.52, "text": " the identity function is like a one here and zero is everywhere else."}, {"start": 523.52, "end": 526.68, "text": " That would be one of the things."}, {"start": 526.68, "end": 527.68, "text": " It's not that easy."}, {"start": 527.68, "end": 533.0, "text": " You need to learn nine weights in the correct way."}, {"start": 533.0, "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": 544.04, "text": " be the zero function or whatever the randomly initialized function, can we make the default"}, {"start": 544.04, "end": 549.48, "text": " function, the one function, can we make the default function the identity function."}, {"start": 549.48, "end": 552.52, "text": " And that brings you to residual connection."}, {"start": 552.52, "end": 560.32, "text": " So instead of learning to transform x via a neural network into x which is the identity"}, {"start": 560.32, "end": 561.32, "text": " function."}, {"start": 561.32, "end": 570.6800000000001, "text": " We don't we have x, stay x and then learn whatever we need to change."}, {"start": 570.6800000000001, "end": 571.6800000000001, "text": " Okay."}, {"start": 571.6800000000001, "end": 577.9200000000001, "text": " So if, let's call that tilde, if the assumption is that it's a good default to not change"}, {"start": 577.9200000000001, "end": 578.9200000000001, "text": " much."}, {"start": 578.9200000000001, "end": 581.84, "text": " So this is almost the same as this."}, {"start": 581.84, "end": 587.6800000000001, "text": " We might make this build this directly into the architecture, the fact that these two"}, {"start": 587.68, "end": 594.28, "text": " are equal plus plus some deviation that is learned right here."}, {"start": 594.28, "end": 601.76, "text": " And the hypothesis is that especially the deeper you go, if you go very deep, each function"}, {"start": 601.76, "end": 604.68, "text": " here will actually learn not that much."}, {"start": 604.68, "end": 609.3199999999999, "text": " It will learn to basically change the signal a little bit, but mostly it will learn the"}, {"start": 609.3199999999999, "end": 612.0799999999999, "text": " identity function if it behaves well."}, {"start": 612.0799999999999, "end": 616.9599999999999, "text": " And therefore it might be, you know, reasonable to build this into the architecture."}, {"start": 616.96, "end": 620.12, "text": " And of course this has turned out to be very accurate."}, {"start": 620.12, "end": 624.4000000000001, "text": " It has actually been reasonable to build this into the architecture."}, {"start": 624.4000000000001, "end": 627.4000000000001, "text": " So that's what they propose right here."}, {"start": 627.4000000000001, "end": 632.96, "text": " So instead of just having weight layers one after another, what they propose is to have"}, {"start": 632.96, "end": 635.88, "text": " these skip connections in here."}, {"start": 635.88, "end": 640.8000000000001, "text": " So these skip connections, they will instead of learning the function, they call this entire"}, {"start": 640.8, "end": 650.1999999999999, "text": " function h of x, which might be very complicated, they learn the function, whatever f and f"}, {"start": 650.1999999999999, "end": 652.7199999999999, "text": " is whatever you need to change about x."}, {"start": 652.7199999999999, "end": 655.52, "text": " You see at the end you add x to it."}, {"start": 655.52, "end": 663.7199999999999, "text": " So these weight layers here, they simply learn whatever makes this next, this output different"}, {"start": 663.7199999999999, "end": 667.28, "text": " from this input and learning differences."}, {"start": 667.28, "end": 672.92, "text": " Now you have the desire property because what do we know about weight layers from before?"}, {"start": 672.92, "end": 675.56, "text": " Well they tend towards the zero function, right?"}, {"start": 675.56, "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.0799999999999, "text": " Well if f tends towards the zero function, then h becomes the identity function."}, {"start": 688.0799999999999, "end": 692.68, "text": " So the default function of this network is the identity function."}, {"start": 692.68, "end": 697.0, "text": " And whenever we learn something, we learn how to deviate from the identity function."}, {"start": 697.0, "end": 702.64, "text": " And that is a much better default function."}, {"start": 702.64, "end": 706.08, "text": " Now it's not entirely true that the default function is the identity function."}, {"start": 706.08, "end": 711.68, "text": " You see that here for example, there's after the skip connection, there is actually a"}, {"start": 711.68, "end": 712.76, "text": " relu."}, {"start": 712.76, "end": 718.44, "text": " So there's still a non-linear function in total, the network in total."}, {"start": 718.44, "end": 723.52, "text": " But the default for the individual blocks here is the identity."}, {"start": 723.52, "end": 728.12, "text": " Now if you chain these blocks, you get a residual network."}, {"start": 728.12, "end": 731.4, "text": " And that's what they propose right here."}, {"start": 731.4, "end": 736.4399999999999, "text": " So on the left you see this original VGG architecture like we described it."}, {"start": 736.4399999999999, "end": 742.72, "text": " So you can see you have an image which has four channels and you first up it to 64 channels"}, {"start": 742.72, "end": 744.36, "text": " and you keep the resolution."}, {"start": 744.36, "end": 750.64, "text": " And then you max pool, which halves the resolution, but you go up with the filters to 128, you max"}, {"start": 750.64, "end": 755.4399999999999, "text": " pool again, go up with the filters and so on."}, {"start": 755.4399999999999, "end": 761.84, "text": " Now this has, even though it doesn't look like it, this has a lot of parameters and it"}, {"start": 761.84, "end": 763.24, "text": " needs a lot of computation."}, {"start": 763.24, "end": 768.88, "text": " So it has 19.6 billion floating point operation for a forward pass."}, {"start": 768.88, "end": 775.72, "text": " In contrast, the networks we're going to build here, the residual networks have 3.6 billion"}, {"start": 775.72, "end": 783.84, "text": " flops, so they are much, much less in terms of complexity than the old VGG networks while"}, {"start": 783.84, "end": 786.9200000000001, "text": " still being much deeper."}, {"start": 786.9200000000001, "end": 790.32, "text": " The hypothesis is the deeper, the better."}, {"start": 790.32, "end": 796.2, "text": " And as a trade off, per layer, you don't actually need to have that many parameters because"}, {"start": 796.2, "end": 802.12, "text": " you don't learn that much per layer, but the succession of layers gains you much more"}, {"start": 802.12, "end": 804.76, "text": " than simply having single massive layers."}, {"start": 804.76, "end": 811.72, "text": " You can see at the same size of resolution here, the resenets can get away with much less"}, {"start": 811.72, "end": 818.92, "text": " amounts of filters and that's why they are less, they are of less size."}, {"start": 818.92, "end": 822.2, "text": " So this is the comparison, the VGG 19."}, {"start": 822.2, "end": 828.64, "text": " Now they do build this 34 layer network, which they call plane and you can see it is simply"}, {"start": 828.64, "end": 833.64, "text": " a 34 layer network with pooling right here."}, {"start": 833.64, "end": 838.84, "text": " And here instead of pooling, they do a stride to convolution, which has also become, this"}, {"start": 838.84, "end": 845.3199999999999, "text": " has become kind of more standard than doing max or average pooling to downscale to do simply"}, {"start": 845.3199999999999, "end": 847.1999999999999, "text": " stride to convolution."}, {"start": 847.1999999999999, "end": 853.48, "text": " So this paper has actually set the standards for a lot of things in modern deep learning."}, {"start": 853.48, "end": 861.2, "text": " So our goal is to go to be to compare, first of all, the VGG 19 to the 34 layer plane"}, {"start": 861.2, "end": 866.6800000000001, "text": " to show that you lose performance when you simply up the number of layers."}, {"start": 866.6800000000001, "end": 871.84, "text": " But then when you introduce the residual connections, as you can see right here, so there"}, {"start": 871.84, "end": 874.72, "text": " is always this jumping connection right here."}, {"start": 874.72, "end": 880.08, "text": " So along these jumping connections, the signal can travel as the identity function."}, {"start": 880.08, "end": 885.44, "text": " What we're going to see is that if we go from plane to residual, introducing no extra"}, {"start": 885.44, "end": 891.84, "text": " parameters, just the skip connections will change everything, will make this network all"}, {"start": 891.84, "end": 898.6, "text": " of a sudden trainable and make the deeper networks, the better networks."}, {"start": 898.6, "end": 904.7600000000001, "text": " Okay, the only little caveat here is of course, in order to build a residual connection,"}, {"start": 904.7600000000001, "end": 908.8800000000001, "text": " the output has to be of the same size as the input because you need to add the input"}, {"start": 908.8800000000001, "end": 910.5200000000001, "text": " to the output."}, {"start": 910.5200000000001, "end": 912.36, "text": " And this here, for example, is not given."}, {"start": 912.36, "end": 918.96, "text": " So here you can see this signal after this layer is going to be half as big because it's"}, {"start": 918.96, "end": 920.76, "text": " a stride to convolution."}, {"start": 920.76, "end": 929.2, "text": " So the output right here is only half the size, but it is twice the number of filters."}, {"start": 929.2, "end": 934.8000000000001, "text": " You can see right here, this is 64 filters and here we go to 128 filters."}, {"start": 934.8000000000001, "end": 941.4, "text": " That's why this connection right here has parameters in order to simply expand the number"}, {"start": 941.4, "end": 942.32, "text": " of filters."}, {"start": 942.32, "end": 949.32, "text": " There are these one by one convolutions that simply up, that simply project the 64 filters"}, {"start": 949.32, "end": 951.84, "text": " to 128 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": 965.5600000000001, "text": " In fact, here the 34 parameters residual network, no, I'm wrong."}, {"start": 965.5600000000001, "end": 967.12, "text": " You have different options."}, {"start": 967.12, "end": 974.0, "text": " So the world has ended up at the option of doing one by one convolutions, but in this paper"}, {"start": 974.0, "end": 977.28, "text": " they still explore three different options."}, {"start": 977.28, "end": 983.12, "text": " And I guess here in this particular experiment, the option A is simply to zero pad."}, {"start": 983.12, "end": 993.8, "text": " So to leave the first 64 channels, but to simply append 128 zero padded filters there"}, {"start": 993.8, "end": 995.6, "text": " or channels."}, {"start": 995.6, "end": 998.6800000000001, "text": " And B is the one by one convolution."}, {"start": 998.6800000000001, "end": 1004.88, "text": " And option C is actually that all of these connections right here also have the one by"}, {"start": 1004.88, "end": 1008.44, "text": " one convolutions, which introduces extra parameters."}, {"start": 1008.44, "end": 1015.6, "text": " And they realized that option C isn't improving over option B substantially."}, {"start": 1015.6, "end": 1018.6, "text": " And in fact is only improving marginally."}, {"start": 1018.6, "end": 1021.5600000000001, "text": " And they say, okay, that's probably just because we have more parameters."}, {"start": 1021.56, "end": 1028.44, "text": " So ultimately they went with option B and I think that's what the world does right now."}, {"start": 1028.44, "end": 1034.6399999999999, "text": " Also, when I read this first, I particularly enjoyed this paragraph right here."}, {"start": 1034.6399999999999, "end": 1036.04, "text": " Let's read it together."}, {"start": 1036.04, "end": 1039.84, "text": " Our implementation for ImageNet follows the practice in the da da da da."}, {"start": 1039.84, "end": 1042.8, "text": " Image is resized with the shorter randomly sampled in this."}, {"start": 1042.8, "end": 1047.1599999999999, "text": " For scale augmentation, this crop is randomly sampled from the image or it's horizontal"}, {"start": 1047.1599999999999, "end": 1049.8799999999999, "text": " flip with the purpose, so as means subtracted."}, {"start": 1049.88, "end": 1051.8400000000001, "text": " This nanorcolor augmentation is used."}, {"start": 1051.8400000000001, "end": 1055.8000000000002, "text": " We adopt the batch normalization right after each convolution before activation."}, {"start": 1055.8000000000002, "end": 1064.3600000000001, "text": " This, an age old discussion was born when to use batch normalization before the activation"}, {"start": 1064.3600000000001, "end": 1065.5200000000002, "text": " or after the activation."}, {"start": 1065.5200000000002, "end": 1070.48, "text": " I still think people are still fighting over this today."}, {"start": 1070.48, "end": 1077.2, "text": " We initialize the weights as in 13 and train all plane residual nets from scratch use SGD"}, {"start": 1077.2, "end": 1078.5600000000002, "text": " da da da da da da."}, {"start": 1078.56, "end": 1081.08, "text": " The learning rate starts from this is divided by then."}, {"start": 1081.08, "end": 1087.6399999999999, "text": " So here in this paragraph, they detail basically all the training procedure and all the tricks"}, {"start": 1087.6399999999999, "end": 1088.6399999999999, "text": " that they use."}, {"start": 1088.6399999999999, "end": 1094.12, "text": " And I remember specifically that I've read all of this, which was the idea and I could follow"}, {"start": 1094.12, "end": 1096.28, "text": " like, oh, this is super well explained."}, {"start": 1096.28, "end": 1098.76, "text": " This is so cool and so on."}, {"start": 1098.76, "end": 1101.6399999999999, "text": " And then I expect basically an implementation of that."}, {"start": 1101.6399999999999, "end": 1106.44, "text": " And then there's one single paragraph with like 20 lines saying, oh, and by the way, we"}, {"start": 1106.44, "end": 1110.76, "text": " use these 50 tricks from these other papers."}, {"start": 1110.76, "end": 1114.1200000000001, "text": " And yeah, that's when it, I guess, it was already happening."}, {"start": 1114.1200000000001, "end": 1121.68, "text": " You needed to do all the modern tricks in order to really reach the top accuracies."}, {"start": 1121.68, "end": 1125.52, "text": " But you know, in hindsight, we know it wasn't the tricks that helped them."}, {"start": 1125.52, "end": 1129.3200000000002, "text": " It was actually their idea."}, {"start": 1129.3200000000002, "end": 1132.3600000000001, "text": " 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.1999999999998, "text": " If you look at the left, these are the plain networks."}, {"start": 1140.1999999999998, "end": 1141.6399999999999, "text": " And we've already sort of seen this."}, {"start": 1141.6399999999999, "end": 1144.4399999999998, "text": " Now, this is on ImageNet right here."}, {"start": 1144.4399999999998, "end": 1150.32, "text": " You can see the 18 layer network simply has lower train and validation accuracy."}, {"start": 1150.32, "end": 1160.56, "text": " So the solid line here is the validation on ImageNet, bold curves denote validation error"}, {"start": 1160.56, "end": 1162.12, "text": " of the center crops."}, {"start": 1162.12, "end": 1164.36, "text": " So I guess they do, yeah, they do center crops."}, {"start": 1164.36, "end": 1170.6399999999999, "text": " So the training error is going to be higher because they do these different augmentations."}, {"start": 1170.6399999999999, "end": 1177.32, "text": " But you can see the training and the validation error are higher in the deeper network."}, {"start": 1177.32, "end": 1182.0, "text": " If you don't use residual connections, again, this is not due to overfitting."}, {"start": 1182.0, "end": 1188.6, "text": " And this is because we can't train these deep networks because we should be able to the"}, {"start": 1188.6, "end": 1194.1599999999999, "text": " solution space of the 18 layer network is a subspace of the solution space of the 34 layer"}, {"start": 1194.1599999999999, "end": 1195.1599999999999, "text": " network."}, {"start": 1195.1599999999999, "end": 1200.56, "text": " Everything tells us we should be able to learn the 34 layers to at least the accuracy"}, {"start": 1200.56, "end": 1203.04, "text": " of the 18 layers, but we can't."}, {"start": 1203.04, "end": 1210.4399999999998, "text": " However, introduce residual connections, and you can see that the trend is exactly reversed."}, {"start": 1210.4399999999998, "end": 1217.0, "text": " Now the 34 layer with residual connections has a much, much lower training and validation"}, {"start": 1217.0, "end": 1219.04, "text": " error than the 18 layer."}, {"start": 1219.04, "end": 1222.72, "text": " In fact, look at this table right here."}, {"start": 1222.72, "end": 1228.48, "text": " If you introduce the residual connections to the 18 layers, it's marginally better."}, {"start": 1228.48, "end": 1234.6, "text": " However, if you introduce the residual connections to the 34 layers, it is a lot better."}, {"start": 1234.6, "end": 1239.0, "text": " And this is another testament to the fact that these residual connections, they really"}, {"start": 1239.0, "end": 1241.96, "text": " help more and more the deeper you go."}, {"start": 1241.96, "end": 1250.32, "text": " You can see the effect in this 18 layers, this is sort of a VGG 19 depth network."}, {"start": 1250.32, "end": 1255.3600000000001, "text": " Well, and there we already know we can train these without residual connections, right?"}, {"start": 1255.3600000000001, "end": 1258.08, "text": " Because we were able to train VGG 19."}, {"start": 1258.08, "end": 1265.76, "text": " However, if we go higher to more layers, these residual connections, all of a sudden, make"}, {"start": 1265.76, "end": 1268.8, "text": " it a lot, a lot better."}, {"start": 1268.8, "end": 1274.56, "text": " You can see that it's not that we can't train the 34 layers, but the residual connections"}, {"start": 1274.56, "end": 1276.72, "text": " just help a lot more."}, {"start": 1276.72, "end": 1284.36, "text": " And most of a sudden, most importantly, they don't degrade the performance from the"}, {"start": 1284.36, "end": 1287.6399999999999, "text": " shallower network."}, {"start": 1287.6399999999999, "end": 1295.1599999999999, "text": " So they explore the different options right here and compare it to others."}, {"start": 1295.16, "end": 1300.8400000000001, "text": " And options, as I said, being A, B and C, where A is the zero padding for the projection,"}, {"start": 1300.8400000000001, "end": 1305.68, "text": " B is having projections simply between where the channels don't fit."}, {"start": 1305.68, "end": 1310.24, "text": " And C being having projections in every single residual connection."}, {"start": 1310.24, "end": 1315.4, "text": " And you can see right here that the option B gives you quite a bit of a boost."}, {"start": 1315.4, "end": 1320.64, "text": " Well, option C doesn't give you that much of a boost, introduces many more parameters."}, {"start": 1320.64, "end": 1328.96, "text": " And overall, I guess they decided against it, which since then the world has also decided"}, {"start": 1328.96, "end": 1330.3600000000001, "text": " against it."}, {"start": 1330.3600000000001, "end": 1333.5200000000002, "text": " They also do deeper networks."}, {"start": 1333.5200000000002, "end": 1344.44, "text": " So they built deeper networks like 50 layer ResNet, 101 layer ResNet and 152 layer ResNet."}, {"start": 1344.44, "end": 1350.3200000000002, "text": " And the 152 layer ResNet ended up being the best one, as you can see here."}, {"start": 1350.32, "end": 1357.72, "text": " And you can see a pretty gain, like it almost, almost lockstep gain depth, more depth means"}, {"start": 1357.72, "end": 1358.72, "text": " better network."}, {"start": 1358.72, "end": 1364.12, "text": " And this at the time, these numbers, they were unheard of."}, {"start": 1364.12, "end": 1371.72, "text": " Like even 50 layer deep neural network was bombastic, but 152 layers."}, {"start": 1371.72, "end": 1373.9199999999998, "text": " It was crazy."}, {"start": 1373.92, "end": 1381.72, "text": " And the fact that still it has less parameters than the VGG 19 and performs better, that was"}, {"start": 1381.72, "end": 1385.3600000000001, "text": " mind, mind blowing, absolutely mind blowing."}, {"start": 1385.3600000000001, "end": 1392.0, "text": " And then at the end, they built an ensemble of these models and ended up taking the 2015"}, {"start": 1392.0, "end": 1394.48, "text": " ImageNet competition winner."}, {"start": 1394.48, "end": 1396.48, "text": " That was still like very important back then."}, {"start": 1396.48, "end": 1402.96, "text": " It was still very important who wins, who wins ImageNet that year, where I think I haven't"}, {"start": 1402.96, "end": 1405.6000000000001, "text": " even followed up on the last few years."}, {"start": 1405.6000000000001, "end": 1413.1200000000001, "text": " It's some kind of wide fix ResNet, whatnot with pre-trained and 50 billion extra data."}, {"start": 1413.1200000000001, "end": 1414.1200000000001, "text": " Yeah."}, {"start": 1414.1200000000001, "end": 1420.8400000000001, "text": " So for the deeper networks, they decide that they are computationally rather become rather"}, {"start": 1420.8400000000001, "end": 1422.0, "text": " expensive."}, {"start": 1422.0, "end": 1428.1200000000001, "text": " So they introduce these bottleneck blocks here on the right, where as you can see, so here,"}, {"start": 1428.12, "end": 1436.8, "text": " if you have a 64-dimensional input, you do 64 feature channels in your convolution, have"}, {"start": 1436.8, "end": 1438.9599999999998, "text": " a 64-dimensional output."}, {"start": 1438.9599999999998, "end": 1443.6, "text": " You can save computation if you first project the higher."}, {"start": 1443.6, "end": 1446.36, "text": " So here you have a 256-dimensional input."}, {"start": 1446.36, "end": 1453.7199999999998, "text": " And they say we can save computational power by pretty much projecting down to 64 first,"}, {"start": 1453.72, "end": 1458.68, "text": " because then our complexity of this layer, which is the expensive layer, will be the same"}, {"start": 1458.68, "end": 1462.1200000000001, "text": " as the complexity of one of these layers."}, {"start": 1462.1200000000001, "end": 1463.92, "text": " And then we can project up again."}, {"start": 1463.92, "end": 1469.64, "text": " The one by one convolution, they are significantly lower computationally intensive than the"}, {"start": 1469.64, "end": 1471.48, "text": " three by three convolutions."}, {"start": 1471.48, "end": 1477.28, "text": " It's nine times less operations if you think about it."}, {"start": 1477.28, "end": 1481.32, "text": " So that's what they use to build the deeper residual networks."}, {"start": 1481.32, "end": 1487.52, "text": " And these residual networks, the ResNet 50 101152, they are still staples today."}, {"start": 1487.52, "end": 1492.84, "text": " You can have pre-trained versions of those, and people still use it."}, {"start": 1492.84, "end": 1499.4399999999998, "text": " Like ResNet 50 is used in every segmentation, whatnot application."}, {"start": 1499.4399999999998, "end": 1502.52, "text": " So yeah, this has turned out."}, {"start": 1502.52, "end": 1506.4399999999998, "text": " These decisions here have made it a long way."}, {"start": 1506.44, "end": 1512.6000000000001, "text": " Here you can see the number of parameters in these residual networks."}, {"start": 1512.6000000000001, "end": 1516.8, "text": " This was the absolute craziest thing right here."}, {"start": 1516.8, "end": 1521.88, "text": " 1,202 layers."}, {"start": 1521.88, "end": 1525.8, "text": " So you can see still until here, ResNet 110."}, {"start": 1525.8, "end": 1529.56, "text": " Now this is on C410 right here, not on ImageNet anymore."}, {"start": 1529.56, "end": 1536.4, "text": " But you can see that even 110 layers still had less parameters, or actually the same"}, {"start": 1536.4, "end": 1544.4, "text": " order of parameters than these previous networks that were only 19 layers deep."}, {"start": 1544.4, "end": 1554.3600000000001, "text": " This was unheard of, and much more unheard of 1,2002 layer network to train on C410."}, {"start": 1554.3600000000001, "end": 1559.96, "text": " It's a bit of an overkill, but they say their goal was explicitly to study depth."}, {"start": 1559.96, "end": 1566.56, "text": " And you can see here that with the deeper and deeper networks, they outperformed all"}, {"start": 1566.56, "end": 1568.72, "text": " of the previous networks."}, {"start": 1568.72, "end": 1573.64, "text": " So all of the baselines end themselves as they went deeper and deeper and deeper."}, {"start": 1573.64, "end": 1579.88, "text": " However, once you go to 1,000 and 2 layers, you go up again."}, {"start": 1579.88, "end": 1583.4, "text": " So here's the question."}, {"start": 1583.4, "end": 1588.44, "text": " Was this all just kind of a trick, a hack, and do we run into the same problem again?"}, {"start": 1588.44, "end": 1591.0, "text": " And that's the question they ask themselves."}, {"start": 1591.0, "end": 1592.96, "text": " And the answer is no."}, {"start": 1592.96, "end": 1597.44, "text": " So if you look right here."}, {"start": 1597.44, "end": 1600.72, "text": " So here you see again, the plane networks."}, {"start": 1600.72, "end": 1607.68, "text": " In the plane networks, you can pretty easily see that the more layers you have, the higher"}, {"start": 1607.68, "end": 1609.52, "text": " your error goes."}, {"start": 1609.52, "end": 1613.68, "text": " Whereas in the residual network, it's exactly the opposite way."}, {"start": 1613.68, "end": 1617.0800000000002, "text": " The more layers you have, the lower your error."}, {"start": 1617.08, "end": 1624.76, "text": " And if you compare this 110 layer network with the 1,200 layer network, you see your validation"}, {"start": 1624.76, "end": 1626.1599999999999, "text": " error going up again."}, {"start": 1626.1599999999999, "end": 1631.4399999999998, "text": " However, your training error, and I can't zoom in more, but it's the same."}, {"start": 1631.4399999999998, "end": 1632.4399999999998, "text": " It's the same."}, {"start": 1632.4399999999998, "end": 1633.6, "text": " And it's at zero."}, {"start": 1633.6, "end": 1638.8799999999999, "text": " So here they conclude and the here they conclude."}, {"start": 1638.8799999999999, "end": 1640.8, "text": " Now we are overfitting."}, {"start": 1640.8, "end": 1644.36, "text": " They don't use like the biggest data augmentation like we used today."}, {"start": 1644.36, "end": 1647.84, "text": " So overfitting was still a thing back then."}, {"start": 1647.84, "end": 1653.52, "text": " So now they conclude, okay, now we have actually built a large enough network that is overfitting."}, {"start": 1653.52, "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.84, "text": " we are probably overfitting."}, {"start": 1662.84, "end": 1669.36, "text": " So not only have they enabled us to build deeper networks, they have effectively shown"}, {"start": 1669.36, "end": 1676.6799999999998, "text": " that this can get you to the to the point where you don't need deeper networks anymore,"}, {"start": 1676.6799999999998, "end": 1682.08, "text": " at least on c410 because you are overfitting and it can effectively get you there."}, {"start": 1682.08, "end": 1687.0, "text": " This is a lot of evidence for the fact that this biasing the networks towards the identity"}, {"start": 1687.0, "end": 1695.32, "text": " function is a very valid thing to do and is the solution to the we can't train deep networks"}, {"start": 1695.32, "end": 1696.32, "text": " problems."}, {"start": 1696.32, "end": 1699.96, "text": " Lastly, they investigate the size of the responses."}, {"start": 1699.96, "end": 1706.4399999999998, "text": " So their hypothesis is that if it is really beneficial to bias the network towards the identity"}, {"start": 1706.4399999999998, "end": 1715.48, "text": " function and if it is really true that each of these layers only learns a little bit,"}, {"start": 1715.48, "end": 1718.6, "text": " 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.56, "text": " So the response magnitude of these layers right here, of the signal through the layers,"}, {"start": 1732.56, "end": 1738.68, "text": " and they compare those with the response magnitude of the other neural networks where you don't"}, {"start": 1738.68, "end": 1740.44, "text": " have the skip connection."}, {"start": 1740.44, "end": 1746.76, "text": " The hypothesis is if we look at these, then the responses of these layers should be much"}, {"start": 1746.76, "end": 1755.0, "text": " larger because they have to learn much more and the responses here will be much smaller"}, {"start": 1755.0, "end": 1759.52, "text": " because the identity function is already doing most of the work."}, {"start": 1759.52, "end": 1760.84, "text": " And that's exactly what you find."}, {"start": 1760.84, "end": 1765.92, "text": " So here the layers are ordered by response and you can see the plane networks and the dash"}, {"start": 1765.92, "end": 1770.76, "text": " lines are significantly above the residual network."}, {"start": 1770.76, "end": 1777.24, "text": " And that's not a function of the depth because if the depth was actually equal here, you"}, {"start": 1777.24, "end": 1782.16, "text": " would expect that the dash lines would would stretch like this."}, {"start": 1782.16, "end": 1786.24, "text": " They would kind of stretch out however exactly the opposite is happening."}, {"start": 1786.24, "end": 1790.4, "text": " You can see that the residual networks, even at the beginning, the responses are very"}, {"start": 1790.4, "end": 1791.88, "text": " much smaller."}, {"start": 1791.88, "end": 1794.5600000000002, "text": " And this is kind of what I like about this paper."}, {"start": 1794.5600000000002, "end": 1796.96, "text": " It's one narrative."}, {"start": 1796.96, "end": 1804.2, "text": " It is a hypothesis and then every single, like the hypothesis is taken and they make predictions"}, {"start": 1804.2, "end": 1805.2, "text": " from the hypothesis."}, {"start": 1805.2, "end": 1812.0800000000002, "text": " They say, okay, if we are right with our hypothesis, not only should our idea get us better accuracy."}, {"start": 1812.08, "end": 1814.8799999999999, "text": " That's what most papers do today."}, {"start": 1814.8799999999999, "end": 1821.8799999999999, "text": " But also, you know, but also it should be that we can, for example, push our network to"}, {"start": 1821.8799999999999, "end": 1826.1599999999999, "text": " the brink of where we actually are overfitting, like here."}, {"start": 1826.1599999999999, "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.3999999999999, "text": " And yeah, that's research like this is just pretty, pretty cool."}, {"start": 1838.4, "end": 1844.88, "text": " And it's, I think, a lesson for us that sadly the world has taken the resnets, but the"}, {"start": 1844.88, "end": 1850.2, "text": " world hasn't all taken the research methodology of this paper."}, {"start": 1850.2, "end": 1855.64, "text": " I, yeah, if you, again, if you want a good read, it's very well written."}, {"start": 1855.64, "end": 1860.96, "text": " You, I'm very sure you can follow it even if you have read very few papers."}, {"start": 1860.96, "end": 1865.64, "text": " And with that, yeah, I hope you enjoyed this."}, {"start": 1865.64, "end": 1870.5600000000002, "text": " Please tell me what you think of going through kind of old papers looking at whether or"}, {"start": 1870.5600000000002, "end": 1873.8400000000001, "text": " not they have stood the test of time."}, {"start": 1873.8400000000001, "end": 1877.72, "text": " And yeah, any other comments, leave them in the comments."}, {"start": 1877.72, "end": 1879.0400000000002, "text": " I do read them."}, {"start": 1879.0400000000002, "end": 1880.0400000000002, "text": " And I'll see you next time."}, {"start": 1880.04, "end": 1895.48, "text": " I'll see you next time."}] |
Yannic Kilcher | 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're at 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 one 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 Won't revolve 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 comments 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 and 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 linked in 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 right 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 loved 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 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 have to say that I'm also on BitTute mines parlor so the reason why I'm mentioning these things is that with recent developments especially around this young 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 isn't likely but you know can I Still have the 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 young LeCun situation He has left Twitter now de facto and And people wanted me to kind of make a follow-up video ask me about it, but I feel you know I have I have nothing more substantial to say and just to make a video for video 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 about the machine learning research And I only want to make videos when I really do have some information to add you know Young 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 then originally wanted to be we gotcha so in other news flatland Round one of flatland has officially started and I previously made a video about flatland It is a new rips challenge. It is a challenge where we have to route trains around a 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 direct dolesh frostbite China CEO trade marked a aadrian and I'm Peter and I forgot new bear ponnage. I'm so sorry new bear ponnage. 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 If we're 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 DQ algorithm is able to reach about a 95% success rate with three to five agents on the maps of 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 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 this court that has contributed in any way This is just awesome. We've just had a recently our first Black land town hall with entirely community generated content. So These people came together and basically joined in making one PowerPoint presentation and 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 this court 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 spine net 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 spine net robot that has the spine net 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 ask some question and usually get 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 or 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 New and didn't know and predicted and we're 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 Very happy to implement them live then next thing I want to branch out in topics Maybe more exotic things Cossality is a big thing quantum machine learning what not more practical applications Robotics control also fairness a lot of people especially after the young 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 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 channels 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 The 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 sponsor 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's interesting, you know, that's what it's gonna 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 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 you're 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 papers 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 gonna 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 tears all the tears are equal There's 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 tears all of them are equal So I have 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 of you 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 really into that in 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-scapable 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. Okay. Okay 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 gonna 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 have Vagally 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 any time Ciao | [{"start": 0.0, "end": 7.24, "text": " Yes, you're at that right. I am going on a break. Don't worry though. There will still be videos just not as many"}, {"start": 7.24, "end": 14.34, "text": " I've decided to basically reduce the upload frequency a little bit mostly because I am going on a break"}, {"start": 14.34, "end": 18.28, "text": " But also because I kind of want to have time to do other things"}, {"start": 18.28, "end": 21.8, "text": " But we'll get to that later. So how's our little channel doing?"}, {"start": 21.8, "end": 26.72, "text": " We've just passed one million views one million times someone thought well"}, {"start": 26.72, "end": 34.4, "text": " That's kind of worth watching and only about 900,000 times where they were severely disappointed after clicking on the video"}, {"start": 34.4, "end": 41.0, "text": " I think I still think that's a net gain honestly the channel just surpassed 30,000 subscribers"}, {"start": 41.0, "end": 47.32, "text": " So technically in log space we're already halfway to a hundred thousand. It's only a matter of time"}, {"start": 47.32, "end": 49.879999999999995, "text": " And I think I've said this in the last update"}, {"start": 49.88, "end": 59.080000000000005, "text": " But this is just absolutely overwhelming how many people are interested in machine learning research and topics related to it"}, {"start": 59.080000000000005, "end": 65.68, "text": " So that's pretty cool and encouraging. Thank you everyone who has already subscribed and"}, {"start": 66.68, "end": 74.48, "text": " Especially the people that leave comments, the people that share the videos. This means a lot and I think it's awesome"}, {"start": 74.48, "end": 78.08, "text": " And it's quite motivating to continue doing this honestly"}, {"start": 78.08, "end": 84.24, "text": " I'm having lots of fun along with that I've gained almost 5,000 Twitter followers"}, {"start": 84.24, "end": 87.28, "text": " I think more than 5,000 Twitter followers which is"}, {"start": 88.2, "end": 91.36, "text": " Strange because Twitter is weird"}, {"start": 92.4, "end": 94.4, "text": " But you know"}, {"start": 94.75999999999999, "end": 96.75999999999999, "text": " So that's pretty cool. I guess I"}, {"start": 97.68, "end": 100.36, "text": " Won't revolve of those are subscribed to the channel"}, {"start": 101.12, "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.72, "end": 116.92, "text": " Absolute largest part a very very positive community you people are absolutely great the comments sections are just so much better than"}, {"start": 117.56, "end": 123.72, "text": " Anything else on the entire internet including paper reviews at major conferences really"}, {"start": 123.72, "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.84, "text": " But it is actually very often true people are"}, {"start": 132.72, "end": 135.28, "text": " discussing ideas in the comments that are"}, {"start": 135.28, "end": 143.48, "text": " valuable and creative and asking interesting questions and helping each other out and that also counts for our discord server"}, {"start": 143.48, "end": 146.52, "text": " So if you're not on our discord server"}, {"start": 146.88, "end": 150.76, "text": " We do have one and there is a channel for beginners question"}, {"start": 150.76, "end": 157.52, "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.16, "text": " It's a vibrant community and I can only recommend that if you're looking to"}, {"start": 162.16, "end": 167.79999999999998, "text": " Contribute to the community and be part of it. It's a great place that being said"}, {"start": 167.79999999999998, "end": 175.44, "text": " I'm also on a number of other platforms such as linked in I finally made a LinkedIn account. I was always kind of"}, {"start": 176.24, "end": 183.88, "text": " Skeptic, I don't know how LinkedIn works like what is the difference between follow and connect and then people like right little messages"}, {"start": 184.07999999999998, "end": 187.48, "text": " While connecting and it says like I'd love to connect"}, {"start": 187.48, "end": 193.0, "text": " But then you accept them and then that message pops up and then it's saying I loved I'd love to connect"}, {"start": 193.0, "end": 198.12, "text": " But you've already connected at that point. This is weird like how does LinkedIn work?"}, {"start": 198.12, "end": 203.76, "text": " Someone tell me what is it for like I get it. It's like professional social networking, but"}, {"start": 205.35999999999999, "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.79999999999998, "text": " I'm not like super active on LinkedIn have to say that"}, {"start": 215.8, "end": 217.8, "text": " I'm also on"}, {"start": 218.28, "end": 227.8, "text": " BitTute mines parlor so the reason why I'm mentioning these things is that with recent developments especially around this young LeCun video"}, {"start": 228.8, "end": 231.8, "text": " There were some developments that potentially"}, {"start": 232.28, "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.32000000000002, "text": " So I would appreciate it if you follow me on at least one other thing at least one other point of"}, {"start": 245.32, "end": 253.07999999999998, "text": " Contact so that in the case that something might happen which isn't likely but you know can I"}, {"start": 254.32, "end": 260.76, "text": " Still have the way of distributing this content all the links are in the video description. I'd love to see you there"}, {"start": 260.76, "end": 264.8, "text": " Wherever so with respect to the young LeCun situation"}, {"start": 265.96, "end": 268.92, "text": " He has left Twitter now de facto and"}, {"start": 268.92, "end": 275.56, "text": " And people wanted me to kind of make a follow-up video ask me about it, but I feel you know"}, {"start": 275.56, "end": 281.12, "text": " I have I have nothing more substantial to say and just to make a video for video sake"}, {"start": 281.28000000000003, "end": 283.92, "text": " It's not really a thing I want to go into general"}, {"start": 284.28000000000003, "end": 290.04, "text": " It's kind of sad, but these kind of news and drama videos they do get a lot of attention"}, {"start": 290.04, "end": 296.28000000000003, "text": " Not like outrageous, but they do get I want to keep this channel mostly about the machine learning research"}, {"start": 296.28, "end": 302.11999999999995, "text": " And I only want to make videos when I really do have some information to add you know"}, {"start": 302.11999999999995, "end": 308.28, "text": " Young LeCun is an adult and he's able to make his decisions of whether he wants to leave Twitter or not"}, {"start": 308.28, "end": 314.15999999999997, "text": " It's probably for the better for his mental health so with respect to the drama videos"}, {"start": 314.15999999999997, "end": 319.0, "text": " I always kind of say that I'll pull you in with the drama and then before you know it"}, {"start": 319.0, "end": 325.55999999999995, "text": " I educate you ha checkmate so that's how this works and how we ultimately end up with"}, {"start": 325.56, "end": 332.48, "text": " Many more machine learners then originally wanted to be we gotcha so in other news flatland"}, {"start": 332.76, "end": 338.28000000000003, "text": " Round one of flatland has officially started and I previously made a video about flatland"}, {"start": 338.28000000000003, "end": 343.08, "text": " It is a new rips challenge. It is a challenge where we have to route trains"}, {"start": 343.84000000000003, "end": 345.44, "text": " around a"}, {"start": 345.44, "end": 350.4, "text": " A 2D map and I wanted to make this kind of a community project where we do research together"}, {"start": 350.4, "end": 358.4, "text": " Hopefully do something with machine learning with reinforcement learning to tackle this problem and to crush the challenge"}, {"start": 358.4, "end": 362.84, "text": " And this is looking extremely good so on our discord server"}, {"start": 362.84, "end": 370.2, "text": " 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"}, {"start": 370.2, "end": 375.56, "text": " Frequency because I want to have time to participate more in these community efforts"}, {"start": 375.56, "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": 389.64, "text": " We do open research anyone is welcome you're still very welcome join our discord server and join us and contribute to the code"}, {"start": 389.64, "end": 395.16, "text": " There is a core group right now that is really pushing forward so just to highlight a few of them"}, {"start": 395.44, "end": 402.0, "text": " There is Novik Edward direct dolesh frostbite China CEO trade marked"}, {"start": 402.0, "end": 409.16, "text": " a aadrian and I'm Peter and I forgot new bear ponnage. I'm so sorry new bear ponnage. You're beautiful"}, {"start": 409.32, "end": 411.32, "text": " These people are helping each other"}, {"start": 411.88, "end": 415.12, "text": " Reach more and better performance profiling code"}, {"start": 416.04, "end": 422.24, "text": " Implementing parts from other papers and it's just great to see that people can collaborate on this even though"}, {"start": 422.24, "end": 426.44, "text": " It's technically a competition, but you know, I guess we're competing against nature"}, {"start": 426.72, "end": 428.72, "text": " If we're anyone I haven't mentioned here"}, {"start": 428.72, "end": 433.40000000000003, "text": " I'm very very sorry any list of names is always prone to leave people out"}, {"start": 433.40000000000003, "end": 436.08000000000004, "text": " I do not want to diminish your impact"}, {"start": 436.08000000000004, "end": 445.28000000000003, "text": " So right now this DQ algorithm is able to reach about a 95% success rate with three to five agents on the maps of 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.88000000000005, "text": " So there's still a lot of work to do so we need you to"}, {"start": 455.88, "end": 464.76, "text": " 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"}, {"start": 465.48, "end": 470.6, "text": " It's fun. So again big shout out to anyone on this court that has contributed in any way"}, {"start": 472.96, "end": 476.32, "text": " This is just awesome. We've just had a recently our first"}, {"start": 476.88, "end": 482.92, "text": " Black land town hall with entirely community generated content. So"}, {"start": 482.92, "end": 492.84000000000003, "text": " These people came together and basically joined in making one PowerPoint presentation and presented to each other their knowledge of the environment and amazingly"}, {"start": 492.84000000000003, "end": 500.6, "text": " We also had the flatland organizers come in and tell us their perspective about the challenge the environment and what's"}, {"start": 500.6, "end": 502.64, "text": " Challenging and what's changed and so on"}, {"start": 503.16, "end": 508.12, "text": " This was just unprecedented for me the amount of contributions there"}, {"start": 508.56, "end": 512.24, "text": " The first town hall is available if you join this court"}, {"start": 512.24, "end": 518.52, "text": " It's linked there. It's recorded. You can still see it and as I said, there's still"}, {"start": 519.12, "end": 526.16, "text": " Plenty of time to join the competition together with us. Okay, next thing you've probably seen the spine net video and"}, {"start": 526.72, "end": 528.72, "text": " The thumbnail there was"}, {"start": 529.4, "end": 531.4, "text": " excessively beautiful"}, {"start": 531.4, "end": 535.04, "text": " So the story behind it is on the discord server"}, {"start": 535.04, "end": 538.0, "text": " I've asked people to help me with this thumbnail"}, {"start": 538.0, "end": 544.92, "text": " Which was originally rather boring and I just kind of wanted to know which subtitle I should put there and then one of the"}, {"start": 544.92, "end": 547.96, "text": " Discord members Lucas Ferreira just gone ahead and"}, {"start": 548.32, "end": 553.08, "text": " Drawn up this very beautiful image of a spine net"}, {"start": 553.6, "end": 556.96, "text": " robot that has the spine net as a spine and"}, {"start": 558.16, "end": 563.2, "text": " This is this kind of stuff is just awesome. So again big shout out to Lucas Ferreira and"}, {"start": 563.2, "end": 570.8000000000001, "text": " The absolutely amazing thumbnail that this has generated and also the contributions to anyone that comes on the discord server and"}, {"start": 571.2, "end": 578.44, "text": " Into the beginners question channel ask some question and usually get some form of help now that being said"}, {"start": 579.5200000000001, "end": 585.1600000000001, "text": " Please don't just come and we'll solve your problem like try to search for a solution before"}, {"start": 585.6800000000001, "end": 592.96, "text": " Going into that group of very well-meaning people because you know if if too many people just"}, {"start": 592.96, "end": 597.48, "text": " Expect them to solve their problems. It won't be as well meaning anymore in the future"}, {"start": 597.8000000000001, "end": 600.84, "text": " Okay, so how does this channel go forward?"}, {"start": 600.84, "end": 604.9200000000001, "text": " I want to make the content a bit more diverse and kind of branch out and"}, {"start": 606.4000000000001, "end": 613.2, "text": " As I already said the upload frequency will be sort of lower after my break or also during my break"}, {"start": 613.2, "end": 618.6800000000001, "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": 631.5999999999999, "text": " You can give feedback about what kind of videos you like"}, {"start": 632.0, "end": 635.3199999999999, "text": " What kind of style of videos you like anything really?"}, {"start": 635.3199999999999, "end": 636.8399999999999, "text": " I'm happy to"}, {"start": 636.8399999999999, "end": 638.8399999999999, "text": " listen to people and"}, {"start": 639.16, "end": 641.16, "text": " Incorporate all the feedback that I can"}, {"start": 641.68, "end": 647.52, "text": " So I want to do some more channel updates maybe more frequently maybe once every two three weeks"}, {"start": 647.52, "end": 653.12, "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": 661.6, "text": " 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"}, {"start": 661.72, "end": 663.92, "text": " Comment section so shout out to whoever"}, {"start": 664.48, "end": 672.3199999999999, "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": 672.32, "end": 679.6800000000001, "text": " New and didn't know and predicted and we're right about and especially I wonder what kind of choices did they make"}, {"start": 679.88, "end": 687.7600000000001, "text": " That survive until this day kind of arbitrary choices that someone made in some paper that just stuck around"}, {"start": 688.44, "end": 695.48, "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.48, "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": 703.44, "text": " Lots of people have requested that I'm not the best coder in the world"}, {"start": 703.6, "end": 708.2, "text": " But I have done my fair share of machine learning research hands-on"}, {"start": 708.2, "end": 712.2, "text": " I have lots of more stupid ideas that might or might not work out and"}, {"start": 712.88, "end": 718.0400000000001, "text": " Very happy to implement them live then next thing I want to branch out in topics"}, {"start": 718.0400000000001, "end": 719.72, "text": " Maybe more exotic things"}, {"start": 719.72, "end": 725.6600000000001, "text": " Cossality is a big thing quantum machine learning what not more practical applications"}, {"start": 725.66, "end": 734.18, "text": " Robotics control also fairness a lot of people especially after the young LeCun video asked me to look more into the fairness literature"}, {"start": 734.18, "end": 740.98, "text": " I am naturally very interested in that and approach it from kind of a a technical but also a societal"}, {"start": 741.5799999999999, "end": 747.5799999999999, "text": " standpoint throughout all of that I would like to include the community more so you I"}, {"start": 747.58, "end": 755.6600000000001, "text": " 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"}, {"start": 755.74, "end": 759.4200000000001, "text": " How to do more community inclusion in the channels content"}, {"start": 759.74, "end": 767.3000000000001, "text": " Please tell me because I think the community has lots of stuff to give and it would be a shame if it were only"}, {"start": 767.58, "end": 772.46, "text": " Me always doing all the things where other people would be much better at it"}, {"start": 772.46, "end": 780.94, "text": " 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"}, {"start": 780.94, "end": 789.6600000000001, "text": " The misconception in this so let me tell you I select papers by what interests me and that alone"}, {"start": 789.6600000000001, "end": 794.58, "text": " If I make a video about a paper it means that I found it interesting enough to read it"}, {"start": 794.58, "end": 798.5, "text": " And I found it interesting enough to make a video about it now"}, {"start": 798.5, "end": 804.02, "text": " This can be accelerated by sending me appropriate amounts of protein and carbohydrates"}, {"start": 804.02, "end": 808.34, "text": " But generally me making a video is not an endorsement of a paper"}, {"start": 808.5, "end": 812.5, "text": " It doesn't mean that this paper is the most important paper or"}, {"start": 813.14, "end": 819.26, "text": " Influential it doesn't mean anything beyond I find it interesting if I ever get sponsor deals"}, {"start": 819.26, "end": 823.1, "text": " I'll let you know that a video is sponsored and that's that I will not"}, {"start": 823.1, "end": 830.22, "text": " Change how I select papers. I will not go by some kind of impact. I would like to branch out my content"}, {"start": 830.22, "end": 834.0600000000001, "text": " I see the danger in only kind of covering what the big companies do"}, {"start": 834.26, "end": 836.98, "text": " But honestly they do a lot of interesting stuff"}, {"start": 836.98, "end": 841.66, "text": " They do a lot of stuff and I'm constantly looking at research that's kind of outside the box"}, {"start": 841.66, "end": 844.98, "text": " Whatever's interesting, you know, that's what it's gonna be"}, {"start": 844.98, "end": 849.38, "text": " I will not start going by some impact factor and I will not start"}, {"start": 849.38, "end": 855.86, "text": " Politicizing my paper review selection anytime soon. You know, I've already had"}, {"start": 856.38, "end": 857.82, "text": " multiple people"}, {"start": 857.82, "end": 860.46, "text": " High profile people come to me and say"}, {"start": 860.9, "end": 868.9, "text": " Well with your platform couldn't you once a week take a paper where the first author is an underrepresented"}, {"start": 869.18, "end": 871.18, "text": " minority and"}, {"start": 871.18, "end": 872.78, "text": " review that and"}, {"start": 872.78, "end": 878.54, "text": " You know, I appreciate the sentiment behind it and I see I see where it comes from but"}, {"start": 878.54, "end": 885.26, "text": " If you consider the practical implications of something like this like I'd have to you know go through papers"}, {"start": 885.98, "end": 891.14, "text": " Google the first author kind of try to find a talk or a picture of them and"}, {"start": 891.98, "end": 896.6999999999999, "text": " Estimate whether the melanin content in their skin is high enough"}, {"start": 897.14, "end": 901.14, "text": " For this to qualify now and something like this and just"}, {"start": 901.54, "end": 904.74, "text": " the thought of this how someone"}, {"start": 904.74, "end": 910.62, "text": " Could do something like this and not start to vomit is just beyond me"}, {"start": 910.62, "end": 916.34, "text": " I don't know what to say other than that. So let me say this if you're thinking"}, {"start": 916.82, "end": 924.66, "text": " Leads you to a place where it's necessary to treat people differently based on the color of their skin"}, {"start": 925.22, "end": 927.22, "text": " You're wrong"}, {"start": 927.34, "end": 932.86, "text": " Like that's my opinion, but you're wrong the answer to bias"}, {"start": 932.86, "end": 935.7, "text": " Cannot consist of more bias"}, {"start": 937.22, "end": 939.22, "text": " That's that I do not care"}, {"start": 939.58, "end": 943.42, "text": " How the person that wrote a paper looks like if your papers on this channel"}, {"start": 943.42, "end": 950.98, "text": " It means your work was interesting to me and I hope that can be my contribution to making the community more fair and just"}, {"start": 951.14, "end": 958.9, "text": " Okay, last thing lots of people have asked me if I had a patreon or something like this and I've sort of resisted"}, {"start": 958.9, "end": 964.4599999999999, "text": " That kind of stuff until now mainly because I knew that the day would come when I"}, {"start": 964.9399999999999, "end": 967.86, "text": " Reduce my upload frequency and I didn't want to kind of"}, {"start": 968.66, "end": 974.3, "text": " trick people into thinking that I was gonna continue this forever again"}, {"start": 975.22, "end": 981.1, "text": " Financial support is not my main goal here and it is completely"}, {"start": 981.9, "end": 987.34, "text": " Absolutely and utterly voluntary and so I just want to have that out there"}, {"start": 987.34, "end": 990.1800000000001, "text": " So I have made a patreon page"}, {"start": 990.1800000000001, "end": 996.82, "text": " I do have some reservation with respect to patreon because of free speech issues and so on"}, {"start": 996.82, "end": 1003.98, "text": " So I've also made a subscribe star page both are equal both have equal tears all the tears are equal"}, {"start": 1003.98, "end": 1008.34, "text": " There's no option where it just where you could just put an amount which I would like"}, {"start": 1008.34, "end": 1011.5, "text": " So I just tried to make a bunch of tears all of them are equal"}, {"start": 1011.5, "end": 1015.4200000000001, "text": " So I have to ask myself what do I give as a benefit because I don't want"}, {"start": 1015.42, "end": 1022.3399999999999, "text": " Someone to have to pay for like extra content because the entire goal of this channel is to educate people"}, {"start": 1022.9, "end": 1029.86, "text": " Including people that don't have money to go to good universities that might live in other parts of the world"}, {"start": 1029.94, "end": 1036.54, "text": " Where education is not as available where resources are not as available to give extra content to people that pay"}, {"start": 1036.74, "end": 1038.98, "text": " Seems to be so I thought okay"}, {"start": 1039.22, "end": 1043.94, "text": " What I could give to the people that do support me on these pages is"}, {"start": 1043.94, "end": 1052.02, "text": " You will get a PDF of my scribbled one note document of the papers that are of you"}, {"start": 1052.02, "end": 1056.46, "text": " I mean it's not very helpful because I mostly scribble and it's going to be like"}, {"start": 1056.8200000000002, "end": 1063.06, "text": " Subdividing the pages weirdly maybe it has more of a symbolic value and if if you really into that in you know"}, {"start": 1063.7, "end": 1065.7, "text": " At least there's something"}, {"start": 1065.7, "end": 1075.02, "text": " I've also made a bunch of crypto wallets so if you'd rather want to use that support me"}, {"start": 1075.02, "end": 1081.98, "text": " You are welcome to do so all the links are in the description of the video again financial support"}, {"start": 1082.38, "end": 1085.82, "text": " Very very very optional and very voluntary though"}, {"start": 1085.82, "end": 1089.3400000000001, "text": " Of course I do think anyone that does I am also going to"}, {"start": 1090.06, "end": 1093.54, "text": " Experiment with ads on the videos and as creators"}, {"start": 1093.54, "end": 1098.46, "text": " We have kind of different options of which ads are displayed and how often and so on"}, {"start": 1098.46, "end": 1103.54, "text": " I find mid video ads annoying. I find non-scapable ads annoying and so on"}, {"start": 1103.54, "end": 1110.22, "text": " I'm really counting on you here to give me feedback after various videos of how much the ads annoy you"}, {"start": 1110.22, "end": 1116.62, "text": " Which ones annoy you which ones don't I'm really counting on you. Okay. Okay last thing. I am planning"}, {"start": 1117.3799999999999, "end": 1121.78, "text": " planning on a line of merch mainly because I think it's funny"}, {"start": 1121.78, "end": 1129.06, "text": " But I don't know if that's gonna work out, but you know maybe if you have fun t-shirt ideas or so just let me know"}, {"start": 1129.06, "end": 1131.06, "text": " All right, that was the update"}, {"start": 1131.18, "end": 1134.46, "text": " As I said, I probably won't be reading comments too much"}, {"start": 1134.7, "end": 1143.74, "text": " But I will catch up after the break and I hope you continue enjoying this channel even with kind of the lower upload frequency"}, {"start": 1143.74, "end": 1151.02, "text": " And the new types of content that come in if you do have suggestions for new exotic content that have"}, {"start": 1151.02, "end": 1153.66, "text": " Vagally has to do with machine learning or not. Let me know"}, {"start": 1154.1, "end": 1163.26, "text": " Let me know what you think of anything I said and I wish you an awesome summer and I hope to see you here any time"}, {"start": 1163.26, "end": 1189.26, "text": " Ciao"}] |
Yannic Kilcher | 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 Los Landscape perspective by Stanislav Furt, Huihi, Hu and Balaji Lakshminarayanan. This paper on a high level explains the Los Landscape of Deep Ensembles 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 Ensembles able to capture different modes of the functional space of these 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 a 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 chasing the next state of the art number. It's also an example of research that you can still do while you don't have giant resources of compute, even though this is by deep mind, but I do believe that this kind of research is still wide open and available to academia and whereas the other kind, the state of the art kind slowly goes into more and more of the money game. All right, 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. All right, so we'll start off. The abstracts as 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-axis, 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. Ah, that's the complex numbers. It's element of some bounded set of class labels. So it's either a cat or a dog or you know 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 on, 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, medium, 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 loss 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 neural network only has a single weight. So this axis here is that single weight or you can project or what? No, 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. So you're 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 apostereiori estimate. You simply optimize one neural network until the best training error. There are different approaches right here. There are approaches that say, okay, we can do, we can 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 non-linear 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. 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 could we 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 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 posterior in close form and so on. And this paper, this paper's hypothesis is that these can only usually capture one of these peaks. So they are very able to capture the surrounding right here. They can 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 multi-modal 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, there 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 a 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 C410, C4100 and so on. And on C410, you can see right here, they use a small CNN, medium CNN, and a resonant. 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 under performing 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 C410. 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 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 this 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 space 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 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 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 5? That would 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 is 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 is 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 loss landscape, right? You initialize randomly somewhere here and then you go, go, go, and at some point, you fall into one of those valleys and then you simply go 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, the initialization is basically you, you are 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 convex setting in that thing. Okay, a really interesting thing that they do is, I 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 are this dataset, 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 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 dataset, the validation dataset, and if I have one random initialization on a training 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 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's 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 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 the different initializations will lead you to different valleys, and that's what they show right here. So, they do a T-Sni plot of predictions. T-Sni is a method to project, to down project high-dimensional vectors. And this is the weight space projected to two dimensions. So, T-Sni 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 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 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 our 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 was 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, it's not a line. 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 is, 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 the 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 dataset 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. Like this is rather astounding, I feel, because I think most people are of the of the idea that 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, well, just place this correctly here, random subspace sampling. So what does it mean? 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, 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 in two 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 thing and over here, there is a bit of a, you thought I was going to 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 Ensemble 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 Ensemble means we initially randomly initialize many times and then train from scratch each member. This method here means we start from a solution and we simply perturb it into random directions. The next thing we can do is we can do dropout, subspace dropout. We again started an optimized solution, applied 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 overlap 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-Sni projection. Now this isn't, I have to say, this isn't the 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 combines points in here or will 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 training, training, the 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 loss 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 evaluated the networks. So, well, 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 neural network at that point. 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 initialized pretty close, the red one is a little bit more to this base and of attraction. The blue one is a little bit more to this base and 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. And you can see the accuracy or 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're not going to go to different modes. The weight space is just too large and you're going to simply be 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 this 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, each one of these is maybe sort of deciding to look at different features in the in the data set, right? 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, the task is way too simple and it can be solved in like a 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 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 perturbed 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 with our original optimum. However, what we also expect is 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 can't just 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 optimum. Those are the optimum from runs where we initialize that a different point and then also trained. And that again is evidence for the fact that there are probably other optimum 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 C for 100 or an image net, this, this effect is more pronounced that you can see these here are closer together as a curve. And these, these are the independent optimum. So I hope 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 optimum and characterize this 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 optimum. 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 on-sembles 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 dash lines here are the baseline accuracies if you just have a single model. And the the test accuracy is put 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 perturbation stuff, I increase inaccuracy. Okay. However, if I build an ensemble, I increase inaccuracy. If I build an ensemble out of 10 members, I increase inaccuracy 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 do the PCA gas, 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 sort of convinced. I hope you are too. And they do a lot of they do us some more experiments right here where you can see that the difference between, so this is single, 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 luminacy, 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 are already too long and this is the last thing is on ImageNet test set and the ImageNet a 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 with 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 to 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 sub spaces look like, how the loss landscape 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 can kind of 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 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 think, right? So I'll be thinking about these things for a while now and thinking of new kind of experiments that walk through 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 what you think is going on actually, that would be very interesting and yeah, I'll see you next time. Bye bye. | [{"start": 0.0, "end": 5.92, "text": " Hi there, today we'll look at Deep Ensembles, a Los Landscape perspective by Stanislav Furt,"}, {"start": 5.92, "end": 12.040000000000001, "text": " Huihi, Hu and Balaji Lakshminarayanan. This paper on a high level explains the"}, {"start": 12.040000000000001, "end": 17.04, "text": " Los Landscape of Deep Ensembles models, so Ensembles of Deep Neural Network."}, {"start": 17.04, "end": 22.8, "text": " And it hypothesizes and it shows through experiments that each member of the ensemble"}, {"start": 22.8, "end": 28.16, "text": " by means of being initialized at a random point, will go and through optimization,"}, {"start": 28.16, "end": 35.04, "text": " go and end up at a different place in weight space, and therefore the Deep Ensembles able to capture"}, {"start": 35.04, "end": 40.56, "text": " different modes of the functional space of these space of solutions. They compare this to"}, {"start": 40.56, "end": 46.24, "text": " Bayesian networks, which are sort of promised to do the same thing, but they often only characterize"}, {"start": 46.24, "end": 52.16, "text": " a single mode and therefore they don't generalize as well. So join me exploring this paper,"}, {"start": 52.16, "end": 57.68, "text": " I think it's a pretty cool paper. The experiments are cleverly designed to show what they're supposed"}, {"start": 57.68, "end": 64.0, "text": " to show, and I generally enjoy this type of research because it's kind of an explanatory research that"}, {"start": 64.0, "end": 69.6, "text": " shows you what's going on inside of these networks rather than chasing the next state of the art"}, {"start": 69.6, "end": 77.52, "text": " number. It's also an example of research that you can still do while you don't have giant"}, {"start": 77.52, "end": 84.16, "text": " resources of compute, even though this is by deep mind, but I do believe that this kind of research"}, {"start": 84.16, "end": 93.52, "text": " is still wide open and available to academia and whereas the other kind, the state of the art kind"}, {"start": 93.52, "end": 100.56, "text": " slowly goes into more and more of the money game. All right, in any case, join me in reading this"}, {"start": 100.56, "end": 107.6, "text": " paper if you like it, share it out, leave a comment to think, to tell me what you think, and leave a"}, {"start": 107.6, "end": 116.0, "text": " like if you enjoyed it. All right, so we'll start off. The abstracts as deep ensembles have been"}, {"start": 116.0, "end": 120.8, "text": " empirically shown to be a promising approach for improving accuracy, uncertainty, and out of"}, {"start": 120.8, "end": 127.11999999999999, "text": " distribution robustness of deep learning models. So what are deep ensembles really quick and"}, {"start": 128.16, "end": 132.64, "text": " an ensemble model and we're in the classification setting. So in the classification setting,"}, {"start": 132.64, "end": 138.55999999999997, "text": " we have data points and each data point has features, so which are the x-axis, some kind of"}, {"start": 138.55999999999997, "end": 147.11999999999998, "text": " D-dimensional feature, and then you have y, which is the label. So that's in some, let's say that's"}, {"start": 147.11999999999998, "end": 154.39999999999998, "text": " some natural number or something like this or is element of a class set. Ah, that's the complex"}, {"start": 154.39999999999998, "end": 161.2, "text": " numbers. It's element of some bounded set of class labels. So it's either a cat or a dog or"}, {"start": 161.2, "end": 169.11999999999998, "text": " you know what, whatever you want. So you have a data set of these things and your plan is to use x"}, {"start": 169.11999999999998, "end": 175.11999999999998, "text": " to predict y. If you build an on, if you build a model, a deep neural network, for example, for"}, {"start": 175.11999999999998, "end": 180.16, "text": " this task, you would simply characterize this function here. You would parameterize it as a deep"}, {"start": 180.16, "end": 186.56, "text": " neural networks of many, many layers. If you build an ensemble, now what you would do is you would"}, {"start": 186.56, "end": 192.24, "text": " take the data set and simply train multiple different ones of these deep neural networks."}, {"start": 193.6, "end": 198.32, "text": " So you'll train multiple different ones and if you now want to classify data point,"}, {"start": 198.32, "end": 204.56, "text": " you'll input that data point into all of these three and at the end, you would somehow aggregate"}, {"start": 204.56, "end": 209.36, "text": " and there are different methods of doing this, but the most obvious one is simply either to aggregate"}, {"start": 209.36, "end": 218.48000000000002, "text": " by the mean or the mode, medium, whatever you want. You could also kind of also learn something here,"}, {"start": 218.48000000000002, "end": 224.32000000000002, "text": " but you can just average the predictions and that will usually give you a better prediction than"}, {"start": 224.32000000000002, "end": 230.4, "text": " if you only have one model. So this is called an ensemble model and if the ensemble members,"}, {"start": 230.4, "end": 235.68, "text": " these thing here are neural networks or deep networks, this is called a deep ensemble."}, {"start": 235.68, "end": 245.28, "text": " So why do we hope to become better? That's the point of this paper is to show what happens in the"}, {"start": 245.28, "end": 252.72, "text": " loss landscape of these deep neural networks and why do they perform better than other methods that"}, {"start": 253.28, "end": 259.04, "text": " are supposed to achieve the same thing? So usually when you build an ensemble model, what are you"}, {"start": 259.04, "end": 267.20000000000005, "text": " hoping for? You're hoping to sort of learn a generalizable function and they have this drawing"}, {"start": 267.20000000000005, "end": 274.72, "text": " right here where it's a bit of a you have to sort of think differently than you usually do. So on"}, {"start": 274.72, "end": 282.32000000000005, "text": " the x axis, you have the space of solutions. So imagine that your neural network only has a"}, {"start": 282.32, "end": 289.92, "text": " single weight. So this axis here is that single weight or you can project or what? No, this is the"}, {"start": 289.92, "end": 297.44, "text": " space of different solutions. So after you optimize, you land somewhere on this axis and you can see"}, {"start": 298.0, "end": 304.48, "text": " that there is a solid line which represents the accuracy on the training set and then there is a"}, {"start": 304.48, "end": 309.12, "text": " dashed line which represents the accuracy of the validation set for a given parameter. So"}, {"start": 309.12, "end": 317.68, "text": " what you usually do is you optimize one neural network to its very best training accuracy. So let's"}, {"start": 317.68, "end": 323.6, "text": " say you start off here. What you would do is you would see, my training accuracy is this high,"}, {"start": 323.6, "end": 329.68, "text": " I need a different color right here, is this high and you calculate the gradient and you could do"}, {"start": 329.68, "end": 336.08, "text": " gradient descent and that means you go down the loss up the accuracy so you go over and over and"}, {"start": 336.08, "end": 341.91999999999996, "text": " over until you reach this point right here where you have maximum training accuracy and then you'll"}, {"start": 341.91999999999996, "end": 347.68, "text": " suffer some generalization loss. So you're right here, it suffers some generalization loss because"}, {"start": 347.68, "end": 352.56, "text": " the validation accuracy at that point isn't as high but generally it's correlated as you can see"}, {"start": 353.28, "end": 360.24, "text": " by the general overlap of these two lines of these two shapes right here. Okay, so this is called a"}, {"start": 360.24, "end": 367.36, "text": " maximum apostereiori estimate. You simply optimize one neural network until the best training error."}, {"start": 369.84000000000003, "end": 376.40000000000003, "text": " There are different approaches right here. There are approaches that say, okay, we can do, we can do"}, {"start": 376.40000000000003, "end": 382.16, "text": " better. So first of all what you see right here is rather peculiar and you might not be used to this"}, {"start": 382.16, "end": 388.0, "text": " that there are different peaks right here. There are different peaks. As you can see in the training"}, {"start": 388.0, "end": 395.76, "text": " and the validation error so they're correlated and the idea is that neural networks are very"}, {"start": 395.76, "end": 402.96, "text": " non-linear and we've known from other papers that they have many many local minima and in fact,"}, {"start": 402.96, "end": 409.2, "text": " so this is one of the astounding things about neural network. Most of these minima are performing"}, {"start": 409.2, "end": 416.24, "text": " equally well. So even though the neural network has different local minima, they all perform about"}, {"start": 416.24, "end": 423.12, "text": " equally well and other papers even say they're all sort of connected on a low-loss landscape."}, {"start": 423.92, "end": 429.68, "text": " So there are many many things that are still mysterious about neural network but we know that"}, {"start": 429.68, "end": 436.08, "text": " there are multiple minima and we know that we basically need to find one of them and it doesn't"}, {"start": 436.08, "end": 445.76, "text": " really matter which one. They all perform sort of equally well. Now as you can, as you might imagine,"}, {"start": 445.76, "end": 451.92, "text": " there are people who aren't really satisfied with this and their approach is to say, why don't we"}, {"start": 451.92, "end": 458.71999999999997, "text": " just capture this entire curve right here? So if we could build a model that could not only,"}, {"start": 458.71999999999997, "end": 464.56, "text": " you know, not only tell us at this point right here, you're this good, but could tell us that at"}, {"start": 464.56, "end": 471.12, "text": " any point, right? How could we capture the entire distribution of solutions? And these are usually"}, {"start": 471.12, "end": 478.4, "text": " in the category of the Bayesian neural networks. They try to capture the entire distribution. Of course,"}, {"start": 478.4, "end": 482.88, "text": " that's not really feasible because you always have to calculate that posterior."}, {"start": 485.12, "end": 490.32, "text": " So what they end up doing is they do some approximation and usually they do some sort of a"}, {"start": 490.32, "end": 496.16, "text": " multivariate Gaussian approximation because you can calculate posterior in close form and so on."}, {"start": 496.16, "end": 503.12, "text": " And this paper, this paper's hypothesis is that these can only usually capture one of these peaks."}, {"start": 503.12, "end": 510.48, "text": " So they are very able to capture the surrounding right here. They can capture very accurately"}, {"start": 510.48, "end": 517.36, "text": " what happens around this particular peak. They are very aware of the shape of the curvature here"}, {"start": 517.36, "end": 522.5600000000001, "text": " and can tell you a lot of things about it. So they can tell you, for example, that the validation,"}, {"start": 522.56, "end": 531.52, "text": " so that you might want to be a bit over here, rather than over here, but they cannot, they don't"}, {"start": 531.52, "end": 538.0, "text": " generally know about these other modes because they are only approximations. They generally don't"}, {"start": 538.0, "end": 546.9599999999999, "text": " produce multi-modal solutions. Another approach is a deep ensemble. Now, this paper shows that in"}, {"start": 546.96, "end": 552.8000000000001, "text": " general, if you train a deep ensemble, what will happen is because you randomly initialize the"}, {"start": 552.8000000000001, "end": 559.52, "text": " deep ensemble. At some points, it will happen that if you do gradient descent on all of them,"}, {"start": 559.52, "end": 564.88, "text": " they will end up sort of covering all these different modes. They still, they don't have an idea of,"}, {"start": 564.88, "end": 569.44, "text": " you know, the curvature, oh, sorry, this one shouldn't go here. This one should go here."}, {"start": 569.44, "end": 573.9200000000001, "text": " The curve, they don't really know about the curvature, but they will give you these different"}, {"start": 573.92, "end": 580.7199999999999, "text": " minima right here. And therefore, they can capture the landscape much, much more easily. If you know"}, {"start": 580.7199999999999, "end": 587.1999999999999, "text": " that these three are minima, you sort of, it might look something like this. And that's a hell of"}, {"start": 587.1999999999999, "end": 592.64, "text": " a lot better than simply the Bayesian approximation that only is able to capture one of the peaks,"}, {"start": 592.64, "end": 601.28, "text": " but really accurately. So, there hypothesis here is that deep ensembles do this job of capturing the"}, {"start": 601.28, "end": 610.64, "text": " different modes of the functional space much better than the Bayesian methods. And it is why the deep"}, {"start": 610.64, "end": 616.0799999999999, "text": " methods, sorry, why the deep ensembles work so well because they end up in different minima."}, {"start": 616.88, "end": 623.36, "text": " And that is, it's a really interesting proposition. And what I find really interesting as well are"}, {"start": 623.36, "end": 628.8, "text": " the experiments that they do to show this. So, they have a lot of these experiments right here."}, {"start": 628.8, "end": 637.1999999999999, "text": " First of all, to the setup, they use C410, C4100 and so on. And on C410, you can see right here,"}, {"start": 637.1999999999999, "end": 644.24, "text": " they use a small CNN, medium CNN, and a resonant. Now the small and medium CNNs, their accuracy is"}, {"start": 644.24, "end": 652.64, "text": " really, really subpar. So, take the results here with some grain of salt because there are effects in"}, {"start": 652.64, "end": 659.68, "text": " these neural network that are really qualitatively different if you are seriously under performing like"}, {"start": 659.68, "end": 665.92, "text": " this one. Like if you have a seriously too small network rather than a large network. Now they do"}, {"start": 665.92, "end": 673.84, "text": " verify all of their things also with this large network and 90% accuracy is acceptable for C410."}, {"start": 673.84, "end": 679.76, "text": " I don't think there's the big qualitative difference between 90 and 95 and so on. But the 64,"}, {"start": 679.76, "end": 688.3199999999999, "text": " if it were only this, I would be rather critical of this work. But it's fine to, if you see the effect"}, {"start": 688.3199999999999, "end": 695.28, "text": " at 64 and then some of the effects you check to carry over to the 90% one, I'm going to generally"}, {"start": 695.28, "end": 704.24, "text": " believe you. Okay. So, first of all, what they do here is they look at a training trajectory of"}, {"start": 704.24, "end": 713.36, "text": " just a single run. So, this paper is half about ensembles but also half generally about what"}, {"start": 714.0, "end": 718.4, "text": " what this training of neural networks do and they reach some very, very cool conclusions that"}, {"start": 718.4, "end": 724.8, "text": " even are independent of deep ensembles. So, here the first thing we do is we have some initial,"}, {"start": 724.8, "end": 730.48, "text": " random initialization in weight space of your weight. And then you do gradient descent and you run"}, {"start": 730.48, "end": 736.8000000000001, "text": " and you run, right? And you get to some minima right here, some minimum right here. And then"}, {"start": 737.84, "end": 745.76, "text": " you do a second one. So, you initialize somewhere else and because you initialize somewhere else,"}, {"start": 745.76, "end": 751.52, "text": " you run, you run, you run, you run, you end up at a different minimum. Okay. This is a property."}, {"start": 751.52, "end": 756.4, "text": " So, these are not convex functions, right? We know about neural networks. You'll end up a different"}, {"start": 756.4, "end": 764.16, "text": " minima but the minima they will perform about equally well. So, the question is, do those"}, {"start": 764.16, "end": 770.8, "text": " different minima that perform equally well describe the same function or are they fundamentally"}, {"start": 770.8, "end": 779.36, "text": " different functions that just happen to reach the same accuracy? And the question is very interesting"}, {"start": 779.36, "end": 787.04, "text": " and this paper attempts to answer that. So, here you can see in the description, on the left,"}, {"start": 787.04, "end": 793.44, "text": " cosine similarity between checkpoints to measure weight space alignment, along optimization trajectory."}, {"start": 794.64, "end": 801.52, "text": " So, we only consider one of these runs. Only consider the left one, for example. And you plot it"}, {"start": 801.52, "end": 809.2, "text": " here and here. This later one comes later, sorry. So, you plot the left only a single run and you"}, {"start": 809.2, "end": 818.0, "text": " ask yourself the checkpoint that I have after epoch 20. How similar is it to the checkpoint that I"}, {"start": 818.0, "end": 827.12, "text": " have after epoch 5? That would be right here. Now, we have to read up how they compare the checkpoints"}, {"start": 827.12, "end": 833.6800000000001, "text": " and this is weight space alignment. Okay. So, weight space alignment, it basically means how much do"}, {"start": 833.68, "end": 839.4399999999999, "text": " the weights align in the cosine fashion? As you can see right here, this is simply the cosine between"}, {"start": 839.4399999999999, "end": 846.0, "text": " the weights. This is one way of comparing two functions. If two functions align in weight space,"}, {"start": 846.0, "end": 850.2399999999999, "text": " there is a decent chance that they describe the same thing. So, as you can see here,"}, {"start": 851.52, "end": 857.8399999999999, "text": " we go, as we go down the optimization trajectory, of course, each one is similar to themselves,"}, {"start": 857.84, "end": 865.44, "text": " but you can see that there is kind of a shift right here. So, at the beginning, the zero of checkpoint"}, {"start": 865.44, "end": 871.6, "text": " is very dissimilar to the checkpoint at the end. But, after very short while, you kind of cross"}, {"start": 871.6, "end": 880.8000000000001, "text": " over and then all these checkpoints right here are sort of similar. So, the... If you just look at two"}, {"start": 880.8000000000001, "end": 887.2, "text": " rows, you look at the bottom row and you look at the top row. The bottom row tells you how similar"}, {"start": 887.2, "end": 892.0, "text": " are the checkpoints during training to the initial checkpoint. And you can see pretty quickly,"}, {"start": 892.6400000000001, "end": 899.6, "text": " they are very dissimilar. So, at this point right here, there is kind of a dissimilarity happening"}, {"start": 899.6, "end": 905.6800000000001, "text": " where the checkpoint goes away from its initialization to something else. And the top row tells you"}, {"start": 905.6800000000001, "end": 914.0, "text": " how similar are they to where the network ends up. And you can see that there appears to be a period"}, {"start": 914.0, "end": 922.8, "text": " in, let's say, here where this shift away starts up until here where it's kind of not similar to"}, {"start": 922.8, "end": 929.6, "text": " anything, but then after that, after here, everything is similar to the final checkpoint. Okay,"}, {"start": 929.6, "end": 936.64, "text": " so this is sort of tells us a hypothesis is that you initialize randomly somewhere, you have this"}, {"start": 936.64, "end": 943.6, "text": " loss landscape, right? You initialize randomly somewhere here and then you go, go, go, and at some point,"}, {"start": 943.6, "end": 951.04, "text": " you fall into one of those valleys and then you simply go to that valley. If you initialize somewhere"}, {"start": 951.04, "end": 956.0, "text": " differently, you can see that at the beginning you might be here somewhere and then you fall into that"}, {"start": 956.0, "end": 963.52, "text": " valley over here. And after that, you're pretty much set. So, this is going to be our hypothesis from"}, {"start": 963.52, "end": 970.56, "text": " now on that in these neural networks, the initialization is basically you, you are somewhere and you kind"}, {"start": 970.56, "end": 976.4, "text": " of meander around a bit until you happen to go into one of these directions, which happens pretty"}, {"start": 976.4, "end": 984.24, "text": " quickly. And then you fall into a hole basically and that's, that's rather convex setting in that thing."}, {"start": 985.4399999999999, "end": 989.6, "text": " Okay, a really interesting thing that they do is,"}, {"start": 989.6, "end": 998.4, "text": " I really interesting thing is that they check the disagreement of predictions. So, you might think"}, {"start": 998.4, "end": 1006.64, "text": " that if a neural network achieves 65 or 90, let's call it 90% accuracy on C410, right? That there"}, {"start": 1006.64, "end": 1014.32, "text": " are just, you know, there are this dataset, that's 100% and there are just these 10% over here,"}, {"start": 1014.32, "end": 1019.84, "text": " they're just the hardest, right? And the more you train, the more are you, you're able to push this"}, {"start": 1019.84, "end": 1024.96, "text": " boundary to the right. So, if you train more, if you have a better network, you're just able to"}, {"start": 1025.76, "end": 1032.4, "text": " explain more and more of the samples. However, this experiment here is going to show that this is"}, {"start": 1032.4, "end": 1038.48, "text": " not the case. What they measure is the disagreement in predictions, which basically means that if I,"}, {"start": 1038.48, "end": 1044.88, "text": " there is this dataset, the validation dataset, and if I have one random initialization on a training"}, {"start": 1044.88, "end": 1053.04, "text": " to 90% accuracy, it will have, it will say these, it will not be able to classify these here."}, {"start": 1053.04, "end": 1059.84, "text": " But if I have the same network, but a different initialization, it might not be able to classify"}, {"start": 1059.84, "end": 1065.6, "text": " these over here, but will be perfectly able to classify these over here, right? This is a very,"}, {"start": 1065.6, "end": 1073.76, "text": " also very interesting property. And you can see right here the disagreement of predictions as you"}, {"start": 1073.76, "end": 1079.84, "text": " go through the training. So, again, we're going to look at the bottom and the top row. So, the bottom"}, {"start": 1079.84, "end": 1088.8, "text": " row and the top row, red is very disagreeing, blue is very agreeing. You can see again that,"}, {"start": 1088.8, "end": 1096.24, "text": " oh, I introduced, again, I introduced the different runs. I'm already taking this away from later."}, {"start": 1096.8799999999999, "end": 1102.6399999999999, "text": " We are just looking at one single run for now. This is a result that's going to come up later"}, {"start": 1102.6399999999999, "end": 1106.6399999999999, "text": " when we look at two different runs of the same neural network, and that's the astounding part."}, {"start": 1106.6399999999999, "end": 1112.32, "text": " Okay, here we're just going to look at one run again during training. So, we can see right here"}, {"start": 1112.32, "end": 1119.28, "text": " at the beginning, of course, every checkpoint agrees with itself on the predictions. However, you"}, {"start": 1119.28, "end": 1124.72, "text": " can see that pretty quickly, the checkpoints start disagreeing. Very quickly, everything is red"}, {"start": 1124.72, "end": 1133.2, "text": " right here. However, on the top, you can see how much, how much do these checkpoints agree with the"}, {"start": 1133.2, "end": 1140.3999999999999, "text": " end, with the 30th epoch checkpoint, and see that there's a period that is red right from here to,"}, {"start": 1140.4, "end": 1147.76, "text": " let's say here. And then after that, they all start agreeing. So, from here on out, it's all"}, {"start": 1147.76, "end": 1156.8000000000002, "text": " pretty blue, which basically means that they agree with the last checkpoint. So, with the"}, {"start": 1158.48, "end": 1166.48, "text": " that all of these agree with the end of the training. Again, this is our hypothesis here that once"}, {"start": 1166.48, "end": 1173.3600000000001, "text": " you're in this valley, that the function kind of stays the same, and you only sort of micro optimize"}, {"start": 1173.3600000000001, "end": 1178.32, "text": " the function. However, at the beginning, you decide into which of those valleys you want to go."}, {"start": 1178.88, "end": 1183.6, "text": " And the different initializations will lead you to different valleys, and that's what they show"}, {"start": 1183.6, "end": 1189.76, "text": " right here. So, they do a T-Sni plot of predictions. T-Sni is a method to project, to down project"}, {"start": 1189.76, "end": 1197.92, "text": " high-dimensional vectors. And this is the weight space projected to two dimensions. So, T-Sni"}, {"start": 1197.92, "end": 1204.56, "text": " axis one and two. These are rather arbitrary. It's just the, if you think of a PCA, it's the"}, {"start": 1204.56, "end": 1211.12, "text": " directions of maximum variance. And you can see the three different runs, they immediately at the"}, {"start": 1211.12, "end": 1216.32, "text": " beginning right here. They immediately go. You can see they have, they do large distances at the"}, {"start": 1216.32, "end": 1223.04, "text": " beginning, between the steps of optimization. And they do in very different directions, just by"}, {"start": 1223.04, "end": 1228.1599999999999, "text": " means of being initialized at different points, and having maybe a bit of noise in the training"}, {"start": 1228.1599999999999, "end": 1235.4399999999998, "text": " process. But once they are at the particular location, they sort of just kind of bounce around"}, {"start": 1235.4399999999998, "end": 1245.36, "text": " right here and try to find the best minima in that region. So, this is our first indication"}, {"start": 1245.36, "end": 1251.04, "text": " that the, if we train the same network multiple times with random initializations, it's going to"}, {"start": 1251.04, "end": 1259.52, "text": " end up at different places. And what we're wondering is, we already know that a single network"}, {"start": 1259.52, "end": 1266.7199999999998, "text": " is very different at the end than at the beginning of training. What we want to know is our two"}, {"start": 1266.7199999999998, "end": 1272.1599999999999, "text": " networks also very different, even though they're trained on the same objective. Just because they"}, {"start": 1272.16, "end": 1276.24, "text": " are at different places in the weight space, doesn't mean they are functionally that different,"}, {"start": 1276.24, "end": 1281.44, "text": " there are symmetries. And it's going to turn out, yes, they actually are very, very different."}, {"start": 1282.0800000000002, "end": 1291.28, "text": " So, this is right here. Here you can see two different things. And we're going to read the plot"}, {"start": 1291.28, "end": 1298.3200000000002, "text": " along with it, just so I remember what I was seeing here. So, using two different architectures,"}, {"start": 1298.32, "end": 1304.32, "text": " okay, for each of these architectures, the left subplot shows the cosine similarity between the"}, {"start": 1304.32, "end": 1308.6399999999999, "text": " different solution weight space. And the right subplot shows the fraction of labels on which the"}, {"start": 1308.6399999999999, "end": 1314.08, "text": " predictions from different solutions disagree. Okay, so it's the same as before. The left is the"}, {"start": 1314.08, "end": 1321.2, "text": " alignment. And now it's not during training. Now we restart independently. We train the same network"}, {"start": 1321.2, "end": 1328.32, "text": " 10 different times. And after that, we're going to compare the 10 different solutions. Remember,"}, {"start": 1328.32, "end": 1334.88, "text": " these all achieve roughly the same accuracy on the data sets. And this is the same whether you go"}, {"start": 1334.88, "end": 1342.88, "text": " to a big architecture like this ResNet 20 or to a small architecture like this small CNN right here."}, {"start": 1342.88, "end": 1349.2, "text": " You can see that every single solution, of course, agrees a lot with itself. That's the diagonal"}, {"start": 1349.2, "end": 1354.88, "text": " right here. But it's completely, it's not a line. It's completely orthogonal to all the other"}, {"start": 1354.88, "end": 1360.4, "text": " solutions. So all the solutions in weight space are orthogonal. Now there's still the chance that"}, {"start": 1360.4, "end": 1366.16, "text": " there is, you know, some symmetry in weight space because, you know, if I, if I have a neural network,"}, {"start": 1366.16, "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.76, "text": " be the same function. However, you can see right here that they completely disagree. So the small CNN,"}, {"start": 1379.76, "end": 1389.92, "text": " remember, it had like a 65% accuracy. The solutions, the red here, they disagree on 25% of the labels."}, {"start": 1389.92, "end": 1397.04, "text": " So that this is exactly this effect we saw before. We train one solution and it will not be able to"}, {"start": 1397.04, "end": 1402.72, "text": " classify these parts of the validation data set. And we train the same network with the same"}, {"start": 1402.72, "end": 1407.68, "text": " dataset with the same loss with everything the same again, just from a random initialization that's"}, {"start": 1407.68, "end": 1413.76, "text": " different. It will end up equally performing equally well, but it will make the mistakes on an"}, {"start": 1413.76, "end": 1420.32, "text": " entirely different set of the validation data points. Like this is rather astounding, I feel,"}, {"start": 1420.32, "end": 1427.68, "text": " because I think most people are of the of the idea that the kind of data points have an intrinsic"}, {"start": 1427.68, "end": 1435.68, "text": " hardness. And if, if we get to 70% accuracy, it will always be the same 70% of data points that we"}, {"start": 1435.68, "end": 1442.96, "text": " miss classify or sorry, that we correctly classify. This is not the case. And this is one thing I think"}, {"start": 1442.96, "end": 1448.5600000000002, "text": " this paper and this line of research does pretty cool is to look at these networks in terms of their"}, {"start": 1448.56, "end": 1458.24, "text": " prediction agreement. So they go further and they compare this to four different methods. So they say,"}, {"start": 1458.24, "end": 1466.1599999999999, "text": " okay, ensembles. ensembles are one method of kind of doing these getting different solutions,"}, {"start": 1466.1599999999999, "end": 1472.1599999999999, "text": " which means we start from random initializations, but there are other ones. So for example, there is,"}, {"start": 1472.16, "end": 1479.92, "text": " well, just place this correctly here, random subspace sampling. So what does it mean? We start at an"}, {"start": 1479.92, "end": 1485.6000000000001, "text": " optimized solution. So you train a network, one single network, and then we choose a random"}, {"start": 1485.6000000000001, "end": 1490.4, "text": " direction at V in weight space. We step in that direction by choosing different values of T,"}, {"start": 1490.4, "end": 1496.48, "text": " looking at the predictions at configurations, theta zero plus TV. We repeat this from many different"}, {"start": 1496.48, "end": 1504.56, "text": " V, but always the same theta zero. So in our original kind of drawing of this thing, we optimize one"}, {"start": 1504.56, "end": 1512.32, "text": " single network. Let's say that's here. And then we sort of wiggle around in here in two different"}, {"start": 1512.32, "end": 1516.96, "text": " random directions. Now of course, there's only one random direction right here. If maybe we can look"}, {"start": 1516.96, "end": 1524.32, "text": " at this at at the, so if here we have the loss landscape and maybe over here, there is a bit of a"}, {"start": 1524.32, "end": 1534.32, "text": " thing and over here, there is a bit of a, you thought I was going to draw. Okay, so we start here,"}, {"start": 1534.32, "end": 1539.28, "text": " and maybe that converges to somewhere here. So what we're going to do is we're going to select"}, {"start": 1539.28, "end": 1544.32, "text": " random directions in that space, and we're just going to go a few steps into this direction and"}, {"start": 1544.32, "end": 1551.04, "text": " compare the weights. Now here, you can already see by the way I'm drawing it, that this will probably"}, {"start": 1551.04, "end": 1558.56, "text": " make you stay in the same region. And our hope with Ensemble is of course, is that they are able to"}, {"start": 1558.56, "end": 1565.92, "text": " capture all of the three different modes right here. But it is a way to obtain different solutions"}, {"start": 1565.92, "end": 1571.6, "text": " that all also perform quite well. If you only perturb your solution by a little bit, it also"}, {"start": 1572.3999999999999, "end": 1577.76, "text": " works quite well. And you can build an Ensemble out of these methods right here. You can build"}, {"start": 1577.76, "end": 1584.16, "text": " an Ensemble out of these. In fact, these Bayesian methods, if you do these approximations with"}, {"start": 1584.16, "end": 1590.48, "text": " Gaussians, that's pretty much what they will end up doing is they will end up characterizing the"}, {"start": 1590.48, "end": 1597.04, "text": " local, the local landscape around one of these minimum. But here, we simply do it by randomly stepping"}, {"start": 1597.04, "end": 1604.16, "text": " into a direction. That's the first method that we're going to investigate to obtain an Ensemble"}, {"start": 1604.16, "end": 1612.8000000000002, "text": " of different solutions. So deep Ensemble means we initially randomly initialize many times and"}, {"start": 1612.8000000000002, "end": 1621.3600000000001, "text": " then train from scratch each member. This method here means we start from a solution and we simply"}, {"start": 1621.3600000000001, "end": 1629.76, "text": " perturb it into random directions. The next thing we can do is we can do dropout, subspace dropout."}, {"start": 1629.76, "end": 1635.84, "text": " We again started an optimized solution, applied dropout with randomly chosen probability."}, {"start": 1636.48, "end": 1642.72, "text": " Again, our hypothesis is going to be that this is going to keep the network rather in the sort of"}, {"start": 1642.72, "end": 1650.56, "text": " same kind of functional mode and not switch over. Diagonal Gaussian subspace. Again, we start from"}, {"start": 1650.56, "end": 1655.36, "text": " an optimized solution. You can see the pattern. And here we actually do some sort of a Gaussian"}, {"start": 1655.36, "end": 1663.12, "text": " approximation to the functional space. We calculate a mean and a standard deviation. And we draw"}, {"start": 1663.12, "end": 1669.36, "text": " samples of the parameters from that distribution and then the same in a low rank regime."}, {"start": 1670.3999999999999, "end": 1677.12, "text": " And here you see what happens. So here is these things. For example, the random subspaces."}, {"start": 1678.7199999999998, "end": 1684.8799999999999, "text": " Here is this overlap with the plot we saw before. So here we have three different trajectories"}, {"start": 1684.88, "end": 1690.88, "text": " of runs. And then at the end of each trajectory, we take the best solution and we do this random"}, {"start": 1690.88, "end": 1698.72, "text": " exploration around it. And this here is the T-Sni projection. Now this isn't, I have to say,"}, {"start": 1698.72, "end": 1705.1200000000001, "text": " this isn't the projection of the weights itself. Sorry, I did not say that before. This is a projection"}, {"start": 1705.12, "end": 1714.8799999999999, "text": " of the predictions, I believe, of a subset of data points. So this is the prediction projection"}, {"start": 1714.8799999999999, "end": 1722.4799999999998, "text": " of that. And you can see that if we perturb the solutions like this, all of these solutions,"}, {"start": 1722.4799999999998, "end": 1729.6, "text": " all of these ensembles, they rather, they stay in their basin of attraction, as you can see"}, {"start": 1729.6, "end": 1736.48, "text": " right here. So with a deep ensemble, we would build an ensemble that, sorry, sorry, sorry,"}, {"start": 1737.36, "end": 1744.48, "text": " we would build an ensemble that combines this point and this point and this point. Whereas here,"}, {"start": 1744.48, "end": 1750.9599999999998, "text": " we will simply either build an ensemble that combines points in here or will build an ensemble"}, {"start": 1750.9599999999998, "end": 1755.9199999999998, "text": " that combines points in here and so on. And you'll see this for all the different methods that"}, {"start": 1755.92, "end": 1762.8000000000002, "text": " we consider here, especially the Gaussian methods. And that's a hint to why even though Bayesian"}, {"start": 1762.8000000000002, "end": 1769.76, "text": " networks explicitly try to capture the entire distribution right here, what they'll end up doing"}, {"start": 1769.76, "end": 1776.4, "text": " is they'll simply end up capturing a single mode. And not, and that's important because the"}, {"start": 1776.4, "end": 1782.4, "text": " single mode is always functionally sort of equal. We saw that this is a training, training,"}, {"start": 1782.4, "end": 1788.72, "text": " the trajectory. And at the end of training, after like this step right here, all the functions"}, {"start": 1788.72, "end": 1795.52, "text": " are pretty much the same, right? They pretty much agree with the end optimum. Whereas between the"}, {"start": 1795.52, "end": 1801.44, "text": " runs, they, these functions completely disagree with each other. So it is important if we want to"}, {"start": 1801.44, "end": 1806.64, "text": " build an ensemble to capture as many of these modes as possible. And only the ensemble, the deep"}, {"start": 1806.64, "end": 1815.1200000000001, "text": " ensembles can do that so far. So this is another experiment where they show this loss landscape."}, {"start": 1815.1200000000001, "end": 1821.6000000000001, "text": " And I really like these kind of plots. So what you see here is a plane. It's a 2D plane."}, {"start": 1821.6000000000001, "end": 1828.24, "text": " And the 2D plane is described by three points. So one point is the origin. You see right here,"}, {"start": 1828.24, "end": 1835.44, "text": " the origin. That's the origin of, that's the zero in weight space. Okay. Then what you have are the"}, {"start": 1835.44, "end": 1842.72, "text": " two optima. So you'd run an optimization two different times. Once it's initialized here,"}, {"start": 1842.72, "end": 1850.8, "text": " and it runs to here, and once it's initialized here, and it runs to here. Okay. So that defines the"}, {"start": 1850.8, "end": 1856.64, "text": " plane that we're going to look at. Now they, for each single pixel in this plane, or actually,"}, {"start": 1856.64, "end": 1864.64, "text": " for each single pixel in this half circle right here, they evaluated the networks. So, well,"}, {"start": 1864.64, "end": 1870.72, "text": " you'll do is simply you do linear combination of these weight of the weight vector here at this"}, {"start": 1870.72, "end": 1877.2, "text": " optimum, the weight vector here at this optimum. And you can, for each point here, defines a neural"}, {"start": 1877.2, "end": 1883.76, "text": " network with those weights. And you can evaluate it. And that's what you get. This is the accuracy of"}, {"start": 1883.76, "end": 1892.24, "text": " the neural network at that point. So here you can see very, very clearly that there are these two"}, {"start": 1892.24, "end": 1898.24, "text": " different modes right here. So each, even though they're initialized super close to each other,"}, {"start": 1898.24, "end": 1903.28, "text": " right. You can see this right here. They're initialized super close to each other because they are,"}, {"start": 1903.28, "end": 1909.44, "text": " this is the flat area right here that we saw before. Because they are in the flat area,"}, {"start": 1911.44, "end": 1916.88, "text": " they're, even though they're initialized pretty close, the red one is a little bit more to this"}, {"start": 1916.88, "end": 1920.88, "text": " base and of attraction. The blue one is a little bit more to this base and of attraction. So they move"}, {"start": 1920.88, "end": 1926.0, "text": " over and as soon as they're in, it's like boom, they go to the minimum of that basin and this area"}, {"start": 1926.0, "end": 1932.8000000000002, "text": " is rather convex and this area is rather convex. And in the middle, you can see is a less,"}, {"start": 1933.6000000000001, "end": 1939.2, "text": " is more loss. So no solution will go there. That's how you get these different minima. That's how"}, {"start": 1939.2, "end": 1944.3200000000002, "text": " you get these different modes. And you can see the accuracy or from the color is going to be the"}, {"start": 1944.32, "end": 1953.4399999999998, "text": " same in each of the, in each of the valleys, consistent with our what we know so far. Now here,"}, {"start": 1953.4399999999998, "end": 1961.36, "text": " the pink stripe is a Gaussian exploration. So if you now do a Gaussian perturbation, Gaussian"}, {"start": 1961.36, "end": 1966.8799999999999, "text": " exploration around this minimum, you basically, you can see again, you don't get out of this valley."}, {"start": 1966.8799999999999, "end": 1972.24, "text": " You don't, you're not going to go to different modes. The weight space is just too large and you're"}, {"start": 1972.24, "end": 1979.6, "text": " going to simply be stuck in there. So the only chance almost you have is to initialize again and"}, {"start": 1979.6, "end": 1984.8, "text": " hope that you end up in a different place. And I guess my hypothesis is that there are many, many"}, {"start": 1984.8, "end": 1992.72, "text": " more of these valleys of these basins than that you can, you could ever capture. So basically every"}, {"start": 1992.72, "end": 1999.36, "text": " single initialization that is different will lead you to a different one of these basins."}, {"start": 1999.36, "end": 2007.28, "text": " I guess it's only a matter of this size. So here again, they do a function similarity."}, {"start": 2007.9199999999998, "end": 2012.6399999999999, "text": " So in this case, it's the function similarity to optimum one. And this is again,"}, {"start": 2013.4399999999998, "end": 2020.8, "text": " how many of the labels agree with the optimum right here. And you can see that within this"}, {"start": 2020.8, "end": 2026.3999999999999, "text": " basin of attraction, you have fairly high overlap of the functional similarity. But here,"}, {"start": 2026.4, "end": 2034.0800000000002, "text": " none, right? So 15% or so, it's not going to be zero because they're going to agree on like some"}, {"start": 2034.0800000000002, "end": 2041.68, "text": " of the examples. I guess there's still something like intrinsic hardness, but they agree on almost"}, {"start": 2041.68, "end": 2048.88, "text": " none of the labels, at least I guess if you normalize by their base accuracy. So even though"}, {"start": 2048.88, "end": 2059.44, "text": " optimum two is performing as well, it is functionally extremely dissimilar to optimum one. So these"}, {"start": 2059.44, "end": 2065.52, "text": " describe really different functions. And I really don't know what to make of this other than,"}, {"start": 2066.32, "end": 2073.44, "text": " you know, each one of these is maybe sort of deciding to look at different features in the"}, {"start": 2073.44, "end": 2080.7200000000003, "text": " in the data set, right? Or to maybe build different high level features from the same low level features."}, {"start": 2080.7200000000003, "end": 2087.76, "text": " And maybe we're still under parameterizing these models because not a single model can sort of"}, {"start": 2087.76, "end": 2094.16, "text": " look at both features at the same time as evidenced by the fact that each of these is always going"}, {"start": 2094.16, "end": 2102.32, "text": " to one of these things. Or it could be that in fact, the task is way too simple and it can be solved"}, {"start": 2102.32, "end": 2109.84, "text": " in like a 500 different ways. And each of these optima is simply one way of solving the task,"}, {"start": 2109.84, "end": 2115.44, "text": " one way of combining feature. And it's actually completely an over specified problem. That's another"}, {"start": 2115.44, "end": 2120.2400000000002, "text": " hypothesis. It would be, I guess, interesting to look at these things. And I'm sure there's work"}, {"start": 2120.2400000000002, "end": 2129.52, "text": " on this. So you can see the same thing for optimum two right here where, okay, go away. Where,"}, {"start": 2129.52, "end": 2137.7599999999998, "text": " you can see that optimum one, it agrees almost nothing with optimum two, right? It doesn't,"}, {"start": 2137.7599999999998, "end": 2144.32, "text": " it doesn't agree. There's not even a hint of a valley right here in the terms of functional"}, {"start": 2144.32, "end": 2150.64, "text": " similarity. That is very, very interesting. So it really means that these two things describe"}, {"start": 2150.64, "end": 2158.72, "text": " two different functions. They do these other plots right here that they call diversity versus accuracy"}, {"start": 2158.72, "end": 2168.24, "text": " plots. So what they'll do is they are going to have different models and they're going to look at"}, {"start": 2168.24, "end": 2176.72, "text": " them in terms of their diversity and their accuracy. So here the y-axis is going to be how different"}, {"start": 2176.72, "end": 2183.6, "text": " are these functions. And that's going to be again in fraction of labels changed, normalized by the"}, {"start": 2183.6, "end": 2190.72, "text": " base accuracy. So here you can see we're always start from this baseline optimum. This baseline"}, {"start": 2190.72, "end": 2199.8399999999997, "text": " optimum has zero diversity zero because it agrees with itself on all the on all the different"}, {"start": 2199.8399999999997, "end": 2206.48, "text": " labels, of course. And then we're going to disturb that using our four methods that we defined"}, {"start": 2206.48, "end": 2212.4, "text": " before. So we're going to randomly subspace. We're going to drop out. We're going to Gaussian"}, {"start": 2212.4, "end": 2218.4, "text": " perturbed and so on. And the more we perturb it, the more diverse our function is going to be"}, {"start": 2218.4, "end": 2224.0, "text": " naturally, right? Because we perturb the function, it starts disagreeing more and more and more"}, {"start": 2224.0, "end": 2232.96, "text": " with our original optimum. However, what we also expect is if we are in the local optimum and maybe"}, {"start": 2232.96, "end": 2240.1600000000003, "text": " here, and you know, maybe the validation accuracy is sort of beside it or a little bit larger and"}, {"start": 2240.16, "end": 2245.8399999999997, "text": " so on. So if we perturb it a little bit, you know, that might not make too much to our accuracy."}, {"start": 2245.8399999999997, "end": 2251.2, "text": " But if we perturb it a lot, you know, we go actually up the loss landscape and then we get less"}, {"start": 2251.2, "end": 2257.7599999999998, "text": " accuracy also on the validation set. So that's what you see right here in these, in these,"}, {"start": 2257.7599999999998, "end": 2264.72, "text": " this curve right here, as you make the function more diverse. So you perturb it a little bit."}, {"start": 2264.72, "end": 2270.7999999999997, "text": " You see that your accuracy doesn't suffer too much. You can't just stay at the same accuracy. But as"}, {"start": 2270.7999999999997, "end": 2277.04, "text": " if you make it more and more and more diverse, you can see that the accuracy suffers until the"}, {"start": 2277.04, "end": 2282.7999999999997, "text": " diversity of one basically means that you disagree on the maximum amount of labels that you can."}, {"start": 2283.68, "end": 2290.9599999999996, "text": " And so you're sort of sort of out of this valley right here. And also, you can see that your"}, {"start": 2290.96, "end": 2299.2, "text": " accuracy goes to zero. So the more these functions disagree, the less their accuracy is."}, {"start": 2299.2, "end": 2305.52, "text": " That seems natural. However, you can see that these red stars right here, they seem to be"}, {"start": 2306.32, "end": 2312.48, "text": " also very different. They seem to not agree with the original baseline optimum. But they seem to be"}, {"start": 2312.48, "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": " optimum. Those are the optimum from runs where we initialize that a different point and then also"}, {"start": 2325.7599999999998, "end": 2333.92, "text": " trained. And that again is evidence for the fact that there are probably other optimum far away"}, {"start": 2335.04, "end": 2341.36, "text": " where these different initializations find this here. So they are very different in terms of"}, {"start": 2341.36, "end": 2347.2, "text": " functional space. They're quite far apart. They predict different things. However, in terms of"}, {"start": 2347.2, "end": 2356.24, "text": " loss, they're almost the same or actually the same. So this is very, very cool experiments"}, {"start": 2356.24, "end": 2363.3599999999997, "text": " right here. And they do this for the different, for different architectures. And you can see that"}, {"start": 2363.3599999999997, "end": 2368.3199999999997, "text": " especially the larger architectures, this actually happens more pronounced. And they also make"}, {"start": 2368.3199999999997, "end": 2375.52, "text": " the point of saying, if you go to harder problems like a C for 100 or an image net, this, this effect"}, {"start": 2375.52, "end": 2384.16, "text": " is more pronounced that you can see these here are closer together as a curve. And these, these are"}, {"start": 2384.16, "end": 2394.56, "text": " the independent optimum. So I hope you're already on board. And still know why we're doing these"}, {"start": 2394.56, "end": 2400.32, "text": " things. We're doing these things because we want to build some sort of ensemble that captures"}, {"start": 2400.32, "end": 2408.56, "text": " the distribution of solutions in order to generalize better. Now we have two options either we start"}, {"start": 2408.56, "end": 2415.92, "text": " kind of from a optimum and characterize this space around that optimum, which is what these"}, {"start": 2415.92, "end": 2422.4, "text": " methods do right here. And what also the Bayesian methods do this, even though they don't want to"}, {"start": 2422.4, "end": 2427.92, "text": " because they do these approximations because they're intractable, they're going to end up doing this."}, {"start": 2427.92, "end": 2437.6, "text": " Or our other, our other option is to restart training a bunch of times. And then we end up at"}, {"start": 2437.6, "end": 2446.16, "text": " different optimum. And the point of the paper is it's better to do that than to build the ensemble"}, {"start": 2446.16, "end": 2453.12, "text": " out of the of these Gaussian methods or of these perturbation methods. And the paper, I guess the"}, {"start": 2453.12, "end": 2457.84, "text": " main claim of the paper is why that happens. And it happens because the ensemble members obtain"}, {"start": 2457.84, "end": 2463.28, "text": " different minima that are functionally different. Okay. So"}, {"start": 2466.8, "end": 2472.7200000000003, "text": " exactly that's what they do here. So they now build on-sembles out of these different things. And"}, {"start": 2472.7200000000003, "end": 2482.32, "text": " you can see that here on the x axis of the ensemble size. So how many ensemble members do you have?"}, {"start": 2482.32, "end": 2489.6000000000004, "text": " And the dash lines here are the baseline accuracies if you just have a single model. And the"}, {"start": 2491.76, "end": 2499.04, "text": " the test accuracy is put on the y axis. Now I actually was I was not that's not correct."}, {"start": 2499.04, "end": 2505.28, "text": " You always build the ensemble out of random initializations. But on top of that you do these things."}, {"start": 2505.28, "end": 2513.0400000000004, "text": " So what you can see right here is if I have this classifier, which is my original classifier,"}, {"start": 2513.0400000000004, "end": 2523.92, "text": " and I add on top of that this PCA Gaussian perturbation stuff, I increase inaccuracy."}, {"start": 2523.92, "end": 2532.88, "text": " Okay. However, if I build an ensemble, I increase inaccuracy. If I build an ensemble out of 10 members,"}, {"start": 2532.88, "end": 2541.44, "text": " I increase inaccuracy this much. Okay. And then if because I can do both things. So if I increase,"}, {"start": 2541.44, "end": 2548.32, "text": " if I do an ensemble, and then on top of that do the PCA gas, I gain another this much right here."}, {"start": 2548.88, "end": 2555.04, "text": " So that's sort of evidence for the fact that you'd rather build an ensemble than do this,"}, {"start": 2555.04, "end": 2567.2, "text": " these other methods of approximating the Bayesian posterior of weights. So yes, I'm sort of convinced."}, {"start": 2567.84, "end": 2574.08, "text": " I hope you are too. And they do a lot of they do us some more experiments right here where you can"}, {"start": 2574.08, "end": 2584.48, "text": " see that the difference between, so this is single, sorry, this is, I guess here accuracy. Oh,"}, {"start": 2584.48, "end": 2590.8, "text": " yeah, if you, this is the out of distribution test. So you can take a data set and you can corrupt it"}, {"start": 2590.8, "end": 2596.0, "text": " by corruption. So there are predefined data sets, but you can also do it yourself, you crop it,"}, {"start": 2596.0, "end": 2606.4, "text": " you can do luminacy, whatever, you can destroy parts of the image. You can see that having more"}, {"start": 2606.4, "end": 2614.7200000000003, "text": " ensemble members. So this is your original models. Here is how they sync with increasing corruption."}, {"start": 2614.7200000000003, "end": 2618.88, "text": " It almost doesn't matter which ones of these methods you do. You see the bottom one is the original"}, {"start": 2618.88, "end": 2624.96, "text": " model and you gain a little bit by doing these things, but not nearly as much by building an ensemble"}, {"start": 2624.96, "end": 2631.2000000000003, "text": " and going here or actually an ensemble of two members or a five members in which case you"}, {"start": 2631.2, "end": 2638.72, "text": " jump this much in accuracy. So these ensembles from different initializations are also very, very,"}, {"start": 2640.08, "end": 2646.64, "text": " are also very good at countering corruption, which you see also here."}, {"start": 2650.96, "end": 2656.08, "text": " Yeah, so this is the JS divergence. Okay, I've read that, but let's not go here."}, {"start": 2656.08, "end": 2662.72, "text": " Videos are already too long and this is the last thing is on ImageNet test set and the ImageNet"}, {"start": 2662.72, "end": 2668.48, "text": " a corrupted set where they pretty much show the same thing. It's not as pronounced here,"}, {"start": 2668.48, "end": 2676.88, "text": " but you can see pretty much how the different if you go from single model to ensemble with two"}, {"start": 2676.88, "end": 2682.72, "text": " members to ensemble with four members, there is a general upwards trend and the general upwards"}, {"start": 2682.72, "end": 2688.8799999999997, "text": " trend is much less pronounced within each ensemble. So if you go just to go from method to method,"}, {"start": 2688.8799999999997, "end": 2695.4399999999996, "text": " then it is between the different groups of ensembles, meaning that the ensemble is a much more"}, {"start": 2695.4399999999996, "end": 2703.7599999999998, "text": " pronounced effect that these other effects. So I hope I have convinced you a little bit of how these"}, {"start": 2704.7999999999997, "end": 2710.48, "text": " sub spaces look like, how the loss landscape neural networks look like, especially the fact"}, {"start": 2710.48, "end": 2716.8, "text": " that there are these different minima and the random initializations will almost always hit"}, {"start": 2716.8, "end": 2721.12, "text": " these different minima and the interesting part is that even though these different minima"}, {"start": 2721.12, "end": 2728.32, "text": " perform equally well, they are functionally very different and an ensemble of differently"}, {"start": 2728.32, "end": 2734.96, "text": " initialized and independently optimized models can actually capture these different modes of the"}, {"start": 2734.96, "end": 2740.88, "text": " functional space and therefore if you build an ensemble out of that, it will generalize better"}, {"start": 2740.88, "end": 2746.2400000000002, "text": " because it can kind of draw information from all of those different modes rather than if you do"}, {"start": 2746.2400000000002, "end": 2751.52, "text": " some sort of Bayesian network which will because you have to approximate usually with Gaussians,"}, {"start": 2751.52, "end": 2760.7200000000003, "text": " will end up only covering one of these modes. That was that is sort of a good summary of what this"}, {"start": 2760.72, "end": 2768.72, "text": " paper says. I again, I enjoy research like this because it's easy and it gives, it kind of makes"}, {"start": 2768.72, "end": 2774.56, "text": " you think, right? So I'll be thinking about these things for a while now and thinking of new kind"}, {"start": 2774.56, "end": 2780.64, "text": " of experiments that walk through and yeah, as I said, this research is still wide open, we don't"}, {"start": 2780.64, "end": 2787.2, "text": " know so many things about neural network and you know, tell me what you think is going on actually,"}, {"start": 2787.2, "end": 2791.2, "text": " that would be very interesting and yeah, I'll see you next time. Bye bye."}] |
Yannic Kilcher | 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 upvoted on Reddit and the top comments 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 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're just going to 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 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 array of RGB coordinates, right. It's it's simply an array of this is like one zero point five 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 zero zero. This pixel right here would be zero one and so on. We have a siren is or a general in 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. And 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 in these 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 is specifically sirens have sine waves as non linearities 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 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 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 I want of image j I want these and 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 models 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 again 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. 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. 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 and guns where you can interpolate in latent space and and so on the problem here is that you know in so in guns we sample these things right here. So that's a different story but in V.A.E.s we need this encoder or in auto encoders we need this encoder to obtain a latent representation for a given data point in guns 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 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 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 zero will get will get to that in one second. 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 itself. So if yeah 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 will jump to this right here so this is the this is the comparison between a variational auto encoder and the gradient origin networks 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. 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 it's 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 equally applicable to non implicit neural networks so for the rest of this paper now I'm not saying it's going to be a little bit more complicated. 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 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 RG 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 point 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 right 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 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 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 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 people be like do you think you know remanion integral or a little bit integral I'm like okay but in this case this is 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 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 L2 loss so this is simply the reconstruction loss between a data point and it's it's 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 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 way we can or a V A E 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 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 to an X hat as well but this is 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 showing 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 without 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 what 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 propagate it 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 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 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 would 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 late 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 guess and then you update it using the gradient now there is no learning rate right here so that learning rate is one in this case so this is and again it is 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 the single step you're actually going to find the correct zero 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 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 producer 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 again right all right so here we go I've cloned the repo and I've I 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 step because the colab was I think a bit slow for me I don't know if I've caught a wrong runtime but essentially there is a bunch of setup code they know this siren layers and so on and then you have the real deal thing right here so you have a 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 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 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 zeros 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 once again you see that the loss I guess you know we get an idea of kind of the noisiness of this thing and 21 19 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 3rd 14 13 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 amnest 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 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 0.01 or so I just want to see whether this works I have no big hopes okay so we're here again and we're going to make this into two 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 okay so the normal distribution already helps or is not worse we we simply initialize it with two 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 where 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 how 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 it's a 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 are almost per 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 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 wants attempt to write a paper about it so yeah but it's it's within place 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 looks much more looks like a variational auto encoder as well the difference here is we 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 representation by backpropagating and some people even do this while some people do this while training they do gradient descent and either do or do not backprop through the GANS deco 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 backprop through both these things and there could be some special interaction because this are implicit neural networks however I very much view these as two different things the cool there is a rather cool while 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 example 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 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 point 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 variation lot to encoder 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 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 you kind of freed from the coordinate representation here and you get kind of a latent latent vector back so this is how you would use an implicit neural network in order to do classification that's I think you're a 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 inter inter parts 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.0, "end": 9.0, "text": " Hi there, today we'll look at gradient origin networks by Sam Bond Taylor and Chris G. Wilcox of Durham University."}, {"start": 9.0, "end": 17.0, "text": " So on a high level, this paper trains implicit representation networks, but not on single data points, but on entire data set."}, {"start": 17.0, "end": 21.0, "text": " It does so by using a latent encoding of each data point."}, {"start": 21.0, "end": 33.0, "text": " 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."}, {"start": 33.0, "end": 41.0, "text": " So it's a bit of a weird formulation and I've seen this paper upvoted on Reddit and the top comments would always say like,"}, {"start": 41.0, "end": 52.0, "text": " 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."}, {"start": 52.0, "end": 63.0, "text": " 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."}, {"start": 63.0, "end": 75.0, "text": " 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."}, {"start": 75.0, "end": 87.0, "text": " If you like opinions, hit the like button and subscribe if you aren't yet and share this video out, maybe that helps someone else understand."}, {"start": 87.0, "end": 98.0, "text": " So this paper is a very short paper. It is four pages and it's a dense paper. It definitely can warrant."}, {"start": 98.0, "end": 105.0, "text": " It definitely can warrant making a longer paper out of it, though that being said, it's an archive paper for now."}, {"start": 105.0, "end": 129.0, "text": " So, you know, there's nothing wrong with archiving kind of unfinished work, but we're just going to 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."}, {"start": 129.0, "end": 142.0, "text": " 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 siren."}, {"start": 142.0, "end": 156.0, "text": " 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."}, {"start": 156.0, "end": 169.0, "text": " 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."}, {"start": 169.0, "end": 186.0, "text": " And it's simply represented as an array of RGB coordinates, right. It's it's simply an array of this is like one zero point five and so on. So all the pixels are in this array. This is the explicit representation of that data point."}, {"start": 186.0, "end": 199.0, "text": " 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."}, {"start": 199.0, "end": 209.0, "text": " 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 zero zero."}, {"start": 209.0, "end": 222.0, "text": " This pixel right here would be zero one and so on. We have a siren is or a general in implicit representation network is a network that takes in any X and Y coordinate as the input."}, {"start": 222.0, "end": 234.0, "text": " 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."}, {"start": 234.0, "end": 251.0, "text": " Okay. And 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 in these single a single picture can become an entire data set for this neural network."}, {"start": 251.0, "end": 266.0, "text": " 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."}, {"start": 266.0, "end": 290.0, "text": " Second of all you can capture some regularity in the data is specifically sirens have sine waves as non linearities 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 repeated at different scales and derivatives of themselves and so on."}, {"start": 290.0, "end": 306.0, "text": " 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."}, {"start": 306.0, "end": 325.0, "text": " Alright, so these are implicit representation models or implicit generative models are these neural networks right here that map from coordinates to colors. Now what's the problem with this is as we said you need one neural network per data point."}, {"start": 325.0, "end": 341.0, "text": " 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."}, {"start": 341.0, "end": 359.0, "text": " 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."}, {"start": 359.0, "end": 376.0, "text": " 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."}, {"start": 376.0, "end": 397.0, "text": " And this will give us a neural network right here that can represent the entire data set because it always can see I want of image j I want these and 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."}, {"start": 397.0, "end": 418.0, "text": " What's much more interesting is if you kind of mix this with the kind of old style the kind of old style generative models 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."}, {"start": 418.0, "end": 437.0, "text": " 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."}, {"start": 437.0, "end": 464.0, "text": " 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 again 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."}, {"start": 464.0, "end": 484.0, "text": " 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."}, {"start": 484.0, "end": 513.0, "text": " 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."}, {"start": 513.0, "end": 534.0, "text": " 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 and guns where you can interpolate in latent space and and so on the problem here is that you know in so in guns we sample these things right here."}, {"start": 534.0, "end": 563.0, "text": " So that's a different story but in V.A.E.s we need this encoder or in auto encoders we need this encoder to obtain a latent representation for a given data point in guns 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 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."}, {"start": 563.0, "end": 575.0, "text": " 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."}, {"start": 575.0, "end": 589.0, "text": " 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."}, {"start": 589.0, "end": 596.0, "text": " And that's that's the problem of this paper and this paper proposes a solution."}, {"start": 596.0, "end": 613.0, "text": " 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."}, {"start": 613.0, "end": 623.0, "text": " This is this right here it takes in the coordinates this is the coordinates and it takes in the latent vector Z."}, {"start": 623.0, "end": 630.0, "text": " Now this whole point with it being initialized at zero will get will get to that in one second."}, {"start": 630.0, "end": 646.0, "text": " 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."}, {"start": 646.0, "end": 656.0, "text": " So the Z is per image and then each image has all the X and Y coordinates of itself."}, {"start": 656.0, "end": 661.0, "text": " So if yeah you I think you can follow."}, {"start": 661.0, "end": 671.0, "text": " 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."}, {"start": 671.0, "end": 685.0, "text": " 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."}, {"start": 685.0, "end": 700.0, "text": " Okay so we'll actually will jump to this right here so this is the this is the comparison between a variational auto encoder and the gradient origin networks so in a variational auto encoder."}, {"start": 700.0, "end": 723.0, "text": " 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."}, {"start": 723.0, "end": 747.0, "text": " 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."}, {"start": 747.0, "end": 776.0, "text": " 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"}, {"start": 776.0, "end": 805.0, "text": " guess you can hear you can input this X it's 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 equally applicable to non implicit neural networks so for the rest of this paper now I'm not saying it's going to be a little bit more complicated."}, {"start": 805.0, "end": 834.0, "text": " 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 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"}, {"start": 834.0, "end": 863.0, "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 the RG 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"}, {"start": 863.0, "end": 883.0, "text": " 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"}, {"start": 883.0, "end": 903.0, "text": " 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 point two different things"}, {"start": 903.0, "end": 923.0, "text": " 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 right 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"}, {"start": 923.0, "end": 943.0, "text": " 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"}, {"start": 943.0, "end": 961.0, "text": " 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 loss that you minimize okay you can see that this is"}, {"start": 961.0, "end": 976.0, "text": " 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"}, {"start": 976.0, "end": 988.0, "text": " 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"}, {"start": 988.0, "end": 1005.0, "text": " 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"}, {"start": 1005.0, "end": 1017.0, "text": " 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"}, {"start": 1017.0, "end": 1030.0, "text": " 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"}, {"start": 1030.0, "end": 1045.0, "text": " integrals I never get them and then I try to talk to them and people be like do you think you know remanion integral or a little bit integral I'm like okay but in this case this is this"}, {"start": 1045.0, "end": 1059.0, "text": " 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 normal loss function with respect to a data point this"}, {"start": 1059.0, "end": 1079.0, "text": " 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"}, {"start": 1079.0, "end": 1098.0, "text": " 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"}, {"start": 1098.0, "end": 1115.0, "text": " 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 L2 loss so this is simply the reconstruction loss between a data point and it's it's reconstruction okay so this part on the"}, {"start": 1115.0, "end": 1132.0, "text": " 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"}, {"start": 1132.0, "end": 1153.0, "text": " 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"}, {"start": 1153.0, "end": 1174.0, "text": " 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"}, {"start": 1174.0, "end": 1202.0, "text": " way we can or a V A E 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"}, {"start": 1202.0, "end": 1230.0, "text": " 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"}, {"start": 1230.0, "end": 1247.0, "text": " with that again there is X and then there is F of Z zero so this is somehow an X to an X hat as well but this is special X hat let's call it X hat prime or X hat zero"}, {"start": 1247.0, "end": 1263.0, "text": " 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"}, {"start": 1263.0, "end": 1282.0, "text": " showing 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 without the data point you simply start with one and there are multiple ways to do this and this paper right here"}, {"start": 1282.0, "end": 1297.0, "text": " simply says we're going to see zero is just going to be a constant value zero the constant value zero that's what it's called gradient origin networks because you always start with your Z zero your initial"}, {"start": 1297.0, "end": 1318.0, "text": " 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"}, {"start": 1318.0, "end": 1342.0, "text": " 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"}, {"start": 1342.0, "end": 1364.0, "text": " so two things here you can see you use F twice which means that your loss if you back propagate it 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"}, {"start": 1364.0, "end": 1383.0, "text": " and 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"}, {"start": 1383.0, "end": 1405.0, "text": " 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"}, {"start": 1405.0, "end": 1433.0, "text": " 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 would 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"}, {"start": 1433.0, "end": 1458.0, "text": " 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"}, {"start": 1458.0, "end": 1486.0, "text": " 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 late representation for the particular image X"}, {"start": 1486.0, "end": 1515.0, "text": " 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"}, {"start": 1515.0, "end": 1544.0, "text": " 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 guess and then you update it using the gradient now there is no learning rate right here so that learning rate is one in this case so this is and again it is zero because it's zero you can just leave it away so this is simply one single"}, {"start": 1544.0, "end": 1572.0, "text": " 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 the single step you're actually going to find the correct zero 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"}, {"start": 1572.0, "end": 1587.0, "text": " 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"}, {"start": 1587.0, "end": 1601.0, "text": " 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"}, {"start": 1601.0, "end": 1626.0, "text": " 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"}, {"start": 1626.0, "end": 1647.0, "text": " 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"}, {"start": 1647.0, "end": 1667.0, "text": " producer 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"}, {"start": 1667.0, "end": 1686.0, "text": " 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 again right"}, {"start": 1686.0, "end": 1702.0, "text": " all right so here we go I've cloned the repo and I've I 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"}, {"start": 1702.0, "end": 1725.0, "text": " step because the colab was I think a bit slow for me I don't know if I've caught a wrong runtime but essentially there is a bunch of setup code they know this siren layers and so on and then you have the real deal thing right here so you have a step so we do 500 steps and in each"}, {"start": 1725.0, "end": 1740.0, "text": " 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"}, {"start": 1740.0, "end": 1753.0, "text": " 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"}, {"start": 1753.0, "end": 1770.0, "text": " here 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"}, {"start": 1770.0, "end": 1782.0, "text": " this reconstruction loss right here and then we're going to backward to all of the parameters so first hypothesis is that this here is simply kind of gradient"}, {"start": 1782.0, "end": 1801.0, "text": " 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"}, {"start": 1801.0, "end": 1820.0, "text": " 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"}, {"start": 1820.0, "end": 1843.0, "text": " 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"}, {"start": 1843.0, "end": 1872.0, "text": " 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"}, {"start": 1872.0, "end": 1899.0, "text": " we there really shouldn't be any change right because zeros 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 once again you see that the loss"}, {"start": 1899.0, "end": 1922.0, "text": " I guess you know we get an idea of kind of the noisiness of this thing and 21 19 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"}, {"start": 1922.0, "end": 1947.0, "text": " 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 3rd 14 13 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 amnest the samples kind of look like this"}, {"start": 1947.0, "end": 1968.0, "text": " 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"}, {"start": 1968.0, "end": 1997.0, "text": " 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"}, {"start": 1997.0, "end": 2013.0, "text": " okay the so the normal initialized isn't really 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"}, {"start": 2013.0, "end": 2029.0, "text": " 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"}, {"start": 2029.0, "end": 2053.0, "text": " and let's like multiply it with like a tiny like 0.01 or so I just want to see whether this works I have no big hopes okay so we're here again and we're going to make this into two different things two steps of gradient descent"}, {"start": 2053.0, "end": 2073.0, "text": " all right so now we have two steps of gradient descent and let's see whether that helps okay so the normal distribution already helps or is not worse we we simply initialize it with two big of a variance"}, {"start": 2073.0, "end": 2102.0, "text": " 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 where 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"}, {"start": 2102.0, "end": 2117.0, "text": " however if you do more than one step of gradient descent wow how 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"}, {"start": 2117.0, "end": 2145.0, "text": " are divided by a generous three and then by maybe it's a 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"}, {"start": 2145.0, "end": 2171.0, "text": " I'm going to guess they are almost per 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"}, {"start": 2171.0, "end": 2200.0, "text": " and that will be our investigation into the code right here okay 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"}, {"start": 2200.0, "end": 2225.0, "text": " by using gradient descent which has been around for a while and I happen to know someone who who wants attempt to write a paper about it so yeah but it's it's within place 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"}, {"start": 2225.0, "end": 2241.0, "text": " 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"}, {"start": 2241.0, "end": 2250.0, "text": " 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"}, {"start": 2250.0, "end": 2269.0, "text": " 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 looks much more looks like a variational"}, {"start": 2269.0, "end": 2288.0, "text": " auto encoder as well the difference here is we 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"}, {"start": 2288.0, "end": 2303.0, "text": " representation by backpropagating and some people even do this while some people do this while training they do gradient descent and either do or do not backprop through the GANS deco through the"}, {"start": 2303.0, "end": 2316.0, "text": " 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"}, {"start": 2316.0, "end": 2329.0, "text": " interaction because you actually backprop through both these things and there could be some special interaction because this are implicit neural networks however I very much view these as two different things"}, {"start": 2329.0, "end": 2341.0, "text": " the cool there is a rather cool while 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"}, {"start": 2341.0, "end": 2351.0, "text": " understand this much better so what we'll have is we'll have the classification loss for example X is going to be your cross entropy loss between two things"}, {"start": 2351.0, "end": 2366.0, "text": " 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"}, {"start": 2366.0, "end": 2378.0, "text": " 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"}, {"start": 2378.0, "end": 2392.0, "text": " 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 point so basically you use this as a feature producer"}, {"start": 2392.0, "end": 2407.0, "text": " 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"}, {"start": 2407.0, "end": 2420.0, "text": " and we know this you know people try to this is like you were to have a variation lot to encoder and then simply use that encoder as a feature producer for a classifier"}, {"start": 2420.0, "end": 2438.0, "text": " which generally doesn't work very well but you know you can you can do it right here and the cool thing is that you can actually use the implicit representation network F to give you features for the entire data sample Z"}, {"start": 2438.0, "end": 2452.0, "text": " so you you kind of freed from the coordinate representation here and you get kind of a latent latent vector back so this is how you would use an implicit neural network in order to do classification"}, {"start": 2452.0, "end": 2465.0, "text": " that's I think you're a 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"}, {"start": 2465.0, "end": 2478.0, "text": " 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"}, {"start": 2478.0, "end": 2491.0, "text": " 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"}, {"start": 2491.0, "end": 2509.0, "text": " and it does some sensible things okay so the code is available and in fact I'll probably inter inter parts into this video a let's actually test our hypotheses right"}, {"start": 2509.0, "end": 2516.0, "text": " let's test these hypotheses that I said so first hypothesis is probably we can start with something else than the constant zero"}, {"start": 2516.0, "end": 2524.0, "text": " and second hypothesis is we can probably improve by doing multiple steps of gradient descent in the inner loop"}, {"start": 2524.0, "end": 2553.0, "text": " 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"}] |
Yannic Kilcher | 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 autoencoder. Now variational autoencoders 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 in V, I don't know how to pronounce that, a deep hierarchical variational autoencoder by Arash Vodot and Jan Kautz of Vida. As I said on a high level, this paper is about how to build a deep hierarchical variational autoencoder, 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. Each of these techniques is going to stack and stack and stack until they reach a model that 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, a model. Yeah. So really briefly, variational autoencoders. So this paper attempts to build a variational autoencoder. What is it? For that, you need to start with a, what an autoencoder is. So an autoencoder, 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. Let's say. A sort of advanced version of this and a probabilistic version of this is the variational autoencoder, 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 you 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, because now you, how you're going to feed this into the decoder, if you just feed mu, you are back to the normal autoencoder. 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 autoencoder. 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, 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 DRUG. And I'm back to the original autoencoder, 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 a VAE, there is not only the objective, or not only this objective, the reconstruction objective, but there is a second objective where we say that we impose a regularization. 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. All right? 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. Z, right? You get Z1, Z2, Z3, 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 VAE, but this here usually is something like the L2 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 L2 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 L2 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 blurry. So here, 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 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 here, 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, in video, also had this paper about this GAN where they are on different scales, like progressive, I think, prog GAN, which was the first that introduced actually this high quality face 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, and 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 8 by 8 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 8 by 8 scaled up to 128 to 128 with two residual cells per latent variable groups. So you continuously scale and scale and scale up 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 upsample it and you let another model add on top of that the next layer of features. You see this is kind of a residual connection right here. And you again sample and you let another neural network upsample, sorry, you know, 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 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'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 need 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 really good at this. People are like cardboard cutouts here. They have like these multiple layers where I mean, I'm I'm 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 two pretty like you can just look at this for hours. This is so like the diff. 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 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 skin texture might just be one scale too much here and that's where we now see the blurriness or it might just be that I don't know. Okay, I have no idea. This just somehow was popping out to me as the main difference. They are much more crisp and so on and much more beautiful, but also they look like puppets. Yeah. Alright, 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 upper most 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 is down 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. The interesting part is how do we get Z2 and you might just think, well, we'll just go like one layer up here, but Z2, as you can see here, it depends on Z1 during sampling. So during inference, we have also have to have that Z2 depends on Z1 and that's why we first need to go to Z1 and actually produce a sample. So our method of inferring the latent codes includes already sampling from those latent codes. 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 Z2 now depends on Z1 in this procedure because you go here and you go here and here. So Z2 depends on Z1, Z3 in turn would depend on Z2 and Z1 and you have a properly hierarchically factorized model right here. Okay. So 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 are residual connections. So we know that residual connections are kind of a sort of a gradient flow highway in order to train very deep networks and we've already seen this with residual networks in 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. Okay, the pluses might actually not be, okay, the pluses can also be combination, I guess. I guess that I might be wrong and they can actually be combinations. In any case they use residual networks 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 cells you can see that they use batch norm, then they use one by one convolutions in order to go to a higher channel number before they do the depth separated 5 by 5 convolutions. So 5 by 5 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 the 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 they swish nonlinearity 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 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 VIE's 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 used 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 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, 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 there, residual cells here. Reducing the memory requirements. They say they use two tricks. First of all, they do mixed precision using a cool new Nvidia library. Given that they're from a video, they get to try these things out first. And second of all, they also to reduce the memory. If you use 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 check pointing 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 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 hierarchy. And they have a special parameterization where in order for the encoder to produce that, 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 of it, 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 is 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. But 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 datasets, they achieve state of the art. In fact, okay, on this dataset, no one else has tried, but at least on the other datasets, they are very, very competitive as you can see right here. And they compare this to, first of all, two other models and even other models 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 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. 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. And 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 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 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, yeah, 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 the scraps, 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 read it up to basically fix that problem. It's 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, yeah, 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 z1, it gives, and so that gives, gets you like an image. And then there's z2, 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 z1 once and then we fix it. And then we only sample the other ones conditioned on z1. 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, there 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 modification, 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, per separable residual cell. Yeah, I don't, the hair color changes, okay? Slightly, maybe. I don't know, 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. 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 is 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": 2.04, "text": " Alright, hi there."}, {"start": 2.04, "end": 4.08, "text": " Have a look at these faces right here."}, {"start": 4.08, "end": 8.92, "text": " So you're probably used by now to seeing computer generated faces of really high quality."}, {"start": 8.92, "end": 14.48, "text": " But probably you're used to seeing these faces coming from a generative adversarial network."}, {"start": 14.48, "end": 20.0, "text": " However, these faces right here are from a variational autoencoder."}, {"start": 20.0, "end": 23.92, "text": " Now variational autoencoders are fundamentally different than GANS."}, {"start": 23.92, "end": 29.44, "text": " And traditionally they've been a bit harder to scale up to high resolution images and give"}, {"start": 29.44, "end": 32.800000000000004, "text": " sort of very detailed sharp output."}, {"start": 32.800000000000004, "end": 39.24, "text": " This paper right here attempts to build such a VAE for these high resolution large data"}, {"start": 39.24, "end": 40.480000000000004, "text": " set."}, {"start": 40.480000000000004, "end": 45.84, "text": " And it basically details everything you need to do to get a VAE like this."}, {"start": 45.84, "end": 52.0, "text": " So the paper is called NVAE or in V, I don't know how to pronounce that, a deep hierarchical"}, {"start": 52.0, "end": 57.28, "text": " variational autoencoder by Arash Vodot and Jan Kautz of Vida."}, {"start": 57.28, "end": 62.800000000000004, "text": " As I said on a high level, this paper is about how to build a deep hierarchical variational"}, {"start": 62.800000000000004, "end": 69.8, "text": " autoencoder, which is sort of a combination of already existing techniques combined in"}, {"start": 69.8, "end": 76.2, "text": " a clever way and then listing all the engineering efforts that you need to do to actually make"}, {"start": 76.2, "end": 77.72, "text": " this work."}, {"start": 77.72, "end": 81.88, "text": " And there is not one thing where you can say, ah, this is the thing that really made it"}, {"start": 81.88, "end": 82.88, "text": " work."}, {"start": 82.88, "end": 89.08, "text": " Each of these techniques is going to stack and stack and stack until they reach a model"}, {"start": 89.08, "end": 93.52, "text": " that surpasses the state of the art on these data sets."}, {"start": 93.52, "end": 98.84, "text": " And they are also able to apply this to an entirely new high quality image data set."}, {"start": 98.84, "end": 102.84, "text": " So these again are some of the samples from that model."}, {"start": 102.84, "end": 111.64, "text": " And as you can see, they look very, very crisp, very sharp and also very, let's say,"}, {"start": 111.64, "end": 112.64, "text": " a model."}, {"start": 112.64, "end": 113.64, "text": " Yeah."}, {"start": 113.64, "end": 117.64, "text": " So really briefly, variational autoencoders."}, {"start": 117.64, "end": 120.76, "text": " So this paper attempts to build a variational autoencoder."}, {"start": 120.76, "end": 121.76, "text": " What is it?"}, {"start": 121.76, "end": 124.96000000000001, "text": " For that, you need to start with a, what an autoencoder is."}, {"start": 124.96000000000001, "end": 129.12, "text": " So an autoencoder, traditionally, let's say you have an image data set and you take an"}, {"start": 129.12, "end": 135.32, "text": " image and you train a model that consists of an encoder that maps your image to a lower"}, {"start": 135.32, "end": 140.6, "text": " dimensional space, a compressed space, which you call the latent space Z. And then you"}, {"start": 140.6, "end": 147.51999999999998, "text": " train a decoder to again, go from the latent space back to the image space."}, {"start": 147.51999999999998, "end": 153.92, "text": " And then you train those two models such that the distance between the output and the input"}, {"start": 153.92, "end": 155.12, "text": " is minimized."}, {"start": 155.12, "end": 156.12, "text": " Okay."}, {"start": 156.12, "end": 158.44, "text": " This is called the reconstruction loss."}, {"start": 158.44, "end": 164.32, "text": " And you train the encoder and the decoder to minimize that reconstruction loss."}, {"start": 164.32, "end": 169.04, "text": " And thereby you hope that this latent space will learn something about the data."}, {"start": 169.04, "end": 170.04, "text": " Let's say."}, {"start": 170.04, "end": 176.64, "text": " A sort of advanced version of this and a probabilistic version of this is the variational autoencoder,"}, {"start": 176.64, "end": 183.88, "text": " where we say what we want to do is we don't want the encoder to just output the directly"}, {"start": 183.88, "end": 188.95999999999998, "text": " the latent code, but we interpret this in a probabilistic fashion."}, {"start": 188.95999999999998, "end": 194.07999999999998, "text": " So the encoder is now a probabilistic function that outputs a distribution over latent"}, {"start": 194.07999999999998, "end": 195.2, "text": " codes."}, {"start": 195.2, "end": 200.95999999999998, "text": " So we take our same image and what we want to do is we want a Bayesian, basically it's"}, {"start": 200.95999999999998, "end": 202.72, "text": " a Bayesian way of thinking of it."}, {"start": 202.72, "end": 207.23999999999998, "text": " We want a distribution over latent codes corresponding to that image."}, {"start": 207.23999999999998, "end": 214.67999999999998, "text": " So our encoder here is not going to output Z, but it's going to output mu and sigma."}, {"start": 214.67999999999998, "end": 218.56, "text": " So it would be ideal if you could output an entire distribution, but we're going to make"}, {"start": 218.56, "end": 222.07999999999998, "text": " some assumptions here that that is a normal distribution."}, {"start": 222.08, "end": 228.64000000000001, "text": " And it's going to output the mean and the standard deviation of that normal distribution."}, {"start": 228.64000000000001, "end": 234.72000000000003, "text": " And then you actually, because now you, how you're going to feed this into the decoder,"}, {"start": 234.72000000000003, "end": 237.96, "text": " if you just feed mu, you are back to the normal autoencoder."}, {"start": 237.96, "end": 239.8, "text": " So that doesn't work."}, {"start": 239.8, "end": 244.8, "text": " What you do is you actually instantiate that normal distribution with the mu and the sigma."}, {"start": 244.8, "end": 246.60000000000002, "text": " So you plug that in here."}, {"start": 246.6, "end": 255.28, "text": " You sample one sample from that normal distribution and then you feed that sample into your decoder."}, {"start": 255.28, "end": 261.6, "text": " Again, your decoder outputs an image from that sample and you compare this with the reconstruction"}, {"start": 261.6, "end": 262.6, "text": " loss."}, {"start": 262.6, "end": 264.48, "text": " And now you train the entire process."}, {"start": 264.48, "end": 274.28, "text": " So you train the, the encoder and the decoder to produce, to reproduce these images correctly."}, {"start": 274.28, "end": 281.35999999999996, "text": " Now if you only do that, then your, then the model will basically regress to a standard"}, {"start": 281.35999999999996, "end": 282.35999999999996, "text": " autoencoder."}, {"start": 282.35999999999996, "end": 283.35999999999996, "text": " Why is that?"}, {"start": 283.35999999999996, "end": 288.32, "text": " Well, what's pretty easy for the, you can see that estimating the distribution is harder"}, {"start": 288.32, "end": 294.15999999999997, "text": " than estimating just the latent code, at least for the training data set, right?"}, {"start": 294.15999999999997, "end": 300.32, "text": " So if you don't pay attention, what's going to, what the encoder is going to do is it's"}, {"start": 300.32, "end": 304.03999999999996, "text": " going to say, oh, well, I, if I just make,"}, {"start": 304.04, "end": 311.16, "text": " this here, my latent code, and if I just make this as small as possible, like zero or like"}, {"start": 311.16, "end": 316.28000000000003, "text": " one to the minus 10, 10, that, that's still one."}, {"start": 316.28000000000003, "end": 318.52000000000004, "text": " 10 to the minus one."}, {"start": 318.52000000000004, "end": 320.24, "text": " That's not that small."}, {"start": 320.24, "end": 324.0, "text": " 10 to the minus 10, 11, 12, okay?"}, {"start": 324.0, "end": 325.84000000000003, "text": " A very small number."}, {"start": 325.84000000000003, "end": 332.20000000000005, "text": " Then that normal distribution will basically be just spiky around my, around the thing,"}, {"start": 332.2, "end": 334.12, "text": " around my mean."}, {"start": 334.12, "end": 341.44, "text": " And so this here will always be kind of the same, Z, so it won't be a distribution at all."}, {"start": 341.44, "end": 343.96, "text": " It will just be this DRUG."}, {"start": 343.96, "end": 346.8, "text": " And I'm back to the original autoencoder, which I don't want."}, {"start": 346.8, "end": 351.08, "text": " I want my probabilistic framework so I can compute likelihoods and so on."}, {"start": 351.08, "end": 357.91999999999996, "text": " There are various advantages to having a probabilistic view of the data, rather than just a model"}, {"start": 357.91999999999996, "end": 359.76, "text": " that produces it."}, {"start": 359.76, "end": 360.76, "text": " Okay?"}, {"start": 360.76, "end": 366.2, "text": " And that's why in a VAE, there is not only the objective, or not only this objective,"}, {"start": 366.2, "end": 373.03999999999996, "text": " the reconstruction objective, but there is a second objective where we say that we impose"}, {"start": 373.03999999999996, "end": 374.52, "text": " a regularization."}, {"start": 374.52, "end": 384.96, "text": " The regularization is that this here is as close as possible to a standard normal distribution."}, {"start": 384.96, "end": 390.03999999999996, "text": " And I guess you can, you can choose that the prior, but in regularly, you say, okay,"}, {"start": 390.04, "end": 396.72, "text": " this here, I don't, I don't want you encoder, I don't want you to go far away from a standard"}, {"start": 396.72, "end": 397.72, "text": " normal distribution."}, {"start": 397.72, "end": 402.52000000000004, "text": " Like, do what you have to do to make the loss small, but don't go away too far."}, {"start": 402.52000000000004, "end": 403.52000000000004, "text": " All right?"}, {"start": 403.52000000000004, "end": 407.28000000000003, "text": " So that's the kind of balance in the VAE."}, {"start": 407.28000000000003, "end": 412.40000000000003, "text": " And as you can imagine, if you have a normal distribution and you sample these Z vectors"}, {"start": 412.40000000000003, "end": 415.76, "text": " here, and the reconstruction loss is always the same."}, {"start": 415.76, "end": 420.0, "text": " So if you input the same X here, a bunch of times, you'll get different Z."}, {"start": 420.0, "end": 421.0, "text": " Z, right?"}, {"start": 421.0, "end": 425.56, "text": " You get Z1, Z2, Z3, because it's sampled from this distribution."}, {"start": 425.56, "end": 427.68, "text": " There's a sampling procedure right here."}, {"start": 427.68, "end": 435.6, "text": " So if your discriminator here is kind of smooth, then it will output different images."}, {"start": 435.6, "end": 440.96, "text": " Now these images will always be compared to that same input image, right?"}, {"start": 440.96, "end": 447.32, "text": " So you're training this whole architecture to always reconstruct that input image from"}, {"start": 447.32, "end": 448.72, "text": " different images."}, {"start": 448.72, "end": 452.6, "text": " So the, there is an interaction, I think."}, {"start": 452.6, "end": 453.72, "text": " I think that's what's happening."}, {"start": 453.72, "end": 461.08000000000004, "text": " I guess I'm not an expert on VAE, but this here usually is something like the L2 loss."}, {"start": 461.08000000000004, "end": 467.32000000000005, "text": " So in terms of how this affects the images, if I have different images that are sort"}, {"start": 467.32000000000005, "end": 473.32000000000005, "text": " of the same, but sort of different, and I have to make it L2 loss close to this image"}, {"start": 473.32000000000005, "end": 478.64000000000004, "text": " right here, then one option I have is to make them kind of blurry."}, {"start": 478.64, "end": 487.08, "text": " So if I make all of them kind of blurry in the L2 loss, that will give me a lower penalty."}, {"start": 487.08, "end": 491.24, "text": " So that's, I believe that's one of the explanations I heard at some point."}, {"start": 491.24, "end": 493.96, "text": " Why VAE's produce usually blurry images?"}, {"start": 493.96, "end": 499.68, "text": " And that's been a problem for a long time, that everything's kind of blurry."}, {"start": 499.68, "end": 507.64, "text": " So here, the hierarchical VAE comes to the rescue."}, {"start": 507.64, "end": 513.0, "text": " So how they are going to battle this problem is by doing a hierarchical, variational auto"}, {"start": 513.0, "end": 514.1999999999999, "text": " encoder."}, {"start": 514.1999999999999, "end": 515.3199999999999, "text": " And this is how it works."}, {"start": 515.3199999999999, "end": 517.12, "text": " So you start off."}, {"start": 517.12, "end": 518.4, "text": " This is your generator."}, {"start": 518.4, "end": 523.36, "text": " By the way, once you've trained your VAE, right, once you've trained it, you can simply"}, {"start": 523.36, "end": 528.68, "text": " sample from your prior, from this here, because that's, you know, close enough to this, or"}, {"start": 528.68, "end": 532.92, "text": " you can, I guess, learn the prior of your data distribution and so on."}, {"start": 532.92, "end": 537.6, "text": " And you can just use the generator right here, the generative part, this part right here,"}, {"start": 537.6, "end": 541.44, "text": " is your generator, in order to produce images."}, {"start": 541.44, "end": 548.2, "text": " So you can sample from a VAE, like you could sample from a GAN."}, {"start": 548.2, "end": 554.12, "text": " Okay, so here we'll look at a model that could combat those things."}, {"start": 554.12, "end": 558.96, "text": " On the right side, you can see the model that you would ultimately sample from."}, {"start": 558.96, "end": 564.6, "text": " So this is going to be your decoder, okay, this generative model right here."}, {"start": 564.6, "end": 570.6, "text": " And what they do is it's very similar to, if you, in video, also had this paper about"}, {"start": 570.6, "end": 576.28, "text": " this GAN where they are on different scales, like progressive, I think, prog GAN, which"}, {"start": 576.28, "end": 581.28, "text": " was the first that introduced actually this high quality face data sets, I believe at"}, {"start": 581.28, "end": 582.88, "text": " least."}, {"start": 582.88, "end": 586.24, "text": " So here we're going to do a very, very similar trick."}, {"start": 586.24, "end": 593.0400000000001, "text": " So the idea is that we start out, and this is a learned quantity, but you can also view"}, {"start": 593.04, "end": 595.0799999999999, "text": " it as just kind of the zero vector."}, {"start": 595.0799999999999, "end": 601.52, "text": " We start out with our noise, we sample our noise, but our noise is going to be, it's going"}, {"start": 601.52, "end": 606.0, "text": " to be, let's say it's in the shape of an image, we can do that, we can reshape images,"}, {"start": 606.0, "end": 607.0, "text": " right?"}, {"start": 607.0, "end": 614.12, "text": " So it's going to just be a 16 entry vector, and it's going to be shaped like this, okay,"}, {"start": 614.12, "end": 616.56, "text": " we sample noise like this."}, {"start": 616.56, "end": 620.88, "text": " And then we produce an image of 16 by 16 from it."}, {"start": 620.88, "end": 626.84, "text": " I think they start with 8 by 8 or something like this, but in conceptually, you do that."}, {"start": 626.84, "end": 629.08, "text": " Then you have a neural network."}, {"start": 629.08, "end": 633.4399999999999, "text": " This is a residual neural network produce an image out of that noise, right?"}, {"start": 633.4399999999999, "end": 635.36, "text": " It maps the noise to the image."}, {"start": 635.36, "end": 639.6, "text": " So this is your, this is your D, your discriminator part."}, {"start": 639.6, "end": 641.72, "text": " But then you're not done."}, {"start": 641.72, "end": 648.16, "text": " What you do is you would actually upscale that image or that can happen in the neural network,"}, {"start": 648.16, "end": 654.48, "text": " I believe, or you are up sampled from the beginning and you enlarge these things."}, {"start": 654.48, "end": 666.76, "text": " But what you would do is you would upscale your neural network and you go higher."}, {"start": 666.76, "end": 667.76, "text": " And so on."}, {"start": 667.76, "end": 671.48, "text": " So you go higher and higher and higher in the hierarchy of noises."}, {"start": 671.48, "end": 673.28, "text": " So this is a hierarchical model."}, {"start": 673.28, "end": 674.52, "text": " Oh, yeah, down here."}, {"start": 674.52, "end": 684.12, "text": " So they start, they start from, as you can see, it consists of 36 groups in their case of"}, {"start": 684.12, "end": 692.68, "text": " latent variables starting from 8 by 8 scaled up to 128 to 128 with two residual cells per"}, {"start": 692.68, "end": 695.36, "text": " latent variable groups."}, {"start": 695.36, "end": 702.12, "text": " So you continuously scale and scale and scale up your images."}, {"start": 702.12, "end": 707.12, "text": " And each time you add another bunch of these noises right here."}, {"start": 707.12, "end": 714.28, "text": " So that means that in this model, you can, the uppermost residual model can sort of get"}, {"start": 714.28, "end": 716.92, "text": " the course details of the image."}, {"start": 716.92, "end": 721.08, "text": " And that's going to be blurry because it's a VAE, but it's going to be blurry in that"}, {"start": 721.08, "end": 722.88, "text": " course scale."}, {"start": 722.88, "end": 730.5600000000001, "text": " And then you upsample it and you let another model add on top of that the next layer of"}, {"start": 730.5600000000001, "end": 731.5600000000001, "text": " features."}, {"start": 731.56, "end": 735.04, "text": " You see this is kind of a residual connection right here."}, {"start": 735.04, "end": 742.16, "text": " And you again sample and you let another neural network upsample, sorry, you know, let another"}, {"start": 742.16, "end": 747.0799999999999, "text": " neural network add more features in a higher resolution."}, {"start": 747.0799999999999, "end": 755.3199999999999, "text": " So even though each VAE can be blurry in its own scale, it will be upscaled and there"}, {"start": 755.3199999999999, "end": 757.88, "text": " will be additional details added."}, {"start": 757.88, "end": 763.96, "text": " And that's why in their samples, you will see that they're not super blurry at all."}, {"start": 763.96, "end": 766.64, "text": " Though I have to say something right here."}, {"start": 766.64, "end": 774.64, "text": " If you look at these images and you compare them, so later they compare them, they're almost"}, {"start": 774.64, "end": 777.4399999999999, "text": " look like puppets, right?"}, {"start": 777.4399999999999, "end": 782.12, "text": " So here you compare it to these are these are previous methods down there."}, {"start": 782.12, "end": 788.36, "text": " Now, you know, to say that they're pretty, they're, you can see they're clearly kind of"}, {"start": 788.36, "end": 795.12, "text": " worse in that you need the symmetry of the faces aren't really given also the symmetries."}, {"start": 795.12, "end": 798.2, "text": " Here there are no long range dependencies."}, {"start": 798.2, "end": 802.44, "text": " The hair details are often missing as compared to like here."}, {"start": 802.44, "end": 808.44, "text": " This is pretty crisp, but if you look at like the skin of people and can just kind of the"}, {"start": 808.44, "end": 812.04, "text": " image composition in shadows, it looks like these, these people are really good at this."}, {"start": 812.04, "end": 815.16, "text": " People are like cardboard cutouts here."}, {"start": 815.16, "end": 820.7199999999999, "text": " They have like these multiple layers where I mean, I'm I'm the only one that that just sees"}, {"start": 820.7199999999999, "end": 821.7199999999999, "text": " this."}, {"start": 821.7199999999999, "end": 826.12, "text": " This is like a plastic cutout and then the face is again like a plastic cutout and the"}, {"start": 826.12, "end": 828.3199999999999, "text": " faces are so smooth."}, {"start": 828.3199999999999, "end": 829.8, "text": " I mean, look at this."}, {"start": 829.8, "end": 835.52, "text": " These are like two pretty like you can just look at this for hours."}, {"start": 835.52, "end": 838.76, "text": " This is so like the diff."}, {"start": 838.76, "end": 843.4399999999999, "text": " Maybe it just seems like this to me, but the difference if you kind of look at the skin"}, {"start": 843.4399999999999, "end": 850.84, "text": " and it almost feels like the bottom ones are actual real photographs in just in terms of"}, {"start": 850.84, "end": 860.0, "text": " the faces and the kind of the color, just the smoothness is just all look like porcelain."}, {"start": 860.0, "end": 864.08, "text": " This might actually be an effect of the VAE, right?"}, {"start": 864.08, "end": 871.0, "text": " Because it's not blurry, right, as a you know, the lines and so on, but the skin texture"}, {"start": 871.0, "end": 877.32, "text": " might just be one scale too much here and that's where we now see the blurriness or it"}, {"start": 877.32, "end": 879.96, "text": " might just be that I don't know."}, {"start": 879.96, "end": 883.6800000000001, "text": " Okay, I have no idea."}, {"start": 883.6800000000001, "end": 889.76, "text": " This just somehow was popping out to me as the main difference."}, {"start": 889.76, "end": 896.64, "text": " They are much more crisp and so on and much more beautiful, but also they look like puppets."}, {"start": 896.64, "end": 897.64, "text": " Yeah."}, {"start": 897.64, "end": 905.56, "text": " Alright, so let's get back to the model right here because so once we decided that we"}, {"start": 905.56, "end": 910.24, "text": " want such a hierarchical model, what we need to do is we need to simply build a VAE"}, {"start": 910.24, "end": 912.36, "text": " for each of these hierarchies, right?"}, {"start": 912.36, "end": 918.28, "text": " So the upper most thing here is a regular VAE noise, right?"}, {"start": 918.28, "end": 924.52, "text": " We have a noise, we sample from it and we generate this particular scale of image."}, {"start": 924.52, "end": 927.16, "text": " Okay, so how do we get that noise?"}, {"start": 927.16, "end": 931.9599999999999, "text": " We simply, this is this is down here is our, this is our encoder and this is our decoder."}, {"start": 931.9599999999999, "end": 937.76, "text": " We simply have our encoder, this is a series of neural networks and we get our latent"}, {"start": 937.76, "end": 939.04, "text": " encoding, right?"}, {"start": 939.04, "end": 945.64, "text": " So the Z is obtained through the kind of VAE encoding method."}, {"start": 945.64, "end": 946.64, "text": " Okay."}, {"start": 946.64, "end": 951.68, "text": " The interesting part is how do we get Z2 and you might just think, well, we'll just go"}, {"start": 951.68, "end": 958.64, "text": " like one layer up here, but Z2, as you can see here, it depends on Z1 during sampling."}, {"start": 958.64, "end": 963.84, "text": " So during inference, we have also have to have that Z2 depends on Z1 and that's why we"}, {"start": 963.84, "end": 967.76, "text": " first need to go to Z1 and actually produce a sample."}, {"start": 967.76, "end": 975.3199999999999, "text": " So our method of inferring the latent codes includes already sampling from those latent"}, {"start": 975.3199999999999, "end": 976.3199999999999, "text": " codes."}, {"start": 976.32, "end": 980.9200000000001, "text": " So you sample and you do the same thing as you would do in the right."}, {"start": 980.9200000000001, "end": 988.9200000000001, "text": " In fact, these models are shared and then you can see that Z2 now depends on Z1 in this"}, {"start": 988.9200000000001, "end": 993.2800000000001, "text": " procedure because you go here and you go here and here."}, {"start": 993.2800000000001, "end": 1001.72, "text": " So Z2 depends on Z1, Z3 in turn would depend on Z2 and Z1 and you have a properly hierarchically"}, {"start": 1001.72, "end": 1004.5200000000001, "text": " factorized model right here."}, {"start": 1004.52, "end": 1008.92, "text": " Okay. So this is called a hierarchical VAE."}, {"start": 1008.92, "end": 1014.12, "text": " It pretty much works like a VAE except that it is hierarchical and you need to do, you"}, {"start": 1014.12, "end": 1020.6, "text": " need to have this bottom up and this top down model in order in your encoder."}, {"start": 1020.6, "end": 1025.4, "text": " And so now there are a bunch of questions with respect to the hierarchical VAE."}, {"start": 1025.4, "end": 1029.96, "text": " The 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": 1037.72, "text": " I guess, pretty quickly."}, {"start": 1037.72, "end": 1042.2, "text": " So the rest of the paper is going to be how to get this to work."}, {"start": 1042.2, "end": 1047.72, "text": " So the main, I think, one of the main parts they do in order to get this to work in"}, {"start": 1047.72, "end": 1051.48, "text": " order to get this to train are residual connections."}, {"start": 1051.48, "end": 1059.8400000000001, "text": " So we know that residual connections are kind of a sort of a gradient flow highway in order"}, {"start": 1059.84, "end": 1066.84, "text": " to train very deep networks and we've already seen this with residual networks in CNNs"}, {"start": 1066.84, "end": 1072.24, "text": " where you have an input and you have some computation in form of a neural network or in"}, {"start": 1072.24, "end": 1078.56, "text": " this case a sampling procedure through a distribution and you have an output and the residual"}, {"start": 1078.56, "end": 1082.6799999999998, "text": " connection would allow you to skip part of that."}, {"start": 1082.6799999999998, "end": 1087.76, "text": " As you can see, used here in both the encoders and the decoders."}, {"start": 1087.76, "end": 1092.16, "text": " So in the encoders you have residual connections and also in the decoders right here you can"}, {"start": 1092.16, "end": 1093.92, "text": " see you have residual connections."}, {"start": 1093.92, "end": 1100.56, "text": " In fact, you always take that lower scale and you don't transform it into an upper scale."}, {"start": 1100.56, "end": 1110.52, "text": " You actually sample noise and then you add the lower scale and the upper scale together."}, {"start": 1110.52, "end": 1114.64, "text": " So it's really an additive model in a hierarchical fashion."}, {"start": 1114.64, "end": 1123.4, "text": " Okay, the pluses might actually not be, okay, the pluses can also be combination, I guess."}, {"start": 1123.4, "end": 1128.16, "text": " I guess that I might be wrong and they can actually be combinations."}, {"start": 1128.16, "end": 1136.3600000000001, "text": " In any case they use residual networks in a lot of cases in their generative and in"}, {"start": 1136.3600000000001, "end": 1139.2800000000002, "text": " their generator and in their encoder."}, {"start": 1139.2800000000002, "end": 1143.72, "text": " You can see right here there is a residual cell for the generative model and a residual"}, {"start": 1143.72, "end": 1146.48, "text": " cell for the encoder."}, {"start": 1146.48, "end": 1152.1200000000001, "text": " Now the exact method of these residual cells you can see that they use batch norm, then"}, {"start": 1152.1200000000001, "end": 1159.08, "text": " they use one by one convolutions in order to go to a higher channel number before they"}, {"start": 1159.08, "end": 1163.72, "text": " do the depth separated 5 by 5 convolutions."}, {"start": 1163.72, "end": 1170.56, "text": " So 5 by 5 because you need a larger receptive field, they make that clear, they need a large"}, {"start": 1170.56, "end": 1176.1599999999999, "text": " receptive field, however the large receptive field means many parameters means their"}, {"start": 1176.1599999999999, "end": 1179.9199999999998, "text": " model would be too big and too much memory."}, {"start": 1179.9199999999998, "end": 1184.0, "text": " So they do the depth separated convolutions, which simply means that you don't mix the"}, {"start": 1184.0, "end": 1186.56, "text": " channels during the convolutions."}, {"start": 1186.56, "end": 1191.56, "text": " So you go up the channels, you do a depth separated convolution and go down the channels"}, {"start": 1191.56, "end": 1192.56, "text": " again."}, {"start": 1192.56, "end": 1195.76, "text": " All of these are kind of hacks to make it work, right?"}, {"start": 1195.76, "end": 1200.92, "text": " Then also they have batch norm and they swish nonlinearity as you can see here."}, {"start": 1200.92, "end": 1206.24, "text": " And then here as well in the encoder, they also say in the text like they stress the importance"}, {"start": 1206.24, "end": 1211.8, "text": " we found that first the batch norm and then the convolution is better than the other way"}, {"start": 1211.8, "end": 1212.8, "text": " around and so on."}, {"start": 1212.8, "end": 1217.8, "text": " So there's a lot of engineering work that went into this right here."}, {"start": 1217.8, "end": 1224.72, "text": " So you see there's batch norm and also you have to kind of hack the batch norm because"}, {"start": 1224.72, "end": 1230.32, "text": " in batch norm you have these training parameters and people have observed that in VIE's if you"}, {"start": 1230.32, "end": 1237.0, "text": " during inference during sampling, if you use the training way where you only regularize"}, {"start": 1237.0, "end": 1240.56, "text": " within the batch, it's better than if you used the running averages."}, {"start": 1240.56, "end": 1243.76, "text": " So you kind of have to hack that."}, {"start": 1243.76, "end": 1247.56, "text": " We modify the momentum parameter of batch norm such that running statistic can catch up"}, {"start": 1247.56, "end": 1249.8, "text": " faster with the batch statistics."}, {"start": 1249.8, "end": 1252.04, "text": " There's a lot of engineering in here."}, {"start": 1252.04, "end": 1256.92, "text": " Like there's a lot of things that you have to get right to get something like this to work"}, {"start": 1256.92, "end": 1258.32, "text": " apparently."}, {"start": 1258.32, "end": 1263.0, "text": " And yeah, the paper just goes on in this style."}, {"start": 1263.0, "end": 1266.3999999999999, "text": " So you can see they use the swish activation."}, {"start": 1266.3999999999999, "end": 1272.28, "text": " They use squeeze and excitation blocks which are another form of residual blocks that were"}, {"start": 1272.28, "end": 1278.12, "text": " introduced quite a long time ago but still being used as you can see."}, {"start": 1278.12, "end": 1283.52, "text": " And yeah, so that's the architecture."}, {"start": 1283.52, "end": 1288.3999999999999, "text": " So you can see they have residual cells there, residual cells here."}, {"start": 1288.3999999999999, "end": 1290.9199999999998, "text": " Reducing the memory requirements."}, {"start": 1290.9199999999998, "end": 1292.6799999999998, "text": " They say they use two tricks."}, {"start": 1292.6799999999998, "end": 1297.6, "text": " First of all, they do mixed precision using a cool new Nvidia library."}, {"start": 1297.6, "end": 1302.12, "text": " Given that they're from a video, they get to try these things out first."}, {"start": 1302.12, "end": 1305.4399999999998, "text": " And second of all, they also to reduce the memory."}, {"start": 1305.44, "end": 1309.88, "text": " If you use batch norm and swish and we store only one feature map for the backward pass"}, {"start": 1309.88, "end": 1314.2, "text": " instead of two and they have to then recompute."}, {"start": 1314.2, "end": 1318.52, "text": " This trick is known as gradient check pointing and cries, recomputing batch norm in the backward"}, {"start": 1318.52, "end": 1319.52, "text": " pass."}, {"start": 1319.52, "end": 1325.8400000000001, "text": " I believe like future deep learning frameworks should just take care of that for you instead"}, {"start": 1325.8400000000001, "end": 1329.4, "text": " of you having to do this kind of stuff."}, {"start": 1329.4, "end": 1330.8400000000001, "text": " Honestly."}, {"start": 1330.84, "end": 1337.1599999999999, "text": " So they also need to they hear they say taming the unbounded KL term."}, {"start": 1337.1599999999999, "end": 1345.84, "text": " So the KL term is what makes the distribution that the encoder outputs close to that distribution"}, {"start": 1345.84, "end": 1348.48, "text": " that you want, like that normal distribution."}, {"start": 1348.48, "end": 1350.6, "text": " So this is the regularization term."}, {"start": 1350.6, "end": 1355.76, "text": " You can see here it's a KL divergence between Q which is what your encoder outputs."}, {"start": 1355.76, "end": 1362.96, "text": " You can see that's the latent code for the image X between that and between your prior"}, {"start": 1362.96, "end": 1368.24, "text": " which you say it should be it should be a like a normal distribution."}, {"start": 1368.24, "end": 1372.8799999999999, "text": " In this case, it should be a hierarchical normal distribution."}, {"start": 1372.8799999999999, "end": 1380.16, "text": " And they have a special characterization here where they say because it's hierarchical,"}, {"start": 1380.16, "end": 1381.16, "text": " right?"}, {"start": 1381.16, "end": 1385.4, "text": " So what does it mean to have hierarchical normal distribution?"}, {"start": 1385.4, "end": 1389.0, "text": " So I'm going to have a hierarchy of normal distributions."}, {"start": 1389.0, "end": 1390.64, "text": " This is my top hierarchy."}, {"start": 1390.64, "end": 1394.68, "text": " And then I'm going to sample one sample right here, right?"}, {"start": 1394.68, "end": 1401.0400000000002, "text": " And then in the next layer, I'm going to have a normal distribution around that sample"}, {"start": 1401.0400000000002, "end": 1402.0400000000002, "text": " right here."}, {"start": 1402.0400000000002, "end": 1405.0, "text": " And I'm going to sample from that and so on."}, {"start": 1405.0, "end": 1410.92, "text": " So my hierarchical normal distribution is going to be always where the next distribution"}, {"start": 1410.92, "end": 1418.0, "text": " in the next layer is dependent on the distribution in the hierarchy."}, {"start": 1418.0, "end": 1424.96, "text": " And they have a special parameterization where in order for the encoder to produce that,"}, {"start": 1424.96, "end": 1430.96, "text": " the encoder has to produce a Z of the first layer and then a Z of the second layer and"}, {"start": 1430.96, "end": 1431.96, "text": " so on."}, {"start": 1431.96, "end": 1437.0800000000002, "text": " In order for the encoder to reproduce that and to be close, it must match this distribution"}, {"start": 1437.0800000000002, "end": 1439.0800000000002, "text": " and it must match this distribution."}, {"start": 1439.08, "end": 1445.8799999999999, "text": " So if it doesn't match this distribution correctly, it will kind of sample somewhere else"}, {"start": 1445.8799999999999, "end": 1447.32, "text": " of it, right?"}, {"start": 1447.32, "end": 1451.4399999999998, "text": " And then that distribution, that base will already be shifted right here."}, {"start": 1451.4399999999998, "end": 1457.52, "text": " So it thinks that the distribution to match is now this normal distribution."}, {"start": 1457.52, "end": 1463.36, "text": " So you can see that the base is already shifted and that's why their encoder only outputs"}, {"start": 1463.36, "end": 1472.36, "text": " the delta to the, as you can see here, there it only outputs the delta to the prior."}, {"start": 1472.36, "end": 1480.4799999999998, "text": " We define here, we define the q of the Z in a given layer as the normal distribution of the"}, {"start": 1480.4799999999998, "end": 1488.36, "text": " mu i with mu i, that's your prior, see, that's your prior of that layer, plus a delta mu."}, {"start": 1488.36, "end": 1495.6799999999998, "text": " And also the sigma is the sigma from the prior times a delta sigma that you output."}, {"start": 1495.6799999999998, "end": 1501.6, "text": " So you're kind of saying you're not supposed to output the actual distribution, you're"}, {"start": 1501.6, "end": 1506.32, "text": " supposed to output the difference of distribution to the prior."}, {"start": 1506.32, "end": 1508.8799999999999, "text": " Now in layer zero, that's the same thing, right?"}, {"start": 1508.8799999999999, "end": 1514.76, "text": " Because the prior is going to be zero mean and unit variance."}, {"start": 1514.76, "end": 1521.52, "text": " So that's this here, this here is zero and this here will be one."}, {"start": 1521.52, "end": 1524.68, "text": " But in all the upper layers, this is going to make it easier."}, {"start": 1524.68, "end": 1531.0, "text": " So that's one trick you have to make this repeated sampling, not hurt you as much."}, {"start": 1531.0, "end": 1537.56, "text": " The other trick they employ here is special regular, sorry, spectral regularization, which"}, {"start": 1537.56, "end": 1543.96, "text": " is a regularization where you regularize the top singular value per layer."}, {"start": 1543.96, "end": 1547.32, "text": " You can use that, you can compute that with a power iteration."}, {"start": 1547.32, "end": 1549.3600000000001, "text": " People have been done doing this before."}, {"start": 1549.3600000000001, "end": 1558.08, "text": " And also you can build in some normalizing flows, which so here if we sample the different,"}, {"start": 1558.08, "end": 1562.16, "text": " if we sample the different layers, what we're going to do is we're going to sample all of"}, {"start": 1562.16, "end": 1564.04, "text": " these things at once, right?"}, {"start": 1564.04, "end": 1570.68, "text": " They're dependent on the upper layer in the hierarchy, but we'll sample them all at once."}, {"start": 1570.68, "end": 1574.44, "text": " And that means they are not sort of connected to each other."}, {"start": 1574.44, "end": 1580.28, "text": " Now in a, if we introduce a flow, we'll basically make them all connected to each other and"}, {"start": 1580.28, "end": 1584.72, "text": " build like a singular distribution of them."}, {"start": 1584.72, "end": 1589.2, "text": " But I don't, I don't want to go too much into this because it doesn't gain that much."}, {"start": 1589.2, "end": 1592.96, "text": " They say you can just build that in if you want."}, {"start": 1592.96, "end": 1598.76, "text": " Okay, so these are all the things that at least they list in the method section."}, {"start": 1598.76, "end": 1604.24, "text": " But there are like a lot more that they are, they have to do."}, {"start": 1604.24, "end": 1611.44, "text": " But ultimately, as you can see right here on, on these, on four of these five datasets,"}, {"start": 1611.44, "end": 1613.76, "text": " they achieve state of the art."}, {"start": 1613.76, "end": 1619.8, "text": " In fact, okay, on this dataset, no one else has tried, but at least on the other datasets,"}, {"start": 1619.8, "end": 1625.08, "text": " they are very, very competitive as you can see right here."}, {"start": 1625.08, "end": 1635.0, "text": " And they compare this to, first of all, two other models and even other models with and"}, {"start": 1635.0, "end": 1639.04, "text": " without auto regressive flows."}, {"start": 1639.04, "end": 1642.0, "text": " And they come pretty close to these auto regressive models."}, {"start": 1642.0, "end": 1648.6399999999999, "text": " So an auto regressive model would be one that generates like one pixel at a time, conditioned"}, {"start": 1648.6399999999999, "end": 1650.32, "text": " on the other pixels."}, {"start": 1650.32, "end": 1651.6, "text": " That this model doesn't do that."}, {"start": 1651.6, "end": 1654.1599999999999, "text": " This model generates all pixels at once."}, {"start": 1654.16, "end": 1656.68, "text": " So it's not auto regressive."}, {"start": 1656.68, "end": 1667.16, "text": " But as you can see, it beats all the other, all the other non auto regressive models."}, {"start": 1667.16, "end": 1673.8400000000001, "text": " And it gets pretty close to the best auto regressive models which are down here."}, {"start": 1673.8400000000001, "end": 1681.64, "text": " They're still better, but the gap is kind of shrinking is what they say."}, {"start": 1681.64, "end": 1682.64, "text": " Cool."}, {"start": 1682.64, "end": 1688.24, "text": " The main result, then they have ablations where they basically, as I said, all of these"}, {"start": 1688.24, "end": 1693.16, "text": " things kind of contribute a little bit, a little bit, a little bit, a little bit to building"}, {"start": 1693.16, "end": 1697.5200000000002, "text": " this bigger and bigger and deeper variational auto encoder."}, {"start": 1697.5200000000002, "end": 1703.64, "text": " So it's hard to say what exactly makes this work because all of it makes it work."}, {"start": 1703.64, "end": 1709.72, "text": " And I guess they just kept going until they beat state of the art or until, you know,"}, {"start": 1709.72, "end": 1711.68, "text": " they ran out of tricks."}, {"start": 1711.68, "end": 1714.28, "text": " And these are the samples that we looked at."}, {"start": 1714.28, "end": 1720.04, "text": " And I do want to spend some time in the appendix right here because I think it's pretty,"}, {"start": 1720.04, "end": 1723.76, "text": " pretty interesting what they do."}, {"start": 1723.76, "end": 1730.04, "text": " So first of all, they show that their model doesn't remember the training samples."}, {"start": 1730.04, "end": 1733.92, "text": " As you can see, right here, these are always the nearest neighbor from the training sample."}, {"start": 1733.92, "end": 1741.88, "text": " So the model is fairly far away from the training samples."}, {"start": 1741.88, "end": 1751.0800000000002, "text": " But yeah, I mean, okay, maybe it's just me, but the left, they just look like more kind"}, {"start": 1751.0800000000002, "end": 1762.52, "text": " of more idealized humans, like very smooth humans, like designer babies."}, {"start": 1762.52, "end": 1770.8, "text": " Here they show that if you use batch norm, as you would use it, I think regularly, where"}, {"start": 1770.8, "end": 1776.76, "text": " you keep these running stats or you do the, yeah, the batch norm from training, then you"}, {"start": 1776.76, "end": 1779.6, "text": " get into this kind of degenerate case."}, {"start": 1779.6, "end": 1784.4, "text": " If you sample at lower temperatures, so the temperature that you sample from the scraps,"}, {"start": 1784.4, "end": 1788.48, "text": " the width of the Gaussian that you ultimately want to sample from."}, {"start": 1788.48, "end": 1794.64, "text": " And if you do, they have this method to readjust the batch norm statistics, which I don't"}, {"start": 1794.64, "end": 1800.56, "text": " want to go into here, but you can read it up to basically fix that problem."}, {"start": 1800.56, "end": 1805.68, "text": " It's a problem that apparently other people have observed as well."}, {"start": 1805.68, "end": 1812.04, "text": " And their method apparently is, you know, is a, is one that manages to do that."}, {"start": 1812.04, "end": 1818.04, "text": " Okay, lastly, there are some more samples right here."}, {"start": 1818.04, "end": 1824.52, "text": " And, yeah, this right here, this is, honestly, this is one of the, I think, one of the most"}, {"start": 1824.52, "end": 1828.0, "text": " interesting things where they go."}, {"start": 1828.0, "end": 1830.52, "text": " And since they have this hierarchical model, right?"}, {"start": 1830.52, "end": 1837.04, "text": " So here is like z1, it gives, and so that gives, gets you like an image."}, {"start": 1837.04, "end": 1839.28, "text": " And then there's z2, and that gets you an image."}, {"start": 1839.28, "end": 1840.92, "text": " And then there's the three and so on."}, {"start": 1840.92, "end": 1847.1599999999999, "text": " And you continuously upscale and hierarchically add the features."}, {"start": 1847.16, "end": 1853.64, "text": " Here they say, what if what happens if we, if we sample z1 once and then we fix it."}, {"start": 1853.64, "end": 1858.48, "text": " And then we only sample the other ones conditioned on z1."}, {"start": 1858.48, "end": 1862.44, "text": " And here, see where you see top scale fixed."}, {"start": 1862.44, "end": 1868.96, "text": " And you can see there is considerable variation in the image, but there is, there is not"}, {"start": 1868.96, "end": 1871.8400000000001, "text": " really a large scale variation."}, {"start": 1871.8400000000001, "end": 1876.0400000000002, "text": " Okay, so the general face keeps constant."}, {"start": 1876.04, "end": 1879.44, "text": " But there are details changing as you can see."}, {"start": 1879.44, "end": 1884.8799999999999, "text": " So here the hair is kind of going over the image, the color is changing."}, {"start": 1884.8799999999999, "end": 1887.6399999999999, "text": " Here, there are a lot of changes."}, {"start": 1887.6399999999999, "end": 1893.68, "text": " The mouth looks slightly different as far as I can see, but I might be hallucinating"}, {"start": 1893.68, "end": 1894.68, "text": " here."}, {"start": 1894.68, "end": 1899.8799999999999, "text": " And then if you fix continuously the top two scales or the top three scales right here,"}, {"start": 1899.8799999999999, "end": 1905.56, "text": " top four scales, you can see that there are more and more just little details that"}, {"start": 1905.56, "end": 1907.72, "text": " change more and more."}, {"start": 1907.72, "end": 1915.8799999999999, "text": " So yeah, so this is we they are operating at five scales starting from eight by eight"}, {"start": 1915.8799999999999, "end": 1919.24, "text": " up to 128 to 128 in each row."}, {"start": 1919.24, "end": 1924.6799999999998, "text": " We fix the samples at a number of top scales and we sample from the rest of the hierarchy."}, {"start": 1924.6799999999998, "end": 1930.3999999999999, "text": " As we can see, the long range global structure is mostly recorded at the top of the hierarchy"}, {"start": 1930.3999999999999, "end": 1933.2, "text": " in the eight by eight dimensional groups."}, {"start": 1933.2, "end": 1938.0800000000002, "text": " The second scale does apply at some global modification, does apply some global modifications"}, {"start": 1938.0800000000002, "end": 1942.32, "text": " such as changing eyes, hair color, skin tone, the shape of the face."}, {"start": 1942.32, "end": 1945.32, "text": " The bottom groups capture mostly low level variations."}, {"start": 1945.32, "end": 1950.0800000000002, "text": " However, the lowest scale can still still make some subtle long range modifications."}, {"start": 1950.0800000000002, "end": 1954.96, "text": " For example, the hair color is slightly modified when we are only sampling from the lowest"}, {"start": 1954.96, "end": 1956.88, "text": " scale in the last row."}, {"start": 1956.88, "end": 1961.72, "text": " This is potentially enabled because of the larger receptive field in our depth wise,"}, {"start": 1961.72, "end": 1965.4, "text": " per separable residual cell."}, {"start": 1965.4, "end": 1973.16, "text": " Yeah, I don't, the hair color changes, okay?"}, {"start": 1973.16, "end": 1974.76, "text": " Slightly, maybe."}, {"start": 1974.76, "end": 1981.76, "text": " I don't know, my eyes are too many faces, okay?"}, {"start": 1981.76, "end": 1987.68, "text": " But you know, what's certainly the case is that their models exhibit much better kind"}, {"start": 1987.68, "end": 1993.92, "text": " of global unity compared to these other samples where you can pretty clearly see like the"}, {"start": 1993.92, "end": 1998.8, "text": " different sides of the faces have little to do with each other and so on."}, {"start": 1998.8, "end": 2001.88, "text": " This is the benefit that you get from doing this hierarchically."}, {"start": 2001.88, "end": 2006.8400000000001, "text": " So you have part of your model that's responsible for kind of the global shape of the image"}, {"start": 2006.8400000000001, "end": 2012.3600000000001, "text": " and then that keeps it consistent and then you have other parts that are responsible for"}, {"start": 2012.3600000000001, "end": 2014.0, "text": " the details."}, {"start": 2014.0, "end": 2015.76, "text": " Okay."}, {"start": 2015.76, "end": 2021.44, "text": " So I hope this was something to, you know, that interested you."}, {"start": 2021.44, "end": 2025.0, "text": " I, myself, it's, as I said, it's, it's an engineering paper."}, {"start": 2025.0, "end": 2027.76, "text": " So there is lots of things described."}, {"start": 2027.76, "end": 2032.52, "text": " There is not like one jumping idea, I guess residual connections are pretty important and"}, {"start": 2032.52, "end": 2038.96, "text": " these depth wise convolutions save memory and but also all of the, all of the other things"}, {"start": 2038.96, "end": 2045.04, "text": " that you have to do to build something like this are pretty, pretty interesting."}, {"start": 2045.04, "end": 2050.56, "text": " Yeah, I hope you gained something from it and I'll see you next time."}] |
Yannic Kilcher | 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 and super positioned again. So this is part two of this paper by Mitchell Wurzman and Vivek Ramonujin. And here's the reason why there's a part two. So after yesterday's video on this paper, 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 they are. And I also want to give some intuition in that because I felt I really had done a good job at that. The second part is that the two different ideas right here being the super masks and the super position. 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 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. All right, so again, not a new paper today I realize this but I think it's worth kind of diving deeper into this paper which is a very cool paper. So don't get me wrong right here and I feel mostly I haven't done a good part at explaining it. Literally lying away. Okay, so let's go to the first point. We had this. So if you hadn't seen the first video, super masks and super position 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 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 super position trick where you apply all the masks in a super position 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 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 the 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 some 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. So again that's that's pretty cool so they start off by saying you have your neural network is basically W and the D sorry D it's it's this fire right here and the W are the last layers weights which compute your log it's so why is going not to be your class but why is going to be your log it's and P is going to be the probability vector over your class which if the you calculate this. So 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 log it's. So they say here would they initialize the weights right here actually they initialize the they have no bias term and the 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 super position of course you want to add all of these masks with their respective alpha waiting factor then multiply by the weights and that gives you your log it's. So note that this this doesn't necessarily only only have to be the last layers 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. 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 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 s neurons so for all these superfluous neurons specifically we want that the gradient with respect to the log it's if the gradient to the log it's is equal that means the gradient to all the rest of the network is equal because the rest of the network goes through the log it's right the gradient through the log it's is equal to the gradient of the supervised loss to the log it's for all the superfluous neurons and zero otherwise so they say the zero otherwise is pretty easily done in math you know just 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 they said 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 had 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 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 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 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 alpha then if we do it for a wrong task for the task 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 task I will be independent from the data from task J if the task data is from task J then this our independent random variables okay so it sort of means that the tasks themselves are kind of independent but it's not it's not the same requirement but you can think of 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 task I think that this is given that means that the features right here and the mask 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 random 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 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 alright I restarted my tablet and we are back so what's kind of 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 this should be smaller or equal to zero so consider this this is the run the feature of the network of you right and then the EUV connects that to the to the mascot point V and the mascot point at that point UV is either zero or one depending on the training so this this Z 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 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 log it 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 the log it and the function basically means it's just measures measures how high these superfluous logids are then 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 logids if it is smaller than zero that means there 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 themes the feature important in a positive sense 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 should be 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 mask 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 their 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 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 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 so let me make it clear in this diagram right here the supermasks 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 these supermasks 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 supermask 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 supermasks 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 mixing factors the gradient pulls the most that's a different idea and the question here is wouldn't that isn't that independent doesn't 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 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 initialized them wrongly probably and 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 and it amnesty is I'm going to also hypothesis that if the task is harder and harder and I don't mean 10 class image net I mean 1000 class image net then these masks are going to degrade severely versus training the actual neural network I might be wrong I mean you can over parameterize really heavily and they will still work okay but in any case I trade the trained these neural networks and they reached higher accuracy and then I did the exact same thing I laid them in super position 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 reach the exact same thing code worked I'm not going to try to scale this up to 250 or 2500 in tasks but I'm going to assume that with the task is not going to be a task 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 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 is this here is sort of fundamental research right this is fundamental machine learning research we do architecture multi task 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 in our network is generally more confident and you're going to miss classify a lot of the tasks so so here what is 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 continuing learning self-money task 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 the process 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 and broader impact statement first some people say this is not applicable to us which I agree for most fundamental research broader if 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 do you do is you just go one level up you go up the levels 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 in that 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 Iran on the end device if models are more efficient than 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 and the broader impact statement which I guess is the smart method because the broader impact statement can be before it 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 it's already defaulting right this 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 is and 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 this is like will 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 Rick this here this is this gender shades paper right where people went and they look at these commercial APIs 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 build four groups or I haven't I haven't I've just looked at the paper but I'm understanding that they divided people up into groups which I find arbitrary to have the these two axes race and gender but okay you can do that and they discovered that these commercial APIs have different accuracy for the different groups right and that basically clear point is that you know these commercial APIs 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 multi task learning like face recognition on different groups of people as a multi task learning problem you have you know group group one right here group to 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 trying to work for first which group is that from and then take the appropriate classifier that would be you know that would be a good a 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 specifically if for one group let's say for group three 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 the factor harder and the model is less sure about the task which means that it's a double so not only is the model itself less accurate but this 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 my share of of comments on the video I made and I still maintain that societal and 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 date the 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 trying 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 that's that 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 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 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 something more to say and I think that was it so yeah I'll see you next time with the new paper okay so I'll go 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 super position 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 super position 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 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 shortly 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 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 multi task 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 these masks right here and the scores I'm going to guess are always going to be multiplied by the weight here in the forward so you can see they're in the forward you get the weights from the alphas yeah yeah this is the super imposed all right 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 right here so we need to know what this self dot stacked is so this self dot stacked is getting right here and this cash 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 mask and then we don't need to actually multiply it with the weight we 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 auto grad 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 is stop 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 well 92% 92% 92% 92% so we have a an overall performance of 92.4% 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 pretty requirement so we have a hundred percent task inference accuracy okay so we don't we don't okay we can we can evaluate this here but you can already see that but 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 these scores are discretized now given that these scores are going to be end 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 network to be initialized you know as we know it so let's try what what are other initialize function so in it dot what do we have here do we have what's usually I don't even know normal so yeah that that sounds about right that sounds about right all right all right so scores and yeah let's try this this could break everything right if you initialize wrong you get like dumb results so okay some 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 we make our parameters so these are going to be our different neural networks that we train this all looks good the alpha's look good now the only thing we want to do honestly is just 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 I have my doubts honestly like there should be no this should be it yeah yeah let's just try it like we're going to get a mistake somewhere like a crash nope nope okay all right actually 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 are of training neural networks and if if my hypothesis correct this here is going to turn out probably even better than this mask thing okay so last task training right here let's start to breathe good laptop fast laptop very nice come on come on come on come on and we're done so again we have an average top one performance of 92 point is this if did I even I ran this right here okay like that's the exact same number it was last time so we need to run in and if we're given the task ID then we are at 93.9% so we 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 it will give us the exact same number I like the 93.7% so yeah 93.9% so I'm you know I'm going to say right here that the on the super masks and the super position really are two separate ideas right you it's because the paper is like it sounds cool and all with the super mask and super position but this inference using the super position and then the entropy to decide is really one idea and training different super the advantage in using super mask is of course that the model is way smaller so you can remember it much more easily but also you know it's really different there's there's nothing to do with the super position yeah alright so I'm going I'm going to guess this also works for you know 200 tasks and what not the higher order of tasks so I think that's it and we're done here yeah | [{"start": 0.0, "end": 9.0, "text": " Hi there. Today we'll look at super masks and super positioned again. So this is part two of this paper by Mitchell Wurzman and Vivek Ramonujin."}, {"start": 9.0, "end": 24.0, "text": " And here's the reason why there's a part two. So after yesterday's video on this paper, 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."}, {"start": 24.0, "end": 35.0, "text": " 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."}, {"start": 35.0, "end": 43.0, "text": " 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."}, {"start": 43.0, "end": 53.0, "text": " 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 they are."}, {"start": 53.0, "end": 63.0, "text": " And I also want to give some intuition in that because I felt I really had done a good job at that."}, {"start": 63.0, "end": 72.0, "text": " The second part is that the two different ideas right here being the super masks and the super position."}, {"start": 72.0, "end": 85.0, "text": " 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."}, {"start": 85.0, "end": 97.0, "text": " And the third one being the broader impact statement of this paper which I usually kind of gloss over it and go like, haha, but I hear there is an important point to it."}, {"start": 97.0, "end": 110.0, "text": " So yeah, we'll get to that. All right, so again, not a new paper today I realize this but I think it's worth kind of diving deeper into this paper which is a very cool paper."}, {"start": 110.0, "end": 120.0, "text": " So don't get me wrong right here and I feel mostly I haven't done a good part at explaining it. Literally lying away."}, {"start": 120.0, "end": 142.0, "text": " Okay, so let's go to the first point. We had this. So if you hadn't seen the first video, super masks and super position 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."}, {"start": 142.0, "end": 161.0, "text": " So one after the other and basically the goal is to not forget tasks once 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."}, {"start": 161.0, "end": 190.0, "text": " 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 super position trick where you apply all the masks in a super position 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."}, {"start": 190.0, "end": 211.0, "text": " 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 G and G basically looks at the it's really strange it looks at the superfluous neurons."}, {"start": 211.0, "end": 236.0, "text": " So they also add the superfluous neurons these S neurons right here and they they the 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 some 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."}, {"start": 236.0, "end": 260.0, "text": " 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."}, {"start": 260.0, "end": 273.0, "text": " 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."}, {"start": 273.0, "end": 302.0, "text": " So again that's that's pretty cool so they start off by saying you have your neural network is basically W and the D sorry D it's it's this fire right here and the W are the last layers weights which compute your log it's so why is going not to be your class but why is going to be your log it's and P is going to be the probability vector over your class which if the you calculate this."}, {"start": 302.0, "end": 327.0, "text": " So 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 log it's."}, {"start": 327.0, "end": 345.0, "text": " So they say here would they initialize the weights right here actually they initialize the they have no bias term and the 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."}, {"start": 345.0, "end": 360.0, "text": " I guess it just works more well if you have these masks in super position of course you want to add all of these masks with their respective alpha waiting factor then multiply by the weights and that gives you your log it's."}, {"start": 360.0, "end": 389.0, "text": " So note that this this doesn't necessarily only only have to be the last layers 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."}, {"start": 389.0, "end": 418.0, "text": " 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 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."}, {"start": 418.0, "end": 447.0, "text": " 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"}, {"start": 447.0, "end": 469.0, "text": " 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 s neurons so for all these superfluous neurons specifically we want that the gradient with respect to the"}, {"start": 469.0, "end": 497.0, "text": " log it's if the gradient to the log it's is equal that means the gradient to all the rest of the network is equal because the rest of the network goes through the log it's right the gradient through the log it's is equal to the gradient of the supervised loss to the log it's for all the superfluous neurons and zero otherwise so they say the zero otherwise is pretty easily done in math you know just set it to zero and in the actual code"}, {"start": 497.0, "end": 522.0, "text": " which you can achieve like this where m indicates the superfluous neurons so this is just they said 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"}, {"start": 522.0, "end": 551.0, "text": " so they say if you had the supervised loss which means if you had 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"}, {"start": 551.0, "end": 565.0, "text": " 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"}, {"start": 565.0, "end": 593.0, "text": " 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"}, {"start": 593.0, "end": 613.0, "text": " 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 first property"}, {"start": 613.0, "end": 630.0, "text": " 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 alpha then if we do it for a wrong"}, {"start": 630.0, "end": 652.0, "text": " task for the task 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"}, {"start": 652.0, "end": 667.0, "text": " 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"}, {"start": 667.0, "end": 688.0, "text": " assumption one is we assume that the mask learn on task I will be independent from the data from task J if the task data is from task J then this our independent random variables okay so it sort of means that the tasks themselves are kind of independent"}, {"start": 688.0, "end": 715.0, "text": " but it's not it's not the same requirement but you can think of 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 task I think that this is given that means that the features right here and the mask are independent variable"}, {"start": 715.0, "end": 742.0, "text": " 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 random initialized neural network"}, {"start": 742.0, "end": 760.0, "text": " 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"}, {"start": 760.0, "end": 770.0, "text": " if this is a randomly initialized neural network then you can make a case that the expected features of those will be zero"}, {"start": 770.0, "end": 786.0, "text": " 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"}, {"start": 786.0, "end": 804.0, "text": " 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"}, {"start": 804.0, "end": 824.0, "text": " 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 equal to zero which means the negative thing is smaller than zero in lemma H1"}, {"start": 824.0, "end": 841.0, "text": " 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"}, {"start": 841.0, "end": 862.0, "text": " alright I restarted my tablet and we are back so what's kind of 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"}, {"start": 862.0, "end": 875.0, "text": " so whenever J is the true task and then I equals J then we can sort of think of the opposite like why this should be smaller or equal to zero"}, {"start": 875.0, "end": 899.0, "text": " so consider this this is the run the feature of the network of you right and then the EUV connects that to the to the mascot point V and the mascot point at that point UV is either zero or one depending on the training so this this Z"}, {"start": 899.0, "end": 916.0, "text": " 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"}, {"start": 916.0, "end": 930.0, "text": " so the secret right here why we can make 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"}, {"start": 930.0, "end": 945.0, "text": " 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"}, {"start": 945.0, "end": 964.0, "text": " 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"}, {"start": 964.0, "end": 983.0, "text": " feature makes that log it 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"}, {"start": 983.0, "end": 1002.0, "text": " the log it and the function basically means it's just measures measures how high these superfluous logids are then why do we find a negative interaction there because if you look at the neural network and you"}, {"start": 1002.0, "end": 1030.0, "text": " forward pass and this particular feature is important and you look at the loss G and you backward pass through the logids if it is smaller than zero that means there 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"}, {"start": 1030.0, "end": 1053.0, "text": " 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"}, {"start": 1053.0, "end": 1069.0, "text": " task and so it makes sense that this here would be a negative number because what we want if the mask themes the feature important in a positive sense we want that if the feature goes up G"}, {"start": 1069.0, "end": 1082.0, "text": " 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"}, {"start": 1082.0, "end": 1100.0, "text": " 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 should be small if the loss is small so if this is really from the task and this feature is really useful"}, {"start": 1100.0, "end": 1119.0, "text": " 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"}, {"start": 1119.0, "end": 1139.0, "text": " the mask 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 their the feature here because it's I is not the correct task which basically means that this feature"}, {"start": 1139.0, "end": 1158.0, "text": " 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"}, {"start": 1158.0, "end": 1176.0, "text": " 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"}, {"start": 1176.0, "end": 1198.0, "text": " and I think I just think that 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"}, {"start": 1198.0, "end": 1212.0, "text": " 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"}, {"start": 1212.0, "end": 1224.0, "text": " 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 it's a bit more of an intuition"}, {"start": 1224.0, "end": 1228.0, "text": " but if you really want to dig into it look at the derivation right here"}, {"start": 1228.0, "end": 1238.0, "text": " okay second point is the fact that the masks and the superpositions don't really have to do anything with each other"}, {"start": 1238.0, "end": 1244.0, "text": " and that's you know I've said throughout the video like remember these tasks are super easy"}, {"start": 1244.0, "end": 1256.0, "text": " so let me make it clear in this diagram right here the supermasks these are simply a way to train a neural network in a crude way"}, {"start": 1256.0, "end": 1266.0, "text": " 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"}, {"start": 1266.0, "end": 1278.0, "text": " 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"}, {"start": 1278.0, "end": 1290.0, "text": " it's still what you do in these supermasks 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"}, {"start": 1290.0, "end": 1300.0, "text": " 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"}, {"start": 1300.0, "end": 1306.0, "text": " so that's the supermask thing again I don't think it's important that the underlying network is always the same"}, {"start": 1306.0, "end": 1312.0, "text": " the only advantage you have is it saves space because these masks are very small"}, {"start": 1312.0, "end": 1325.0, "text": " the supermasks 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"}, {"start": 1325.0, "end": 1339.0, "text": " and you look at which 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 doesn't really depend on the masks or doesn't it"}, {"start": 1339.0, "end": 1351.0, "text": " 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"}, {"start": 1351.0, "end": 1363.0, "text": " 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"}, {"start": 1363.0, "end": 1374.0, "text": " 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"}, {"start": 1374.0, "end": 1384.0, "text": " 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"}, {"start": 1384.0, "end": 1405.0, "text": " 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 initialized them wrongly probably and 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"}, {"start": 1405.0, "end": 1429.0, "text": " 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"}, {"start": 1429.0, "end": 1440.0, "text": " and it amnesty is I'm going to also hypothesis that if the task is harder and harder and I don't mean 10 class image net I mean 1000 class image net"}, {"start": 1440.0, "end": 1452.0, "text": " then these masks are going to degrade severely versus training the actual neural network I might be wrong I mean you can over parameterize really heavily and they will still work"}, {"start": 1452.0, "end": 1481.0, "text": " okay but in any case I trade the trained these neural networks and they reached higher accuracy and then I did the exact same thing I laid them in super position 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 reach the exact same thing code worked I'm not going to try to scale this up to 250 or 2500 in tasks but I'm going to assume that with the task is not going to be a task"}, {"start": 1481.0, "end": 1498.0, "text": " 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"}, {"start": 1498.0, "end": 1515.0, "text": " 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"}, {"start": 1515.0, "end": 1539.0, "text": " 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 these are two cool ideas but they can be applied independently so"}, {"start": 1539.0, "end": 1559.0, "text": " 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 is this here is sort of fundamental research right this is fundamental machine learning research we do architecture multi task learning"}, {"start": 1559.0, "end": 1577.0, "text": " 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"}, {"start": 1577.0, "end": 1595.0, "text": " 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"}, {"start": 1595.0, "end": 1613.0, "text": " 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"}, {"start": 1613.0, "end": 1627.0, "text": " 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 in our network is generally"}, {"start": 1627.0, "end": 1639.0, "text": " more confident and you're going to miss classify a lot of the tasks so so here what is this have to do with the broader impact statement if you look at the broader impact"}, {"start": 1639.0, "end": 1659.0, "text": " statement what they say right here so they say a goal of continuing learning self-money task 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"}, {"start": 1659.0, "end": 1688.0, "text": " the process 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 and broader impact statement first some people say this is not applicable to us which I agree for most fundamental research broader if like the broader impact statement is supposed to be what does this particular method how will this influence broader society so"}, {"start": 1688.0, "end": 1708.0, "text": " 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"}, {"start": 1708.0, "end": 1728.0, "text": " 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 do you do is you just go one level up you go up the"}, {"start": 1728.0, "end": 1738.0, "text": " levels 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"}, {"start": 1738.0, "end": 1748.0, "text": " learning can be used to do good in that 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"}, {"start": 1748.0, "end": 1761.0, "text": " 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"}, {"start": 1761.0, "end": 1774.0, "text": " models require less compute efficient model by Iran on the end device if models are more efficient than large scale research is not limited to wealthier institutions by the way I also the broader impact"}, {"start": 1774.0, "end": 1786.0, "text": " 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"}, {"start": 1786.0, "end": 1797.0, "text": " 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"}, {"start": 1797.0, "end": 1809.0, "text": " statement should be by the way there is also method method three which is to simply tell me more about your paper and the broader impact statement which I guess is the smart method because the broader impact"}, {"start": 1809.0, "end": 1819.0, "text": " statement can be before it 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"}, {"start": 1819.0, "end": 1829.0, "text": " 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"}, {"start": 1829.0, "end": 1839.0, "text": " statement I guess well whether that's smart is a different discussion but here they just it's it's already defaulting right this it's already the default"}, {"start": 1839.0, "end": 1852.0, "text": " 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"}, {"start": 1852.0, "end": 1864.0, "text": " and efficient models in general when models are more efficient they're also more available and less subject to regularization as is and study of result for instance when a high impact"}, {"start": 1864.0, "end": 1883.0, "text": " 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"}, {"start": 1883.0, "end": 1902.0, "text": " 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 this is like will technology this is basically a statement about technology"}, {"start": 1902.0, "end": 1923.0, "text": " and so why why do I have a particular not issue but why do I pick this broader impact statement they even Rick this here this is this gender shades paper right where people went and they look at these commercial APIs for face recognition I think that's the paper"}, {"start": 1923.0, "end": 1945.0, "text": " 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 build four groups or I haven't I haven't I've just looked at the paper but I'm"}, {"start": 1945.0, "end": 1962.0, "text": " understanding that they divided people up into groups which I find arbitrary to have the these two axes race and gender but okay you can do that and they discovered that these commercial APIs have different accuracy for the different groups right and that basically"}, {"start": 1962.0, "end": 1982.0, "text": " clear point is that you know these commercial APIs 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"}, {"start": 1982.0, "end": 1998.0, "text": " it is very viable to actually frame the the task for example like this is an example if you frame the task of multi task learning like face recognition on different groups of people as a multi task learning"}, {"start": 1998.0, "end": 2012.0, "text": " problem you have you know group group one right here group to 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 trying to"}, {"start": 2012.0, "end": 2040.0, "text": " work for first which group is that from and then take the appropriate classifier that would be you know that would be a good a 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 specifically if for one group let's say for group three the task is way harder"}, {"start": 2040.0, "end": 2060.0, "text": " 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 the factor harder and the model is less sure about the task which means that it's a double"}, {"start": 2060.0, "end": 2086.0, "text": " so not only is the model itself less accurate but this 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 my share of of comments on the video I made and I still maintain that societal"}, {"start": 2086.0, "end": 2104.0, "text": " and 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"}, {"start": 2104.0, "end": 2122.0, "text": " 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"}, {"start": 2122.0, "end": 2138.0, "text": " therefore not as much selected if I give a date the 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"}, {"start": 2138.0, "end": 2167.0, "text": " 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 trying 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"}, {"start": 2167.0, "end": 2195.0, "text": " bad that's that's that's that 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"}, {"start": 2195.0, "end": 2224.0, "text": " 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 analyzed formally in theory there's intuition given"}, {"start": 2224.0, "end": 2242.0, "text": " all good so don't get me wrong this is not like trashing this paper it's just I felt I had something more to say and I think that was it so yeah I'll see you next time with the new paper"}, {"start": 2242.0, "end": 2259.0, "text": " okay so I'll go 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 super position with each other"}, {"start": 2259.0, "end": 2283.0, "text": " okay so what we're going to do is we're going to train the different neural networks and then use this kind of super position 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"}, {"start": 2283.0, "end": 2304.0, "text": " 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"}, {"start": 2304.0, "end": 2333.0, "text": " 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 shortly 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 the model is built here"}, {"start": 2333.0, "end": 2354.0, "text": " you see this this multitask fully connected which has these different layers right here and it's built by these multi task 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"}, {"start": 2354.0, "end": 2379.0, "text": " from a linear module and it has a parameter called num tasks and then it has a parameter scores which I guess is these masks right here and the scores I'm going to guess are always going to be multiplied by the weight here in the forward so you can see"}, {"start": 2379.0, "end": 2407.0, "text": " they're in the forward you get the weights from the alphas yeah yeah this is the super imposed all right 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"}, {"start": 2407.0, "end": 2428.0, "text": " we're then going to multiply each of the alphas with the weights and with that we're going to get this subnet mask right here so we need to know what this self dot stacked is so this self dot stacked is getting right here and this cash mask"}, {"start": 2428.0, "end": 2456.0, "text": " 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 mask and then we don't need to actually multiply it with the weight we just just forget about the weight honestly and just train the subnet"}, {"start": 2456.0, "end": 2484.0, "text": " so for the subnet as you can see here you have this get subnet thing and that's an auto grad 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 is stop breathing so we've trained five tasks and now we can run inference on that so this is when the task is given"}, {"start": 2484.0, "end": 2510.0, "text": " real quick you can see task well 92% 92% 92% 92% so we have a an overall performance of 92.4% 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"}, {"start": 2510.0, "end": 2532.0, "text": " of course the tasks are at this pretty requirement so we have a hundred percent task inference accuracy okay so we don't we don't okay we can we can evaluate this here but you can already see that but 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"}, {"start": 2532.0, "end": 2546.0, "text": " we want to check out the same thing so we want to change first of all this get subnet this is where it's these scores are discretized now given that these scores are going to be end to end up being our actual weights"}, {"start": 2546.0, "end": 2559.0, "text": " 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"}, {"start": 2559.0, "end": 2584.0, "text": " 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 network to be initialized you know as we know it so let's try what what are"}, {"start": 2584.0, "end": 2604.0, "text": " other initialize function so in it dot what do we have here do we have what's usually I don't even know normal so yeah that that sounds about right that sounds about right all right all right so"}, {"start": 2604.0, "end": 2617.0, "text": " scores and yeah let's try this this could break everything right if you initialize wrong you get like dumb results so okay"}, {"start": 2617.0, "end": 2637.0, "text": " some 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"}, {"start": 2637.0, "end": 2666.0, "text": " 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"}, {"start": 2666.0, "end": 2692.0, "text": " with this mask in it we make our parameters so these are going to be our different neural networks that we train this all looks good the alpha's look good now the only thing we want to do honestly is just to have not the weight times the subnet here but the subnet as such like this"}, {"start": 2692.0, "end": 2720.0, "text": " is this it do we now train actual neural networks I I have my doubts honestly like there should be no this should be it yeah yeah let's just try it like we're going to get a mistake somewhere like a crash nope nope okay all right"}, {"start": 2720.0, "end": 2746.0, "text": " actually 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"}, {"start": 2746.0, "end": 2764.0, "text": " 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"}, {"start": 2764.0, "end": 2786.0, "text": " and you know according to my hypothesis these mask things are just kind of crude quantized ways are of training neural networks and if if my hypothesis correct this here is going to turn out probably even better than this mask thing"}, {"start": 2786.0, "end": 2802.0, "text": " okay so last task training right here let's start to breathe good laptop fast laptop very nice come on come on come on come on"}, {"start": 2802.0, "end": 2818.0, "text": " and we're done so again we have an average top one performance of 92 point is this if did I even I ran this right here okay like that's the exact same number it was last time so we need to run in"}, {"start": 2818.0, "end": 2841.0, "text": " and if we're given the task ID then we are at 93.9% so we 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"}, {"start": 2841.0, "end": 2870.0, "text": " 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 it will give us the exact same number I like the 93.7% so yeah 93.9% so I'm you know I'm going to say right here that"}, {"start": 2870.0, "end": 2895.0, "text": " the on the super masks and the super position really are two separate ideas right you it's because the paper is like it sounds cool and all with the super mask and super position but this inference using the super position and then the entropy to decide is really one idea"}, {"start": 2895.0, "end": 2924.0, "text": " and training different super the advantage in using super mask is of course that the model is way smaller so you can remember it much more easily but also you know it's really different there's there's nothing to do with the super position yeah alright so I'm going I'm going to guess this also works for you know 200 tasks and what not the higher order of tasks"}, {"start": 2924.0, "end": 2931.0, "text": " so I think that's it and we're done here yeah"}] |
Yannic Kilcher | 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 supermasks in superposition by Mitchell Wurzmann, Vivek Ramanujin at L. So on a high level this paper tackles the problem of sequentially learning many many tasks without catastrophic forgetting by leveraging these things called supermasks. A supermask is basically a binary mask that you want lays 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 supermasks in superposition model capable of sequentially learning thousands 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 task. 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 maybe it's C410 right. So this is C410. Cool. Another model can do C410 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 is 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 image net. Okay now image net is a pretty big data set. So you take your model and you also train it on image net. 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 afford 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 M-nist 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 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 M-nist 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 supermasks. So supermasks 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 supermask that achieves good performance. So what's a supermask? A supermask 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 1 or a 0. So like 1 so here is like 0 0 0 0 0 this is a 1 this is a 0 0 0 this is a 1. So the network isn't going to be 0s and 1s but it's going to be multiplied each connection is going to be multiplied by a 0 or a 1 which means wherever there's a 1 whatever weight that connection had that will be the value of the weight of the connection if it is a 0 whatever weight that connection had it will be it will be pinned to 0 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 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've made a video about that and the sort of intuition behind the supermasks 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 I have my two layers right here and then each connection here is a number like 0.25 this is you know 7 this is negative 3 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 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 it's kind of it's sort of a mix of drop out 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 0 or 1 you get good enough okay so this is sort of my hypothesis my hypothesis would be that the harder the task the the harder it gets to find supermasks that perform well that's what I think is going but never to say for the tasks they're considering here you can find these supermasks and there is a way to do that by using gradient descent even though the supermasks 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 MNEST this is image net 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 supermask 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 some continue learning it's much more akin to training a sync a training one model per task and then inferring the task just that we do it in a much more crude way so it's more like learning a compressed model per task I I find it's a better way to look at it than than continuous learning in any case you learn these supermasks and then here is the the hard bit okay 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 um 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 um 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 of one which you know you have to separate this idea as separate from the masks um at its core it's simply saying if I have three different models that I have 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 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 okay 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 and it has a bit to do with how the 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 all right 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 a thousand tasks we need to try each of the thousand 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 super position 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 on 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 weights 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 it 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 the output 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 alpha's and we calculate the gradient of the entropy with respect to each of the alpha's 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 the kind of 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 like we want the one where we're very 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 learns who promasks with a coefficient alpha initially said to one over k each alpha can be interpreted as the belief that super mask 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 minimise 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 what's the deal here like they show in this graph right here they show this is much faster so if we 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 right we mix these ones we run one forward pass we do back prop 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 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 is there are two catches actually first of all this here is 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 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 it's you still you still are implicitly saving you're 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 w1 and there's w2 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 i1 mask i2 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 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 all right 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 dataset which is a thousand class dataset and it distributes it into one hundred different tasks each is a ten class classification task now not 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 a thousand classes but if you split that task I'm going to bet that you have these high resolution images and you have a ten 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 c for a one hundred which does the same thing to c for one hundred 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 average accuracy of 92 percent so on image net 92 percent it was pretty pretty good of course this is again this is ten class which makes the numbers a lot different with the sub sub sub sub sub sub you get to this pretty good 88 percent 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 mask to retrieve during testing so there is nothing of this entropy gradients here none of it this simply evaluates the 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 c4 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 sparsity 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 this 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 task with a common trunk that gets you pretty much nowhere with the subs of 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 even 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 now you might object and say hey don't I need to store the underlying random initialize network and the answer is yes and no actually only need to store the random c to produce it so checkmate um 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 um 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 I think does might not hold so what they do is they have this binary algorithm where they do a binary search where so they 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 the highest of the negative gradients they they eliminate half of them so you can see 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 um 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 they make it they 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 are going in 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 I've 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 you 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 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 no 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 1 2 3 4 5 output neurons if you if the image here is like a 5 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 counted 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's really there isn't there isn't a way for the network to kind of go get around predicting the wrong task for kind of share information so you assume that the labels are not shared are unshared yeah so it's the the subs up here has it is significantly harder task than the baselines 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 entropy 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 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 subs up 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 right it's a fully connected network now the fully connected network here performing better is sort of expected first of all amnesty is really easy and can actually be solved with a fully connected network and second of all especially permuted amnesty 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 it 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 amnesty all right and then in this experiment right here and this is the sort of crown experiment they learn they do this permuted amnesty but they go up to 2500 tasks right 2500 different permutations button 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 nn right here so in this nn not not only are you not given the task label at testing time you were 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 amnesty and that might already give you a very very big hint right or you know simple correlation of two pixels though that's that's a task specific thing but the 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 yada it's it's going to be complicated right but just keep that in mind however 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 task 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 effect how they tune their constants like they have to define a threshold where they say okay if the 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 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 are 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 rotated M-nist and also their model does pretty well on the rotated M-nist task where the differences of between the the differences between the task 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 rotated by 10 I can't even draw that subtle of a rotation by 10 degrees and you know the subs up 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 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 these entropy it just spikes when you get the correct thing because it's 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 to pixels right if like this pixel correlated with this pixel if the correlations 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 one 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 augment it 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 lunate model using output size 500 now they're they're 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 2,500 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 hop field and 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 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 RS so S is higher than L and refer to the neurons that are passed 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 0, 1 or 2 these classes never appear during training so they claim this helps during during their procedure and 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 two many neurons what happens well our label is always going to be of the top three neurons so let's say our label is 1 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 log it's okay so pre pre soft max outputs so our our algorithm our cross entropy loss is going to push all of these here down during every single training point it's going to push this one up and all 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 entropy I think honestly this is simply you could achieve the same thing by using a different temperature parameter in the soft max 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're 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 so 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 know 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 computers as an alternative to entropy in equation 4 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 is is it yes so G is going to be this right here so why 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 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 these 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 and so this log log some 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 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 some x will be very small so this is an alternative where we can basically only look at the superfluous neurons and say is are these 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 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 10 that needed 10 output classes right so this tells me that these superfluous neurons are pretty important for them and this is probably one of the things that makes this work right these superfluous neurons so you 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 if 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 amnest so the necessary amount would 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 hop field 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 we're 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 hop field network which is basically just a a big matrix this is the hop field network and then they encode the masks in this hop field network so specifically the hop field network is of size D squared where it is able to encode to 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 hop field network like this where Z is a binary string you can recover the binary strings by gradient descent in the hop field 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 a 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 it was 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 I don't want to go into the hop field networks because I really feel this should be its own paper I guess they just want to show that it's it's also possible to compress these masks into one 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'd 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 and you're excited to see where this goes in the future all right I'll see you next time bye bye | [{"start": 0.0, "end": 5.76, "text": " Hi there, today we'll look at supermasks in superposition by Mitchell Wurzmann, Vivek"}, {"start": 5.76, "end": 11.76, "text": " Ramanujin at L. So on a high level this paper tackles the problem of sequentially"}, {"start": 11.76, "end": 17.32, "text": " learning many many tasks without catastrophic forgetting by leveraging these things called"}, {"start": 17.32, "end": 23.2, "text": " supermasks. A supermask is basically a binary mask that you want lays over a randomly"}, {"start": 23.2, "end": 30.24, "text": " initialized neural network to make the mask network perform better than a random initialization."}, {"start": 30.24, "end": 35.0, "text": " They will train these masks for each of the tasks that they consider and then at inference"}, {"start": 35.0, "end": 42.92, "text": " time they can recover the task that the data is from and therefore kind of do this lifelong"}, {"start": 42.92, "end": 48.96, "text": " multitask learning better than the baselines that they compare against. In fact they can"}, {"start": 48.96, "end": 54.92, "text": " do better without knowing the task than the baselines can with knowing the task. So that's"}, {"start": 54.92, "end": 62.56, "text": " pretty pretty cool. This is a pretty dense paper in terms of content and we won't go"}, {"start": 62.56, "end": 69.16, "text": " over everything in the paper but we'll go over the ideas and what kind of what I think"}, {"start": 69.16, "end": 75.4, "text": " makes them work. So yeah stick around if you want to know that. Also consider sharing"}, {"start": 75.4, "end": 80.96000000000001, "text": " this video out tell your friends about it and subscribe if you haven't it helps. So"}, {"start": 80.96000000000001, "end": 89.0, "text": " yeah. Cool so let's dive in. We present the supermasks in superposition model capable"}, {"start": 89.0, "end": 93.92, "text": " of sequentially learning thousands of tasks without catastrophic forgetting. So the term"}, {"start": 93.92, "end": 100.96000000000001, "text": " catastrophic forgetting comes from the world of this kind of sequential multitask learning"}, {"start": 100.96, "end": 105.39999999999999, "text": " where you have a model let's call say this is your model the black box and you let it"}, {"start": 105.39999999999999, "end": 110.24, "text": " learn on a task. Let's say this is an image recognition task. So you have a data set and"}, {"start": 110.24, "end": 114.91999999999999, "text": " you let it run on this data set. You learn the data set maybe it's C410 right. So this"}, {"start": 114.91999999999999, "end": 123.11999999999999, "text": " is C410. Cool. Another model can do C410 pretty well. Then you also want to learn a different"}, {"start": 123.11999999999999, "end": 130.16, "text": " task. You want to learn Mnist. Okay so you have Mnist and you want to learn Mnist and"}, {"start": 130.16, "end": 136.56, "text": " you want to learn that one. So your hope is that your final model can do both. So you'll"}, {"start": 136.56, "end": 142.84, "text": " take this one and you simply train it on Mnist as well. And then you know we know there"}, {"start": 142.84, "end": 147.24, "text": " is this kind of fine tuning pre training and so on. So your hope would be that at the end"}, {"start": 147.24, "end": 152.35999999999999, "text": " it can do both. But then you want another one you want image net. Okay now image net is"}, {"start": 152.35999999999999, "end": 157.96, "text": " a pretty big data set. So you take your model and you also train it on image net. And with"}, {"start": 157.96, "end": 163.68, "text": " time the model is always going to be very good at the task you just learned. But it is going"}, {"start": 163.68, "end": 170.28, "text": " to forget the tasks that you learned previously. This is the catastrophic forgetting problem."}, {"start": 170.28, "end": 175.36, "text": " You might ask why don't I just train on all the tasks equally like at the same time. And"}, {"start": 175.36, "end": 181.96, "text": " that's a valid question. You can do that. But this in the task description here it's"}, {"start": 181.96, "end": 186.68, "text": " necessary that we learn the task one after another because you know maybe we get this"}, {"start": 186.68, "end": 192.56, "text": " data in this year and then it's pretty big data. We can't just afford to retrain on all"}, {"start": 192.56, "end": 197.24, "text": " the data all the time. We want to kind of continuously integrate our knowledge. This is"}, {"start": 197.24, "end": 203.28, "text": " very important in the fields of like lifelong learning where you want to kind of the hope"}, {"start": 203.28, "end": 208.48000000000002, "text": " is you can build a system that continuously integrates experience but doesn't forget"}, {"start": 208.48000000000002, "end": 214.08, "text": " the old experience. Okay and the experience might come from new data sets and so on. But"}, {"start": 214.08, "end": 219.04000000000002, "text": " you don't want to forget the old ones. So catastrophic forgetting is one of the main problems"}, {"start": 219.04000000000002, "end": 225.0, "text": " in these types of research in this field of research of lifelong learning. And this paper"}, {"start": 225.0, "end": 232.28, "text": " is going to tackle this how it's sort of so if you think of what could you do right here."}, {"start": 232.28, "end": 237.84, "text": " What you could do is you could simply not use the same model right. You can simply train"}, {"start": 237.84, "end": 243.96, "text": " the different models for each task and just keep them around right. And at you know test"}, {"start": 243.96, "end": 249.72, "text": " time you need some way of deciding so there are two different scenarios in at test time."}, {"start": 249.72, "end": 255.64000000000001, "text": " So you learn all of these models and then at test time there's an image and it could be"}, {"start": 255.64000000000001, "end": 261.0, "text": " that I tell you that this image by the way that's an M-nist image right. So you just grab"}, {"start": 261.0, "end": 267.64, "text": " this model and you apply it very cool or it could be that I don't tell you what image"}, {"start": 267.64, "end": 273.96, "text": " it is like no clue. Then you need a way to decide where it comes from but once you do"}, {"start": 273.96, "end": 279.0, "text": " decide where it comes from it's again pretty easy once you think I think this is an M-nist"}, {"start": 279.0, "end": 286.28, "text": " the thing you can apply this one. So you could technically do that but it's very unhelpful"}, {"start": 286.28, "end": 294.2, "text": " because these models they can be large right. First of all they can be large so that"}, {"start": 294.2, "end": 300.12, "text": " means it costs you to store those and second of all there might actually be some overlap"}, {"start": 300.12, "end": 305.44, "text": " like C410 and ImageNet are both natural images so they might benefit from each other's"}, {"start": 305.44, "end": 311.71999999999997, "text": " feature in some way. Now what we're going to do here is we're sort of going to do this"}, {"start": 311.71999999999997, "end": 318.48, "text": " separate models approach. Namely we're going to use these we're going to build these supermasks."}, {"start": 318.48, "end": 323.76, "text": " So supermasks are the second thing that we're going to combine here. Our approach uses"}, {"start": 323.76, "end": 329.92, "text": " a randomly initialized fixed base network and for each task find a sub network, a supermask"}, {"start": 329.92, "end": 336.52, "text": " that achieves good performance. So what's a supermask? A supermask comes from these"}, {"start": 336.52, "end": 344.59999999999997, "text": " kind of papers about lottery ticket hypothesis and one of these papers discovered basically"}, {"start": 344.59999999999997, "end": 351.08, "text": " or conjectured and then showed in evidence that if you have a network that is randomly"}, {"start": 351.08, "end": 358.59999999999997, "text": " initialized just like this is your neural network the gray thing and there is a way to"}, {"start": 358.59999999999997, "end": 365.36, "text": " mask it which means masking basically means that you either activate or inactivate connections."}, {"start": 365.36, "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": 379.52, "text": " is a 1 or a 0. So like 1 so here is like 0 0 0 0 0 this is a 1 this is a 0 0 0 this is"}, {"start": 379.52, "end": 385.08, "text": " a 1. So the network isn't going to be 0s and 1s but it's going to be multiplied each"}, {"start": 385.08, "end": 391.03999999999996, "text": " connection is going to be multiplied by a 0 or a 1 which means wherever there's a 1 whatever"}, {"start": 391.03999999999996, "end": 396.59999999999997, "text": " weight that connection had that will be the value of the weight of the connection if it"}, {"start": 396.59999999999997, "end": 404.59999999999997, "text": " is a 0 whatever weight that connection had it will be it will be pinned to 0 so there"}, {"start": 404.6, "end": 412.04, "text": " will be no signal flowing. So this paper established that if you take a randomly initialized neural"}, {"start": 412.04, "end": 418.84000000000003, "text": " network there is a way to mask it and you can find those masks where if you mask in a particular"}, {"start": 418.84000000000003, "end": 424.12, "text": " way the network will already perform better than random on a given task. So there is a way"}, {"start": 424.12, "end": 430.12, "text": " to solve MNIST by using a randomly initialized neural network and then simply masking it cleverly"}, {"start": 430.12, "end": 437.68, "text": " and then the mask network will have a good accuracy on MNIST. And they found that and I've"}, {"start": 437.68, "end": 447.56, "text": " made a video about that and the sort of intuition behind the supermasks is this is just my intuition"}, {"start": 447.56, "end": 454.48, "text": " is that you know MNIST this is what I'm guessing MNIST is a relatively easy task. In fact most"}, {"start": 454.48, "end": 461.56, "text": " of the tasks they're considering in these papers are relatively easy and if you have a randomly"}, {"start": 461.56, "end": 468.40000000000003, "text": " initialized neural network basically what you have around is a bunch of weight right so if I have"}, {"start": 468.40000000000003, "end": 477.8, "text": " my two layers right here and then each connection here is a number like 0.25 this is you know 7 this"}, {"start": 477.8, "end": 483.96000000000004, "text": " is negative 3 and so on. Now they're going to consider they here are going to consider weights"}, {"start": 483.96, "end": 488.52, "text": " that are initialized in a very special way but ultimately you just have a bunch of random weights"}, {"start": 488.52, "end": 496.0, "text": " lying around and if the task is super easy let's say and the neural network is sufficiently over"}, {"start": 496.0, "end": 505.0, "text": " parameterized there might be many many ways of achieving your goal. So rather than being able to"}, {"start": 505.0, "end": 509.52, "text": " adjust the weights like you would do when you train the neural network you would actually change"}, {"start": 509.52, "end": 515.88, "text": " those numbers you get away with simply selecting the combination of weights that will you know give"}, {"start": 515.88, "end": 525.1999999999999, "text": " you a good performance. So in it's kind of it's sort of a mix of drop out and vector quantization"}, {"start": 525.1999999999999, "end": 531.6, "text": " so in vector quantization you also you get away with quantizing the vectors to given precision"}, {"start": 531.6, "end": 538.4, "text": " and here the task is easy enough such that by simple over parameterization and selecting of the"}, {"start": 538.4, "end": 545.36, "text": " weights that you have around mixing them correctly by simply so you can't mix arbitrarily but you can"}, {"start": 545.36, "end": 553.52, "text": " mix with 0 or 1 you get good enough okay so this is sort of my hypothesis my hypothesis would be that"}, {"start": 553.52, "end": 562.16, "text": " the harder the task the the harder it gets to find supermasks that perform well that's what I"}, {"start": 562.16, "end": 568.16, "text": " think is going but never to say for the tasks they're considering here you can find these"}, {"start": 568.16, "end": 573.68, "text": " supermasks and there is a way to do that by using gradient descent even though the supermasks"}, {"start": 573.68, "end": 580.88, "text": " are discrete so what we're going to do is we're going to use the same randomly initialized neural"}, {"start": 580.88, "end": 587.92, "text": " network for each of the tasks right so this is like C410 this is MNEST this is image net we're"}, {"start": 587.92, "end": 593.8399999999999, "text": " going to use the same gray network but we're going to find an individual mask for each of those"}, {"start": 593.84, "end": 600.88, "text": " networks for each of those tasks on top of the same network and they're all going to perform"}, {"start": 600.88, "end": 607.2800000000001, "text": " relatively well according to the supermask conjecture now again this is not surprising"}, {"start": 608.1600000000001, "end": 614.5600000000001, "text": " and the fact that we always use the same randomly initialized network you know isn't really"}, {"start": 614.5600000000001, "end": 619.6, "text": " it's not really necessary that we always use the same but in this case they say okay we always"}, {"start": 619.6, "end": 626.88, "text": " use the same and then we only need to store the mask for each task the mask is much simpler than"}, {"start": 626.88, "end": 633.44, "text": " the weights because you know a 32 bit floating point number is 32 bits while a masking bit is only"}, {"start": 633.44, "end": 642.5600000000001, "text": " one bit so we save basically a factor of 32 in our models but essentially essentially right it's"}, {"start": 642.56, "end": 651.4399999999999, "text": " not the case that we are training the same model and some continue learning it's much more akin"}, {"start": 651.4399999999999, "end": 661.76, "text": " to training a sync a training one model per task and then inferring the task just that we do it"}, {"start": 661.76, "end": 667.92, "text": " in a much more crude way so it's more like learning a compressed model per task I I find it's a"}, {"start": 667.92, "end": 674.64, "text": " better way to look at it than than continuous learning in any case you learn these supermasks"}, {"start": 674.64, "end": 681.28, "text": " and then here is the the hard bit okay the easy bit is if I tell you which tasks the inference"}, {"start": 681.28, "end": 686.4, "text": " data point the test data point comes from you have a pretty easy time um classifying it you"}, {"start": 686.4, "end": 692.64, "text": " simply select the mask accordingly you run forward pass and that's it if I don't tell you where"}, {"start": 692.64, "end": 700.48, "text": " the test data point comes from that's the hard part now they need a way to decide where the"}, {"start": 701.1999999999999, "end": 710.56, "text": " data point comes from and the the idea that they have right here they have sort of multiple ideas"}, {"start": 710.56, "end": 719.4399999999999, "text": " but the main idea the first idea is that if you have trained these individual models for the"}, {"start": 719.44, "end": 730.1600000000001, "text": " individual tasks then um okay there's not good explanation here then the correct model should be"}, {"start": 730.1600000000001, "end": 737.12, "text": " very confident right this is an assumption that you make so I'm going to take my image of the test"}, {"start": 737.12, "end": 743.2800000000001, "text": " set and I'm going to feed it through the model of one which you know you have to separate this idea"}, {"start": 743.28, "end": 750.0799999999999, "text": " as separate from the masks um at its core it's simply saying if I have three different models that"}, {"start": 750.0799999999999, "end": 754.64, "text": " I have trained for three different tasks and now I get an input I don't know which one it's from"}, {"start": 755.36, "end": 762.24, "text": " I can simply feed it to each one of them and I can look at the output distribution so maybe my"}, {"start": 762.24, "end": 767.92, "text": " output distribution right here this is as you can see three output neurons it's a three class"}, {"start": 767.92, "end": 775.92, "text": " classifier right here my output distribution is somewhat here like this and here it's like this"}, {"start": 777.4399999999999, "end": 784.56, "text": " and here it's like I shouldn't do that I got a comment you know who you are"}, {"start": 787.28, "end": 797.04, "text": " and here it's like this okay so which one would you pick and their answer here is we should"}, {"start": 797.04, "end": 807.92, "text": " pick this one because of it has very low entropy so this middle model here is very very sure about"}, {"start": 807.92, "end": 814.4, "text": " this data point it's very sure about its prediction because it the distance basically of the top"}, {"start": 814.4, "end": 820.0799999999999, "text": " prediction to all the other predictions is so high it's very confident in its prediction"}, {"start": 820.0799999999999, "end": 826.24, "text": " whereas here you can see that the distance is not too high also here the distance between the"}, {"start": 826.24, "end": 834.24, "text": " highest and the others is not too high so they say we are going to pick the model or the mask in"}, {"start": 834.24, "end": 842.8, "text": " this case for which the output entropy is the highest and that is a heuristic for now but it tends"}, {"start": 842.8, "end": 849.6, "text": " to work pretty well and it has a bit to do with how the relatively difficult your tasks are so your"}, {"start": 849.6, "end": 858.08, "text": " tasks need to be kind of equally difficult otherwise it's not otherwise this can get a little bit"}, {"start": 859.2, "end": 863.36, "text": " a little bit out of hand but there are ways to solve it and they allude to that in the kind of"}, {"start": 863.36, "end": 870.24, "text": " future work section but in this case if the tasks are equally hard and they consider tasks that"}, {"start": 870.24, "end": 876.72, "text": " are equally hard then the entropy is a good measure of how confident these things are and therefore"}, {"start": 876.72, "end": 884.72, "text": " we can check which task it is by using the entropy as a heuristic all right so we're left with"}, {"start": 884.72, "end": 890.4, "text": " simply trying each of the masks and then decide taking the one that has the highest entropy now"}, {"start": 891.2, "end": 898.08, "text": " they say this is costly because if we've learned you know a thousand tasks we need to try each of the"}, {"start": 898.08, "end": 905.2, "text": " thousand masks in order to do that so they go for something else and this is the second word in"}, {"start": 905.2, "end": 914.48, "text": " the title this superposition word so instead of doing that what they'll do is they'll use a super"}, {"start": 914.48, "end": 921.76, "text": " position of masks and actually the picture also I find more descriptive than the formula I can write"}, {"start": 921.76, "end": 929.0400000000001, "text": " down the formula down here so what they'll do is they'll say why don't we just overlap all of the"}, {"start": 929.04, "end": 935.76, "text": " masks so we'll have all of these masks mi for on for each tasks and we'll initialize them with"}, {"start": 935.76, "end": 944.8, "text": " coefficients alpha i will just mix them like this and alpha here it's initialized in one over k where"}, {"start": 944.8, "end": 951.1999999999999, "text": " k is the number of tasks okay we'll just mix them and then we'll multiply them by the weights of"}, {"start": 951.2, "end": 962.6400000000001, "text": " the neural network and that's will that neural network is where we input our image into okay so"}, {"start": 963.6800000000001, "end": 970.08, "text": " what does that give us that basically gives us a mix of all the networks it like it's it's pretty"}, {"start": 970.08, "end": 976.72, "text": " safe to say that the entire network is going to be in there and maybe sometimes you know multiple"}, {"start": 976.72, "end": 983.44, "text": " times like if multiple masks use the same weight it's going to be in there with a higher weight"}, {"start": 983.44, "end": 988.1600000000001, "text": " and so on so that's what you see right here you can see that all the masks are overlapped in"}, {"start": 988.1600000000001, "end": 993.0400000000001, "text": " superposition with each other now what does the output give you the output gives you nothing the"}, {"start": 993.0400000000001, "end": 998.5600000000001, "text": " output gives you kind of the average prediction of the network so this here is going to give you"}, {"start": 998.5600000000001, "end": 1004.64, "text": " kind of the sort of the average prediction of all of the networks which isn't very helpful but of"}, {"start": 1004.64, "end": 1014.48, "text": " course what we can do is we can look at the gradients of this so if we from this calculate the"}, {"start": 1014.48, "end": 1024.0, "text": " entropy which is here denoted h and we calculate we back propagate this so we back propagate this"}, {"start": 1024.0, "end": 1030.8799999999999, "text": " to the alpha's and we calculate the gradient of the entropy with respect to each of the alpha's"}, {"start": 1030.88, "end": 1039.92, "text": " what does that give us so what's the intuition here the intuition is if I change my alpha a bit"}, {"start": 1040.5600000000002, "end": 1047.7600000000002, "text": " how does the entropy change so basically this gives you the sensitivity of the entropy to these alpha"}, {"start": 1047.7600000000002, "end": 1056.0, "text": " parameters so if this is high what does it mean it means that this mask right here has a big"}, {"start": 1056.0, "end": 1064.96, "text": " influence on the entropy specifically if I were to increase the alpha then the entropy would"}, {"start": 1066.16, "end": 1073.44, "text": " increase okay and if I were to decrease the alpha then the entropy would decrease that's the"}, {"start": 1074.0, "end": 1080.08, "text": " the kind of what the gradient gives you now did I say before we want the one with the highest"}, {"start": 1080.08, "end": 1088.08, "text": " entropy I'm pretty sure we want the one with the with the lowest entropy like we want the one"}, {"start": 1088.08, "end": 1095.6, "text": " where we're very very very very sure right I might have said that absolutely wrong so"}, {"start": 1099.4399999999998, "end": 1108.0, "text": " if you see right here this is the formalism first we associate each of the k learns who"}, {"start": 1108.0, "end": 1113.2, "text": " promasks with a coefficient alpha initially said to one over k each alpha can be interpreted as"}, {"start": 1113.2, "end": 1118.56, "text": " the belief that super mask m is the correct mask equivalently the belief that the current"}, {"start": 1118.56, "end": 1125.04, "text": " unknown task is task i the model output is then computed with a weighted superposition of all"}, {"start": 1125.04, "end": 1131.6, "text": " learned tasks which is this thing right here the correct mask should produce a confidence"}, {"start": 1131.6, "end": 1137.52, "text": " low entropy output therefore we recover the correct mask we find the coefficients alpha which"}, {"start": 1137.52, "end": 1145.52, "text": " minimise the output entropy h okay so yes we want the task with the lowest entropy of course not"}, {"start": 1145.52, "end": 1152.8, "text": " with the highest entropy so if we look at the gradient right here the gradient basically tells us"}, {"start": 1152.8, "end": 1161.04, "text": " how each of the masks will influence the different the entropy and if we simply select the alpha"}, {"start": 1161.04, "end": 1168.72, "text": " where the gradient here is the most negative number so we want this to be as low as possible not"}, {"start": 1168.72, "end": 1177.2, "text": " zero but you know negative as high as possible then we know that if we increase this the"}, {"start": 1177.2, "end": 1186.8, "text": " contribution of this mask then the entropy will go down the most okay and again our hypothesis here"}, {"start": 1186.8, "end": 1195.12, "text": " is that maximum entropy sorry minimum entropy means most confidence prediction means that the if all"}, {"start": 1195.12, "end": 1201.36, "text": " tasks are equally hard it probably means that the data point is from the task where we have the"}, {"start": 1201.36, "end": 1210.1599999999999, "text": " lowest entropy so what's the what's the deal here like they show in this graph right here they show"}, {"start": 1210.16, "end": 1216.88, "text": " this is much faster so if we if we were to evaluate each mask individually and measure its entropy of"}, {"start": 1216.88, "end": 1222.4, "text": " course with the number of tasks we'll simply linearly increase our time in the forward pass because"}, {"start": 1222.4, "end": 1230.48, "text": " we need to try out each of these masks however if we do what they're doing here we simply run one"}, {"start": 1230.48, "end": 1238.16, "text": " right we mix these ones we run one forward pass we do back prop and they consider two strategies"}, {"start": 1238.16, "end": 1244.16, "text": " so what you can do is you can do gradient descent on these alphas which takes you know a number of"}, {"start": 1244.16, "end": 1251.1200000000001, "text": " steps to converge or you can actually do a single step so you just observe the gradient and by the"}, {"start": 1251.1200000000001, "end": 1257.6000000000001, "text": " gradient you you recognize which one has the lowest gradient and that's the one you pick so where's"}, {"start": 1257.6000000000001, "end": 1266.24, "text": " the catch here the catch is that if you do something like this if you do something is there are two"}, {"start": 1266.24, "end": 1274.8, "text": " catches actually first of all this here is a convex combination right this is convex combination"}, {"start": 1275.36, "end": 1282.08, "text": " and the problem isn't convex at all but if you simply take this convex combination multiply it"}, {"start": 1282.08, "end": 1289.2, "text": " and then look at the gradient you sort of assume that the problem is a kind of a convex nicely shaped"}, {"start": 1289.2, "end": 1296.0, "text": " problem and if you then observe these the gradients with respect to the alphas you you make assumptions"}, {"start": 1296.0, "end": 1303.92, "text": " about the problem that might not be true so you lose you kind of heuristically approximate the"}, {"start": 1303.92, "end": 1309.36, "text": " importance of these masks that's the first thing the second thing of course is that"}, {"start": 1310.96, "end": 1318.48, "text": " it's you still you still are implicitly saving you're still are implicitly trying all the models"}, {"start": 1318.48, "end": 1324.0, "text": " but you're just not trying them explicitly you're implicitly trying all the models because when"}, {"start": 1324.0, "end": 1332.24, "text": " you do this combination right here your auto differentiation library will actually keep track of"}, {"start": 1332.24, "end": 1341.28, "text": " what the individual models contribute it's just that per layer so of course this here this w is"}, {"start": 1341.28, "end": 1348.32, "text": " multi layer perceptron which means that if you have multiple layers you know there's w1 and there's"}, {"start": 1348.32, "end": 1357.04, "text": " w2 and you have your alphas and your alphas are also you know you can distribute them into"}, {"start": 1358.24, "end": 1365.6, "text": " these sorry your masks are also mask for layer one mask for layer two and so on so your auto"}, {"start": 1365.6, "end": 1372.08, "text": " differentiation package needs to keep track of okay mask one goes here with this alpha mask to"}, {"start": 1372.08, "end": 1381.28, "text": " the layer two goes here with this alpha and there is there so it needs to keep track of this graph"}, {"start": 1381.28, "end": 1387.12, "text": " it's just that this is highly optimized and you also need to you only need to do it layer by layer"}, {"start": 1388.32, "end": 1400.08, "text": " so the contribution of alpha of mask one this is maybe alpha i of mask i1 mask i2 the contribution"}, {"start": 1400.08, "end": 1410.6399999999999, "text": " of the alpha i will not be explicit in this layer it will be implicit as an average across the layer"}, {"start": 1410.6399999999999, "end": 1416.96, "text": " right so again this is you assume in each layer you assume a convex combination of all the alphas"}, {"start": 1416.96, "end": 1424.56, "text": " and propagate that forward and therefore if you look at the next layer you can only view what mask"}, {"start": 1424.56, "end": 1432.24, "text": " two does mask of layer two does as in terms of a convex combination of layer one so you make"}, {"start": 1432.24, "end": 1437.28, "text": " multiple approximations and you rely on the optimization of your auto differentiation library"}, {"start": 1437.28, "end": 1444.72, "text": " to keep track of these different things and do operations in parallel and in in the case where"}, {"start": 1444.72, "end": 1452.1599999999999, "text": " you do it linearly I'm going to guess you simply do it as a sequential operation but it's going"}, {"start": 1452.16, "end": 1459.92, "text": " to be exact so that's the trade-off all right so we now know how we can figure out where the"}, {"start": 1459.92, "end": 1470.24, "text": " task is from and let's see how that works so in this first task we are looking at split image net"}, {"start": 1470.24, "end": 1476.4, "text": " split image net simply it takes the image net dataset which is a thousand class dataset and it"}, {"start": 1476.4, "end": 1484.5600000000002, "text": " distributes it into one hundred different tasks each is a ten class classification task now not"}, {"start": 1484.5600000000002, "end": 1492.72, "text": " two things first thing is that split image net each task is approximately as hard as each other"}, {"start": 1492.72, "end": 1500.0, "text": " as as the other tasks right it's still image net classification and it's the same number of the"}, {"start": 1500.0, "end": 1508.64, "text": " of it's the same number of labels and each task is about you know the same hardness you can make"}, {"start": 1508.64, "end": 1515.04, "text": " that assumption and second of all the tasks are actually pretty pretty easy right it's hard to"}, {"start": 1515.04, "end": 1521.68, "text": " distinguish image net into a thousand classes but if you split that task I'm going to bet that"}, {"start": 1521.68, "end": 1527.92, "text": " you have these high resolution images and you have a ten class classification it's going to be"}, {"start": 1527.92, "end": 1535.6000000000001, "text": " relatively easy so all our conditions are met for at least for my hypothesis to hold and you can see"}, {"start": 1535.6000000000001, "end": 1542.16, "text": " on the right side you can see split c for a one hundred which does the same thing to c for one"}, {"start": 1542.16, "end": 1548.88, "text": " hundred it subdivides it into different very small class classification tasks you can see the"}, {"start": 1548.88, "end": 1554.88, "text": " results the upper bound here is where you train a single model for each of the tasks that gets you"}, {"start": 1554.88, "end": 1564.48, "text": " to average accuracy of 92 percent so on image net 92 percent it was pretty pretty good of course"}, {"start": 1564.48, "end": 1572.8000000000002, "text": " this is again this is ten class which makes the numbers a lot different with the sub sub sub sub"}, {"start": 1572.8000000000002, "end": 1582.0, "text": " sub sub you get to this pretty good 88 percent accuracy this is this super masks in superposition"}, {"start": 1582.0, "end": 1591.44, "text": " this here is a baseline that also does lifelong learning now they have these annotations right here"}, {"start": 1591.44, "end": 1600.72, "text": " gg which yes gg haha but so the first letter will always tell you whether the task ID is given"}, {"start": 1600.72, "end": 1608.16, "text": " during training and the second letter will tell you whether the task ID is given during testing"}, {"start": 1608.16, "end": 1615.0400000000002, "text": " so this here simply evaluates whether or not this masking is feasible which you can see here it is"}, {"start": 1615.0400000000002, "end": 1622.3200000000002, "text": " so this will we know which mask to train during training and we know which mask to retrieve during"}, {"start": 1622.3200000000002, "end": 1628.64, "text": " testing so there is nothing of this entropy gradients here none of it this simply evaluates the"}, {"start": 1628.64, "end": 1634.16, "text": " the viability of the masking approach which as you can see it's pretty viable and it's more"}, {"start": 1634.16, "end": 1644.48, "text": " viable than these baselines this same thing on the c4 100 right here so you can see they also"}, {"start": 1644.48, "end": 1649.52, "text": " evaluate since I guess it's an easier problem they also evaluate the number of bytes which they"}, {"start": 1649.52, "end": 1654.88, "text": " can control so they can control the number of bytes in their model by simply increasing or"}, {"start": 1654.88, "end": 1664.0, "text": " decreasing the required sparsity of their mask so you can change your mask by saying how sparsity"}, {"start": 1664.0, "end": 1669.52, "text": " want it and of course if you want it more sparse you get a worse model because you have less"}, {"start": 1670.16, "end": 1678.96, "text": " less ones in your budget to make your model perform well but you can see that if they do it with"}, {"start": 1678.96, "end": 1688.56, "text": " these baseline model this batch e you severely underperform with regard to the upper bound right here"}, {"start": 1688.56, "end": 1694.8799999999999, "text": " the upper bound again is where you train a model per task and separate heads here is another kind"}, {"start": 1694.8799999999999, "end": 1701.76, "text": " of dummy baseline where you train a different head for each of the task with a common trunk that gets"}, {"start": 1701.76, "end": 1710.08, "text": " you pretty much nowhere with the subs of algorithm you do get almost to the performance of the upper"}, {"start": 1710.08, "end": 1716.72, "text": " bound and in fact if you do this transfer approach right here you do get there the transfer approach"}, {"start": 1716.72, "end": 1723.68, "text": " simply means that so you do these tasks in succession right you do task one okay done you do task two"}, {"start": 1723.68, "end": 1730.32, "text": " okay done and for each one you train a mask okay for each one you train this is mask one mask two"}, {"start": 1730.32, "end": 1738.24, "text": " the transfer approach simply says if I start task three I'm going to start the mask three my initial"}, {"start": 1738.24, "end": 1744.08, "text": " weights basically are going to be a running average of the masks that I have already considered"}, {"start": 1744.08, "end": 1752.6399999999999, "text": " or an average there is some amount of transfer going on simply to initialize the weights it's"}, {"start": 1752.6399999999999, "end": 1758.0, "text": " actually astounding that this helps you so much but with this if you look at the actual numbers I"}, {"start": 1758.0, "end": 1765.28, "text": " believe you even get like a tiny bit higher than the training a single model for each of the tasks"}, {"start": 1765.28, "end": 1775.04, "text": " okay so this sort of establishes the viability of training the different masks for the different"}, {"start": 1775.04, "end": 1781.6, "text": " tasks which I again I think it is not surprising because essentially you're training a different model"}, {"start": 1781.6, "end": 1790.16, "text": " per task and it's just the fact that you do a very crude model and that you can store very"}, {"start": 1790.16, "end": 1795.52, "text": " efficiently now you might object and say hey don't I need to store the underlying random"}, {"start": 1795.52, "end": 1801.2, "text": " initialize network and the answer is yes and no actually only need to store the random c to produce"}, {"start": 1801.2, "end": 1810.64, "text": " it so checkmate um yeah they do so here they explain this one shot algorithm where they simply"}, {"start": 1810.64, "end": 1817.6000000000001, "text": " look at the gradient of the entropy you can see with the maximum negative gradient of the entropy"}, {"start": 1817.6, "end": 1825.52, "text": " um they also have this binary algorithm if the task where they say with the task is harder to"}, {"start": 1825.52, "end": 1832.08, "text": " differentiate this kind of assumption of the convex combination I think does might not hold so"}, {"start": 1832.08, "end": 1840.08, "text": " what they do is they have this binary algorithm where they do a binary search where so they they"}, {"start": 1840.08, "end": 1847.28, "text": " simply want to circumvent the necessity to evaluate each of the masks by itself because that"}, {"start": 1847.28, "end": 1854.56, "text": " takes long so they do something in between where they do this binary algorithm this is right here"}, {"start": 1856.6399999999999, "end": 1863.92, "text": " where they do this convex combination they evaluate the gradient but then they don't just take the"}, {"start": 1863.92, "end": 1870.6399999999999, "text": " the highest of the negative gradients they they eliminate half of them so you can see whenever"}, {"start": 1870.64, "end": 1877.44, "text": " it's lower than the median they eliminate it and then they start off with this new set of reduced"}, {"start": 1877.44, "end": 1882.88, "text": " alphas so in each of these steps they eliminate half of the masks and then they recompute again"}, {"start": 1882.88, "end": 1889.0400000000002, "text": " because because it is not a convex problem the the order might actually be different in the second"}, {"start": 1889.0400000000002, "end": 1896.72, "text": " and third and fourth step um of course this is simply this is like halfway towards between this"}, {"start": 1896.72, "end": 1905.04, "text": " one-shot algorithm and trying each mask by itself it's kind of a compromise I mean they they make it"}, {"start": 1905.84, "end": 1912.64, "text": " they they really try to not not try each mask once because it's one of their contributions right"}, {"start": 1912.64, "end": 1917.92, "text": " but then they probably realized if we just do it one shot sometimes it doesn't work so they are"}, {"start": 1917.92, "end": 1922.72, "text": " going in between which is you know it's a pretty cool idea all right next experiments"}, {"start": 1922.72, "end": 1930.24, "text": " we're now in this situation and you see you see a number of things so first of all we have a"}, {"start": 1930.24, "end": 1936.72, "text": " new I've added a new baseline this PSP and you can see that the baselines operate in this gg regime"}, {"start": 1936.72, "end": 1942.48, "text": " so the baselines are given the task during training and given the task during evaluation"}, {"start": 1942.48, "end": 1948.96, "text": " you see the upper bound here in gray is where you train a model for each task and"}, {"start": 1948.96, "end": 1954.56, "text": " you assume that's an upper bound because you assume the tasks are kind of unrelated to each other"}, {"start": 1955.6000000000001, "end": 1962.32, "text": " which is is not the case so there is actually potential to beat the to beat the upper bound baseline"}, {"start": 1962.32, "end": 1969.68, "text": " and subs up here you see operates in a different regime namely there's this regime of you're given"}, {"start": 1969.68, "end": 1976.16, "text": " the task during training but then during testing you're not given the task okay and this you here"}, {"start": 1976.16, "end": 1982.0800000000002, "text": " it basically means that the labels you assume that the labels of the tasks are not shared so"}, {"start": 1983.1200000000001, "end": 1991.44, "text": " in in this case if you predict if you predict like if you split MNIST into always that"}, {"start": 1992.0800000000002, "end": 2000.96, "text": " two class no if you split MNIST into two tasks you predict the first task is 01234 the second"}, {"start": 2000.96, "end": 2007.92, "text": " task is 56789 okay and you have the same amount of labels so you always have five output neurons"}, {"start": 2007.92, "end": 2018.4, "text": " right so you have 1 2 3 4 5 output neurons if you if the image here is like a 5 that would be task"}, {"start": 2018.96, "end": 2028.24, "text": " task one label zero right if your network now predicts label zero correctly but predicts the"}, {"start": 2028.24, "end": 2034.72, "text": " the image to come from task one you counted as a mistake you say well you know you've predicted"}, {"start": 2034.72, "end": 2040.4, "text": " the right output neuron but you've told me it comes from task zero from from the zero to four so I'm"}, {"start": 2040.4, "end": 2046.16, "text": " going to count that as a mistake so it's really there isn't there isn't a way for the network to kind"}, {"start": 2046.16, "end": 2053.92, "text": " of go get around predicting the wrong task for kind of share information so you assume that"}, {"start": 2053.92, "end": 2063.76, "text": " the labels are not shared are unshared yeah so it's the the subs up here has it is significantly"}, {"start": 2063.76, "end": 2070.16, "text": " harder task than the baselines keep keep that in mind and now we're applying our because we"}, {"start": 2070.16, "end": 2076.96, "text": " we are not given the task at inference time now we're applying our heuristic where we go and look"}, {"start": 2076.96, "end": 2084.56, "text": " at which of the mask entropy is the lowest respectively we use this actually this one shot algorithm"}, {"start": 2084.56, "end": 2092.08, "text": " where we look at the gradients and you can see this is on permuted Mnist in permuted Mnist what you do is"}, {"start": 2092.96, "end": 2100.8, "text": " you take Mnist and you simply permute the pixels and this it sounds crazy but you you simply"}, {"start": 2100.8, "end": 2106.5600000000004, "text": " permute the pixels and that gives you a new task so you can come up with like almost an infinite number"}, {"start": 2106.5600000000004, "end": 2115.76, "text": " of tasks because there are what 28 times 28 pixels so you can commute them 784 you know factorial times"}, {"start": 2117.76, "end": 2123.76, "text": " which gives you like infinitely many tasks and so you can modulate so here you can see the number"}, {"start": 2123.76, "end": 2130.0800000000004, "text": " of tasks learned increases and at the beginning this baselines especially this baseline is doing"}, {"start": 2130.08, "end": 2137.2, "text": " fairly well actually on par with the upper bound when you only have 10 different tasks however"}, {"start": 2138.88, "end": 2146.64, "text": " after that quickly degrades however this subs up here it you know keeps it keeps its performance"}, {"start": 2146.64, "end": 2154.0, "text": " which it so this doesn't only mean that it correctly predicts the output neuron it also"}, {"start": 2154.0, "end": 2161.36, "text": " correctly predicts which task which permutation was applied to the digit simply by looking where"}, {"start": 2161.36, "end": 2170.08, "text": " the entropy is high right so that's pretty cool and you know it's it's actually kind of"}, {"start": 2170.08, "end": 2177.04, "text": " surprising to be to be honest so on the left this is a lunette architecture on the right it's a"}, {"start": 2177.04, "end": 2183.36, "text": " fully connected network now the fully connected network here performing better is sort of expected"}, {"start": 2183.36, "end": 2187.6800000000003, "text": " first of all amnesty is really easy and can actually be solved with a fully connected network"}, {"start": 2187.6800000000003, "end": 2193.52, "text": " and second of all especially permuted amnesty I guess doesn't really conform to the"}, {"start": 2194.32, "end": 2201.36, "text": " to the assumptions of convolutional neural networks anymore again keep in mind these tasks are very"}, {"start": 2201.36, "end": 2212.08, "text": " easy yeah so so especially for the fully connected network of course each permutation kind of looks"}, {"start": 2212.08, "end": 2218.7999999999997, "text": " the same because it's it doesn't care at the beginning that it pixels are next to each other"}, {"start": 2218.7999999999997, "end": 2226.08, "text": " simply each pixel is a different thing it's just the fact that it cannot it cannot learn from one"}, {"start": 2226.08, "end": 2231.6, "text": " tasks much about the other tasks that's why you that's the nature of permuted amnesty"}, {"start": 2233.2799999999997, "end": 2239.44, "text": " all right and then in this experiment right here and this is the sort of crown experiment"}, {"start": 2239.44, "end": 2249.68, "text": " they learn they do this permuted amnesty but they go up to 2500 tasks right 2500 different permutations"}, {"start": 2250.16, "end": 2257.92, "text": " button so but now they have an additional thing right here so again they have this sub sub where"}, {"start": 2257.92, "end": 2266.64, "text": " it needs to predict the correct permutation but also they compare it with a an algorithm that needs"}, {"start": 2266.64, "end": 2274.64, "text": " that is this nn right here so in this nn not not only are you not given the task label at"}, {"start": 2274.64, "end": 2281.3599999999997, "text": " testing time you were actually not even given the task label at training time but here the outputs"}, {"start": 2281.3599999999997, "end": 2287.8399999999997, "text": " are shared so you know since since you have no way of knowing which task it is you've never given"}, {"start": 2287.8399999999997, "end": 2294.64, "text": " it as long as you predict the correct class you good so it's always it's always a 10 class"}, {"start": 2294.64, "end": 2302.8799999999997, "text": " classification problem it's just no permuted you're not given the task label here so first of all"}, {"start": 2302.8799999999997, "end": 2309.7599999999998, "text": " I want to say that this here the shared labels it could actually contribute to the success of this"}, {"start": 2309.7599999999998, "end": 2316.96, "text": " algorithm right here because even though you permute the pixels you can still sort of do things"}, {"start": 2316.96, "end": 2324.24, "text": " like count the frequency of light pixels versus dark pixels in amnesty and that might already give you"}, {"start": 2324.24, "end": 2331.8399999999997, "text": " a very very big hint right or you know simple correlation of two pixels though that's that's a"}, {"start": 2331.8399999999997, "end": 2338.24, "text": " task specific thing but the the frequency of light pixels versus dark pixels will already give you"}, {"start": 2338.24, "end": 2344.9599999999996, "text": " a big boost in accuracy and now you can actually share that feature that feature will always be"}, {"start": 2344.9599999999996, "end": 2353.8399999999997, "text": " the same for every permutation so this is something you can share between tasks and I would like"}, {"start": 2353.84, "end": 2360.08, "text": " so one way I guess you could eliminate that well I don't know I'm not sure is you kind of have to"}, {"start": 2360.08, "end": 2365.28, "text": " randomize the number of light pixels but keep the classes the same yada it's it's going to be"}, {"start": 2365.28, "end": 2372.32, "text": " complicated right but just keep that in mind however how how does the algorithm even decide"}, {"start": 2372.32, "end": 2385.28, "text": " so they have a heuristic right here as well namely they say okay if we don't have no task identity"}, {"start": 2385.28, "end": 2393.92, "text": " during training or inference where task identity is entirely unknown even during training if"}, {"start": 2393.92, "end": 2398.88, "text": " sub sub is uncertain about the current task identity it is likely that the data does not do not"}, {"start": 2398.88, "end": 2405.2000000000003, "text": " belong to any tasks seen so far when this occurs a new super mask is allocated and the number of"}, {"start": 2405.2000000000003, "end": 2411.12, "text": " tasks learned so far is incremented okay so the they go with the same principle right here they say"}, {"start": 2411.12, "end": 2418.96, "text": " if we get a new training sample we just evaluated against all the masks that we had so far or we do our"}, {"start": 2418.96, "end": 2426.96, "text": " you know one shot algorithm to to approximate which masks gets it gets us a low entropy if none of"}, {"start": 2426.96, "end": 2433.2, "text": " the mask gets us a low entropy then we decide this must be some kind of unseen task so we're going to"}, {"start": 2433.2, "end": 2442.7200000000003, "text": " allocate a new mask for this unseen tasks and that heuristic as you can see it performs fairly"}, {"start": 2442.7200000000003, "end": 2450.88, "text": " fairly well where was our graph our graph was down here in fact it performs pretty much on par"}, {"start": 2450.88, "end": 2460.0, "text": " with where you know the task during training and just not during during inference up until like"}, {"start": 2460.0, "end": 2468.2400000000002, "text": " here the very last bit if you really get into the high task regime where I guess it starts getting"}, {"start": 2468.2400000000002, "end": 2473.6, "text": " it starts getting confusing so this this heuristic might start to break down but it might just be"}, {"start": 2473.6, "end": 2478.1600000000003, "text": " effect how they tune their constants like they have to define a threshold where they say okay if the"}, {"start": 2478.16, "end": 2484.8799999999997, "text": " entropy is somehow higher than this threshold then we allocate a new a new task and this might be"}, {"start": 2484.8799999999997, "end": 2493.04, "text": " optimized in order to solve this again these tasks are very very very very very easy so keep keep"}, {"start": 2493.04, "end": 2503.8399999999997, "text": " that in mind yeah okay so this basically was the experimental part of that paper now they consider"}, {"start": 2503.84, "end": 2510.6400000000003, "text": " different extensions to that and I'm not sure are they also considered some ablations which are"}, {"start": 2510.6400000000003, "end": 2519.52, "text": " pretty interesting so here they say we are going to up the kind of the hardness of the task with"}, {"start": 2519.52, "end": 2527.44, "text": " rotated M-nist and also their model does pretty well on the rotated M-nist task where the differences"}, {"start": 2527.44, "end": 2534.48, "text": " of between the the differences between the task are simply some of them are rotated by 10 degrees"}, {"start": 2534.48, "end": 2542.16, "text": " so that's a tiny rotation in the right if you have a number three you kind of rotated by 10 I"}, {"start": 2542.16, "end": 2551.04, "text": " can't even draw that subtle of a rotation by 10 degrees and you know the subs up must correctly"}, {"start": 2551.04, "end": 2560.64, "text": " predict which task the image is from or it will not get the it will not get a correct reward"}, {"start": 2561.6, "end": 2568.32, "text": " and the fact that it performs pretty well and the fact that it has you know rotation degrees where"}, {"start": 2568.32, "end": 2574.48, "text": " it outperforms the baseline that is actually given the rotation so it's given the task at"}, {"start": 2574.48, "end": 2581.84, "text": " inference time is pretty pretty remarkable again I believe this is due to the fact that these tasks"}, {"start": 2581.84, "end": 2588.4, "text": " are so easy and therefore these entropy it just spikes when you get the correct thing because"}, {"start": 2589.36, "end": 2596.56, "text": " it's sort of it sort of latches on to very easy features for each task so I'm going to guess"}, {"start": 2596.56, "end": 2602.48, "text": " that the tasks are you know generally solvable by maybe correlating to pixels right if like this"}, {"start": 2602.48, "end": 2607.6, "text": " pixel correlated with this pixel if the correlations high it's a three the correlations low it's"}, {"start": 2607.6, "end": 2613.36, "text": " something else okay and then if you rotate it it's just not the case anymore that this pixel and"}, {"start": 2613.36, "end": 2622.32, "text": " this pixel the correlation is very high so if you predict using this correlation you'll get a"}, {"start": 2622.32, "end": 2628.72, "text": " pretty low confidence and I'm going to guess that yeah if you have discrete tasks and it's in this"}, {"start": 2628.72, "end": 2634.08, "text": " task then your confidence will just spike because the task is so easy and because all the tasks are"}, {"start": 2634.08, "end": 2639.7599999999998, "text": " about equally hard because if you can find this correlation here you can find it over here it's"}, {"start": 2639.7599999999998, "end": 2646.56, "text": " simply going to be two different two different pixels in this task and then one as you try the masks"}, {"start": 2647.4399999999996, "end": 2654.9599999999996, "text": " whenever you hit the one where you can predict pretty confidently with those two pixels then your"}, {"start": 2654.96, "end": 2660.48, "text": " confidence is going to spike your entropy is going to get down and you know it's that task right"}, {"start": 2661.36, "end": 2671.44, "text": " they also here they compare where is it the one shot algorithm so they they they use their one shot"}, {"start": 2671.44, "end": 2679.04, "text": " algorithm to and and they put it on a baseline so this baseline where they always actually have to"}, {"start": 2679.04, "end": 2689.7599999999998, "text": " give it the the task they augment it by by their their one shot algorithm to select the task and it"}, {"start": 2689.7599999999998, "end": 2696.48, "text": " turns out they can you know make it perform fairly well not on par with them interestingly but they"}, {"start": 2696.48, "end": 2703.92, "text": " can make it perform also fairly well actually better than it was performing before so they have"}, {"start": 2703.92, "end": 2711.52, "text": " different extensions right here and that's some of them are pretty important the one important"}, {"start": 2711.52, "end": 2719.12, "text": " thing they do is they have these superfluous neurons and that's sort of hidden and it's always a bit"}, {"start": 2720.8, "end": 2728.4, "text": " so here for example you see in the output they say we have a lunate model using output size 500"}, {"start": 2728.4, "end": 2734.0, "text": " now they're they're only 10 different labels in the MNIST task right also in the permuted MNIST"}, {"start": 2734.0, "end": 2741.28, "text": " task there are 10 different labels that I mean there are a total of 25,000 labels if you have"}, {"start": 2741.28, "end": 2748.88, "text": " 2,500 tasks but the neural network has output size 10 however their neural network here has output"}, {"start": 2748.88, "end": 2758.32, "text": " size 500 which is surprising so they say right here and we're going to get to the hop field"}, {"start": 2758.32, "end": 2765.1200000000003, "text": " and network at the very end for those who are still around because that's I think that should be"}, {"start": 2765.1200000000003, "end": 2772.8, "text": " its own paper but you know they say it could use an output of size L where L is the actual"}, {"start": 2772.8, "end": 2780.1600000000003, "text": " number of labels per per task though we find in practice that it helps significantly to add extra"}, {"start": 2780.16, "end": 2788.7999999999997, "text": " neurons to the final layer specifically we consider outputs P in RS so S is higher than L"}, {"start": 2789.92, "end": 2799.92, "text": " and refer to the neurons that are passed L as superfluous neurons so let's try to make sense of"}, {"start": 2799.92, "end": 2807.6, "text": " this so they have a neural network and let's say it's a three-class classification task right so"}, {"start": 2807.6, "end": 2813.36, "text": " you have three classes and that's what you would do they simply add a bunch of neurons right here"}, {"start": 2813.36, "end": 2817.8399999999997, "text": " that means they also they you know they add all of the connections from the previous layer to those"}, {"start": 2817.8399999999997, "end": 2826.64, "text": " neurons but still the classes can only be either 0, 1 or 2 these classes never appear during training"}, {"start": 2826.88, "end": 2837.2799999999997, "text": " so they claim this helps during during their procedure and I thought about it a bit"}, {"start": 2837.28, "end": 2844.8, "text": " and we might be able to try to guess why it makes sense they say they simply say we observe"}, {"start": 2844.8, "end": 2853.6000000000004, "text": " 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"}, {"start": 2853.6000000000004, "end": 2858.6400000000003, "text": " our model using these two many neurons what happens well our label is always going to be of the top"}, {"start": 2858.6400000000003, "end": 2864.6400000000003, "text": " three neurons so let's say our label is 1 this is going to result in a one-hot vector like this"}, {"start": 2864.64, "end": 2870.0, "text": " now what are we training in this layer here in this layer here we're training log it's"}, {"start": 2871.2799999999997, "end": 2882.56, "text": " okay so pre pre soft max outputs so our our algorithm our cross entropy loss is going to push"}, {"start": 2883.3599999999997, "end": 2889.2799999999997, "text": " all of these here down during every single training point it's going to push this one up"}, {"start": 2889.28, "end": 2895.6800000000003, "text": " and all these down now these three here are going to be pushed up and down depending on the label"}, {"start": 2895.6800000000003, "end": 2902.48, "text": " however all of these down here are going to be only pushed down during the entire training"}, {"start": 2902.48, "end": 2911.6800000000003, "text": " so they are going to be exceptionally low numbers okay now if we then come and we look at the"}, {"start": 2911.68, "end": 2922.48, "text": " at the entropy of this the entropy I think honestly this is simply you could achieve the same thing"}, {"start": 2923.04, "end": 2929.12, "text": " by using a different temperature parameter in the soft max or in the entropy that you consider"}, {"start": 2929.12, "end": 2936.48, "text": " because why can this help and this helps with inferring which task it's coming from right so"}, {"start": 2936.48, "end": 2942.72, "text": " if you consider a task where you only have three outputs so you don't have this bit down here"}, {"start": 2942.72, "end": 2948.64, "text": " and you look at the entropy it's going to be you know it's going to be something"}, {"start": 2950.4, "end": 2955.76, "text": " something sorry I have to draw this right here it's going to be like this you know it's fairly"}, {"start": 2955.76, "end": 2964.4, "text": " confident but if and maybe for the other tasks it's not going to be as confident you know it's"}, {"start": 2964.4, "end": 2970.96, "text": " maybe going to be like this a bit however if you have those and if it's of the correct tasks I'm"}, {"start": 2970.96, "end": 2976.48, "text": " going to guess this kind of stays the same because they're really low but if it's of the incorrect"}, {"start": 2976.48, "end": 2984.0, "text": " tasks then you're not sure and you're not being sure about the output also means that you allocate"}, {"start": 2984.0, "end": 2990.96, "text": " a lot more to these things right here because you've sort of never seen this particular kind of"}, {"start": 2990.96, "end": 2996.88, "text": " training examples so you're not sure so you're just going to distribute your kind of your"}, {"start": 2996.88, "end": 3003.36, "text": " probability mass across these things right here because you've not been trained on that kind of"}, {"start": 3003.36, "end": 3009.44, "text": " input right it's very important to see that this is task this is the correct task which they always"}, {"start": 3009.44, "end": 3018.08, "text": " label J and for for any other incorrect task you've never seen data like this so these things here"}, {"start": 3018.08, "end": 3024.24, "text": " sort of act like an outlier class without you explicitly training an outlier class you simply"}, {"start": 3024.24, "end": 3030.16, "text": " train these things during training you make them small but you it's important to notice you"}, {"start": 3030.16, "end": 3038.56, "text": " always make them small from a data point that comes from their particular task okay that's what"}, {"start": 3038.56, "end": 3046.56, "text": " you train them for and now if you input a data point from a different task they have less reason to"}, {"start": 3046.56, "end": 3052.7999999999997, "text": " be small because this is an outlier data point so you have much more fluctuations so you have more"}, {"start": 3052.7999999999997, "end": 3059.2, "text": " fluctuations here and therefore the entropy is going to be even higher all right this is sort of"}, {"start": 3059.2, "end": 3065.2, "text": " how I make sense of the fact that these additional superfluous neurons help here they act as kind"}, {"start": 3065.2, "end": 3074.88, "text": " of an outlier detector for the training data set of that particular task now because you know you"}, {"start": 3074.88, "end": 3080.88, "text": " have different training data for each task they go further and they say it actually works even"}, {"start": 3080.88, "end": 3087.84, "text": " better it works even better if we instead of this entropy heuristic we consider another heuristic"}, {"start": 3089.76, "end": 3095.36, "text": " accordingly we consider an objective G which encourages the s-neurons to have large negative"}, {"start": 3095.36, "end": 3103.84, "text": " values and computers as an alternative to entropy in equation 4 so G they analyze down in the appendix"}, {"start": 3103.84, "end": 3109.92, "text": " and we're just quickly going to look at what G is sorry this is about to load right here"}, {"start": 3111.6800000000003, "end": 3124.08, "text": " and it's very interesting to see what G is is is it yes so G is going to be this right here"}, {"start": 3125.1200000000003, "end": 3133.1200000000003, "text": " so why are the logits and then G is this expression right here so and in fact it's this"}, {"start": 3133.12, "end": 3140.08, "text": " expression with the with a bit of a modification so it's going to be G is going to be the log"}, {"start": 3140.08, "end": 3150.96, "text": " sum x of the logits right so it's this is some this is somewhat like the entropy and what we're"}, {"start": 3150.96, "end": 3157.12, "text": " going to consider is the gradient of G so what we want is the gradient of G with respect to our"}, {"start": 3157.12, "end": 3164.88, "text": " alphas and the condition here with this detach operation is that"}, {"start": 3169.52, "end": 3179.04, "text": " the gradient of G should be you know the gradient of the loss function for all V that are superfluous"}, {"start": 3179.04, "end": 3188.4, "text": " neurons and zero otherwise so we're going to detach the gradient of G for all the real neurons for"}, {"start": 3188.4, "end": 3194.56, "text": " all the the actual logits of the output class and we're only going to consider the gradient flowing"}, {"start": 3194.56, "end": 3201.04, "text": " through the superfluous neurons so all of this here is if we take the gradient it's only going to"}, {"start": 3201.04, "end": 3212.24, "text": " flow to in these in the last layer through the gradients of these superfluous neurons okay and"}, {"start": 3212.24, "end": 3217.44, "text": " that's why we don't need the entropy because the entropy always considers you know the difference"}, {"start": 3217.44, "end": 3223.44, "text": " sort of the difference between the correct label and the other labels we are pretty sure that in"}, {"start": 3223.44, "end": 3232.48, "text": " our superfluous neurons we don't have the correct label okay and so this log log some x of our of"}, {"start": 3232.48, "end": 3240.64, "text": " these outputs here what will they represent well this is sort of a flatness measure again it's"}, {"start": 3240.64, "end": 3248.64, "text": " kind of like the entropy except we don't have a correct label right here if one of them is very"}, {"start": 3248.64, "end": 3257.52, "text": " high and the other ones are very lower if if they're generally very high up then this will be high"}, {"start": 3257.52, "end": 3266.24, "text": " however consider the difference between this and this where they're all super small and also"}, {"start": 3266.24, "end": 3272.48, "text": " they're all pretty equal the log some x will be very small so this is an alternative where we can"}, {"start": 3272.48, "end": 3281.52, "text": " basically only look at the superfluous neurons and say is are these superfluous neurons all very small"}, {"start": 3282.16, "end": 3288.96, "text": " and you know none of them basically says I'm the correct label then we can be pretty sure that"}, {"start": 3288.96, "end": 3298.2400000000002, "text": " over here there is some confidence however if they are sort of kind of larger and you know generally"}, {"start": 3298.24, "end": 3305.68, "text": " kind of generally large maybe unequal that means we're not very confident because these are our"}, {"start": 3305.68, "end": 3312.3199999999997, "text": " outlier classes they shouldn't be they shouldn't be large at all so an alternative to looking at the"}, {"start": 3312.3199999999997, "end": 3319.12, "text": " entropy of this distribution is to build such superfluous neurons and then look at those and"}, {"start": 3319.12, "end": 3326.56, "text": " only those and so the gradient of only those in order to decide which task it's from it's an"}, {"start": 3326.56, "end": 3334.16, "text": " interesting idea I have to say but I maybe one could achieve sort of the same thing with a with a"}, {"start": 3334.16, "end": 3341.44, "text": " temperature parameter here or by building an explicit outlier detection but it's generally an"}, {"start": 3341.44, "end": 3347.2799999999997, "text": " interesting idea for outlier detection I have to say I've never really seen anything like this"}, {"start": 3347.2799999999997, "end": 3352.88, "text": " though I also haven't really considered it so here they show the importance and you've seen in"}, {"start": 3352.88, "end": 3358.2400000000002, "text": " the experiments before that there sometimes was this H objective and also this G objective"}, {"start": 3358.96, "end": 3364.56, "text": " so you can look at the entropy but also you can look at the G in both cases you have superfluous"}, {"start": 3364.56, "end": 3373.52, "text": " neurons so before you actually saw you have 500 neurons for a task of 10 that needed 10"}, {"start": 3373.52, "end": 3379.92, "text": " output classes right so this tells me that these superfluous neurons are pretty important for them"}, {"start": 3379.92, "end": 3389.6800000000003, "text": " and this is probably one of the things that makes this work right these superfluous neurons so"}, {"start": 3389.6800000000003, "end": 3398.56, "text": " you kind of setting up a trap where for the wrong models you let it run into this trap of assigning"}, {"start": 3398.56, "end": 3404.16, "text": " a lot of weight into these outlier classes and only if the correct model is trained to not do that"}, {"start": 3404.16, "end": 3410.16, "text": " on the particular data that you're considering I don't think this comes through in the paper too"}, {"start": 3410.16, "end": 3414.96, "text": " much that this is one of I guess this is one of the main factors making this work and you can see"}, {"start": 3414.96, "end": 3420.24, "text": " right here they actually do an experiment so I don't want to be too mean where they say look if"}, {"start": 3420.24, "end": 3428.48, "text": " we train with just 25 classes and this is permuted amnest so the necessary amount would be 10 so if"}, {"start": 3428.48, "end": 3435.36, "text": " we train with only 25 you can see how quickly we degrade right here however as we go up and train"}, {"start": 3435.36, "end": 3444.32, "text": " with 100 and 200 we get better and better in fact if we train with this G objective it always sort"}, {"start": 3444.32, "end": 3452.48, "text": " of outperforms the H objective interestingly the more output neurons you have the less this"}, {"start": 3452.48, "end": 3459.28, "text": " difference seems to be but maybe the percent difference is the same the percent error difference"}, {"start": 3459.28, "end": 3467.28, "text": " is the same I don't know I can't tell from here yeah so this isn't all there is also this"}, {"start": 3467.28, "end": 3474.96, "text": " hop field network going on where they say okay okay so essentially we're actually training"}, {"start": 3474.96, "end": 3479.28, "text": " different models right we're not really superimposing all of these models we're training a different"}, {"start": 3479.28, "end": 3485.84, "text": " mask for each of the tasks and we're kind of remembering the masks and so on can we also build a"}, {"start": 3485.84, "end": 3492.88, "text": " model where we actually only have one model and that's what they do right here where they build a"}, {"start": 3492.88, "end": 3498.4, "text": " hop field network which is basically just a a big matrix this is the hop field network and then"}, {"start": 3498.4, "end": 3505.0400000000004, "text": " they encode the masks in this hop field network so specifically the hop field network is of size"}, {"start": 3505.04, "end": 3514.08, "text": " D squared where it is able to encode to to the D different binary strings and it does so in a"}, {"start": 3514.08, "end": 3519.7599999999998, "text": " fuzzy way but you know you can prove that if you construct the hop field network like this where"}, {"start": 3519.7599999999998, "end": 3528.08, "text": " Z is a binary string you can recover the binary strings by gradient descent in the hop field network"}, {"start": 3528.08, "end": 3535.2799999999997, "text": " and as obviously the more binary strings you encode the less you get out like it's not magic you"}, {"start": 3535.2799999999997, "end": 3543.7599999999998, "text": " can't store that many bits into a thing that doesn't have that many bits but I believe you know"}, {"start": 3543.7599999999998, "end": 3550.56, "text": " again this is using gradient descent and it can do so with surprising it was surprising accuracy"}, {"start": 3550.56, "end": 3557.2799999999997, "text": " so remember that these here are bits while these here are floating point numbers so the comparison"}, {"start": 3557.28, "end": 3562.88, "text": " that I just made isn't entirely fair but I don't I don't want to go into the hop field networks"}, {"start": 3562.88, "end": 3567.52, "text": " because I really feel this should be its own paper I guess they just want to show that it's it's"}, {"start": 3567.52, "end": 3577.28, "text": " also possible to compress these masks into one into one thing such that I can't make the argument"}, {"start": 3577.28, "end": 3582.4, "text": " anymore that hey all you're doing is training different models for different tasks all right all"}, {"start": 3582.4, "end": 3587.44, "text": " in all pretty cool paper as I said pretty dense paper I invite you to read it they have a big"}, {"start": 3587.44, "end": 3594.08, "text": " appendix where they'd have more experiments and so on and explain everything in detail all in all"}, {"start": 3594.8, "end": 3601.04, "text": " I from this I don't really take the method but the ideas are very interesting and I am"}, {"start": 3601.04, "end": 3615.2, "text": " and you're excited to see where this goes in the future all right I'll see you next time bye bye"}] |
Yannic Kilcher | 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 you 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've 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's 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 sim clear 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 the self supervised techniques can help you and supervised learning and then in sim clear v2 you do semi supervised in that you do self supervising then fully supervised and then distillation like self distillation there's there's all this 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 10 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% chances 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 Huivin fun I guess for training for putting up a repo training these C4 10 models or training these PyTorch vision models on C4 10 C4 10 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 repo it says it downloads these I've not done this before I have no clue how this is going to 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 in term mixed with data and code because this is the thing that I'm going to 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 already have a c410 folder right here so we'll use this and then so path.join we'll 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 no 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 see for 10 what was it called see for 10 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 revision so that's not going to be an issue okay so here we're going to call see for 10 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 followed 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 c4 10 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 c4 10 module is a lightning module as you can see right here it is we know how tens of sorry pie torch lightning works if you don't know how pie torch 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 the other yada if it's two 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 kuda and put that to true and then we'll say oh come on there is like a lot of stuff going on here let's so and then torch is called torch I 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 okay so if kuda is not available we'll just set the kuda to false if th dot kuda dot is a very level okay not if it's not available then hparams dot kuda 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 it this logs directory where the check points 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 on remove tree recursively delete the lead to directory tree 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 dope dope 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 nets 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 hard code at the fact is hard code at the fact that there are there is this state dicts directory okay yeah that's terrible 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 load it 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 dear 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 see for 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 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 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 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 see 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 kuda dot get device is that possible let's try no okay no 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 just says pre trained device always CPU I just can't believe that I guess I'll believe it we'll 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 start so missing keys in state dick a lot of missing stuff we can 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 break point 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 dick is that let's look at its keys we got a bunch of stuff okay so why can't we load that model load state dick state dick and now unexpected keys in state dick missing keys so this is always pre-pended 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 dot load state dick right look at us we made it so this is testing I guess this is this resonant 18 or what not 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 is 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 common 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 a like a module list there's this module list 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 going to go for the same kind of classifiers right now to really boil it down to have the same architecture for the students and for the teachers for ba in range in range and here we probably need a flag so hperms dot num students okay so these are going to be our student models 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 is 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 PyTorch and then 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 dataset not found or corrupted okay so what we'll have to do is we'll have to implement I'll 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 directory logs why why doesn't it make it no such file directory logs 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 four 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 um 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 um so it should only train the student models okay and even even like that we should probably always set the teacher model in in eval mode um 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 going to guess is a cross entropy so the predictions here are actually going to be log it's 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 um until the point where you 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 10 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 log it's 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 don't want to backprop 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 modeling to eval mode so I guess that does it set train no that should do it I have no idea um yeah let's let's run it again uh 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 I will go student forward or we simply run the images through that and that gives us the log it's and then we use our loss function on the log it's and 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 uh nope dot 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 uh losses I guess we could make it the average just so if we change the number of students um we'll we'll get some kind of some sort of a better sense of the the actual numbers what what what what okay I think over here we're good yeah so so the our teacher model is not in training mode but our student models hopefully or 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 writes 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 uh per easy per easy but we need to collect the log it's so come on so we'll also have the log it's append the student log it's okay so we have a whole bunch of log it's 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 as 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 log it and then run a softmax on top of that because I'm going to guess the log it's our 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 log it's they're all when we need to somehow concatenate those um or stack them so how we're going to stack them so they're 250 they're 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 cross dimension zero so those are going to be our log it's our final log it's and then our predictions are going to be the argmax of the log it's in the last dimension yep that should be pretty straightforward I guess that's it easy as that um 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 one D target tense expected multi target not supported so the cross entropy loss in PyTorch does not support that um 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 cross for his problem with the classes yada yada yada wait should we want the yada yada yada 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 soft max 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 we somehow need a soft cross entropy loss let's search for that PyTorch um soft cross entropy soft classes I guess people do that kind of stuff so the the problem with these kind of losses is that what you do what you have to do is kind of protect yourself against um 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 soft max that should take care of it for us okay this is tensor flow uh okay okay following thread cross entropy loss I guess people just do really the log soft max and then do that and we should be fine with this okay thanks uh 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 mm 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 cross entropy is simply the uh probability of the true label times the log probability of the wrong or or the predicted label yeah if you as you see right here so we're going to simply multiply target times the log probability of the predicted label and then um some some dot 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 um to do do do do do do do do do do do do so we're going to take student logids 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 logids so So n and dot, that exists log softmax functional. OK, we need functional. And student logits of that dimension. So now we have properly normalized student logit. So that's going to be student log probs. And then what we want to do is simply multiply the teacher probs times the student log probs. 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 some 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. OK. So I need to check. Maybe we should have taken a smaller model. It sometimes pays off to start with a really small model, small model, just so you can do these kind of things fast. So here we have dimension out of range, to do, which is where is that? In forward, in line 78, let's go there. In line 78. OK. Here, the max is not going to be as much fun. 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 the predictions is already an arg max. So I guess we can remove this all. Whether or not that agrees with labels.data, we don't need any of that.float. And we also don't need that. So the accuracy is simply going to be the mean of this. No? I guess. So we're here. And 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. Yeah. Yeah. Yeah. Float mean. Perfect. How could this be any more easy? But this right here is all of it. So validation step. It's a accuracy. Correct. 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 have succeeded. OK. We're pretty close, I feel. So it says grad can implicitly create it 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 will do I see this loss function here will output basically one loss for each date 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 get 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. OK. 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 solved that, right? No losses. Yeah, see our losses is going to be an entire tensor. And now we just fix that right now. OK. 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 with respect to this download stuff right here is 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 locks such that they coordinate. And I usually use a file lock for this. So I'm going to create that right here from the file lock. And then I simply create the lock. Let's go file lock. And here you have to input a file. Sometimes like, yeah, data lock. I don't know. You just pick some file and that's the file that 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 a let's say 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 to I do have the tool. Okay. So I'm going to 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. Same mistake. Of course, since we don't. Yep. Next mistake. We'll just go through the mistake. Learning rate. 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? Oh, with I. Okay. So I want to, first of all, delete this. Delete this. Yes. Ah, yes, 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. Nope. Clear the logs and we're much better, much better. Okay. Much better. So what we, what we will do is my system requires like a file and I'm just going to copy one from another project quickly. Okay. So we're back and I copied that over. As you can see, you basically give hyper parameters and it blasts the hyper parameters 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. See for 10 train ensemble. Yes, that's the file. Cool. And here we're just going to put all of our hyper parameters. And that will remove the logs file. I'm okay with that but want this. Okay. 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. We want 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 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 hyper parameter 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 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. Call it seed. No. Is it here? This seed everything? Yeah. So hparams.reps. Sorry seed. Cool. What 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 try a bunch of them. We can try all of them. Why don't we try all of them? Like this, then what's going to 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. 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 classifiers 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 then to make myself actually do it. So let's go. Let's go with just one repetition. So for 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 20. 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. Go cancel this right now. And we'll go ahead and just blast this onto our servers. And hopefully that's going to work. I have no idea. Is everything fine? Everything's fine. Go. Do 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 xx, you have the number of students in the ensemble. Remember, these students are all trained from the same teacher. The teacher you can see in orange. That's just a single teacher for reference. You can see that if you have one student model, it sometimes underperforms or 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 doesn't finish here is because there's 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 king. 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 the 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? This seems like to, like, come on. There's no new information here. So I thought, hey, the teacher, the teacher, I'm all, I've just grabbed them 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 that 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 that just took the last checkpoint to make it didn't even look at its performance to make sure that I didn't 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 was almost the same. Like I was astounded at how well it works and then I thought, hey, maybe I'm kind of, you know, cheating here. So I read 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 100 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 a literature a bit more and I came up with a number of papers that do things like this. And 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, same clear V2 uses the self distillation in order to do, 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, 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 out perform 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 have some introduction of variability in the students 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, how does this compare to an ensemble of teacher models? Like if we 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 students, 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 I wrote some, I rewrote some code. It's just plumbing and I release the code. It's linked, but it's just plumbing. Don't worry. Don't worry, there's no great thoughts in there. It's just plumbing such that my students 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 basically means that I have the ability to train up to 10 models or 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 a forward pass, load the second checkpoint, run a 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 there is a significant, like this is almost overlapping right here. For most models, they're sometimes the student wins, sometimes the teacher wins, so the teacher ensemble wins. Now, remember, the teachers are trained on, you know, 10 times as much data right here. But again, it's always the same data, but still they have the opportunity to learn 10 times as much information from the data. Whereas the students, they're all distilled from that same teacher without any noise, any augmentation, except for the augmentation that you use during training anyway. And I've done this for 100 epochs and I've done this for 250. Is this already 250? Now, I think that was 100. I just put that there. Nope. Okay. Yeah, that was 100 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 100 epochs. So all of this makes no sense to me, right? The student is still distilled from the 100 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 should out, the 250 epochs generally outperforms the 100 epochs models. Still, they are the same. This is pretty crazy results, I think. And 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 have something to do with the function landscape itself, and kind of exploring different minima 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 loss 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 haven't decided yet which order I'm going to release things. But this here, it's pretty interesting, and we need like a name. 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 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 cell phone samples. Alright, so the plan from here is to check on at least one other data set. You know, 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 are 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 train 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 a five minute video of like, woo, I discovered something because then there's no clue of 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": 6.5600000000000005, "text": " Hey what's up? So I've had this relatively dumb research idea and people have been"}, {"start": 6.5600000000000005, "end": 11.120000000000001, "text": " asking me for more coding videos and so on so I thought why not do a video"}, {"start": 11.120000000000001, "end": 16.04, "text": " where I take a research idea and implement it from scratch just to show how one"}, {"start": 16.04, "end": 22.16, "text": " would go or how I would go about implementing something like this. Now this"}, {"start": 22.16, "end": 26.64, "text": " was simply meant as sort of a demonstration but then at the end it actually"}, {"start": 26.64, "end": 33.8, "text": " worked and so yeah that was unexpected and my initial reaction was just to be"}, {"start": 33.8, "end": 39.24, "text": " like oh crap just hold everything you know stop video making you develop the"}, {"start": 39.24, "end": 45.44, "text": " idea write a paper about it okay and I was about doing that when I realized"}, {"start": 45.44, "end": 50.08, "text": " that you know I'm always the one complaining that research is not transparent"}, {"start": 50.08, "end": 56.480000000000004, "text": " enough and people aren't open enough and so on so I sort of thought I"}, {"start": 56.48, "end": 60.8, "text": " might do a different thing right here in that I will actually share the process"}, {"start": 60.8, "end": 66.36, "text": " of this non-finished research project so currently I am in the middle of this"}, {"start": 66.36, "end": 71.52, "text": " I've no idea whether it's going to work out or not and that's it and I think"}, {"start": 71.52, "end": 76.67999999999999, "text": " we can do open source software development you know completely in the open"}, {"start": 76.67999999999999, "end": 81.75999999999999, "text": " whereas with research we're all like super scared that people are gonna scoop us"}, {"start": 81.76, "end": 87.88000000000001, "text": " and we people just keep it keep their work hidden until they're done and then"}, {"start": 87.88000000000001, "end": 94.96000000000001, "text": " boom they put it on archive and all I want to go to a world where we collaborate"}, {"start": 94.96000000000001, "end": 99.2, "text": " much more in research and it's much more like open source software"}, {"start": 99.2, "end": 107.80000000000001, "text": " development so here's my way here's my process of implementing this idea and"}, {"start": 107.8, "end": 112.44, "text": " it's fairly long so if you just want to get to the results you can just skip"}, {"start": 112.44, "end": 117.24, "text": " at the end I'll put timestamps in there's this new YouTube chapter video so"}, {"start": 117.24, "end": 123.03999999999999, "text": " that'll be very helpful I guess yeah and with that being said I hope you"}, {"start": 123.03999999999999, "end": 127.56, "text": " enjoy this let me know what you think of videos like this and I'll see you"}, {"start": 127.56, "end": 133.76, "text": " next time hey what's going on today we're going to take a research idea and"}, {"start": 133.76, "end": 140.12, "text": " implement it as fast as we can so this is not really to show you the best"}, {"start": 140.12, "end": 144.48, "text": " research idea because it's not and it's probably been done before so I have"}, {"start": 144.48, "end": 148.76, "text": " no high hopes here but this is just to show that if you had like some research"}, {"start": 148.76, "end": 152.6, "text": " idea and you've actually done the literature research and figured no one has"}, {"start": 152.6, "end": 157.35999999999999, "text": " done that yet which I haven't because probably someone has done that how you"}, {"start": 157.35999999999999, "end": 163.39999999999998, "text": " could take this and like get started up initially pretty quickly and this is just"}, {"start": 163.4, "end": 168.72, "text": " the process that I would go through and I'm going to go through with you today"}, {"start": 168.72, "end": 174.76, "text": " and we're going to try to get this up and running as quickly as possible so I"}, {"start": 174.76, "end": 181.52, "text": " had this idea that looking at sim clear v2 there's a lot of things to be done"}, {"start": 181.52, "end": 188.12, "text": " still in the space of let's say self teaching self distillation and so on you"}, {"start": 188.12, "end": 193.48000000000002, "text": " know there's mean teacher and then there's what not and this is all usually done"}, {"start": 193.48000000000002, "end": 198.96, "text": " in the semi supervised very few label regime and so on but we know that the"}, {"start": 198.96, "end": 202.84, "text": " self supervised techniques can help you and supervised learning and then in"}, {"start": 202.84, "end": 207.64000000000001, "text": " sim clear v2 you do semi supervised in that you do self supervising then fully"}, {"start": 207.64000000000001, "end": 213.48000000000002, "text": " supervised and then distillation like self distillation there's there's all"}, {"start": 213.48, "end": 218.51999999999998, "text": " this kinds of interleaving stuff and I thought okay what if I just take a"}, {"start": 218.51999999999998, "end": 224.28, "text": " pre-trained network that performs really well on something and I self distill it"}, {"start": 224.28, "end": 230.92, "text": " into a bunch of student models like a number like 10 or so and then I like that's"}, {"start": 230.92, "end": 236.6, "text": " my ensemble model will that perform better than the original model like this"}, {"start": 236.6, "end": 241.2, "text": " is a terrible idea and it's probably not going to work like there's 99%"}, {"start": 241.2, "end": 248.39999999999998, "text": " chances not going to work but let's try to test this today so I got my drink I"}, {"start": 248.39999999999998, "end": 254.88, "text": " got my carbs since it's weekend and we're going to give this a shot all right so"}, {"start": 254.88, "end": 260.64, "text": " first thing we need some sort of base to go from in research it's good to build"}, {"start": 260.64, "end": 264.64, "text": " your own stuff but a lot of times if you want to be as fast as possible you"}, {"start": 264.64, "end": 271.36, "text": " want to go as quickly as you can so here I found this repo thankfully with an"}, {"start": 271.36, "end": 280.91999999999996, "text": " MIT license so shout out to Huivin fun I guess for training for putting up a"}, {"start": 280.91999999999996, "end": 287.56, "text": " repo training these C4 10 models or training these PyTorch vision models on"}, {"start": 287.56, "end": 292.64, "text": " C4 10 C4 10 is a small enough data set so that we can kind of work with it"}, {"start": 292.64, "end": 297.64, "text": " and these models are already pre-trained so I've cloned this repo and we're"}, {"start": 297.64, "end": 304.15999999999997, "text": " going to adjust that so there is a first of all there is a download as you can"}, {"start": 304.15999999999997, "end": 308.56, "text": " see here which in this repo it says it downloads these I've not done this"}, {"start": 308.56, "end": 314.03999999999996, "text": " before I have no clue how this is going to work out in this download script here"}, {"start": 314.03999999999996, "end": 321.71999999999997, "text": " downloads the weights from box and I hope you can see this and then I guess you"}, {"start": 321.72, "end": 327.36, "text": " can load the the pre-trained weights with pre-trained equals true and yeah we'll"}, {"start": 327.36, "end": 331.20000000000005, "text": " get into all that later so the first thing we got to do is get this to run"}, {"start": 331.20000000000005, "end": 338.04, "text": " let's say so let's look at this downloads thing first so the download thing is"}, {"start": 338.04, "end": 343.28000000000003, "text": " going to have a URL it's going to use requests to get that URL and then save this"}, {"start": 343.28000000000003, "end": 348.88000000000005, "text": " into this state dicts thing now what I usually want to do is I don't I want my"}, {"start": 348.88, "end": 353.88, "text": " folder of code to only have code and not to be in term mixed with data and code"}, {"start": 353.88, "end": 357.0, "text": " because this is the thing that I'm going to ship around to various servers and"}, {"start": 357.0, "end": 361.4, "text": " so on so I'd rather have the code in one folder and then the data and like a"}, {"start": 361.4, "end": 368.6, "text": " central folder so I'm not really fine with this sort of downloading the this"}, {"start": 368.6, "end": 374.96, "text": " right here into into the folder that we have so what I'm going to do is I'm"}, {"start": 374.96, "end": 378.68, "text": " going to change that such that it downloads it into a central folder so first"}, {"start": 378.68, "end": 384.64, "text": " we already have OS so what we're going to do is we're going to get some like"}, {"start": 384.64, "end": 397.44, "text": " data path going which is going to be our home folder OS path and I guess I"}, {"start": 397.44, "end": 405.8, "text": " also already have a c410 folder right here so we'll use this and then"}, {"start": 405.8, "end": 416.24, "text": " so path.join we'll join that and that's going to download it's not really"}, {"start": 416.24, "end": 427.0, "text": " data is it it's more like models okay let's do this cool so data path is this"}, {"start": 427.0, "end": 431.92, "text": " is the models that is going to download all right and then it unzips the"}, {"start": 431.92, "end": 436.28000000000003, "text": " file again so here it unzips the file to the current working directory I don't"}, {"start": 436.28000000000003, "end": 443.68, "text": " want this so I'm going to change that again to the models path all right no"}, {"start": 443.68, "end": 450.20000000000005, "text": " directory to path to zip file directory to extract to I think we're fine right"}, {"start": 450.20000000000005, "end": 456.36, "text": " now so this download script is going to download the path the all the weights"}, {"start": 456.36, "end": 462.0, "text": " there now I want this to happen sort of automatically while this is in a server"}, {"start": 462.0, "end": 467.88, "text": " or while this is on a server so what I'm going to do is probably just to so if"}, {"start": 467.88, "end": 472.12, "text": " this script runs you can see it runs the main but in the other script I might"}, {"start": 472.12, "end": 476.92, "text": " just want to do this automatically so let's go to the test script right here"}, {"start": 476.92, "end": 483.28000000000003, "text": " or let's say we go to the train script this is probably the main script"}, {"start": 483.28, "end": 494.55999999999995, "text": " right here the train script so we have to somehow call this other script here"}, {"start": 495.11999999999995, "end": 499.71999999999997, "text": " probably in the main function all right so let's import this other so import"}, {"start": 499.71999999999997, "end": 508.79999999999995, "text": " see for 10 what was it called see for 10 download"}, {"start": 508.8, "end": 517.6, "text": " okay and here we're going to call that and does this does this not download it"}, {"start": 517.6, "end": 521.72, "text": " if it already exists we have to check that so a lot of this is just going to be"}, {"start": 521.72, "end": 529.24, "text": " you know beating the stuff into beating stuff into into existence so if this"}, {"start": 529.24, "end": 533.44, "text": " zip file already exists we're not going to we're not going to do anything"}, {"start": 533.44, "end": 542.48, "text": " right which leaves us open if like if the unzipping fails then we're going to"}, {"start": 542.48, "end": 551.44, "text": " be in a kind of dumb path but you know we'll risk it zip path would be that"}, {"start": 551.44, "end": 566.24, "text": " so let's if OS path exists zip path then return okay so we're good in the"}, {"start": 566.24, "end": 572.8800000000001, "text": " download script what else do we need the data set I probably already have the"}, {"start": 572.8800000000001, "end": 580.12, "text": " data set from Torch revision so that's not going to be an issue okay so here"}, {"start": 580.12, "end": 587.84, "text": " we're going to call see for 10 download dot main all right and that should do"}, {"start": 587.84, "end": 602.36, "text": " we can't really call that yet let's actually just run this download script no no"}, {"start": 602.36, "end": 607.5600000000001, "text": " such followed directory probably need to make that probably need to make that"}, {"start": 607.56, "end": 629.3199999999999, "text": " directory right okay if OS make there's models path exist okay true yeah that"}, {"start": 629.3199999999999, "end": 635.1199999999999, "text": " should be something all right and we're downloading so this is 2.4 gigabytes"}, {"start": 635.12, "end": 641.76, "text": " which can you know be put by itself let's put that over there and while that's"}, {"start": 641.76, "end": 647.84, "text": " downloading let's check out the test script actually let's check out the test"}, {"start": 647.84, "end": 658.64, "text": " script so this simply takes in this c4 10 module and instantiates a trainer and"}, {"start": 658.64, "end": 664.12, "text": " as you can see it calls test on it so this should not be too hard I'm going to"}, {"start": 664.12, "end": 669.72, "text": " guess this c4 10 module is a lightning module as you can see right here it is"}, {"start": 669.72, "end": 675.16, "text": " we know how tens of sorry pie torch lightning works if you don't know how"}, {"start": 675.16, "end": 678.76, "text": " pie torch lightning works pretty easy you configure this module right here you"}, {"start": 678.76, "end": 682.48, "text": " configure a bunch of stuff like the data sets the training step and so on and"}, {"start": 682.48, "end": 690.12, "text": " you're good to go so I guess what we're going to do is we're going to change"}, {"start": 690.12, "end": 698.72, "text": " this train script and change it to our needs okay so let's copy that let's"}, {"start": 698.72, "end": 707.28, "text": " go with train ensemble bang so this is what we're going to change all right so"}, {"start": 707.28, "end": 715.84, "text": " first if the GPUs is a string then the other yada if it's two then wow that's"}, {"start": 715.84, "end": 724.52, "text": " that's that's kind of a weird engineering quirk right here okay what I want to"}, {"start": 724.52, "end": 732.36, "text": " do is make the GPU use transparent so we'll only ever use one GPU so let's"}, {"start": 732.36, "end": 749.16, "text": " call that kuda and put that to true and then we'll say oh come on there is"}, {"start": 749.16, "end": 760.52, "text": " like a lot of stuff going on here let's so and then torch is called torch I"}, {"start": 760.52, "end": 766.1999999999999, "text": " hate that can I do this can I import it like twice with different names"}, {"start": 766.1999999999999, "end": 774.88, "text": " probably it's probably not very good but I'll do it okay so if kuda is not"}, {"start": 774.88, "end": 783.0799999999999, "text": " available we'll just set the kuda to false if th dot kuda dot is a very level"}, {"start": 783.08, "end": 791.6800000000001, "text": " okay not if it's not available then hparams dot kuda equals false and then we'll"}, {"start": 791.6800000000001, "end": 808.08, "text": " set the GPUs to zero comma I guess that's what it expects if else none and that"}, {"start": 808.08, "end": 815.12, "text": " should do it for the GPUs okay so second thing that we need we're going to"}, {"start": 815.12, "end": 823.62, "text": " need we're going fit here and there is it this logs directory where the check"}, {"start": 823.62, "end": 827.8000000000001, "text": " points are going to be saved I'm fine with that I just want to kind of remove"}, {"start": 827.8000000000001, "end": 837.84, "text": " the logs directory at the beginning so I'll do that and whenever we start this"}, {"start": 837.84, "end": 841.48, "text": " I'm going to remove the logs directory this is a controversial move but you"}, {"start": 841.48, "end": 854.6, "text": " know on remove tree recursively delete the lead to directory tree yes logs good"}, {"start": 854.6, "end": 863.8000000000001, "text": " okay our download is done so what do we do next we might want to do just try"}, {"start": 863.8, "end": 872.52, "text": " to test test something and here in the test thing we might want to set the"}, {"start": 872.52, "end": 883.04, "text": " GPUs I don't have a GPU right here so none and the data directory is going to"}, {"start": 883.04, "end": 902.4, "text": " be yeah I'll put it so nope dope dope okay it doesn't find the it doesn't find"}, {"start": 902.4, "end": 907.64, "text": " the the state dicts and so on now we're going to have to fix this we're going to"}, {"start": 907.64, "end": 917.56, "text": " have to fix the fact that it doesn't load okay okay and that's probably going to"}, {"start": 917.56, "end": 924.04, "text": " be here in these models so if I look in the dense nets for example which we"}, {"start": 924.04, "end": 928.24, "text": " can learn and there's this pre-trained argument and what's that going to be"}, {"start": 928.24, "end": 937.36, "text": " it's oh that's bad okay it like has hard code at the fact is hard code at the"}, {"start": 937.36, "end": 948.36, "text": " fact that there are there is this state dicts directory okay yeah that's"}, {"start": 948.36, "end": 954.72, "text": " terrible terrible terrible terrible terrible so I guess this is going to be in"}, {"start": 954.72, "end": 960.32, "text": " every single one of these models and that's not good so what we're going to do"}, {"start": 960.32, "end": 966.28, "text": " is probably always load it without the pre-trained and then kind of loaded"}, {"start": 966.28, "end": 972.96, "text": " ourselves from the from the correct directory so what's the correct directory"}, {"start": 972.96, "end": 978.44, "text": " again we're going to set the model dear we probably can just take that from"}, {"start": 978.44, "end": 995.2, "text": " the download script like that state dicts okay and then we want the"}, {"start": 995.2, "end": 1000.72, "text": " architecture I guess that's a thing we can actually put the classifier here"}, {"start": 1000.72, "end": 1006.8000000000001, "text": " right here that's something we can so it's going to be the classifier if you"}, {"start": 1006.8, "end": 1013.4, "text": " look in the state dicts directory I'm going to guess you can models see for"}, {"start": 1013.4, "end": 1021.52, "text": " 10 state dicts we haven't unpacked it where have we not where have we unpacked it"}, {"start": 1021.52, "end": 1037.12, "text": " to help help oh no have we unpacked it to here we have not we have not so what"}, {"start": 1037.12, "end": 1042.44, "text": " is in here it's a c4 10 models something and then state dicts okay so it's"}, {"start": 1042.44, "end": 1047.12, "text": " always going to be the architecture plus PT so we can you know we can deal"}, {"start": 1047.12, "end": 1056.2399999999998, "text": " with that so it's going to be c4 10 models state dicts that's fine and then"}, {"start": 1056.2399999999998, "end": 1064.76, "text": " it's always going to be the architecture plus PT so let's look at one of these"}, {"start": 1064.76, "end": 1071.36, "text": " models to see how this is loaded we've saw we've seen this here so we simply"}, {"start": 1071.36, "end": 1083.04, "text": " want to load this state dict in and here it constructs the thing this is let's do"}, {"start": 1083.04, "end": 1090.1599999999999, "text": " proper string interpolation shall we oh device where this device come from we"}, {"start": 1090.16, "end": 1106.92, "text": " should check that out device is given device device device device CPU"}, {"start": 1108.76, "end": 1116.92, "text": " where is device given okay dense net device CPU oh I guess device is always"}, {"start": 1116.92, "end": 1127.4, "text": " CPU and then then we map it to wherever I'm not entirely sure so here we see"}, {"start": 1127.4, "end": 1135.16, "text": " set device I guess we can just get the device from somewhere let's try it out"}, {"start": 1135.16, "end": 1151.92, "text": " okay so we're going to need this right here so we're going to OS path join"}, {"start": 1151.92, "end": 1162.0400000000002, "text": " models path and something that's dot PT so and here we're going to get the"}, {"start": 1162.04, "end": 1174.32, "text": " architecture which is the classifier cool so that's how we load something and"}, {"start": 1174.32, "end": 1185.28, "text": " then the device maybe we can just go torch kuda dot get device is that possible"}, {"start": 1185.28, "end": 1214.76, "text": " let's try no okay no no get device device maybe"}, {"start": 1215.28, "end": 1226.16, "text": " nope map location was given okay so we have to figure out where this device"}, {"start": 1226.16, "end": 1238.8, "text": " comes from honestly here no module there's this get classifier right here but"}, {"start": 1238.8, "end": 1256.12, "text": " just says pre trained device always CPU I just can't believe that I guess I'll"}, {"start": 1256.12, "end": 1271.8799999999999, "text": " believe it we'll always load to the CPU okay cool we can do that I guess"}, {"start": 1271.8799999999999, "end": 1280.12, "text": " pytorch lightning will then put it on the GPU for us cool so this is about how"}, {"start": 1280.12, "end": 1293.6, "text": " far I got when I try to do this by myself and now the problem start so missing"}, {"start": 1293.6, "end": 1305.28, "text": " keys in state dick a lot of missing stuff we can we can't possibly load that yeah no not"}, {"start": 1305.28, "end": 1326.76, "text": " going to so we can't load stuff what does it do load file name equals and then let's"}, {"start": 1326.76, "end": 1334.52, "text": " paste this and let's put some kind of break point here so we can check it out"}, {"start": 1356.76, "end": 1371.8799999999999, "text": " okay that exists no she feels like that should exist yeah that exists what's the what's"}, {"start": 1371.8799999999999, "end": 1385.2, "text": " the deal what's the matter here so we got model which is I guess a resonant 18"}, {"start": 1385.2, "end": 1395.0800000000002, "text": " and we got this thing that we might want to load so why doesn't it work torch load load"}, {"start": 1395.0800000000002, "end": 1410.4, "text": " file name see that works so that's the state dick is that let's look at its keys we got"}, {"start": 1410.4, "end": 1423.64, "text": " a bunch of stuff okay so why can't we load that model load state dick state dick and now"}, {"start": 1423.64, "end": 1439.2800000000002, "text": " unexpected keys in state dick missing keys so this is always pre-pended with model dot and here"}, {"start": 1439.28, "end": 1462.8799999999999, "text": " it's not okay what do we do about that I guess this is because we loaded ourselves okay cool"}, {"start": 1462.88, "end": 1472.48, "text": " so our model is not yes so our model has the sub path model so we need model dot model dot"}, {"start": 1472.48, "end": 1483.8400000000001, "text": " dot load state dick right look at us we made it so this is testing I guess this is this"}, {"start": 1483.84, "end": 1493.28, "text": " resonant 18 or what not so we can leave that to run for itself so we figured out how to load this"}, {"start": 1493.28, "end": 1503.36, "text": " stuff took us a while now let's go ahead and we know how to load the models we know how to"}, {"start": 1503.36, "end": 1508.6399999999999, "text": " load the weights so this is our teacher model right our teacher model is supposed to load up the"}, {"start": 1508.64, "end": 1517.2800000000002, "text": " weights and then and then teach the student models so here what is this training thing do we"}, {"start": 1517.2800000000002, "end": 1526.72, "text": " download the thing we make our GPUs to be really good okay and then we instantiate this module"}, {"start": 1526.72, "end": 1532.0, "text": " right here as you can see so now we're going to check out this module by the way the testing is"}, {"start": 1532.0, "end": 1538.88, "text": " done and as you can see there's an accuracy of 93.33 which I'm pretty happy with this is congruent"}, {"start": 1538.88, "end": 1545.68, "text": " with what we saw right here the resonant 18 do okay and we can I guess we can take a resonant 18"}, {"start": 1545.68, "end": 1551.52, "text": " or a resonant 50 they're both fairly small right here so a lot of them are going to fit on our GPUs"}, {"start": 1551.52, "end": 1559.84, "text": " once we use the GPUs so let's change this module around right here to actually do the to actually do"}, {"start": 1559.84, "end": 1566.08, "text": " the let's say the the proper thing that we wanted to do so here we have self-dot model as you can"}, {"start": 1566.08, "end": 1576.32, "text": " see and it's get classifier and the question is does it load it pre-trained so what we want to do"}, {"start": 1576.32, "end": 1583.4399999999998, "text": " is this is going to be our teacher model and this in this get classifier we want pre-trained"}, {"start": 1583.44, "end": 1590.96, "text": " to be false always right here we don't want any sort of we don't want to load the pre-trained"}, {"start": 1591.68, "end": 1599.92, "text": " instead what we want to do is we actually want to have the we want to load it ourselves right so"}, {"start": 1601.52, "end": 1606.3200000000002, "text": " here pre-trained false and now we're going from our test script we're going to take over the path"}, {"start": 1606.32, "end": 1618.48, "text": " 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"}, {"start": 1618.48, "end": 1633.9199999999998, "text": " OS that common along just fine yep yep yep so now here we're going to have our self-teacher"}, {"start": 1633.92, "end": 1642.4, "text": " model to load that state dict all right so this is it for initialization now we also need our"}, {"start": 1642.4, "end": 1647.2, "text": " student models of course so our student models are going to be a bunch of models"}, {"start": 1650.3200000000002, "end": 1661.04, "text": " models are going to be a bunch of models where what do we say so this is going to be a torch"}, {"start": 1661.04, "end": 1664.8799999999999, "text": " or a like a module list there's this module list"}, {"start": 1679.36, "end": 1689.76, "text": " torch dot nn dot module list right so I initialize that with a list and the list is going to be"}, {"start": 1689.76, "end": 1694.56, "text": " get me the classifier and we're just going to go for the same kind of classifiers right now to"}, {"start": 1694.56, "end": 1700.8, "text": " really boil it down to have the same architecture for the students and for the teachers for"}, {"start": 1703.84, "end": 1715.2, "text": " ba in range in range and here we probably need a flag so hperms dot num students"}, {"start": 1715.2, "end": 1722.48, "text": " okay so these are going to be our student models so let's quickly create this num students thing"}, {"start": 1722.48, "end": 1733.04, "text": " right here I'll probably have to have an integer and we'll go with five students for now okay so"}, {"start": 1733.04, "end": 1741.6000000000001, "text": " we're creating five students all of them are not pre-trained so we're going to are we going to"}, {"start": 1741.6, "end": 1748.08, "text": " train them from scratch or do we want actually to take over the weights we probably don't want to"}, {"start": 1748.08, "end": 1755.6, "text": " take over the weights let's just train them from scratch in a distillation mode I have no clue"}, {"start": 1755.6, "end": 1764.56, "text": " about this stuff by the way okay I guess this concludes this already concludes what we what we"}, {"start": 1764.56, "end": 1772.3999999999999, "text": " wanted to do so I guess this module list what can we do with it is anyone know I don't know by"}, {"start": 1772.3999999999999, "end": 1779.36, "text": " the way I'm sorry for the switching between the dark and the bright background I don't know how"}, {"start": 1779.36, "end": 1788.08, "text": " to fix that so PyTorch and then module list it would be nice if we could give them some names"}, {"start": 1788.08, "end": 1798.1599999999999, "text": " right so I guess that's just an iterable right here so probably there's nothing that we can do to"}, {"start": 1798.1599999999999, "end": 1804.8, "text": " give them proper names or we'd have to hack around and I don't want to do that so I guess we can"}, {"start": 1804.8, "end": 1814.3999999999999, "text": " just check if that actually computes until here so let's check it out let's try the ensemble"}, {"start": 1814.4, "end": 1824.3200000000002, "text": " it doesn't dataset not found or corrupted okay so what we'll have to do is we'll have to implement"}, {"start": 1824.8000000000002, "end": 1830.16, "text": " I'll have to change this data directory right here so the data deer is going to be"}, {"start": 1833.6000000000001, "end": 1834.5600000000002, "text": " OS this"}, {"start": 1834.56, "end": 1841.52, "text": " whatever my c410 directory is"}, {"start": 1846.24, "end": 1852.08, "text": " no such file directory logs okay so logs doesn't exist so let's actually make it"}, {"start": 1852.08, "end": 1865.04, "text": " still no such file directory logs why why doesn't it make it"}, {"start": 1868.08, "end": 1873.84, "text": " no such file directory logs okay we need to ignore errors here"}, {"start": 1873.84, "end": 1883.4399999999998, "text": " and we're good okay so it computes until the point you probably you probably can't see that right"}, {"start": 1884.0, "end": 1892.32, "text": " 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"}, {"start": 1892.32, "end": 1900.56, "text": " the point right here in our module after we've created the teacher and the students so if we"}, {"start": 1900.56, "end": 1908.8, "text": " look at self technically we should be able to see right here a whole bunch of ResNet 18s"}, {"start": 1909.84, "end": 1917.44, "text": " whole bunch so here you can see the teacher model right and I'm going to guess you can see"}, {"start": 1918.24, "end": 1922.72, "text": " layer four and here you can see the student models so the student models are going to be in a"}, {"start": 1922.72, "end": 1928.8, "text": " whole list of models and now we're going to train them so since they're initialized differently"}, {"start": 1928.8, "end": 1933.76, "text": " our hope is going to be that they're sort of going to end up at different places we're going to"}, {"start": 1933.76, "end": 1940.0, "text": " train them with the same like we're going to be really really stupid about this okay all right so"}, {"start": 1940.96, "end": 1943.28, "text": " let's be really stupid about it um"}, {"start": 1945.84, "end": 1950.24, "text": " so what what are we gonna have to change here is our training step and our training step is"}, {"start": 1950.24, "end": 1958.1599999999999, "text": " actually fine we'll simply forward we'll get a loss from that and then we are going to return"}, {"start": 1958.16, "end": 1965.1200000000001, "text": " that and that's going to be back propped so in our optimizer wherever we initialize our optimizer"}, {"start": 1965.1200000000001, "end": 1971.52, "text": " we should probably give it the parameters that are not only the student model parameters right not"}, {"start": 1971.52, "end": 1973.8400000000001, "text": " the teacher model parameters um"}, {"start": 1978.24, "end": 1986.24, "text": " so it should only train the student models okay and even even like that we should probably"}, {"start": 1986.24, "end": 1995.36, "text": " always set the teacher model in in eval mode um but we'll do that in the forward step right here"}, {"start": 1995.36, "end": 2001.92, "text": " so in the forward step we get images and labels and here it runs it just forward through the model"}, {"start": 2001.92, "end": 2009.92, "text": " we want to change that we actually want to have teacher predictions which we're going to have the"}, {"start": 2009.92, "end": 2015.28, "text": " teacher model we're going to forward this through the teacher models now the criterion I'm going to"}, {"start": 2015.28, "end": 2021.2, "text": " guess is a cross entropy so the predictions here are actually going to be log it's right and this is"}, {"start": 2022.72, "end": 2032.24, "text": " this is good except that what we want to do is have a distribution of over labels so"}, {"start": 2032.8, "end": 2038.8799999999999, "text": " after the teacher here runs through and let's put a break point right here and actually look at it"}, {"start": 2038.88, "end": 2048.4, "text": " I find it's always easy if you go and just run um until the point where you are at the code"}, {"start": 2048.4, "end": 2053.76, "text": " and then you can just look at stuff so here there's oh there's a validation sanity check"}, {"start": 2054.56, "end": 2060.88, "text": " okay probably don't want that and now we have the break right here and now we can look at"}, {"start": 2060.88, "end": 2069.52, "text": " teacher predictions dot shape so that's a batch size times 10 and if we look at it I'm going to"}, {"start": 2069.52, "end": 2073.2000000000003, "text": " guess there's some negative numbers in there so that's not going to be that those are going to be"}, {"start": 2073.2000000000003, "end": 2080.7200000000003, "text": " log it's now we want them that to be a soft max over the last dimension and that's going to be"}, {"start": 2080.7200000000003, "end": 2086.4, "text": " of the same shape but of course now we're going to have a proper distribution so if we sum over"}, {"start": 2086.4, "end": 2091.6800000000003, "text": " the last dimension you should see a bunch of ones all right so the teacher predictions are going to be"}, {"start": 2093.6800000000003, "end": 2104.08, "text": " soft max over the last dimension and since we don't want to backprop through the teacher"}, {"start": 2104.08, "end": 2112.2400000000002, "text": " we can do this in an environment of no grad right here so we have that with"}, {"start": 2112.24, "end": 2118.56, "text": " not being stupid and we also set the teacher modeling to eval mode so"}, {"start": 2121.7599999999998, "end": 2126.24, "text": " I guess that does it set train no"}, {"start": 2130.9599999999996, "end": 2138.08, "text": " that should do it I have no idea um yeah let's let's run it again"}, {"start": 2138.08, "end": 2148.96, "text": " uh we could have done that there okay so so far so good so we have the teacher predictions now"}, {"start": 2149.52, "end": 2156.72, "text": " what we need to do is run them through the student and use them as labels so we'll go for student"}, {"start": 2156.72, "end": 2167.68, "text": " in student models I will go student forward or we simply run the images through that"}, {"start": 2170.16, "end": 2180.24, "text": " and that gives us the log it's and then we use our loss function on the log it's"}, {"start": 2180.24, "end": 2190.7999999999997, "text": " and not the labels but the teacher predictions right so we never actually use the labels here as you can see"}, {"start": 2193.52, "end": 2200.0, "text": " and that's going to be the student loss and now we have a bunch of losses"}, {"start": 2203.04, "end": 2204.64, "text": " and we're going to append that"}, {"start": 2204.64, "end": 2211.6, "text": " uh nope dot"}, {"start": 2216.08, "end": 2222.7999999999997, "text": " like this and our loss is simply going to be the sum of all the student losses"}, {"start": 2225.92, "end": 2227.6, "text": " not even the average I guess we could"}, {"start": 2227.6, "end": 2238.08, "text": " uh losses I guess we could make it the average just so if we change the number of students um"}, {"start": 2238.08, "end": 2246.7999999999997, "text": " we'll we'll get some kind of some sort of a better sense of the the actual numbers what what what"}, {"start": 2246.7999999999997, "end": 2251.04, "text": " what okay I think over here we're good yeah so"}, {"start": 2251.04, "end": 2260.16, "text": " so the our teacher model is not in training mode but our student models hopefully"}, {"start": 2262.4, "end": 2268.32, "text": " or in training mode no is this the eval pass I guess this is the eval pass this is the validation"}, {"start": 2268.32, "end": 2276.24, "text": " sanity check pass okay so this is going to be our loss and our accuracy now writes okay"}, {"start": 2276.24, "end": 2283.7599999999998, "text": " what's going to be our accuracy our accuracy is going to be we have these student losses all of them"}, {"start": 2284.3999999999996, "end": 2291.2799999999997, "text": " and what we are going to do is we're simply going to take the maximum prediction across the"}, {"start": 2291.2799999999997, "end": 2298.3999999999996, "text": " students uh per easy per easy but we need to collect the log it's so"}, {"start": 2298.4, "end": 2313.12, "text": " come on so we'll also have the log it's append the student"}, {"start": 2315.04, "end": 2322.48, "text": " log it's okay so we have a whole bunch of log it's right here and we'll get some predictions"}, {"start": 2322.48, "end": 2329.84, "text": " out of that now the question is do we want to simply take the mode or do we actually want to run"}, {"start": 2329.84, "end": 2337.44, "text": " as softmax over each and then take the average prediction I'm not super super sure but"}, {"start": 2338.72, "end": 2345.28, "text": " we can try to do it in different different ways so right now we might just want to take the"}, {"start": 2345.28, "end": 2352.5600000000004, "text": " maybe the average log it and then run a softmax on top of that because I'm going to guess the"}, {"start": 2352.5600000000004, "end": 2360.7200000000003, "text": " log it's our outputs of a linear layer so they might behave more in a linear fashion than if we were"}, {"start": 2360.7200000000003, "end": 2372.7200000000003, "text": " to average the actual probabilities that come out right maybe let's let's do this okay so"}, {"start": 2372.72, "end": 2380.0, "text": " we'll go we'll take these log it's they're all when we need to somehow concatenate those um"}, {"start": 2382.72, "end": 2383.6, "text": " or stack them"}, {"start": 2386.3199999999997, "end": 2392.48, "text": " so how we're going to stack them so they're 250 they're batch size by number of classes so"}, {"start": 2393.04, "end": 2398.64, "text": " we'll just stack them at dimension zero I guess that's fine and then we are going to"}, {"start": 2398.64, "end": 2404.0, "text": " mean also cross dimension zero so those are going to be our"}, {"start": 2405.3599999999997, "end": 2412.4, "text": " log it's our final log it's and then our predictions are going to be the argmax"}, {"start": 2412.4, "end": 2426.2400000000002, "text": " of the log it's in the last dimension yep that should be pretty straightforward"}, {"start": 2429.6, "end": 2441.52, "text": " I guess that's it easy as that um yes the rest here should just do by itself and I'm going to go"}, {"start": 2441.52, "end": 2450.56, "text": " ahead and run give this another run and see where we run into problems can't really see how this could"}, {"start": 2450.56, "end": 2461.04, "text": " ever go wrong we'll just take everything over okay we actually got a problem one D target tense"}, {"start": 2461.04, "end": 2467.84, "text": " expected multi target not supported so the cross entropy loss in PyTorch does not support that"}, {"start": 2467.84, "end": 2477.44, "text": " um let's let's give it a shot make this a little bigger for you and let's go for the cross"}, {"start": 2479.84, "end": 2489.6800000000003, "text": " p loss I can't type today so here we have the cross entropy loss and the cross entropy loss"}, {"start": 2489.6800000000003, "end": 2494.08, "text": " is useful when training cross for his problem with the classes yada yada yada wait should we want"}, {"start": 2494.08, "end": 2501.2, "text": " the yada yada yada okay criterion expects a class index as the target okay"}, {"start": 2504.7999999999997, "end": 2511.36, "text": " so what we need is like a soft loss right we don't need this cross entropy loss we actually want"}, {"start": 2512.24, "end": 2520.7999999999997, "text": " we want to have soft targets so what do we do we want to do I think the cross entropy loss is"}, {"start": 2520.8, "end": 2529.1200000000003, "text": " a combination of the here of the log soft max and the NLL loss can we take the NLL loss maybe"}, {"start": 2531.6000000000004, "end": 2542.4, "text": " so the NLL loss right here is going to be the target that this loss expect should be a class index"}, {"start": 2542.4, "end": 2552.8, "text": " no okay that's not good so next let's go do we have"}, {"start": 2557.04, "end": 2562.64, "text": " we we somehow need a soft cross entropy loss let's search for that PyTorch"}, {"start": 2562.64, "end": 2575.2, "text": " um soft cross entropy soft classes I guess people do that kind of stuff so"}, {"start": 2578.56, "end": 2585.2799999999997, "text": " the the problem with these kind of losses is that what you do what you have to do is kind of"}, {"start": 2585.28, "end": 2594.88, "text": " protect yourself against um against numerical instabilities right so what we want to do is"}, {"start": 2596.4, "end": 2602.88, "text": " find a function that does this for us I guess if we do the lot the the log soft max that should"}, {"start": 2603.44, "end": 2611.92, "text": " take care of it for us okay this is tensor flow uh okay"}, {"start": 2611.92, "end": 2613.92, "text": " okay"}, {"start": 2615.2000000000003, "end": 2624.56, "text": " following thread cross entropy loss I guess people just do really the log soft max and then do that"}, {"start": 2631.52, "end": 2636.64, "text": " and we should be fine with this okay thanks uh k frank"}, {"start": 2636.64, "end": 2648.16, "text": " yeah maybe maybe this has advanced since then so we can give like a last look at this and this"}, {"start": 2648.16, "end": 2657.92, "text": " is a bit too big I'm sorry your eyes are gonna have to suffer and we're going to look at loss functions"}, {"start": 2657.92, "end": 2668.16, "text": " and we're going to just look through them multi label soft margin loss"}, {"start": 2669.2000000000003, "end": 2680.48, "text": " mm multi label we don't really want multi label right we want this but not with the targets"}, {"start": 2680.48, "end": 2690.08, "text": " okay I guess we're just gonna have to write this ourselves so ultimately what is the cross"}, {"start": 2690.08, "end": 2698.48, "text": " entropy cross entropy is simply the uh probability of the true label times the log probability of the"}, {"start": 2699.92, "end": 2705.44, "text": " wrong or or the predicted label yeah if you as you see right here so we're going to simply"}, {"start": 2705.44, "end": 2714.4, "text": " multiply target times the log probability of the predicted label and then um some some"}, {"start": 2714.4, "end": 2722.7200000000003, "text": " dot take that mean across the batch I guess yeah that should do we can implement this"}, {"start": 2724.7200000000003, "end": 2733.84, "text": " let's do it so this criterion right here is going to be our loss function and that's only used once"}, {"start": 2733.84, "end": 2744.96, "text": " so what we can do is going to be a function um to do do do do do do do do do do do do"}, {"start": 2744.96, "end": 2753.6800000000003, "text": " so we're going to take student logids and we're going to take teacher probabilities okay"}, {"start": 2755.76, "end": 2762.6400000000003, "text": " so how's that gonna work out we're going to do the log soft max from the student logids so"}, {"start": 2762.64, "end": 2769.48, "text": " So n and dot, that exists log softmax functional."}, {"start": 2769.48, "end": 2770.56, "text": " OK, we need functional."}, {"start": 2775.16, "end": 2780.56, "text": " And student logits of that dimension."}, {"start": 2780.56, "end": 2784.92, "text": " So now we have properly normalized student logit."}, {"start": 2784.92, "end": 2789.4, "text": " So that's going to be student log probs."}, {"start": 2789.4, "end": 2792.6, "text": " And then what we want to do is simply multiply the teacher"}, {"start": 2792.6, "end": 2797.2000000000003, "text": " probs times the student log probs."}, {"start": 2797.2000000000003, "end": 2803.4, "text": " And the negative of that is going to be our loss."}, {"start": 2803.4, "end": 2808.2400000000002, "text": " The question is, do we want to sum that, I guess,"}, {"start": 2808.2400000000002, "end": 2816.7200000000003, "text": " across this dimension or mean it?"}, {"start": 2816.72, "end": 2819.6, "text": " I guess some sum should do."}, {"start": 2819.6, "end": 2822.7999999999997, "text": " All right, this is it."}, {"start": 2822.7999999999997, "end": 2823.64, "text": " Easy as that."}, {"start": 2823.64, "end": 2827.8399999999997, "text": " Why have we searched for so long?"}, {"start": 2827.8399999999997, "end": 2831.7999999999997, "text": " So the criterion, we can simply replace that now by our loss"}, {"start": 2831.7999999999997, "end": 2832.12, "text": " function."}, {"start": 2835.12, "end": 2836.2, "text": " Cool."}, {"start": 2836.2, "end": 2837.3999999999996, "text": " So let's run it again."}, {"start": 2842.72, "end": 2844.3999999999996, "text": " Yada, yada, yada."}, {"start": 2844.3999999999996, "end": 2845.3199999999997, "text": " OK."}, {"start": 2845.32, "end": 2846.32, "text": " So I need to check."}, {"start": 2849.1600000000003, "end": 2851.4, "text": " Maybe we should have taken a smaller model."}, {"start": 2851.4, "end": 2854.56, "text": " It sometimes pays off to start with a really small model,"}, {"start": 2854.56, "end": 2861.1600000000003, "text": " small model, just so you can do these kind of things fast."}, {"start": 2861.1600000000003, "end": 2866.92, "text": " So here we have dimension out of range,"}, {"start": 2866.92, "end": 2870.6000000000004, "text": " to do, which is where is that?"}, {"start": 2870.6000000000004, "end": 2874.88, "text": " In forward, in line 78, let's go there."}, {"start": 2874.88, "end": 2875.88, "text": " In line 78."}, {"start": 2878.6, "end": 2880.1600000000003, "text": " OK."}, {"start": 2880.1600000000003, "end": 2884.04, "text": " Here, the max is not going to be as much fun."}, {"start": 2884.04, "end": 2885.0, "text": " Let's go there."}, {"start": 2885.0, "end": 2886.7200000000003, "text": " I think this is some of these things"}, {"start": 2886.7200000000003, "end": 2889.2000000000003, "text": " change over time in PyTorch."}, {"start": 2889.2000000000003, "end": 2893.08, "text": " So this code might be written when, you know."}, {"start": 2893.08, "end": 2898.1600000000003, "text": " So what we have is we have a max over the predictions."}, {"start": 2898.1600000000003, "end": 2903.04, "text": " And the predictions is already an arg max."}, {"start": 2903.04, "end": 2907.36, "text": " So I guess we can remove this all."}, {"start": 2907.36, "end": 2910.2799999999997, "text": " Whether or not that agrees with labels.data,"}, {"start": 2910.2799999999997, "end": 2916.08, "text": " we don't need any of that.float."}, {"start": 2916.08, "end": 2919.72, "text": " And we also don't need that."}, {"start": 2919.72, "end": 2925.12, "text": " So the accuracy is simply going to be the mean of this."}, {"start": 2925.12, "end": 2927.32, "text": " No?"}, {"start": 2927.32, "end": 2927.84, "text": " I guess."}, {"start": 2927.84, "end": 2929.16, "text": " So we're here."}, {"start": 2929.16, "end": 2935.3999999999996, "text": " And we just do predictions equals labels."}, {"start": 2935.3999999999996, "end": 2936.48, "text": " Yes."}, {"start": 2936.48, "end": 2940.92, "text": " And we want the sum of that."}, {"start": 2946.0, "end": 2949.24, "text": " Actually, we want the float first."}, {"start": 2949.24, "end": 2951.8399999999997, "text": " And then we want the mean."}, {"start": 2951.8399999999997, "end": 2953.16, "text": " Yeah, that seems reasonable."}, {"start": 2953.16, "end": 2954.3999999999996, "text": " So let's do it like this."}, {"start": 2954.4, "end": 2955.4, "text": " Yeah."}, {"start": 2955.4, "end": 2956.4, "text": " Yeah."}, {"start": 2956.4, "end": 2957.4, "text": " Yeah."}, {"start": 2957.4, "end": 2958.4, "text": " Yeah."}, {"start": 2958.4, "end": 2959.4, "text": " Float mean."}, {"start": 2959.4, "end": 2960.4, "text": " Perfect."}, {"start": 2960.4, "end": 2965.88, "text": " How could this be any more easy?"}, {"start": 2965.88, "end": 2969.6800000000003, "text": " But this right here is all of it."}, {"start": 2969.6800000000003, "end": 2971.6800000000003, "text": " So validation step."}, {"start": 2971.6800000000003, "end": 2973.6800000000003, "text": " It's a accuracy."}, {"start": 2973.6800000000003, "end": 2974.92, "text": " Correct."}, {"start": 2974.92, "end": 2978.88, "text": " We'll just look at it once we done it."}, {"start": 2978.88, "end": 2984.1600000000003, "text": " And what I do is usually just run it until it doesn't give me any mistakes anymore."}, {"start": 2984.16, "end": 2986.64, "text": " And then I know I have succeeded."}, {"start": 3014.16, "end": 3025.16, "text": " OK."}, {"start": 3025.16, "end": 3027.04, "text": " We're pretty close, I feel."}, {"start": 3027.04, "end": 3034.16, "text": " So it says grad can implicitly create it only for scalar outputs, which probably means"}, {"start": 3034.16, "end": 3037.16, "text": " our loss function is not a scalar."}, {"start": 3037.16, "end": 3042.7999999999997, "text": " So when we return the loss right here, here we have the sum of the losses divided by the"}, {"start": 3042.8, "end": 3044.1200000000003, "text": " length of the losses."}, {"start": 3044.1200000000003, "end": 3055.44, "text": " Let's go here and check out what's up with that."}, {"start": 3055.44, "end": 3062.0, "text": " So what will do I see this loss function here will output basically one loss for each"}, {"start": 3062.0, "end": 3063.0800000000004, "text": " date point."}, {"start": 3063.0800000000004, "end": 3072.7200000000003, "text": " So what we need to do, I guess, is call mean on this or sum when they created the criterion"}, {"start": 3072.72, "end": 3073.8799999999997, "text": " in the original one."}, {"start": 3073.8799999999997, "end": 3078.52, "text": " Now we've thrown it away."}, {"start": 3078.52, "end": 3081.3999999999996, "text": " Look at the get diff right here."}, {"start": 3081.3999999999996, "end": 3095.12, "text": " So I guess this reduces, how does this reduce the cross entropy loss when we don't do anything?"}, {"start": 3095.12, "end": 3099.12, "text": " Cross entropy loss reduces reduction mean."}, {"start": 3099.12, "end": 3100.12, "text": " OK."}, {"start": 3100.12, "end": 3104.56, "text": " So let's reduce with the mean."}, {"start": 3104.56, "end": 3109.44, "text": " So if we call loss, then after that we should call mean."}, {"start": 3109.44, "end": 3114.44, "text": " And then here, I'm not so sure anymore we should divide here because the learning rate"}, {"start": 3114.44, "end": 3117.16, "text": " is kind of tuned to the original loss size."}, {"start": 3117.16, "end": 3123.08, "text": " So I guess we'll be content for now with summing up these things."}, {"start": 3123.08, "end": 3127.56, "text": " And over here, I guess we've solved that, right?"}, {"start": 3127.56, "end": 3130.56, "text": " No losses."}, {"start": 3130.56, "end": 3135.36, "text": " Yeah, see our losses is going to be an entire tensor."}, {"start": 3135.36, "end": 3139.2, "text": " And now we just fix that right now."}, {"start": 3139.2, "end": 3140.44, "text": " OK."}, {"start": 3140.44, "end": 3143.64, "text": " So let's try it again."}, {"start": 3143.64, "end": 3145.48, "text": " In the meantime, what can we do?"}, {"start": 3145.48, "end": 3146.96, "text": " We can."}, {"start": 3146.96, "end": 3150.16, "text": " So we already take care of our GPU."}, {"start": 3150.16, "end": 3152.2, "text": " We take care of the logs."}, {"start": 3152.2, "end": 3161.24, "text": " One thing to do with respect to this download stuff right here is if you have a server"}, {"start": 3161.24, "end": 3166.2, "text": " or something and you let a lot of things run in parallel, what you want to do is make"}, {"start": 3166.2, "end": 3170.52, "text": " sure they don't all download the same stuff at the same time."}, {"start": 3170.52, "end": 3171.8799999999997, "text": " That's pretty bad."}, {"start": 3171.8799999999997, "end": 3176.68, "text": " So what you want to do is ideally have some sort of locks such that they coordinate."}, {"start": 3176.68, "end": 3178.8399999999997, "text": " And I usually use a file lock for this."}, {"start": 3178.84, "end": 3189.56, "text": " So I'm going to create that right here from the file lock."}, {"start": 3189.56, "end": 3194.92, "text": " And then I simply create the lock."}, {"start": 3194.92, "end": 3197.1200000000003, "text": " Let's go file lock."}, {"start": 3197.1200000000003, "end": 3202.32, "text": " And here you have to input a file."}, {"start": 3202.32, "end": 3210.6400000000003, "text": " Sometimes like, yeah, data lock."}, {"start": 3210.6400000000003, "end": 3211.6400000000003, "text": " I don't know."}, {"start": 3211.6400000000003, "end": 3218.84, "text": " You just pick some file and that's the file that these processes are going to sync on."}, {"start": 3218.84, "end": 3230.2000000000003, "text": " And then once you do this, you simply wrap all of it in a with lock."}, {"start": 3230.2, "end": 3237.2, "text": " So only one at a time can go in in this function."}, {"start": 3237.2, "end": 3240.24, "text": " All right."}, {"start": 3240.24, "end": 3241.72, "text": " So that's that."}, {"start": 3241.72, "end": 3244.56, "text": " That should make us safe."}, {"start": 3244.56, "end": 3247.52, "text": " And right here we're now training."}, {"start": 3247.52, "end": 3249.0, "text": " This is excellent."}, {"start": 3249.0, "end": 3251.56, "text": " We are training the students."}, {"start": 3251.56, "end": 3256.08, "text": " Now we need to do that on an actual GPU."}, {"start": 3256.08, "end": 3260.04, "text": " So I have multiple tools to ship this to a GPU."}, {"start": 3260.04, "end": 3271.0, "text": " So first of all, I can try to ship this to a let's say to one GPU."}, {"start": 3271.0, "end": 3277.16, "text": " So the way you do that is first of all, I want some sort of unbuffered version of Python."}, {"start": 3277.16, "end": 3283.6, "text": " And then I have this to I do have the tool."}, {"start": 3283.6, "end": 3284.6, "text": " Okay."}, {"start": 3284.6, "end": 3294.6, "text": " So I'm going to call one of our servers."}, {"start": 3294.6, "end": 3297.52, "text": " And we don't know what's going on."}, {"start": 3297.52, "end": 3298.52, "text": " Okay."}, {"start": 3298.52, "end": 3306.64, "text": " So cannot import name seed everything from PyTorch Lightning."}, {"start": 3306.64, "end": 3307.64, "text": " Seed everything."}, {"start": 3307.64, "end": 3313.16, "text": " Is that some kind of new thing in PyTorch Lightning?"}, {"start": 3313.16, "end": 3322.6, "text": " I guess I have it apparently."}, {"start": 3322.6, "end": 3327.16, "text": " So here."}, {"start": 3327.16, "end": 3329.12, "text": " Seed everything with zero."}, {"start": 3329.12, "end": 3330.12, "text": " Why?"}, {"start": 3330.12, "end": 3332.92, "text": " I don't need that."}, {"start": 3332.92, "end": 3335.2799999999997, "text": " We are running without any seed here."}, {"start": 3335.2799999999997, "end": 3337.8399999999997, "text": " We are being really cool."}, {"start": 3337.8399999999997, "end": 3338.8399999999997, "text": " Okay."}, {"start": 3338.8399999999997, "end": 3340.3599999999997, "text": " Next mistake."}, {"start": 3340.3599999999997, "end": 3341.3599999999997, "text": " Cannot."}, {"start": 3341.3599999999997, "end": 3342.3599999999997, "text": " Okay."}, {"start": 3342.36, "end": 3343.36, "text": " Same mistake."}, {"start": 3343.36, "end": 3345.36, "text": " Of course, since we don't."}, {"start": 3345.36, "end": 3347.36, "text": " Yep."}, {"start": 3347.36, "end": 3354.52, "text": " Next mistake."}, {"start": 3354.52, "end": 3356.6, "text": " We'll just go through the mistake."}, {"start": 3356.6, "end": 3357.6, "text": " Learning rate."}, {"start": 3357.6, "end": 3358.6, "text": " Learning rate."}, {"start": 3358.6, "end": 3360.6, "text": " Loggers."}, {"start": 3360.6, "end": 3365.1600000000003, "text": " So I guess we need to update PyTorch Lightning on the servers."}, {"start": 3365.1600000000003, "end": 3367.6, "text": " And I'll do that quickly."}, {"start": 3367.6, "end": 3368.6, "text": " Okay."}, {"start": 3368.6, "end": 3370.96, "text": " I've updated PyTorch Lightning."}, {"start": 3370.96, "end": 3374.32, "text": " Let's check out whether or not we can actually run something."}, {"start": 3374.32, "end": 3375.32, "text": " Yeah."}, {"start": 3375.32, "end": 3376.4, "text": " We can run something."}, {"start": 3376.4, "end": 3379.92, "text": " So this again is now downloading this on the server."}, {"start": 3379.92, "end": 3383.32, "text": " While this is happening, there's another thing we can do."}, {"start": 3383.32, "end": 3391.36, "text": " Namely, I have sort of sort of made a system to run stuff on servers, which I like a lot"}, {"start": 3391.36, "end": 3394.0, "text": " honestly."}, {"start": 3394.0, "end": 3396.44, "text": " So I guess we can try this out."}, {"start": 3396.44, "end": 3398.2400000000002, "text": " How do I hidden?"}, {"start": 3398.2400000000002, "end": 3400.04, "text": " Oh, with I."}, {"start": 3400.04, "end": 3401.04, "text": " Okay."}, {"start": 3401.04, "end": 3406.12, "text": " So I want to, first of all, delete this."}, {"start": 3406.12, "end": 3407.12, "text": " Delete this."}, {"start": 3407.12, "end": 3408.12, "text": " Yes."}, {"start": 3408.12, "end": 3412.6, "text": " Ah, yes, delete this."}, {"start": 3412.6, "end": 3415.12, "text": " Cool."}, {"start": 3415.12, "end": 3418.2799999999997, "text": " And this Git folder is a bit annoying."}, {"start": 3418.2799999999997, "end": 3425.12, "text": " Let's restructure because otherwise it will always ship the Git folder with everything up"}, {"start": 3425.12, "end": 3426.12, "text": " here."}, {"start": 3426.12, "end": 3427.12, "text": " Does it do that?"}, {"start": 3427.12, "end": 3432.64, "text": " Yeah, I don't like to have the code in the top level."}, {"start": 3432.64, "end": 3441.8399999999997, "text": " So quickly make a sources directory, move everything in there."}, {"start": 3441.8399999999997, "end": 3451.8399999999997, "text": " So move the C410 models into the source directory, move all the Python files into the source"}, {"start": 3451.8399999999997, "end": 3452.8399999999997, "text": " directory."}, {"start": 3452.8399999999997, "end": 3453.8399999999997, "text": " Nope."}, {"start": 3453.84, "end": 3463.08, "text": " Clear the logs and we're much better, much better."}, {"start": 3463.08, "end": 3466.56, "text": " Okay."}, {"start": 3466.56, "end": 3470.2000000000003, "text": " Much better."}, {"start": 3470.2000000000003, "end": 3476.2000000000003, "text": " So what we, what we will do is my system requires like a file and I'm just going to copy"}, {"start": 3476.2, "end": 3486.2, "text": " one from another project quickly."}, {"start": 3486.2, "end": 3495.4399999999996, "text": " Okay."}, {"start": 3495.4399999999996, "end": 3498.96, "text": " So we're back and I copied that over."}, {"start": 3498.96, "end": 3505.68, "text": " As you can see, you basically give hyper parameters and it blasts the hyper parameters"}, {"start": 3505.68, "end": 3508.04, "text": " through in a kind of a random search fashion."}, {"start": 3508.04, "end": 3510.56, "text": " It's not too sophisticated but we can work with it."}, {"start": 3510.56, "end": 3517.16, "text": " So 10, that's the file right."}, {"start": 3517.16, "end": 3521.72, "text": " See for 10 train ensemble."}, {"start": 3521.72, "end": 3523.64, "text": " Yes, that's the file."}, {"start": 3523.64, "end": 3525.52, "text": " Cool."}, {"start": 3525.52, "end": 3532.96, "text": " And here we're just going to put all of our hyper parameters."}, {"start": 3532.96, "end": 3535.88, "text": " And that will remove the logs file."}, {"start": 3535.88, "end": 3539.96, "text": " I'm okay with that but want this."}, {"start": 3539.96, "end": 3543.96, "text": " Okay."}, {"start": 3543.96, "end": 3550.12, "text": " Cool."}, {"start": 3550.12, "end": 3552.6, "text": " So what do we want?"}, {"start": 3552.6, "end": 3558.32, "text": " We want basically we just want to try it like a bunch of times and then see like average"}, {"start": 3558.32, "end": 3559.64, "text": " across it."}, {"start": 3559.64, "end": 3560.64, "text": " Right."}, {"start": 3560.64, "end": 3562.12, "text": " That's all."}, {"start": 3562.12, "end": 3566.64, "text": " We want the architecture to change."}, {"start": 3566.64, "end": 3582.8399999999997, "text": " So let's say the classifier is a ResNet 18 or a ResNet 34 or a ResNet 50."}, {"start": 3582.8399999999997, "end": 3586.0, "text": " Just so we have a bunch of stuff to do."}, {"start": 3586.0, "end": 3592.88, "text": " Okay, and this downloaded and is training on GPU."}, {"start": 3592.88, "end": 3594.36, "text": " Hopefully."}, {"start": 3594.36, "end": 3600.0, "text": " If this works, then we can ship this off and we'll make this other hyper parameter that"}, {"start": 3600.0, "end": 3605.44, "text": " I like to use called rep, which is just basically a dummy parameter."}, {"start": 3605.44, "end": 3610.16, "text": " And so I can just repeat the experiment a bunch of times."}, {"start": 3610.16, "end": 3614.16, "text": " And let's put that in here."}, {"start": 3614.16, "end": 3622.44, "text": " So this is really this has no effect except for randomizing it a bit."}, {"start": 3622.44, "end": 3626.08, "text": " I guess we can try to seed stuff."}, {"start": 3626.08, "end": 3631.24, "text": " So whenever it says seed everything, we'll just seed it with this."}, {"start": 3631.24, "end": 3635.24, "text": " Call it seed."}, {"start": 3635.24, "end": 3639.3599999999997, "text": " No."}, {"start": 3639.3599999999997, "end": 3641.92, "text": " Is it here?"}, {"start": 3641.92, "end": 3643.44, "text": " This seed everything?"}, {"start": 3643.44, "end": 3644.44, "text": " Yeah."}, {"start": 3644.44, "end": 3646.6, "text": " So hparams.reps."}, {"start": 3646.6, "end": 3648.04, "text": " Sorry seed."}, {"start": 3648.04, "end": 3650.84, "text": " Cool."}, {"start": 3650.84, "end": 3655.08, "text": " What this this is doing something."}, {"start": 3655.08, "end": 3656.4, "text": " Nice."}, {"start": 3656.4, "end": 3657.92, "text": " You can see it."}, {"start": 3657.92, "end": 3660.2000000000003, "text": " So this is unbuffered Python output."}, {"start": 3660.2000000000003, "end": 3662.2000000000003, "text": " Thanks."}, {"start": 3662.2000000000003, "end": 3664.8, "text": " Yeah."}, {"start": 3664.8, "end": 3668.48, "text": " So what other classifiers do we have?"}, {"start": 3668.48, "end": 3673.44, "text": " We can try a bunch of them."}, {"start": 3673.44, "end": 3675.4, "text": " We can try all of them."}, {"start": 3675.4, "end": 3678.76, "text": " Why don't we try all of them?"}, {"start": 3678.76, "end": 3683.76, "text": " Like this, then what's going to this rat file?"}, {"start": 3683.76, "end": 3685.16, "text": " I don't know why I called it rat."}, {"start": 3685.16, "end": 3693.16, "text": " I just want it like some three letter thing."}, {"start": 3693.16, "end": 3696.16, "text": " So yep."}, {"start": 3696.16, "end": 3697.16, "text": " Like this."}, {"start": 3697.16, "end": 3704.24, "text": " Then we can just take all of that crap and delete it and delete this."}, {"start": 3704.24, "end": 3706.2799999999997, "text": " And those are going to be all our models."}, {"start": 3706.2799999999997, "end": 3711.0, "text": " So our classifiers going to consist of all of this stuff."}, {"start": 3711.0, "end": 3715.48, "text": " Let's."}, {"start": 3715.48, "end": 3719.0, "text": " I know, I know, I know, I suck at them."}, {"start": 3719.0, "end": 3721.3599999999997, "text": " Don't tell me."}, {"start": 3721.3599999999997, "end": 3722.68, "text": " Actually tell me."}, {"start": 3722.68, "end": 3729.8399999999997, "text": " I want Vim tips trying to learn something new like each week in Vim, but it is hard."}, {"start": 3729.8399999999997, "end": 3732.3199999999997, "text": " And then to make myself actually do it."}, {"start": 3732.3199999999997, "end": 3734.68, "text": " So let's go."}, {"start": 3734.68, "end": 3736.72, "text": " Let's go with just one repetition."}, {"start": 3736.72, "end": 3742.04, "text": " So for if we are not sure we can still up the number of repetitions, we don't even have"}, {"start": 3742.04, "end": 3743.04, "text": " the rep right now."}, {"start": 3743.04, "end": 3745.16, "text": " This is called seed."}, {"start": 3745.16, "end": 3747.2, "text": " All right."}, {"start": 3747.2, "end": 3750.3199999999997, "text": " So we have different classifiers."}, {"start": 3750.32, "end": 3756.92, "text": " And what we're going to need, we also have this num students, right?"}, {"start": 3756.92, "end": 3766.76, "text": " Let's go with one with five and with 20."}, {"start": 3766.76, "end": 3773.0800000000004, "text": " So here we got one epoch done and we get a validation loss."}, {"start": 3773.0800000000004, "end": 3778.36, "text": " Do we get a validation accuracy validating validating?"}, {"start": 3778.36, "end": 3780.2400000000002, "text": " I have no idea."}, {"start": 3780.24, "end": 3784.68, "text": " Go cancel this right now."}, {"start": 3784.68, "end": 3789.7999999999997, "text": " And we'll go ahead and just blast this onto our servers."}, {"start": 3789.7999999999997, "end": 3791.9599999999996, "text": " And hopefully that's going to work."}, {"start": 3791.9599999999996, "end": 3795.08, "text": " I have no idea."}, {"start": 3795.08, "end": 3798.4399999999996, "text": " Is everything fine?"}, {"start": 3798.4399999999996, "end": 3800.7999999999997, "text": " Everything's fine."}, {"start": 3800.7999999999997, "end": 3803.04, "text": " Go."}, {"start": 3803.04, "end": 3814.44, "text": " Do what?"}, {"start": 3814.44, "end": 3821.88, "text": " Cool."}, {"start": 3821.88, "end": 3825.56, "text": " And let me get back to you once this is finished."}, {"start": 3825.56, "end": 3826.56, "text": " All right."}, {"start": 3826.56, "end": 3827.56, "text": " We're back."}, {"start": 3827.56, "end": 3832.7599999999998, "text": " So I've just written some code here to extract the results of that run."}, {"start": 3832.76, "end": 3836.1200000000003, "text": " And something, you know, it's pretty interesting what came out."}, {"start": 3836.1200000000003, "end": 3841.6000000000004, "text": " So in these plots, you'll see on the xx, you have the number of students in the ensemble."}, {"start": 3841.6000000000004, "end": 3844.76, "text": " Remember, these students are all trained from the same teacher."}, {"start": 3844.76, "end": 3846.6800000000003, "text": " The teacher you can see in orange."}, {"start": 3846.6800000000003, "end": 3849.88, "text": " That's just a single teacher for reference."}, {"start": 3849.88, "end": 3855.84, "text": " You can see that if you have one student model, it sometimes underperforms or sometimes"}, {"start": 3855.84, "end": 3859.92, "text": " outperforms the single teacher model."}, {"start": 3859.92, "end": 3864.84, "text": " But then if you have more student models, you can see that there is a pretty monotonic"}, {"start": 3864.84, "end": 3866.08, "text": " relationship."}, {"start": 3866.08, "end": 3872.2000000000003, "text": " So here it's the reason this doesn't finish here is because there's not enough space"}, {"start": 3872.2000000000003, "end": 3876.7200000000003, "text": " on the GPU for that many student models."}, {"start": 3876.7200000000003, "end": 3880.2400000000002, "text": " But you can see that the relationship here is fairly monotonic."}, {"start": 3880.2400000000002, "end": 3882.16, "text": " Here it's a bit of a king."}, {"start": 3882.16, "end": 3887.96, "text": " So the first idea, like this, this is really astounding because these students have all"}, {"start": 3887.96, "end": 3890.32, "text": " been trained from that single teacher."}, {"start": 3890.32, "end": 3893.7200000000003, "text": " And they have been trained for as long as the teacher has been trained."}, {"start": 3893.7200000000003, "end": 3895.68, "text": " So they don't have more compute than the teacher."}, {"start": 3895.68, "end": 3901.2400000000002, "text": " They've been trained from scratch, not from some checkpoint or from the teacher weights."}, {"start": 3901.2400000000002, "end": 3903.68, "text": " It's simple distillation from the teacher."}, {"start": 3903.68, "end": 3904.84, "text": " No labels."}, {"start": 3904.84, "end": 3907.08, "text": " And the students are all in parallel as well."}, {"start": 3907.08, "end": 3910.4, "text": " So they don't see different data or even different data augmentations."}, {"start": 3910.4, "end": 3915.52, "text": " It's the exact same order of the exact same data points going through all of the students,"}, {"start": 3915.52, "end": 3917.6, "text": " the exact same learning rate schedule."}, {"start": 3917.6, "end": 3921.44, "text": " There's no noise and so on."}, {"start": 3921.44, "end": 3926.8399999999997, "text": " So the first thought that came to my mind, like something fishy is going on here, right?"}, {"start": 3926.8399999999997, "end": 3932.16, "text": " This seems like to, like, come on."}, {"start": 3932.16, "end": 3934.8399999999997, "text": " There's no new information here."}, {"start": 3934.8399999999997, "end": 3940.64, "text": " So I thought, hey, the teacher, the teacher, I'm all, I've just grabbed them from this"}, {"start": 3940.64, "end": 3942.7999999999997, "text": " repo, from this pre-trained checkpoints."}, {"start": 3942.7999999999997, "end": 3947.16, "text": " And these pre-trained checkpoints, they are, you know, the checkpoints that have performed"}, {"start": 3947.16, "end": 3949.3599999999997, "text": " best on the validation set."}, {"start": 3949.3599999999997, "end": 3955.16, "text": " So this is sort of a sneaky way of how we could train on the validation set, right?"}, {"start": 3955.16, "end": 3959.8399999999997, "text": " Because we annotate each data point in the training data set with this checkpoint."}, {"start": 3959.8399999999997, "end": 3965.6, "text": " And the checkpoint has been selected for performing especially well on the validation data set."}, {"start": 3965.6, "end": 3970.2, "text": " It could explain why we get a gain on the validation data set."}, {"start": 3970.2, "end": 3977.08, "text": " So what I did is I retrained all of the teacher models such that I just retrained"}, {"start": 3977.08, "end": 3981.24, "text": " them for these 100 epochs and that I just took the last checkpoint."}, {"start": 3981.24, "end": 3983.64, "text": " The, all everything's the same."}, {"start": 3983.64, "end": 3986.44, "text": " The hyper parameters, learning rate, schedule and so on."}, {"start": 3986.44, "end": 3991.48, "text": " This is not tuned for any particular model and it's pretty, like, it's pretty standard."}, {"start": 3991.48, "end": 3994.56, "text": " It's like, it's not like 0.12589."}, {"start": 3994.56, "end": 3999.88, "text": " It's like 0.01 and 100 epochs or so."}, {"start": 3999.88, "end": 4004.44, "text": " Fairly standard parameters and that just took the last checkpoint to make it didn't even"}, {"start": 4004.44, "end": 4010.28, "text": " look at its performance to make sure that I didn't select something that was especially"}, {"start": 4010.28, "end": 4013.2400000000002, "text": " good on the validation data set."}, {"start": 4013.2400000000002, "end": 4018.84, "text": " And the results here you'll see are actually already the results of that run, which the"}, {"start": 4018.84, "end": 4021.7200000000003, "text": " previous run was almost the same."}, {"start": 4021.7200000000003, "end": 4025.88, "text": " Like I was astounded at how well it works and then I thought, hey, maybe I'm kind of,"}, {"start": 4025.88, "end": 4027.92, "text": " you know, cheating here."}, {"start": 4027.92, "end": 4035.2400000000002, "text": " So I read it with the teachers that are not specifically selected and this is already"}, {"start": 4035.2400000000002, "end": 4037.32, "text": " the results."}, {"start": 4037.32, "end": 4039.48, "text": " So that's pretty cool, right?"}, {"start": 4039.48, "end": 4046.4, "text": " So then I wondered what happens if I now, if I increase my training amount."}, {"start": 4046.4, "end": 4048.2000000000003, "text": " So I just let this run for more."}, {"start": 4048.2000000000003, "end": 4053.6800000000003, "text": " Like what if I let the students run for more than the teacher has run?"}, {"start": 4053.6800000000003, "end": 4056.32, "text": " Again, there's no new information here."}, {"start": 4056.32, "end": 4060.48, "text": " So you can see that the now the, okay, the green is now the teacher."}, {"start": 4060.48, "end": 4066.32, "text": " The blue is 100 epochs and the orange is 250 epochs."}, {"start": 4066.32, "end": 4073.0, "text": " And you can see with that, even one student will outperform the teacher, but many students"}, {"start": 4073.0, "end": 4075.92, "text": " will outperform even more."}, {"start": 4075.92, "end": 4080.32, "text": " So if you give more compute, there's lots of lots of headroom here to improve."}, {"start": 4080.32, "end": 4081.32, "text": " You'll see this here."}, {"start": 4081.32, "end": 4087.4, "text": " I think this last one with the blue line is just a bit of a weird, a weird configuration."}, {"start": 4087.4, "end": 4091.6000000000004, "text": " I guess if you were to rerun that, that would, you know, fall in line."}, {"start": 4091.6000000000004, "end": 4096.360000000001, "text": " So this is pretty, pretty weird, right?"}, {"start": 4096.360000000001, "end": 4098.52, "text": " So I have a bunch of questions."}, {"start": 4098.52, "end": 4104.2, "text": " So first of all, I've searched a literature a bit more and I came up with a number of papers"}, {"start": 4104.2, "end": 4105.4800000000005, "text": " that do things like this."}, {"start": 4105.48, "end": 4111.4, "text": " And usually when you do distillation, you, people stress the importance of like how to introduce"}, {"start": 4111.4, "end": 4118.959999999999, "text": " noise, like in the noisy student paper or that you really need these data augmentations"}, {"start": 4118.959999999999, "end": 4127.32, "text": " or, you know, same clear V2 uses the self distillation in order to do, in order to label"}, {"start": 4127.32, "end": 4128.32, "text": " more data."}, {"start": 4128.32, "end": 4134.0, "text": " So they say it's important that we bring more unlabeled data into the process and so on."}, {"start": 4134.0, "end": 4137.12, "text": " So all of this really doesn't match right here."}, {"start": 4137.12, "end": 4142.64, "text": " And especially this focus on we need noise during the distillation process to build these"}, {"start": 4142.64, "end": 4143.84, "text": " ensembles."}, {"start": 4143.84, "end": 4147.56, "text": " This is also, you know, mean teacher, things like this."}, {"start": 4147.56, "end": 4153.28, "text": " I also found a paper called Born Again Neural Networks that does something quite similar,"}, {"start": 4153.28, "end": 4158.84, "text": " but not very simple, not like the same where they distill a teacher to the student with the"}, {"start": 4158.84, "end": 4160.76, "text": " same architecture."}, {"start": 4160.76, "end": 4166.92, "text": " And then they distill the student again into another student and then that into another"}, {"start": 4166.92, "end": 4168.2, "text": " student and so on."}, {"start": 4168.2, "end": 4172.92, "text": " And then at the end they say, oh, we can also build an ensemble, but sometimes their ensembles"}, {"start": 4172.92, "end": 4177.04, "text": " out perform their, you know, chain of distillation."}, {"start": 4177.04, "end": 4180.68, "text": " Sometimes they don't, they don't really focus on that part a lot."}, {"start": 4180.68, "end": 4185.64, "text": " And it's way more complicated like you distill one student after another and I also think"}, {"start": 4185.64, "end": 4193.400000000001, "text": " they have some introduction of variability in the students like noise or different augmentations"}, {"start": 4193.400000000001, "end": 4194.76, "text": " and so on."}, {"start": 4194.76, "end": 4198.88, "text": " So this here seems, you know, really, really, really simple."}, {"start": 4198.88, "end": 4203.64, "text": " Now I want to know this ensemble effect."}, {"start": 4203.64, "end": 4205.84, "text": " It seems pretty, pretty weird, right?"}, {"start": 4205.84, "end": 4207.56, "text": " So what gives?"}, {"start": 4207.56, "end": 4215.4800000000005, "text": " So the first thing we could do is we could say what, how does this compare to an ensemble"}, {"start": 4215.48, "end": 4216.48, "text": " of teacher models?"}, {"start": 4216.48, "end": 4222.48, "text": " Like if we actually were to build an ensemble, like train five teacher models on, you know,"}, {"start": 4222.48, "end": 4228.959999999999, "text": " five, five different teacher models, it's still the same data, but reasonably they might"}, {"start": 4228.959999999999, "end": 4232.839999999999, "text": " be able to learn something more from the data."}, {"start": 4232.839999999999, "end": 4237.36, "text": " If we have five teacher models, they might learn different things from the data and therefore"}, {"start": 4237.36, "end": 4244.2, "text": " if we combine them, they might kind of overlap their knowledge and sort of catch where,"}, {"start": 4244.2, "end": 4249.24, "text": " if one doesn't generalize in one data point, the other four can overrule it."}, {"start": 4249.24, "end": 4253.8, "text": " Whereas with these students, with these cell phone samples, there's not really a way where"}, {"start": 4253.8, "end": 4259.0, "text": " we can learn more from data because we can only learn from the teacher and the teacher"}, {"start": 4259.0, "end": 4262.08, "text": " is fixed and has seen that much data, right?"}, {"start": 4262.08, "end": 4263.08, "text": " So how does this compare?"}, {"start": 4263.08, "end": 4264.96, "text": " So I wrote some, I rewrote some code."}, {"start": 4264.96, "end": 4267.84, "text": " It's just plumbing and I release the code."}, {"start": 4267.84, "end": 4270.92, "text": " It's linked, but it's just plumbing."}, {"start": 4270.92, "end": 4271.92, "text": " Don't worry."}, {"start": 4271.92, "end": 4274.76, "text": " Don't worry, there's no great thoughts in there."}, {"start": 4274.76, "end": 4279.28, "text": " It's just plumbing such that my students are not all in parallel."}, {"start": 4279.28, "end": 4282.36, "text": " So the ensembles are not trained in parallel anymore."}, {"start": 4282.36, "end": 4287.04, "text": " I train each model individually, which means that at maximum I have to have two models"}, {"start": 4287.04, "end": 4292.04, "text": " on the same GPU, one teacher and one student."}, {"start": 4292.04, "end": 4298.4400000000005, "text": " So I make sure that the teachers, they are trained from scratch and the students, they're"}, {"start": 4298.4400000000005, "end": 4301.12, "text": " always trained from the same teacher, right?"}, {"start": 4301.12, "end": 4305.5199999999995, "text": " So the student ensembles will be exactly the same as we have them here."}, {"start": 4305.5199999999995, "end": 4309.96, "text": " That means one teacher is responsible for all the students, but yeah."}, {"start": 4309.96, "end": 4313.28, "text": " So okay, I'll just show you the results right here."}, {"start": 4313.28, "end": 4321.32, "text": " So if we look at those results, you can see that, and I've done it for a bunch of models"}, {"start": 4321.32, "end": 4325.0, "text": " right here, the blue line is the ensemble of teachers."}, {"start": 4325.0, "end": 4327.48, "text": " And here on the x axis you see the number of models."}, {"start": 4327.48, "end": 4334.959999999999, "text": " And now since I'm not training everything on the same GPU, but I recombine later, that"}, {"start": 4334.959999999999, "end": 4340.879999999999, "text": " basically means that I have the ability to train up to 10 models or actually however many"}, {"start": 4340.879999999999, "end": 4342.2, "text": " I want."}, {"start": 4342.2, "end": 4348.719999999999, "text": " And the only real trick in the code is that when I evaluate one of these ensembles, what"}, {"start": 4348.719999999999, "end": 4355.0, "text": " I do is I load a mini batch and then I basically load the first checkpoint, run a forward"}, {"start": 4355.0, "end": 4359.2, "text": " pass, load the second checkpoint, run a forward pass, load the third checkpoint, run"}, {"start": 4359.2, "end": 4360.2, "text": " a forward pass."}, {"start": 4360.2, "end": 4363.84, "text": " I do this for all the checkpoints until I go to the next mini batch, but that's just for"}, {"start": 4363.84, "end": 4364.84, "text": " evaluating, right?"}, {"start": 4364.84, "end": 4369.08, "text": " It just seemed easiest with the code that I had."}, {"start": 4369.08, "end": 4376.08, "text": " So you can see right here that there is a significant, like this is almost overlapping"}, {"start": 4376.08, "end": 4377.88, "text": " right here."}, {"start": 4377.88, "end": 4383.36, "text": " For most models, they're sometimes the student wins, sometimes the teacher wins, so the"}, {"start": 4383.36, "end": 4385.04, "text": " teacher ensemble wins."}, {"start": 4385.04, "end": 4391.08, "text": " Now, remember, the teachers are trained on, you know, 10 times as much data right here."}, {"start": 4391.08, "end": 4395.679999999999, "text": " But again, it's always the same data, but still they have the opportunity to learn 10 times"}, {"start": 4395.679999999999, "end": 4397.48, "text": " as much information from the data."}, {"start": 4397.48, "end": 4402.4, "text": " Whereas the students, they're all distilled from that same teacher without any noise, any"}, {"start": 4402.4, "end": 4410.2, "text": " augmentation, except for the augmentation that you use during training anyway."}, {"start": 4410.2, "end": 4415.08, "text": " And I've done this for 100 epochs and I've done this for 250."}, {"start": 4415.08, "end": 4416.4, "text": " Is this already 250?"}, {"start": 4416.4, "end": 4418.28, "text": " Now, I think that was 100."}, {"start": 4418.28, "end": 4419.92, "text": " I just put that there."}, {"start": 4419.92, "end": 4420.92, "text": " Nope."}, {"start": 4420.92, "end": 4421.92, "text": " Okay."}, {"start": 4421.92, "end": 4429.16, "text": " Yeah, that was 100 epochs, but you'll see the 250 epoch plots, they look very much the"}, {"start": 4429.16, "end": 4430.16, "text": " same."}, {"start": 4430.16, "end": 4434.5599999999995, "text": " Okay, they're just a bit better if you train for 250 epochs."}, {"start": 4434.5599999999995, "end": 4439.96, "text": " Now, interestingly, okay, here's the interesting part about the 250 epochs."}, {"start": 4439.96, "end": 4449.68, "text": " The student is still distilled from a teacher model that has been trained for 100 epochs."}, {"start": 4449.68, "end": 4455.6, "text": " So all of this makes no sense to me, right?"}, {"start": 4455.6, "end": 4462.04, "text": " The student is still distilled from the 100 epoch teacher model, yet if you train the student"}, {"start": 4462.04, "end": 4468.88, "text": " for 250 epochs in self distillation and then build an ensemble of these students from"}, {"start": 4468.88, "end": 4474.2, "text": " that same teacher model, and you compare that to an ensemble of teachers that have all"}, {"start": 4474.2, "end": 4484.2, "text": " been trained for longer, for 250 epochs, which should out, the 250 epochs generally outperforms"}, {"start": 4484.2, "end": 4486.16, "text": " the 100 epochs models."}, {"start": 4486.16, "end": 4488.68, "text": " Still, they are the same."}, {"start": 4488.68, "end": 4492.88, "text": " This is pretty crazy results, I think."}, {"start": 4492.88, "end": 4502.08, "text": " And my conclusion from this is that the ensemble effect right here is not a function of learning"}, {"start": 4502.08, "end": 4505.4400000000005, "text": " of extracting more information from the data."}, {"start": 4505.4400000000005, "end": 4512.16, "text": " The ensemble effect might actually have something to do with the function landscape itself,"}, {"start": 4512.16, "end": 4517.76, "text": " and kind of exploring different minima of the same function, not of the same function,"}, {"start": 4517.76, "end": 4523.2, "text": " but exploring different functions to describe the same phenomena."}, {"start": 4523.2, "end": 4528.12, "text": " And I've also found a paper that explains the loss landscape of deep ensembles, and I"}, {"start": 4528.12, "end": 4529.76, "text": " will make a video on that."}, {"start": 4529.76, "end": 4534.16, "text": " Maybe it's out already, maybe it will be out after you see this one."}, {"start": 4534.16, "end": 4540.16, "text": " I haven't decided yet which order I'm going to release things."}, {"start": 4540.16, "end": 4544.56, "text": " But this here, it's pretty interesting, and we need like a name."}, {"start": 4544.56, "end": 4551.56, "text": " Self, self ensembles are already a thing, but they are always with noise and stuff like"}, {"start": 4551.56, "end": 4552.56, "text": " this."}, {"start": 4552.56, "end": 4556.0, "text": " So let's call them something like plain self ensembles."}, {"start": 4556.0, "end": 4558.280000000001, "text": " Like that, that sounds like a good name."}, {"start": 4558.280000000001, "end": 4565.280000000001, "text": " Plain self ensembles, the act of self distillation, a single model into multiple models without"}, {"start": 4565.280000000001, "end": 4571.280000000001, "text": " any noise, any augmentations, anything, just you run as if you were to train the model"}, {"start": 4571.280000000001, "end": 4572.76, "text": " itself."}, {"start": 4572.76, "end": 4579.280000000001, "text": " And then you build an ensemble of these models by simply averaging the logits, plain"}, {"start": 4579.280000000001, "end": 4580.68, "text": " cell phone samples."}, {"start": 4580.68, "end": 4586.96, "text": " Alright, so the plan from here is to check on at least one other data set."}, {"start": 4586.96, "end": 4594.08, "text": " You know, these models, I appreciate that I could get them pre-trained, but they're"}, {"start": 4594.08, "end": 4598.76, "text": " just the image net models and then kind of let run on C410."}, {"start": 4598.76, "end": 4605.6, "text": " So there's no kind of guarantee that these have been, you know, tuned or anything, that"}, {"start": 4605.6, "end": 4607.0, "text": " the learning rates are whatnot."}, {"start": 4607.0, "end": 4614.4800000000005, "text": " So I want to take like an image net model, still make sure that I don't use any like hidden"}, {"start": 4614.4800000000005, "end": 4621.2, "text": " information where I could cheat on the validation set, but try this on at least one thing and"}, {"start": 4621.2, "end": 4623.96, "text": " see if that works as well."}, {"start": 4623.96, "end": 4630.64, "text": " If we can sort of push image net performance simply by doing this trick."}, {"start": 4630.64, "end": 4635.76, "text": " So that's the plan for now and I have some other ideas, but I just wanted to let you"}, {"start": 4635.76, "end": 4636.92, "text": " know."}, {"start": 4636.92, "end": 4640.44, "text": " And this is sort of how research works, I guess."}, {"start": 4640.44, "end": 4644.96, "text": " You have a dumb idea and it turns out to work."}, {"start": 4644.96, "end": 4651.4, "text": " And then you go on and still probably, probably there is not maybe too much interesting things"}, {"start": 4651.4, "end": 4656.24, "text": " here, maybe it doesn't work on image net because these models are just under train and this"}, {"start": 4656.24, "end": 4663.44, "text": " somehow made them better somehow or regularize them somehow that usually doesn't work."}, {"start": 4663.44, "end": 4665.719999999999, "text": " There's so much that can go wrong still."}, {"start": 4665.719999999999, "end": 4670.2, "text": " So, but yeah, that was it."}, {"start": 4670.2, "end": 4675.639999999999, "text": " And I invite you to like check out other papers in this space if you want."}, {"start": 4675.639999999999, "end": 4677.839999999999, "text": " It's a pretty interesting space."}, {"start": 4677.84, "end": 4682.16, "text": " And with that, I don't have much more to say."}, {"start": 4682.16, "end": 4685.360000000001, "text": " Yeah, I hope you enjoyed this."}, {"start": 4685.360000000001, "end": 4691.24, "text": " Let me know what you think of like research implementation or research process videos"}, {"start": 4691.24, "end": 4692.24, "text": " like this."}, {"start": 4692.24, "end": 4694.360000000001, "text": " I'm not sure what people expect."}, {"start": 4694.360000000001, "end": 4699.8, "text": " Like I can't make this into a five minute video of like, woo, I discovered something because"}, {"start": 4699.8, "end": 4704.4800000000005, "text": " then there's no clue of what's happening."}, {"start": 4704.48, "end": 4708.32, "text": " But maybe like an hour or so is also too long."}, {"start": 4708.32, "end": 4709.32, "text": " I'm not sure."}, {"start": 4709.32, "end": 4712.32, "text": " Yeah, let me know what you think and I'll see you next time."}, {"start": 4712.32, "end": 4742.28, "text": " Bye."}] |
Yannic Kilcher | 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-per-muted backbone for recognition and localization by Xianze Du at all 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. So basically what we do is we have the first convolutional neural network, 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 2, 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? 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 don't really, so not enough. 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 successfully 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 cursor and cursor segmentation and at the end, your segmentation might be something like this. Okay, so we have had a lot of success building image classifiers with this reasoning. And this is sort of a human heuristic that just has worked well, right? 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 down scaling 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 it can just 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 is 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 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 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 through this direct way or through these connections right here, feeds features to 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. So on the left, you have the typical architecture. You see that the width, 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, 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. 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 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, this is one, two, three, four, five, 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. 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'll initialize a reinforcement learning controller that decides on the ordering and on the connections and they have some action space and you basically let it run. So it proposes a couple of architectures 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 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. Now 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 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 we have this layer and it is connected to these two layers. You 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 a learned transformation from a number of input channels to a number of output channels without change without doing any actual convolution operation this is simply linear operation upscaling or up up up 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 c0 you can see very small here maybe that there is this first we go to alpha times c0 and alpha is I think in the default setting it's 1 half. So first we always go to 1 half the number of features before we do this switch here and then we have two options either so you go to 1 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 the the current one has more features than the end it's probably not as bad because you first go to less features than 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. You know 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 these 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 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. You 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. It's important to keep the computational resampling low. We introduce a scaling factor alpha. We have that then we use a nearest neighbor interpolation for up sampling or a stride 2, 3 by 3 convolution. Okay so it's nearest neighbor by up sampling. Alright so 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 ResNet50 is the original architecture and remember we're only talking about the backbone right here. Now in the original ResNet50 architecture we have this ResNet50, 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 ResNet50 is continuously getting smaller and more features. They do an intermediate step. So this right here is their final thing where they 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 and 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 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. So it's actually a different way of doing a residual block. It was 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 roughly the same amount of parameters and then 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. So that's pretty cool. Though remember that the left thing, this is made by humans. This is just our heuristic and the right things they are made by RL and they are for these particular data sets. They do find that generally this also transfers to image net 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 spine net 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, 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 in here you always have these single connections and here you always have 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 resin at run with double connections. So if they are 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 resin 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 take features from different kind 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 in the things that they learned. 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. 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 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 if you train without them. Maybe if you train without them, you can reach as good an accuracy. So this graph damage investigation, it has something but not I wouldn't trust it too much. 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 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 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 like this. Okay. And I'm 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 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. Hey, let's say these are, these are now your sequences or you can also make them as attention heads. Okay. These are 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 would 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 it remains to be seen, 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 we 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 a resonant 100 or a resonant 150? There you don't have the computational resources to neural architectures. Imagine this, Google hasn't had 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 spine net 49 and they say we build a spine net 60 96 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 to 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, oh, yeah, 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 everything is a win here. So they apply this to these data sets. I don't want to go too much 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 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 it's entirely possible that this works better. There's no particular reason why the ResNet 50 should work at all. It's just a heuristic. But I guess it remains to be seen whether that's generally true or just in the things they considered. You 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 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 broad 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 like the video. Share it out. So | [{"start": 0.0, "end": 6.16, "text": " Hi there, today we'll look at SpineNet learning scale-per-muted backbone for recognition and"}, {"start": 6.16, "end": 10.8, "text": " localization by Xianze Du at all of Google research."}, {"start": 10.8, "end": 16.96, "text": " On a high level this paper proposes to take current recognition and localization networks"}, {"start": 16.96, "end": 22.76, "text": " which have a CNN backbone, usually something like a ResNet, and switch up the order of"}, {"start": 22.76, "end": 29.0, "text": " the blocks in the ResNet and cross-connect them in a different way, such that they reach"}, {"start": 29.0, "end": 34.24, "text": " a higher accuracy with the new network that has the same amount of parameters or almost"}, {"start": 34.24, "end": 35.88, "text": " the same amount of parameters."}, {"start": 35.88, "end": 40.68, "text": " They then further modify this network, such that it reaches that higher accuracy with"}, {"start": 40.68, "end": 44.24, "text": " less compute than the original network."}, {"start": 44.24, "end": 48.2, "text": " So if you want to know how it's done, you know, stick around."}, {"start": 48.2, "end": 53.68, "text": " You can help me by sharing out this video if you liked it, if you didn't like it, leave"}, {"start": 53.68, "end": 58.84, "text": " a comment and tell me what you didn't like, otherwise I have no chance of improving."}, {"start": 58.84, "end": 61.52, "text": " So that's the deal, okay?"}, {"start": 61.52, "end": 62.52, "text": " Cool."}, {"start": 62.52, "end": 68.60000000000001, "text": " So the task here is a recognition and localization as you can see here, which basically means"}, {"start": 68.60000000000001, "end": 73.0, "text": " that you have an image and there's stuff on the image."}, {"start": 73.0, "end": 78.80000000000001, "text": " Maybe there's a cat right here and maybe there is some kind of a house right here."}, {"start": 78.80000000000001, "end": 85.44, "text": " And the task, these tasks come in various forms, but some of the tasks are to say what's"}, {"start": 85.44, "end": 88.80000000000001, "text": " on the image, so in this case, cat."}, {"start": 88.8, "end": 90.8, "text": " And house."}, {"start": 90.8, "end": 92.39999999999999, "text": " And also where is it?"}, {"start": 92.39999999999999, "end": 97.03999999999999, "text": " Now this could be a point, this could be a bounding box, or this could actually be a pixel"}, {"start": 97.03999999999999, "end": 98.56, "text": " segmentation."}, {"start": 98.56, "end": 103.39999999999999, "text": " All of this sort of tasks exists in various forms."}, {"start": 103.39999999999999, "end": 111.56, "text": " What usually is done in these tasks is you want to go in some way through a neural network"}, {"start": 111.56, "end": 117.2, "text": " and the neural network will output the same image again or the same shape."}, {"start": 117.2, "end": 123.28, "text": " So it will output a image that is of the same shape that if this is your input image, I'm"}, {"start": 123.28, "end": 127.8, "text": " going to, I'm just going to quickly redraw without the labels."}, {"start": 127.8, "end": 132.08, "text": " If this is your input image, then the output image, let's say we're doing bounding boxes."}, {"start": 132.08, "end": 138.16, "text": " The output would say something like here are bounding boxes and also the output would"}, {"start": 138.16, "end": 142.4, "text": " be cat and house."}, {"start": 142.4, "end": 146.28, "text": " So these are the two outputs that the neural network would generate."}, {"start": 146.28, "end": 151.4, "text": " This is some sort of a convolutional neural network because they deal with images fairly"}, {"start": 151.4, "end": 153.04, "text": " well."}, {"start": 153.04, "end": 159.28, "text": " Now usually when we do image processing, and we know this from, for example, image classification,"}, {"start": 159.28, "end": 164.52, "text": " so if we just have image classification, just to classify here, if we just want the"}, {"start": 164.52, "end": 171.8, "text": " outputs cat or house, or even just one single thing like an image net, our convolutional"}, {"start": 171.8, "end": 174.52, "text": " neural networks have a particular architecture."}, {"start": 174.52, "end": 180.52, "text": " So basically what we do is we have the first convolutional neural network, the first layers"}, {"start": 180.52, "end": 188.28, "text": " will take the image and run these convolutional filters across them, which gives you the"}, {"start": 188.28, "end": 190.64000000000001, "text": " same shape image back."}, {"start": 190.64000000000001, "end": 193.32000000000002, "text": " But then with time we scale it down."}, {"start": 193.32000000000002, "end": 198.88, "text": " We have a max pooling or a convolution with stride 2, so that the image is only this big"}, {"start": 198.88, "end": 200.12, "text": " anymore."}, {"start": 200.12, "end": 206.52, "text": " And then we have a bunch of further layers and then we scale it down again and so on."}, {"start": 206.52, "end": 209.32, "text": " Now as we scale it down, the number of channels goes up."}, {"start": 209.32, "end": 212.76, "text": " Of course at the beginning you have three channels for the three colors."}, {"start": 212.76, "end": 217.16, "text": " But then after the first convolution you might have whatever, 32 channels right here."}, {"start": 217.16, "end": 219.4, "text": " This is no longer the original image."}, {"start": 219.4, "end": 224.68, "text": " This now is of course for each pixel you have a stack of features, right?"}, {"start": 224.68, "end": 231.52, "text": " Because that's what your convolutional layer does."}, {"start": 231.52, "end": 236.0, "text": " And then when you scale it down, you have even more feature maps."}, {"start": 236.0, "end": 242.24, "text": " So we tend to scale down the resolution of our feature maps, but we tend to increase"}, {"start": 242.24, "end": 245.4, "text": " the number of feature maps right here."}, {"start": 245.4, "end": 251.28, "text": " The reasoning behind this is if you look at these bounding boxes, they don't really,"}, {"start": 251.28, "end": 252.88, "text": " so not enough."}, {"start": 252.88, "end": 257.96, "text": " If you look at the labels right here, the fact that there's a cat on the image shouldn't"}, {"start": 257.96, "end": 262.0, "text": " depend on the exact pixel location of the cat, right?"}, {"start": 262.0, "end": 266.44, "text": " So even if I scale this down a bit, I'll still recognize that there's a cat somewhere."}, {"start": 266.44, "end": 268.76, "text": " It can still aggregate that information."}, {"start": 268.76, "end": 271.48, "text": " In fact, I could deal with a single, right?"}, {"start": 271.48, "end": 276.4, "text": " I could deal with scaling this down successfully up to a single pixel."}, {"start": 276.4, "end": 279.44, "text": " And that's ultimately what an image classifier does."}, {"start": 279.44, "end": 285.24, "text": " You simply have a single vector at the end with the features in it and from that you classify."}, {"start": 285.24, "end": 291.44, "text": " So the reasoning is that as you go through the network, you pick up the low level features."}, {"start": 291.44, "end": 297.96, "text": " First, like here, you pick up the edges and the kind of low level shapes."}, {"start": 297.96, "end": 304.15999999999997, "text": " As you go higher through the network, your features become more abstract but less localized,"}, {"start": 304.15999999999997, "end": 306.8, "text": " which means that it's less important where they are."}, {"start": 306.8, "end": 312.2, "text": " And that's why you look at this image through a cursor and cursor segmentation and at the"}, {"start": 312.2, "end": 317.40000000000003, "text": " end, your segmentation might be something like this."}, {"start": 317.40000000000003, "end": 323.28000000000003, "text": " Okay, so we have had a lot of success building image classifiers with this reasoning."}, {"start": 323.28000000000003, "end": 327.48, "text": " And this is sort of a human heuristic that just has worked well, right?"}, {"start": 327.48, "end": 335.52, "text": " Now when we do something like this, bounding box classification or even per pixel classification,"}, {"start": 335.52, "end": 339.52, "text": " all of a sudden, it is very important where the things are, right?"}, {"start": 339.52, "end": 343.88, "text": " It is very important that it's this pixel and this pixel and this pixel and this pixel forming"}, {"start": 343.88, "end": 349.32, "text": " the bounding box because the more accurate you are, the better your bounding box classifier."}, {"start": 349.32, "end": 355.08, "text": " You still have this right here, this recognition, but the localization part, we can't just scale"}, {"start": 355.08, "end": 359.32, "text": " down anymore because we need to output something that's of the same size."}, {"start": 359.32, "end": 366.08, "text": " So what people have done is they've gone from this kind of, from architecture that scales"}, {"start": 366.08, "end": 368.28, "text": " down because we know that works well."}, {"start": 368.28, "end": 370.32, "text": " We know the down scaling works well."}, {"start": 370.32, "end": 375.15999999999997, "text": " So we take that and then we scale up again."}, {"start": 375.15999999999997, "end": 377.76, "text": " And there is some reasoning behind this, right?"}, {"start": 377.76, "end": 384.0, "text": " So that's what we can do because we know this part works very well for extracting high level"}, {"start": 384.0, "end": 386.6, "text": " features that are not that localized."}, {"start": 386.6, "end": 390.92, "text": " So our reasoning is going to be something like, okay, we'll force the network through"}, {"start": 390.92, "end": 392.92, "text": " this kind of bottleneck right here."}, {"start": 392.92, "end": 398.84000000000003, "text": " We'll force it to learn some high level features because otherwise it can just kind of remember"}, {"start": 398.84000000000003, "end": 401.84000000000003, "text": " the individual pixels and that won't work as well."}, {"start": 401.84000000000003, "end": 407.44, "text": " We'll force it to remember the high level, we'll force it to remember what a cat is."}, {"start": 407.44, "end": 413.6, "text": " And then it will help in the pixel segmentation to know what a cat is."}, {"start": 413.6, "end": 418.72, "text": " This is very valid assumption, but it doesn't need to be the case."}, {"start": 418.72, "end": 423.40000000000003, "text": " And so there is one additional thing that these networks usually do is that they have like"}, {"start": 423.40000000000003, "end": 428.0, "text": " some skip connections here from the layers that are of the same size to the layers that"}, {"start": 428.0, "end": 430.84000000000003, "text": " are of the same size right here to here."}, {"start": 430.84000000000003, "end": 435.96000000000004, "text": " In order to kind of recover these high level features because if you only look at an image"}, {"start": 435.96000000000004, "end": 441.44, "text": " through the lens of this right here and you have to segment the ear of the cat, you know,"}, {"start": 441.44, "end": 445.8, "text": " you can only either color an entire pixel or not."}, {"start": 445.8, "end": 449.92, "text": " So you want to gain back some of that, some of those high level features and that's what"}, {"start": 449.92, "end": 451.76, "text": " you do with skip connections."}, {"start": 451.76, "end": 455.72, "text": " And that's why these networks usually look like this."}, {"start": 455.72, "end": 459.4, "text": " Now in this work, the authors sort of criticize this."}, {"start": 459.4, "end": 461.72, "text": " They say why, why are we doing it like this?"}, {"start": 461.72, "end": 464.48, "text": " Isn't there a better way to do it?"}, {"start": 464.48, "end": 469.84, "text": " Specifically, we want to look at this part right here, which is called the backbone."}, {"start": 469.84, "end": 476.0, "text": " So we assume that we have these output layers that give you at different scales, different"}, {"start": 476.0, "end": 477.15999999999997, "text": " features."}, {"start": 477.15999999999997, "end": 483.76, "text": " And what we have to do is we have to construct a backbone that somehow feeds features either"}, {"start": 483.76, "end": 490.08, "text": " through this direct way or through these connections right here, feeds features to these"}, {"start": 490.08, "end": 492.32, "text": " ultimate classifiers."}, {"start": 492.32, "end": 498.47999999999996, "text": " So these classifiers will then be used to classify the bounding boxes and classify the"}, {"start": 498.48, "end": 504.08000000000004, "text": " output classes for recognition and localization."}, {"start": 504.08000000000004, "end": 506.08000000000004, "text": " This is an illustration of this."}, {"start": 506.08000000000004, "end": 512.96, "text": " On the left, you see a typical backbone and they call this a scale decreased network."}, {"start": 512.96, "end": 518.04, "text": " So an example of scale decreased network on the left versus a scale permuted network"}, {"start": 518.04, "end": 519.48, "text": " on the right."}, {"start": 519.48, "end": 524.84, "text": " The width of the block indicates feature resolution and the height indicates feature dimension."}, {"start": 524.84, "end": 528.52, "text": " dotted arrows represent connections from two blocks not plotted."}, {"start": 528.52, "end": 531.1600000000001, "text": " So on the left, you have the typical architecture."}, {"start": 531.1600000000001, "end": 538.12, "text": " You see that the width, this is the resolution is very high."}, {"start": 538.12, "end": 543.0, "text": " And as you go through the layers, that resolution gets smaller and smaller and smaller."}, {"start": 543.0, "end": 548.44, "text": " But the number of features indicated by the height gets higher and higher and higher as"}, {"start": 548.44, "end": 549.84, "text": " you go through."}, {"start": 549.84, "end": 551.84, "text": " This is your typical architecture."}, {"start": 551.84, "end": 555.6800000000001, "text": " We are looking into, let's say, this is not the only one."}, {"start": 555.6800000000001, "end": 559.12, "text": " What we can do is we can build any sort of backbone."}, {"start": 559.12, "end": 560.6800000000001, "text": " And here they restrict themselves."}, {"start": 560.6800000000001, "end": 566.76, "text": " They say, okay, in order to make it comparable, in order to be, you know, scientifically"}, {"start": 566.76, "end": 573.4, "text": " a bit more rigorous than just building anything, what we restrict ourselves are simply permutations"}, {"start": 573.4, "end": 574.4, "text": " of this."}, {"start": 574.4, "end": 578.52, "text": " So we only allow us to permute these things."}, {"start": 578.52, "end": 583.68, "text": " So all the, you know, this goes here and this goes here as you see."}, {"start": 583.68, "end": 587.56, "text": " And that ensures that you still have roughly the same amount of parameters."}, {"start": 587.56, "end": 592.76, "text": " Now there is a sort of a parameter difference because these connections here, you need to"}, {"start": 592.76, "end": 597.84, "text": " up and down sample the images and sometimes that introduces parameters."}, {"start": 597.84, "end": 602.68, "text": " But in essence, you have the rough same amount of parameters."}, {"start": 602.68, "end": 608.48, "text": " And then you can really research what can we improve a network simply by rearranging"}, {"start": 608.48, "end": 614.5600000000001, "text": " its blocks because that would give evidence that this scaling down architecture isn't really"}, {"start": 614.5600000000001, "end": 616.84, "text": " the best one."}, {"start": 616.84, "end": 619.5600000000001, "text": " So here you can see an example of this."}, {"start": 619.5600000000001, "end": 622.6800000000001, "text": " This is what they call a scale permuted network."}, {"start": 622.6800000000001, "end": 627.2, "text": " Sorry, this scale permuted network right here."}, {"start": 627.2, "end": 632.2, "text": " So in a scale permuted network, what you're allowed to do is you're allowed, you have"}, {"start": 632.2, "end": 638.0, "text": " these blocks on the left and you're allowed to put them anywhere you want in any sort"}, {"start": 638.0, "end": 642.72, "text": " of, I don't want to say order, but yes, in any sort of order."}, {"start": 642.72, "end": 644.6, "text": " Yes, it's an order actually."}, {"start": 644.6, "end": 652.76, "text": " So it goes from here down, this is one, two, three, four, five, any block for any block,"}, {"start": 652.76, "end": 655.88, "text": " you first place, you first place this block."}, {"start": 655.88, "end": 660.4, "text": " You're allowed to connect it to any other block before it."}, {"start": 660.4, "end": 664.48, "text": " Now here we don't see, but you can see there's two incoming connections right here."}, {"start": 664.48, "end": 667.12, "text": " So we make use of more than one connection."}, {"start": 667.12, "end": 672.8, "text": " On the left you see there's always one connection between the blocks and on the right you see"}, {"start": 672.8, "end": 680.72, "text": " we allow up to two blocks to connect to a given block."}, {"start": 680.72, "end": 684.96, "text": " Then you're done with this block, you place the next block, this one here."}, {"start": 684.96, "end": 690.92, "text": " Also you're allowed to have two incoming connections, this one here and this one here."}, {"start": 690.92, "end": 692.84, "text": " And you place the next block and so on."}, {"start": 692.84, "end": 698.1600000000001, "text": " Now how you make this, you also see that there doesn't need to be like a straight linear"}, {"start": 698.1600000000001, "end": 702.84, "text": " path because there is no connection right here if you can see that."}, {"start": 702.84, "end": 710.0, "text": " So you might be wondering how do I decide which block goes where and how do I decide"}, {"start": 710.0, "end": 718.76, "text": " on which connections connect where and that is going to be the idea here to use neural"}, {"start": 718.76, "end": 720.1600000000001, "text": " architecture search."}, {"start": 720.16, "end": 725.52, "text": " So neural architecture search right now is still a fancy way of saying let's try stuff"}, {"start": 725.52, "end": 726.52, "text": " out."}, {"start": 726.52, "end": 732.92, "text": " And so what you'll do is you'll initialize a reinforcement learning controller that"}, {"start": 732.92, "end": 739.0799999999999, "text": " decides on the ordering and on the connections and they have some action space and you basically"}, {"start": 739.0799999999999, "end": 740.0799999999999, "text": " let it run."}, {"start": 740.0799999999999, "end": 747.8, "text": " So it proposes a couple of architectures and then you measure all of them, you train all"}, {"start": 747.8, "end": 751.76, "text": " of these architectures and you see how well they fare and then you go back to the controller."}, {"start": 751.76, "end": 753.5999999999999, "text": " That's the reward signal."}, {"start": 753.5999999999999, "end": 759.7199999999999, "text": " And so we can draw so you have an agent which builds the building plan."}, {"start": 759.7199999999999, "end": 768.1999999999999, "text": " So the agent agent will emit as an action a building plan like big small big small big with"}, {"start": 768.1999999999999, "end": 772.5999999999999, "text": " connections like this and like this and like this."}, {"start": 772.6, "end": 778.96, "text": " And then that will go to the environment, the environment here simply takes the architecture"}, {"start": 778.96, "end": 782.76, "text": " and trains train the architecture."}, {"start": 782.76, "end": 789.08, "text": " And then the let's say the Eval loss or the validation loss."}, {"start": 789.08, "end": 794.72, "text": " The validation accuracy is equal is going to be your reward signal."}, {"start": 794.72, "end": 800.1600000000001, "text": " So you simply train a reinforcement learning agent to solve this particular problem which"}, {"start": 800.16, "end": 805.9599999999999, "text": " is training this in recognition and localization on the particular data set as well as possible"}, {"start": 805.9599999999999, "end": 811.56, "text": " to basically come up with the best architecture which you know it's it's fancy and it's a bit"}, {"start": 811.56, "end": 815.24, "text": " better than trying everything out but it's not much better right now."}, {"start": 815.24, "end": 819.88, "text": " And it takes a lot of compute to run these experiments because it takes a lot of iterations"}, {"start": 819.88, "end": 825.56, "text": " of this and every iteration consists of training one of these networks fully once."}, {"start": 825.56, "end": 829.24, "text": " Now you can do something with like early stopping and stuff but."}, {"start": 829.24, "end": 832.36, "text": " So you get the idea."}, {"start": 832.36, "end": 836.6800000000001, "text": " This is what they what they propose and this is you know how they get better."}, {"start": 836.6800000000001, "end": 843.28, "text": " So there are a number of challenges in this."}, {"start": 843.28, "end": 852.88, "text": " Namely we we said okay when you input a signal for example when you input a signal from this"}, {"start": 852.88, "end": 859.4399999999999, "text": " layer to this layer you can see that you have to shrink the resolution and you have to"}, {"start": 859.4399999999999, "end": 862.76, "text": " up the number of features."}, {"start": 862.76, "end": 869.96, "text": " And this was already sort of solved in the resonant original resonant paper but they reiterate"}, {"start": 869.96, "end": 876.6, "text": " how they do this here basically you have we have this layer and it is connected to these"}, {"start": 876.6, "end": 877.6, "text": " two layers."}, {"start": 877.6, "end": 883.08, "text": " You said every layer can receive inputs from two layers you see at the very end these"}, {"start": 883.08, "end": 885.64, "text": " are just added together."}, {"start": 885.64, "end": 894.36, "text": " Okay so we have two things first of all the number of features is different you can see right"}, {"start": 894.36, "end": 900.32, "text": " over here the number of features the number of channels is different than the number of"}, {"start": 900.32, "end": 905.72, "text": " channels in the output image let's say right here."}, {"start": 905.72, "end": 911.12, "text": " So those are different and in fact they're different in both inputs and we have this method"}, {"start": 911.12, "end": 916.0400000000001, "text": " of one by one convolutions that was introduced in the original resonant paper if we do one"}, {"start": 916.0400000000001, "end": 923.12, "text": " by one convolutions it's basically a a learned transformation from a number of input channels"}, {"start": 923.12, "end": 928.6, "text": " to a number of output channels without change without doing any actual convolution operation"}, {"start": 928.6, "end": 935.6, "text": " this is simply linear operation upscaling or up up up the number of feature maps."}, {"start": 935.6, "end": 942.0, "text": " You can see these one by one convolutions are employed here in various ways."}, {"start": 942.0, "end": 948.28, "text": " So because this is fairly compute intensive or so they claim what they do first is they"}, {"start": 948.28, "end": 956.0, "text": " always first go to less features so here we have a number of features which is maybe let's"}, {"start": 956.0, "end": 964.8000000000001, "text": " say this is f or sorry this is c0 you can see very small here maybe that there is this"}, {"start": 964.8, "end": 971.9599999999999, "text": " first we go to alpha times c0 and alpha is I think in the default setting it's 1 half."}, {"start": 971.9599999999999, "end": 981.3199999999999, "text": " So first we always go to 1 half the number of features before we do this switch here"}, {"start": 981.3199999999999, "end": 987.68, "text": " and then we have two options either so you go to 1 half the features and at the end you"}, {"start": 987.68, "end": 989.88, "text": " go to the number of target features."}, {"start": 989.88, "end": 995.04, "text": " So it could be if the target features are more than you currently have it could be that"}, {"start": 995.04, "end": 1002.96, "text": " you first go to less features and then you go to even more features right as if the"}, {"start": 1002.96, "end": 1007.68, "text": " the current one has more features than the end it's probably not as bad because you first"}, {"start": 1007.68, "end": 1010.36, "text": " go to less features than to even less features."}, {"start": 1010.36, "end": 1016.28, "text": " This is probably one of the things they did to save computation but which you can imagine"}, {"start": 1016.28, "end": 1020.72, "text": " that it hurts because here you simply have to you have to basically throw away half the"}, {"start": 1020.72, "end": 1026.68, "text": " features or you have to like linearly combine them in every step where you connect two layers"}, {"start": 1026.68, "end": 1028.76, "text": " to each other."}, {"start": 1028.76, "end": 1032.44, "text": " You know okay so there's two situations."}, {"start": 1032.44, "end": 1038.52, "text": " First situation your current resolution here is higher than the target resolution."}, {"start": 1038.52, "end": 1045.6, "text": " In that case we can simply do a convolution with a bigger stride than one right if you"}, {"start": 1045.6, "end": 1050.84, "text": " have an image and you do a convolution usually you have these overlapping convolution such"}, {"start": 1050.84, "end": 1057.1599999999999, "text": " that the result is the same size as you started with but you can also do a bigger stride"}, {"start": 1057.1599999999999, "end": 1063.52, "text": " and I'm a bit overdrawing this here but you can do a bigger stride such that the final"}, {"start": 1063.52, "end": 1069.0, "text": " resolution is smaller and you can also do this max pooling right here."}, {"start": 1069.0, "end": 1075.76, "text": " So the max pooling is also a way to reduce the number of the resolution of the image."}, {"start": 1075.76, "end": 1078.24, "text": " So if we're bigger we can do that."}, {"start": 1078.24, "end": 1085.84, "text": " If we are currently smaller than the target what we can do is we can up sample and up sample"}, {"start": 1085.84, "end": 1091.92, "text": " you can do by doing nearest neighbor or things like this."}, {"start": 1091.92, "end": 1098.56, "text": " You can also do a learned up sample there are various ways I believe here they do a nearest"}, {"start": 1098.56, "end": 1103.1599999999999, "text": " neighbor but I'm not sure anymore actually."}, {"start": 1103.1599999999999, "end": 1108.0, "text": " Let's check it out."}, {"start": 1108.0, "end": 1111.6, "text": " That's here somewhere."}, {"start": 1111.6, "end": 1113.8799999999999, "text": " Resampling and cross scale connections."}, {"start": 1113.8799999999999, "end": 1116.96, "text": " Yada yada yada yada yada yada."}, {"start": 1116.96, "end": 1120.04, "text": " It's important to keep the computational resampling low."}, {"start": 1120.04, "end": 1122.08, "text": " We introduce a scaling factor alpha."}, {"start": 1122.08, "end": 1129.0, "text": " We have that then we use a nearest neighbor interpolation for up sampling or a stride"}, {"start": 1129.0, "end": 1131.8, "text": " 2, 3 by 3 convolution."}, {"start": 1131.8, "end": 1136.04, "text": " Okay so it's nearest neighbor by up sampling."}, {"start": 1136.04, "end": 1144.08, "text": " Alright so that's how they up and down sample the feature maps to the correct shapes either"}, {"start": 1144.08, "end": 1151.76, "text": " using nearest neighbor up sampling or using multi stride convolution followed by max pooling."}, {"start": 1151.76, "end": 1153.68, "text": " So what does that give them?"}, {"start": 1153.68, "end": 1157.12, "text": " Now they do several different steps in this."}, {"start": 1157.12, "end": 1162.6, "text": " So the first architecture this ResNet50 is the original architecture and remember we're"}, {"start": 1162.6, "end": 1167.12, "text": " only talking about the backbone right here."}, {"start": 1167.12, "end": 1173.56, "text": " Now in the original ResNet50 architecture we have this ResNet50, FPN and this FPN is"}, {"start": 1173.56, "end": 1175.52, "text": " these are called the output layers."}, {"start": 1175.52, "end": 1183.6, "text": " This is what then goes and classifies the bounding boxes and the labels and so on."}, {"start": 1183.6, "end": 1192.96, "text": " Now here you can see the ResNet50 is continuously getting smaller and more features."}, {"start": 1192.96, "end": 1195.52, "text": " They do an intermediate step."}, {"start": 1195.52, "end": 1202.56, "text": " So this right here is their final thing where they let this algorithm go wild and you can"}, {"start": 1202.56, "end": 1204.8799999999999, "text": " see that it's pretty, pretty fuzzy."}, {"start": 1204.88, "end": 1211.16, "text": " So this RL controller finds this architecture to be the best architecture and you can see"}, {"start": 1211.16, "end": 1218.5200000000002, "text": " it's continuously down and up and down and sorry and up and down and there's considerable"}, {"start": 1218.5200000000002, "end": 1224.44, "text": " cross connections between all of these things and then here you have the you have the different"}, {"start": 1224.44, "end": 1229.2800000000002, "text": " output layers built into the network rather than next to the network right."}, {"start": 1229.2800000000002, "end": 1234.5600000000002, "text": " So these are the ones that are now the red border ones are now the features that are"}, {"start": 1234.56, "end": 1238.36, "text": " used for going and classifying."}, {"start": 1238.36, "end": 1242.76, "text": " As an intermediate step they also consider this architecture where they basically built"}, {"start": 1242.76, "end": 1249.12, "text": " a smaller ResNet right here and then let the algorithm decide on the rest right here."}, {"start": 1249.12, "end": 1256.1599999999999, "text": " So it still has the same amount of parameters roughly but they can investigate what happens"}, {"start": 1256.1599999999999, "end": 1263.84, "text": " if we go to this lower, if we have this structure at the beginning but then part of it we"}, {"start": 1263.84, "end": 1270.6, "text": " can do with our algorithm and lastly they also consider this architecture."}, {"start": 1270.6, "end": 1276.08, "text": " Now this architecture again their algorithm has control over the whole network but there"}, {"start": 1276.08, "end": 1278.6, "text": " is an additional thing that the algorithm can do."}, {"start": 1278.6, "end": 1284.56, "text": " The algorithm can also decide to change the number of features and to change the type"}, {"start": 1284.56, "end": 1285.8799999999999, "text": " of block."}, {"start": 1285.8799999999999, "end": 1291.0, "text": " So here you can see these are all residual blocks and these are these called bottleneck"}, {"start": 1291.0, "end": 1292.0, "text": " blocks."}, {"start": 1292.0, "end": 1296.92, "text": " So it's actually a different way of doing a residual block."}, {"start": 1296.92, "end": 1304.76, "text": " It was introduced in the original ResNet paper but the controller can simply switch to that"}, {"start": 1304.76, "end": 1311.08, "text": " and that can save some computation if you go through these bottleneck blocks."}, {"start": 1311.08, "end": 1312.24, "text": " So what does that give you?"}, {"start": 1312.24, "end": 1319.48, "text": " You can see below that the ResNet 50 is at 37.8% average precision."}, {"start": 1319.48, "end": 1324.92, "text": " If you liberate the top part to leave it to the algorithm it's at 39."}, {"start": 1324.92, "end": 1329.92, "text": " If you liberate the entire network it's at 40.7 and remember these are roughly the same"}, {"start": 1329.92, "end": 1337.3600000000001, "text": " amount of parameters and then if you also let the network control a bit of the feature"}, {"start": 1337.3600000000001, "end": 1344.32, "text": " size and the type of block you get a 40.8 which is the same as before but now this one"}, {"start": 1344.32, "end": 1351.76, "text": " I believe has about, oh yeah here we go, with 10% fewer flops."}, {"start": 1351.76, "end": 1354.36, "text": " So that's pretty cool."}, {"start": 1354.36, "end": 1359.4399999999998, "text": " Though remember that the left thing, this is made by humans."}, {"start": 1359.4399999999998, "end": 1366.8, "text": " This is just our heuristic and the right things they are made by RL and they are for these"}, {"start": 1366.8, "end": 1368.6, "text": " particular data sets."}, {"start": 1368.6, "end": 1376.1599999999999, "text": " They do find that generally this also transfers to image net classification but still this"}, {"start": 1376.1599999999999, "end": 1381.48, "text": " is sort of a, it works well for the type of data we work with and so on."}, {"start": 1381.48, "end": 1387.24, "text": " So I don't know how much I would trust it how far we should go of building spine net"}, {"start": 1387.24, "end": 1394.1999999999998, "text": " 49 as our new backbone for every image task that we have."}, {"start": 1394.1999999999998, "end": 1398.28, "text": " It remains to be seen I believe."}, {"start": 1398.28, "end": 1405.32, "text": " Before actually we go to the experiments, I want to state my idea right here."}, {"start": 1405.32, "end": 1412.04, "text": " So you get the general gist here and so another kind of coral I have with this is that in"}, {"start": 1412.04, "end": 1418.08, "text": " here you always have these single connections and here you always have these double connections"}, {"start": 1418.08, "end": 1424.6399999999999, "text": " and I've looked through the experiment it seems like nowhere do they ablate or anything"}, {"start": 1424.64, "end": 1433.8000000000002, "text": " what what it means to only have single connections or if they so if they let the resin at run with"}, {"start": 1433.8000000000002, "end": 1434.88, "text": " double connections."}, {"start": 1434.88, "end": 1441.2800000000002, "text": " So if they are controller could not switch the order but only introduce the connections."}, {"start": 1441.2800000000002, "end": 1445.8000000000002, "text": " They might have done this they have a lot of experiments where they do the different"}, {"start": 1445.8000000000002, "end": 1447.1200000000001, "text": " ablations."}, {"start": 1447.12, "end": 1454.8, "text": " So I would be interested what happens when you let it run on the resin but let it have"}, {"start": 1454.8, "end": 1460.52, "text": " two connections per per layer is it then better or not."}, {"start": 1460.52, "end": 1465.36, "text": " So here the importance I'll get to my idea later."}, {"start": 1465.36, "end": 1471.3999999999999, "text": " The importance of scale permutation that's where they investigate how important is it"}, {"start": 1471.4, "end": 1479.24, "text": " that you permute the layers and that turns out to be fairly important."}, {"start": 1479.24, "end": 1484.68, "text": " Then the importance of cross scale connections that's how they investigate here."}, {"start": 1484.68, "end": 1486.24, "text": " So these are these connections."}, {"start": 1486.24, "end": 1490.8000000000002, "text": " They say the cross scale connections play a crucial role in fusing features at different"}, {"start": 1490.8000000000002, "end": 1493.6000000000001, "text": " resolutions throughout the scale permuted network."}, {"start": 1493.6000000000001, "end": 1496.0800000000002, "text": " So that's the reasoning behind it."}, {"start": 1496.08, "end": 1502.12, "text": " We take features from different kind of resolutions and we can also scale up again and then scale"}, {"start": 1502.12, "end": 1508.48, "text": " down again to gain some additional features from the from the higher resolutions."}, {"start": 1508.48, "end": 1511.36, "text": " We study it's important by graph damage."}, {"start": 1511.36, "end": 1517.24, "text": " So either they remove the short term connections or they remove the long range connections or"}, {"start": 1517.24, "end": 1522.8799999999999, "text": " they remove both and then connect one block to the previous block via a sequential connection."}, {"start": 1522.88, "end": 1526.7600000000002, "text": " So this is only in the things that they learned."}, {"start": 1526.7600000000002, "end": 1532.16, "text": " So this model is where they fully give their model control over the ordering and connections."}, {"start": 1532.16, "end": 1535.2, "text": " You can see that as this 40.7%."}, {"start": 1535.2, "end": 1540.24, "text": " Now if they delete the short range connections, they drop to 35."}, {"start": 1540.24, "end": 1544.2800000000002, "text": " If they delete the only the long range, they drop to even more."}, {"start": 1544.2800000000002, "end": 1549.7600000000002, "text": " So here you can see that these long range connections which I guess are connections that are"}, {"start": 1549.76, "end": 1557.12, "text": " going across multiple blocks, skipping multiple blocks, these tend to be very important."}, {"start": 1557.12, "end": 1565.04, "text": " So you can make the case that it might be very important to fuse these things from different"}, {"start": 1565.04, "end": 1571.16, "text": " layers to fuse the features from different resolutions because these long range connections"}, {"start": 1571.16, "end": 1573.08, "text": " tend to be important."}, {"start": 1573.08, "end": 1580.96, "text": " It's one thing to say that if we just leave them away with our model, if we just damage it"}, {"start": 1580.96, "end": 1584.76, "text": " and then let it run, it drops in accuracy."}, {"start": 1584.76, "end": 1589.36, "text": " It's not entirely the same thing as to say that these are important because you don't"}, {"start": 1589.36, "end": 1593.48, "text": " really know what happens if you train without them."}, {"start": 1593.48, "end": 1597.8, "text": " Maybe if you train without them, you can reach as good an accuracy."}, {"start": 1597.8, "end": 1604.28, "text": " So this graph damage investigation, it has something but not I wouldn't trust it too"}, {"start": 1604.28, "end": 1605.28, "text": " much."}, {"start": 1605.28, "end": 1611.12, "text": " Yeah, I think they haven't investigated what happens if they keep the ResNet order but"}, {"start": 1611.12, "end": 1614.84, "text": " let the connections be twice."}, {"start": 1614.84, "end": 1621.44, "text": " But you get the general idea of the paper right here of what they do."}, {"start": 1621.44, "end": 1624.6399999999999, "text": " Now they do this with architecture search right here."}, {"start": 1624.6399999999999, "end": 1626.12, "text": " But here's an idea."}, {"start": 1626.12, "end": 1628.52, "text": " Okay, I propose the following."}, {"start": 1628.52, "end": 1631.08, "text": " You have an image right here."}, {"start": 1631.08, "end": 1636.6799999999998, "text": " And we are wondering here, should we let it go through a layer that's wide and with"}, {"start": 1636.6799999999998, "end": 1643.08, "text": " less features, should we let it go through a layer that's very many features but not"}, {"start": 1643.08, "end": 1650.28, "text": " as wide, but we have to downscale the image or should we let it go first through something"}, {"start": 1650.28, "end": 1651.8, "text": " intermediate."}, {"start": 1651.8, "end": 1653.84, "text": " Let's see like this."}, {"start": 1653.84, "end": 1654.84, "text": " Okay."}, {"start": 1654.84, "end": 1657.12, "text": " And I'm wondering how should we order these blocks?"}, {"start": 1657.12, "end": 1661.28, "text": " Why can't we do all of at the same time?"}, {"start": 1661.28, "end": 1665.56, "text": " Why can't we do this, this, and this?"}, {"start": 1665.56, "end": 1666.56, "text": " Okay."}, {"start": 1666.56, "end": 1673.04, "text": " And then in the next layer, again, do all of them at the same time."}, {"start": 1673.04, "end": 1678.04, "text": " And you can already see where this is going."}, {"start": 1678.04, "end": 1681.56, "text": " I hope, I hope you can see where this is going."}, {"start": 1681.56, "end": 1687.84, "text": " So you have a routing right here and how do we do routing in modern times in deep learning"}, {"start": 1687.84, "end": 1689.12, "text": " with attention?"}, {"start": 1689.12, "end": 1694.3999999999999, "text": " So I propose you have layers with different attention."}, {"start": 1694.3999999999999, "end": 1699.8799999999999, "text": " Hey, let's say these are, these are now your sequences or you can also make them as"}, {"start": 1699.8799999999999, "end": 1700.8799999999999, "text": " attention heads."}, {"start": 1700.8799999999999, "end": 1701.8799999999999, "text": " Okay."}, {"start": 1701.8799999999999, "end": 1703.52, "text": " These are these."}, {"start": 1703.52, "end": 1713.0, "text": " And the lower level features are routed to the higher level features with an attention"}, {"start": 1713.0, "end": 1715.2, "text": " mechanism."}, {"start": 1715.2, "end": 1717.8, "text": " And you do this layer by layer by layer."}, {"start": 1717.8, "end": 1720.36, "text": " So you let, because what's the problem here?"}, {"start": 1720.36, "end": 1726.08, "text": " The problem here is that the same data point has to go, you know, you find these good connections"}, {"start": 1726.08, "end": 1730.8, "text": " but the all the data points have to go through the same connections."}, {"start": 1730.8, "end": 1736.8, "text": " And it might actually be that you need different routing depending on the data point."}, {"start": 1736.8, "end": 1740.08, "text": " It might be that what this is, this is good for the average data point, but it would"}, {"start": 1740.08, "end": 1744.8799999999999, "text": " be much better if whenever there's a cat, you take one path and whenever there's a dog,"}, {"start": 1744.8799999999999, "end": 1747.08, "text": " you take a different path."}, {"start": 1747.08, "end": 1749.76, "text": " So this will allow for that."}, {"start": 1749.76, "end": 1755.84, "text": " You basically have the routing parameterized by an attention mechanism."}, {"start": 1755.84, "end": 1758.48, "text": " This, I have no clue how much compute this would take."}, {"start": 1758.48, "end": 1762.64, "text": " It doesn't seem that outrageous because what's your sequence length here?"}, {"start": 1762.64, "end": 1767.6, "text": " Your sequence length is going to be the number of layers maybe and maybe times the number"}, {"start": 1767.6, "end": 1769.96, "text": " of feature maps, maybe have different attention heads."}, {"start": 1769.96, "end": 1774.52, "text": " So you maybe want to replicate some of those here."}, {"start": 1774.52, "end": 1779.96, "text": " But ultimately, I would guess the attention mechanism itself isn't that much of an overhead."}, {"start": 1779.96, "end": 1783.6, "text": " Maybe it's an overhead that you have so many in parallel."}, {"start": 1783.6, "end": 1784.6, "text": " Yeah."}, {"start": 1784.6, "end": 1789.48, "text": " But it remains to be seen, that's the idea."}, {"start": 1789.48, "end": 1793.7199999999998, "text": " Yeah, you heard it here first."}, {"start": 1793.7199999999998, "end": 1794.7199999999998, "text": " Okay."}, {"start": 1794.7199999999998, "end": 1797.0, "text": " So they have more experiments."}, {"start": 1797.0, "end": 1801.9599999999998, "text": " So they also build here is where they say, okay, we have the spine net 49 now."}, {"start": 1801.9599999999998, "end": 1804.76, "text": " And we found this to work, we found this to work really well."}, {"start": 1804.76, "end": 1807.8799999999999, "text": " This is our spine net 49 architecture."}, {"start": 1807.8799999999999, "end": 1808.8799999999999, "text": " Cool."}, {"start": 1808.8799999999999, "end": 1810.6799999999998, "text": " And we want to make it bigger."}, {"start": 1810.68, "end": 1815.96, "text": " But I guess they didn't have the computational resources to run the neural architecture"}, {"start": 1815.96, "end": 1817.92, "text": " search for bigger networks."}, {"start": 1817.92, "end": 1821.76, "text": " This is now as about as big as a resonant 50, right?"}, {"start": 1821.76, "end": 1827.44, "text": " But what if you want to go to a resonant 100 or a resonant 150?"}, {"start": 1827.44, "end": 1831.72, "text": " There you don't have the computational resources to neural architectures."}, {"start": 1831.72, "end": 1837.04, "text": " Imagine this, Google hasn't had the computational resources to do neural architecture search"}, {"start": 1837.04, "end": 1838.44, "text": " on this thing."}, {"start": 1838.44, "end": 1842.76, "text": " So this must be expensive or I'm just, I have no idea."}, {"start": 1842.76, "end": 1845.04, "text": " But what they do is they kind of do a trick."}, {"start": 1845.04, "end": 1854.56, "text": " So here they take the spine net 49 and they say we build a spine net 60 96 by simply repeating"}, {"start": 1854.56, "end": 1856.44, "text": " each block twice."}, {"start": 1856.44, "end": 1860.92, "text": " So all the incoming connections would go to the first block and all the outgoing connections"}, {"start": 1860.92, "end": 1862.92, "text": " would come from the second block, right?"}, {"start": 1862.92, "end": 1867.68, "text": " Here you had to in and maybe there's actually no limit to how many outgoing connections you"}, {"start": 1867.68, "end": 1869.1200000000001, "text": " can have."}, {"start": 1869.1200000000001, "end": 1875.3200000000002, "text": " And also you can also do this three times, which I think is a bit of a cheap way and it kind"}, {"start": 1875.3200000000002, "end": 1878.4, "text": " of defeats the entire purpose, right?"}, {"start": 1878.4, "end": 1882.68, "text": " Couldn't you make the exact same argument again here that maybe it's helpful to route"}, {"start": 1882.68, "end": 1889.16, "text": " from this block right here or maybe it's helpful that these don't have the same scale right"}, {"start": 1889.16, "end": 1891.5600000000002, "text": " after one another."}, {"start": 1891.5600000000002, "end": 1896.72, "text": " It just seems, but okay, so they say we found this good structure and we simply duplicate"}, {"start": 1896.72, "end": 1897.72, "text": " each block."}, {"start": 1897.72, "end": 1902.76, "text": " I'm not that big of a fan in any case."}, {"start": 1902.76, "end": 1908.16, "text": " So they train this and it of course outperforms everything else if you compare with kind of models"}, {"start": 1908.16, "end": 1909.16, "text": " of the same size."}, {"start": 1909.16, "end": 1917.4, "text": " So here you compare this spine net 49 to the ResNet 50 and you can see there's about"}, {"start": 1917.4, "end": 1918.92, "text": " the same number of parameters."}, {"start": 1918.92, "end": 1924.32, "text": " How about it outperforms the ResNet 50 pretty much."}, {"start": 1924.32, "end": 1930.76, "text": " And as you go up the number of parameters here, the performance goes up yet again."}, {"start": 1930.76, "end": 1937.12, "text": " And I believe these dagger ones here are simply trained with a special schedule with, oh,"}, {"start": 1937.12, "end": 1943.8, "text": " yeah, here with applying stochastic depth and swish activation for a longer training schedule."}, {"start": 1943.8, "end": 1950.32, "text": " So you can see that not only do are the spine nets, sorry, the number of parameters is"}, {"start": 1950.32, "end": 1951.32, "text": " here."}, {"start": 1951.32, "end": 1960.48, "text": " Not only are the spine nets slightly smaller than the ResNets, they do require less flops"}, {"start": 1960.48, "end": 1961.96, "text": " and they reach better accuracy."}, {"start": 1961.96, "end": 1969.1599999999999, "text": " So everything is a win here."}, {"start": 1969.1599999999999, "end": 1972.56, "text": " So they apply this to these data sets."}, {"start": 1972.56, "end": 1981.32, "text": " I don't want to go too much into that."}, {"start": 1981.32, "end": 1985.28, "text": " But in the last part, they also apply this to image net."}, {"start": 1985.28, "end": 1989.96, "text": " So there's image classification where they basically say, okay, we can just go to our"}, {"start": 1989.96, "end": 1994.56, "text": " architecture and we can just add up all the output blocks."}, {"start": 1994.56, "end": 2000.08, "text": " We scale them appropriately and add up all the output blocks right here because these"}, {"start": 2000.08, "end": 2002.72, "text": " are good features for localization and so on."}, {"start": 2002.72, "end": 2005.6, "text": " And we can train it to do image classification."}, {"start": 2005.6, "end": 2013.8, "text": " So all of these go into a big combination classifier that does the 1000 classes of image"}, {"start": 2013.8, "end": 2016.36, "text": " net, image classification."}, {"start": 2016.36, "end": 2019.6, "text": " And that also works pretty well with this network."}, {"start": 2019.6, "end": 2026.76, "text": " So they basically argue what they found is sort of a better image processing network than"}, {"start": 2026.76, "end": 2028.6799999999998, "text": " the ResNet 50."}, {"start": 2028.68, "end": 2034.28, "text": " And I guess they would argue that from now on, you should take this as your backbone for"}, {"start": 2034.28, "end": 2038.48, "text": " image classification and recognition and so on."}, {"start": 2038.48, "end": 2042.76, "text": " Which it's entirely possible that this works better."}, {"start": 2042.76, "end": 2046.76, "text": " There's no particular reason why the ResNet 50 should work at all."}, {"start": 2046.76, "end": 2048.28, "text": " It's just a heuristic."}, {"start": 2048.28, "end": 2055.92, "text": " But I guess it remains to be seen whether that's generally true or just in the things they"}, {"start": 2055.92, "end": 2056.92, "text": " considered."}, {"start": 2056.92, "end": 2066.0, "text": " You see right here the spine net generally improving over the image net, which is not stated"}, {"start": 2066.0, "end": 2068.6800000000003, "text": " right here, but it does generally improve."}, {"start": 2068.6800000000003, "end": 2077.84, "text": " And you can see as you go higher and higher spine net, the numbers tend to improve as well."}, {"start": 2077.84, "end": 2084.6, "text": " And this is already pretty respectable, respectable number for image net, right?"}, {"start": 2084.6, "end": 2085.6, "text": " All right."}, {"start": 2085.6, "end": 2090.2799999999997, "text": " So this was it for this paper, for this particular paper."}, {"start": 2090.2799999999997, "end": 2095.8399999999997, "text": " They do have two different of these object detection recognition data sets."}, {"start": 2095.8399999999997, "end": 2100.68, "text": " And I invite you to check out the experiments more closely if you're interested in that sort"}, {"start": 2100.68, "end": 2101.68, "text": " of thing."}, {"start": 2101.68, "end": 2107.16, "text": " I was mainly interested in the method of doing and arranging these layers and so on."}, {"start": 2107.16, "end": 2111.44, "text": " 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": 2119.56, "text": " they get a better model out of that."}, {"start": 2119.56, "end": 2125.68, "text": " And if it turns out that this model is a good model, the entire community will be better"}, {"start": 2125.68, "end": 2126.68, "text": " off."}, {"start": 2126.68, "end": 2132.2400000000002, "text": " Unfortunately, there's no broad impact statement to tell us that also the terrorists will"}, {"start": 2132.2400000000002, "end": 2138.28, "text": " be able to use this for purposes."}, {"start": 2138.28, "end": 2140.4, "text": " But you can imagine that yourself."}, {"start": 2140.4, "end": 2142.6800000000003, "text": " All right, that was it for me."}, {"start": 2142.6800000000003, "end": 2148.28, "text": " Again, leave a comment if you want me to change anything or have suggestions."}, {"start": 2148.28, "end": 2149.76, "text": " Leave a like if you like the video."}, {"start": 2149.76, "end": 2150.76, "text": " Share it out."}, {"start": 2150.76, "end": 2155.76, "text": " So"}] |
Yannic Kilcher | 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-order-regressive transformers with linear attention by Angleau-Scataropoulos, Apaure-Vierch, Nicolas-Ous-Pappas, and François Fleuré. 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 order-regressive transformers, this makes the transformer essentially equivalent to a special kind of RNN. So yeah, that's 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 that so 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 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 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, GPT2, GPT, 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 auto regressive transformer because you always have a piece you predict the next piece and then I give you that next give you that entire piece and then you predict the next piece yet again and so on. And this auto regressive 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 a number of neurons as the sequence is long. Now from this 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 in 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 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 each you have to imagine each token right here this this have or have 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. 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 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 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. All right. 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. 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 non-linear and it being non-linear 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 will not have to do that. So let's dive into it. So here they go linear transformers. And the start off we're saying each transform layer is essentially this right here. So this is a this is kind of a higher level of view. What we view 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 transpose right here. Yep, 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 this distribution of how to aggregate information each row. We'll 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 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 consider 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. You 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 act 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 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, as I say here, equation three is equivalent to equation two. If we substitute the similarity function with the exponential function. Now 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 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 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 five a and five of b transpose. Okay, this is like, this is an inner product. So what it means is that this can be like a super non-linear 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 here is 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 non-linear, 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 its 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 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 non-linear function would just become a linear function. Wouldn't that be much easier? Linear functions are much easier to work with than non-linear functions. And if we know that as long as we get the correct phi, we do exactly the same thing as the non-linear function, you know, that would be helpful. So there is an entire, literally, it's an 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 non-linear 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 phi function that we would need would map to an infinite dimensional space. 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 such as linear, but we can't because these spaces are too high-dimensional, 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 and 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 they're 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 is no i. So we can just sort of pull this out of the 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 Brakat 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 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 is 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 all of n. Okay. Plus, of course, 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, 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 LL 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 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 is 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 they 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. And 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 weigh 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 biolistem baseline and the reformer, but they do not beat the softmax transformer. So there, 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 M-ness, then if you go on C for 10, it is 4,000 times faster. Simply by the 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 make it different from the old attention? Now, I want to sort of connect this to the kind of olden, olden literature of topic modeling. So if you think of this transformer again, of this attention mechanism, what you'll have is a dynamic routing of information. So 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 non-linear in terms of when we use the softmax and so on. So that what makes it 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, with input tokens here, output tokens here. The dimension of this map defines is how many topics there are. So 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 can't 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 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 I, sort of how I imagine that. Okay, so you get to distribute each token right here into these topics. And then the outputs, 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, of course, now it depends 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, um, 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 kuda. 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 R and N's. Now this is a bit, uh, 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, um, what we can do is we can define these two quantities, right? S and Z. And 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 transformer is 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 R and N, um, you have to, you know, run your R and N input this hidden state and input that map forward the hidden state. So you have to do all of this forward propagation, um, in order to derive at this hidden, at this output right here, make the output and then you need to backprop 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 go and I just cut a second to last word and so on. I can actually make all of these different training examples for a 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 allowed 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, uh, 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, uh, 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 would be, it would be really easy if you could attend to the input of that token, right? It could simply remember what that token is. And then, um, aggregate that here and then predict that. So if for each token, we restrict the attention to the tokens that came before it, right? 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. Then 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 Oranin. And with their formulation, you can make this pretty explicit. Namely, you have these two states S and a Z. And in each sequence element, it's actually like an Oranin where you update the S and the Z with these quantities right here. And so it's like an Oranin where these are the hidden states that you pass forward, right? And then you can formulate any transformer as an Oranin 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 a 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 Oranin. But their analysis shows that this a transformer, all the regressive is essentially an Oranin. And you can, you can, so you can make a connection in that. And you can actually formulate this as an Oranin, which means that you can train in the transformer fashion everything at the same time. But what is cool about an Oranin? An Oranin at inference time. An Oranin once it has produced, you know, this word, it can then, because if you produce order aggressively, 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 word, the next word, and then from that, the next word, and so on. An Oranin, 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 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 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 order-aggressive 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 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 technical order-aggressive 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 this hack to make the order-aggressive transformers train in parallel is actually making the transformer formulation much weaker. And therefore, that's then equivalent to an RNN. Okay? 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 other aggressive transformers that we currently train. Now, why is this connection so powerful? It allows a token to attend to tokens forward of it. And what does it mean to be able to attend? 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 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 it needs to do something conditioned on A. So 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't 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? You 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 is some of the output samples. You know, 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 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 mistakes 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 accuracy or whatnot and the linear transformers way, way faster. So I can see that this is going to be a I think 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": 5.48, "text": " Hi there. Today we're looking at transformers or RNNs, fast-order-regressive"}, {"start": 5.48, "end": 9.48, "text": " transformers with linear attention by Angleau-Scataropoulos,"}, {"start": 9.48, "end": 15.4, "text": " Apaure-Vierch, Nicolas-Ous-Pappas, and Fran\u00e7ois Fleur\u00e9. So this paper on a high"}, {"start": 15.4, "end": 21.2, "text": " level proposes to interpret the attention mechanism in transformers with a in"}, {"start": 21.2, "end": 25.560000000000002, "text": " terms of a kernel function. And therefore the resulting higher-dimensional"}, {"start": 25.56, "end": 31.799999999999997, "text": " linear operation can be used to formulate the linear transformer, which is"}, {"start": 31.799999999999997, "end": 37.08, "text": " orders of magnitude faster than a classic transformer. They also show that in"}, {"start": 37.08, "end": 41.879999999999995, "text": " the case of order-regressive transformers, this makes the transformer"}, {"start": 41.879999999999995, "end": 48.76, "text": " essentially equivalent to a special kind of RNN. So yeah, that's that's what"}, {"start": 48.76, "end": 53.519999999999996, "text": " this paper is about. And I think I have some comments to make that I haven't"}, {"start": 53.52, "end": 58.480000000000004, "text": " really seen made by others, though I have to admit that so haven't really looked"}, {"start": 58.480000000000004, "end": 65.04, "text": " at many comments. So I might just be telling old boring things. As always if you"}, {"start": 65.04, "end": 69.36, "text": " like content like this, consider sharing it out. Leave a like if you liked it."}, {"start": 69.36, "end": 74.24000000000001, "text": " Leave a comment to let me know what you think. I do read the comments and"}, {"start": 74.24000000000001, "end": 80.4, "text": " they're generally comment section is very very helpful to me and also people"}, {"start": 80.4, "end": 86.80000000000001, "text": " respond to each other. It's fairly cool to see that the community is usually"}, {"start": 86.80000000000001, "end": 93.12, "text": " very helpful to people asking questions. And yeah, just let me know what you think."}, {"start": 93.12, "end": 99.28, "text": " Alright, so what's the problem with transformers? And I've done many videos on"}, {"start": 99.28, "end": 103.60000000000001, "text": " transformers and I keep referring back to them for people who don't know"}, {"start": 103.60000000000001, "end": 108.08000000000001, "text": " what it is, but there's this original paper called attention is all you need"}, {"start": 108.08, "end": 113.67999999999999, "text": " that where I made a video about that. So if you don't know what transformers are"}, {"start": 113.67999999999999, "end": 116.96, "text": " you can go look at that. That should basically cover everything you need to know."}, {"start": 116.96, "end": 123.2, "text": " But there's many more transformers in the meantime. There's Bert, GPT2, GPT,"}, {"start": 123.2, "end": 130.32, "text": " whatever the number is after that. Many sequence processing models are now"}, {"start": 130.32, "end": 136.24, "text": " transformers. Many set processing models are now transformers. So this has reached"}, {"start": 136.24, "end": 142.08, "text": " a very very made a very big splash in the community. So essentially transformers come"}, {"start": 142.08, "end": 146.88, "text": " with this attention mechanism where you have an input set actually. But"}, {"start": 147.60000000000002, "end": 155.36, "text": " let's consider it a sequence. So a sequence of text maybe like I have an ice cream"}, {"start": 155.36, "end": 160.88, "text": " cone something like this. And you want to classify the text or you want to"}, {"start": 160.88, "end": 166.88, "text": " perform language modeling. So in language modeling the problem is as follows. I"}, {"start": 166.88, "end": 171.84, "text": " give you this piece of text and I ask you to predict the next piece of text."}, {"start": 173.44, "end": 177.76, "text": " This is this was kind of the first task that these transformers were used on."}, {"start": 178.64, "end": 183.35999999999999, "text": " And this is what is called an auto regressive transformer because you always have a"}, {"start": 183.35999999999999, "end": 188.07999999999998, "text": " piece you predict the next piece and then I give you that next give you that entire piece and"}, {"start": 188.08, "end": 193.44000000000003, "text": " then you predict the next piece yet again and so on. And this auto regressive property is going to"}, {"start": 193.44000000000003, "end": 198.88000000000002, "text": " you know come in play in this paper later. But ultimately what you have in a transformer is called"}, {"start": 198.88000000000002, "end": 204.4, "text": " an attention mechanism. So an attention mechanism is the following. Each layer in the transformer"}, {"start": 204.4, "end": 211.28, "text": " you can imagine as having the same number of nodes kind of a number of neurons as the sequence is"}, {"start": 211.28, "end": 217.84, "text": " long. Now from this input sequence you're going to generate for each of these tokens you're going"}, {"start": 217.84, "end": 224.8, "text": " to generate three different things. You're going to generate a key query in the value. So in"}, {"start": 224.8, "end": 230.0, "text": " in these you do from so usually this doesn't come in form of a letter right this comes in form"}, {"start": 230.0, "end": 234.96, "text": " of some kind of embedding vector. And from that you're going to generate three different things."}, {"start": 234.96, "end": 240.32, "text": " I should probably use different colors for for so this is a function you're going to produce"}, {"start": 240.32, "end": 246.56, "text": " three different things from that. You're going to produce a key. You're going to produce a query"}, {"start": 246.56, "end": 254.4, "text": " and you're going to produce a value. Now the key is you can imagine it being attached to this"}, {"start": 254.4, "end": 261.84000000000003, "text": " lower layer right here. So that's the key for this token right here. That's the key the key here"}, {"start": 261.84000000000003, "end": 268.32, "text": " for that token right here. It's a word piece right. So the keys again are also just you know vectors"}, {"start": 268.32, "end": 275.84000000000003, "text": " vector vector. The query you figuratively attach to the top layer right here. So the queries they go"}, {"start": 275.84, "end": 284.4, "text": " here for each token and they are also vectors. And the values will keep out of it for now. So"}, {"start": 284.4, "end": 289.44, "text": " the queries and the keys define basically how you route the information and you route the information"}, {"start": 290.23999999999995, "end": 299.35999999999996, "text": " by going over each so each each you have to imagine each token right here this this have or have"}, {"start": 299.36, "end": 308.8, "text": " it needs to aggregate information from all the other tokens right. So we're going through multiple"}, {"start": 308.8, "end": 315.52000000000004, "text": " layers of this and in each layer each of these tokens is aggregating information from the other"}, {"start": 315.52000000000004, "end": 321.76, "text": " tokens. If we do this in multiple rounds is eventually you know the each token is aggregating"}, {"start": 321.76, "end": 328.96000000000004, "text": " information eventually each token knows about all the other tokens. But how this information aggregation"}, {"start": 328.96, "end": 335.44, "text": " is done is very important. For example if the token is a pronoun it would be very interested in"}, {"start": 335.44, "end": 342.47999999999996, "text": " information coming from any sort of named entity in the sentence because it very much wants to know"}, {"start": 342.47999999999996, "end": 348.15999999999997, "text": " what it is referring to right. If you are a if you are the the pronoun in the sentence"}, {"start": 349.2, "end": 354.79999999999995, "text": " it is very vital that you understand which of these things you refer to. So you'll start aggregating"}, {"start": 354.8, "end": 362.32, "text": " information for that. And then once you know who or what you refer to then the other parts of the"}, {"start": 362.32, "end": 367.44, "text": " sentence can make use of that information so they will start requesting information from you."}, {"start": 369.28000000000003, "end": 376.72, "text": " So layer after layer each token aggregates information from each other token. So this works by"}, {"start": 376.72, "end": 382.0, "text": " let's say we're at this token right here what we're going to do is we're going to form the inner"}, {"start": 382.0, "end": 389.44, "text": " product between that vector and each of these vectors. And then we're going to transfer that into a"}, {"start": 389.44, "end": 399.92, "text": " softmax which makes this into a first of all there's so we do the query together with all the keys"}, {"start": 401.52, "end": 407.2, "text": " and then we run it through the exponential function. And after that we're going to normalize it"}, {"start": 407.2, "end": 413.59999999999997, "text": " by the sum of all the exponential functions. That will give us a properly normalized"}, {"start": 413.59999999999997, "end": 419.36, "text": " distribution so a histogram basically of where we are going to get our information from."}, {"start": 420.08, "end": 425.2, "text": " This is going to be the highest where the inner product right here is the highest. So"}, {"start": 425.2, "end": 433.2, "text": " from this token right here. And you know this is fairly fairly standard what I drew by accident"}, {"start": 433.2, "end": 440.8, "text": " is fairly standard that a token probably wants to know a lot about itself. So you want to carry"}, {"start": 440.8, "end": 445.12, "text": " forward the information that you already have in this particular token. That's why your inner"}, {"start": 445.12, "end": 450.4, "text": " product is going to maybe align a lot with your own key. So the keys and queries are learned. So"}, {"start": 450.4, "end": 457.2, "text": " each token decides what kind of information it wants to advertise to the others and then also"}, {"start": 457.2, "end": 466.56, "text": " each token decides what kind of information it wants to gather from the others. And the routing"}, {"start": 466.56, "end": 472.71999999999997, "text": " then is put through a softmax function and that gives you this right here. You do this for every"}, {"start": 472.71999999999997, "end": 480.0, "text": " single token. So the problem with this is that every single token needs to do the inner product"}, {"start": 480.0, "end": 486.64, "text": " of its query with all the different keys. And each of that has to go through the softmax and then"}, {"start": 487.28, "end": 492.48, "text": " the value that's actually aggregated are these values right here. Now the values are simply a"}, {"start": 492.48, "end": 501.28, "text": " transformation of the incoming values. Values are what's really propagated. You can think of it as"}, {"start": 501.28, "end": 507.68, "text": " just like a one layer neural network. Ultimately you could also leave away the values. People don't do"}, {"start": 507.68, "end": 514.24, "text": " this. Some people do the same queries and keys but the values are just a transformation of your"}, {"start": 514.24, "end": 520.8, "text": " input. So the important thing is this right here. This decides how you're going to aggregate the values."}, {"start": 522.32, "end": 530.48, "text": " All right. So this is has a quadratic complexity. So if you if you have n input tokens,"}, {"start": 531.6, "end": 537.52, "text": " then this entire process will require n squared operations because you need to form the inner"}, {"start": 537.52, "end": 544.72, "text": " products between each pair of queries and keys. And it also is going to require that much memory."}, {"start": 544.72, "end": 550.64, "text": " And this we're going to see this is in large part due to this softmax operation because"}, {"start": 551.1999999999999, "end": 557.6, "text": " because we have a softmax it makes the whole thing non-linear and it being non-linear basically"}, {"start": 557.6, "end": 562.56, "text": " means we'll have to you know store everything keep everything around and we have to"}, {"start": 562.56, "end": 568.64, "text": " recompute for each query. We're going to see in this paper formulation where if we make the whole"}, {"start": 568.64, "end": 575.3599999999999, "text": " process linear, then we will will not have to do that. So let's dive into it."}, {"start": 579.68, "end": 586.3199999999999, "text": " So here they go linear transformers. And the start off we're saying each transform layer is"}, {"start": 586.3199999999999, "end": 592.16, "text": " essentially this right here. So this is a this is kind of a higher level of view. What we view so far"}, {"start": 592.16, "end": 597.68, "text": " is just this part right here. This is the attention routing mechanism. Each layer is actually"}, {"start": 597.68, "end": 605.36, "text": " wrapped in a residual connection and also a simple element wise or row wise feed forward layer."}, {"start": 605.8399999999999, "end": 612.64, "text": " But these things are usually not that much into consideration. What's really hurting in the"}, {"start": 612.64, "end": 618.8, "text": " transformer if you go into very long sequences is this attention routing mechanism."}, {"start": 618.8, "end": 625.12, "text": " So the attention routing mechanism is as follows. You can see right here this is the formal"}, {"start": 625.12, "end": 631.52, "text": " expression of what I described right here. Here you have the and notice this is an outer product."}, {"start": 632.4, "end": 644.0, "text": " So if I have if I have n sequence elements, the q right here are the queries. So this transforms"}, {"start": 644.0, "end": 653.12, "text": " each of the n into a into a D dimensional space right. And also the keys will transform each of"}, {"start": 653.12, "end": 661.68, "text": " these into a D dimensional space. So this here is going this here is going to be a n by n matrix"}, {"start": 661.68, "end": 671.92, "text": " right. This is this q k t is going to be an n by n matrix. This is x w q w k x."}, {"start": 671.92, "end": 677.36, "text": " And this transpose right here. Yep, like this. Okay."}, {"start": 679.36, "end": 685.36, "text": " So this is sort of an outer product. And then we're going to take the row wise softmax."}, {"start": 685.36, "end": 690.24, "text": " And that will give us for each row in this matrix. So for each row in this matrix,"}, {"start": 691.5999999999999, "end": 697.1999999999999, "text": " we're going to have this distribution of how to aggregate information each row."}, {"start": 697.2, "end": 704.0, "text": " We'll give us basically for each of the upper level tokens for each of the outputs"}, {"start": 704.0, "end": 709.36, "text": " how we need to aggregate information from the inputs and the information that we're"}, {"start": 709.36, "end": 718.88, "text": " aggregating are these values right here. Now they generalize this. First of all, they say we can"}, {"start": 718.88, "end": 725.6800000000001, "text": " also we can write it in this form right here. Instead of having a softmax, we can actually"}, {"start": 725.68, "end": 732.88, "text": " think of any kind of similarity function between the queries and the keys. So here you see"}, {"start": 734.0799999999999, "end": 740.0799999999999, "text": " what we want to do if we want to calculate output i here, the important thing is there is no longer"}, {"start": 740.0799999999999, "end": 747.12, "text": " this is an entire matrix. And we consider a row wise softmax. And now we write this out into"}, {"start": 748.0, "end": 754.8, "text": " the individual elements of the output. And we can we can do so. We can say, okay,"}, {"start": 754.8, "end": 762.64, "text": " how do we obtain one element of the output? We're going to calculate some sort of similarity"}, {"start": 763.68, "end": 770.3199999999999, "text": " of that particular query. You see i here, i here. We're going to calculate some sort of similarity"}, {"start": 770.3199999999999, "end": 777.68, "text": " between the query of that particular output with all of the keys. So here you can see all of the"}, {"start": 777.68, "end": 784.4, "text": " keys of the input. And we're going to act and we're going to normalize, right, this is the normalization"}, {"start": 784.4, "end": 791.04, "text": " that happens also in the softmax. And that will give us like a histogram of how we aggregate the"}, {"start": 791.04, "end": 797.92, "text": " values right here. So all of this of this red stuff will give us again some sort of a histogram"}, {"start": 797.92, "end": 805.84, "text": " of how we're going to aggregate information. If you look a bit like this and you know how the"}, {"start": 805.84, "end": 812.96, "text": " softmax is defined, you'll see that if we plug in the exponential function for as the similarity"}, {"start": 812.96, "end": 818.48, "text": " function, then you'll get back to the softmax. Okay, as I say here, equation three is equivalent"}, {"start": 818.48, "end": 824.0, "text": " to equation two. If we substitute the similarity function with the exponential function."}, {"start": 825.84, "end": 834.0, "text": " Now they go ahead and they go into kernels. So for that, you sort of need to understand"}, {"start": 834.8000000000001, "end": 842.72, "text": " what a kernel is. A kernel is a special kind for the purposes that we are looking at here."}, {"start": 842.72, "end": 849.0400000000001, "text": " A kernel is a special kind of a similarity function. It needs to have some properties right here."}, {"start": 850.08, "end": 855.76, "text": " But essentially they say, well, this kind of looks like a kernel and we will simply say, okay,"}, {"start": 855.76, "end": 865.9200000000001, "text": " here, this similarity, what if we use a kernel here? So a kernel simply is a similarity function"}, {"start": 865.9200000000001, "end": 871.12, "text": " of two vectors. If you interpret it like, it has some more conditions. I know, I know, don't"}, {"start": 871.12, "end": 879.76, "text": " freak on me. But the interesting properties about kernels is that if a similarity function is a"}, {"start": 879.76, "end": 891.36, "text": " kernel, it means that there exists a mapping. And where do we do? So if k between a and b is a kernel,"}, {"start": 891.36, "end": 906.4, "text": " if k is a kernel, that means that there exists a similar a function phi such that phi such that the"}, {"start": 906.4, "end": 916.4, "text": " kernel between a and b can be expressed as a linear product between five a and five of b transpose."}, {"start": 916.4, "end": 927.68, "text": " Okay, this is like, this is an inner product. So what it means is that this can be like a super"}, {"start": 927.68, "end": 934.88, "text": " non-linear function, a kernel for example, it can be and the example often given in like machine"}, {"start": 934.88, "end": 941.6, "text": " learning classes is maybe something like this. You have one dimensional data, right? And here is"}, {"start": 941.6, "end": 948.96, "text": " the here is zero. And you have two kinds of data points. You have the x's right here. And you have"}, {"start": 948.96, "end": 958.64, "text": " the circles right here. Now I cannot classify this data linearly. However, however, I can transform"}, {"start": 958.64, "end": 966.88, "text": " this into a higher dimensional space. So my function phi is of my function phi of x is going to"}, {"start": 966.88, "end": 976.4, "text": " map to the vector x x squared. And that will transform the data into a two dimensional space,"}, {"start": 976.4, "end": 984.32, "text": " right? And the data will look something like this. So it's going to the y axis is going to be"}, {"start": 984.32, "end": 997.6, "text": " the square of the x axis. Okay. And like this. And now I can find a linear classifier. Okay. So in"}, {"start": 997.6, "end": 1004.72, "text": " this case, right here, you can see that in this higher space, things become linear, things become"}, {"start": 1004.72, "end": 1014.64, "text": " linearly classifiable. And very similarly, like this is you can define the similarity between"}, {"start": 1014.64, "end": 1019.84, "text": " things right here. So the similarity function would be the square function right here. And"}, {"start": 1021.6, "end": 1028.4, "text": " this would be a quadratic, an example of a quadratic kernel. So this function right here can be"}, {"start": 1028.4, "end": 1035.3600000000001, "text": " very non-linear. I mean, it can be a linear function, but it can be very non-linear, but it is"}, {"start": 1035.3600000000001, "end": 1043.0400000000002, "text": " equivalent. It is equivalent. This means it is equivalent to a linear function in a high-dimensional"}, {"start": 1043.0400000000002, "end": 1054.8000000000002, "text": " space. Now to figure out linear. To figure out what this function phi is is the big, the big"}, {"start": 1054.8, "end": 1060.96, "text": " question of course. For a couple of kernels, we know the function phi, right? For the quadratic"}, {"start": 1060.96, "end": 1068.24, "text": " kernel, for example, we know we just saw that phi maps this to the vector of the coordinate and"}, {"start": 1068.24, "end": 1075.44, "text": " its quadratic to its square. We know for a couple of other kernels what their associated functions"}, {"start": 1075.44, "end": 1079.76, "text": " are, but in general, if it's a kernel, then we can just replace it with a linear function"}, {"start": 1079.76, "end": 1091.84, "text": " with this thing. And in reverse, we can just say, well, what we could do is we could just simply"}, {"start": 1091.84, "end": 1100.8, "text": " define a function phi and basically map this into map these a and b into a higher-dimensional"}, {"start": 1100.8, "end": 1106.8799999999999, "text": " space where this super-duper non-linear function would just become a linear function. Wouldn't that"}, {"start": 1106.88, "end": 1112.16, "text": " be much easier? Linear functions are much easier to work with than non-linear functions. And if we"}, {"start": 1112.88, "end": 1120.48, "text": " know that as long as we get the correct phi, we do exactly the same thing as the non-linear function,"}, {"start": 1120.48, "end": 1125.0400000000002, "text": " you know, that would be helpful. So there is an entire, literally, it's an entire, like, decade"}, {"start": 1125.0400000000002, "end": 1131.5200000000002, "text": " of kernelization and kernelize everything, kernelized SVMs to start, but then you can go way"}, {"start": 1131.52, "end": 1138.56, "text": " further in this and this is just the beginning and this is just a very sloppy explanation by me"}, {"start": 1138.56, "end": 1144.56, "text": " right here. But ultimately, they're saying, hey, instead of doing complicated non-linear"}, {"start": 1145.36, "end": 1152.4, "text": " similarity function like the softmax, can't we just project a and b into the higher-dimensional"}, {"start": 1152.4, "end": 1160.48, "text": " space and then just do the linear inner product and do the same thing as the softmax. And the answer"}, {"start": 1160.48, "end": 1168.72, "text": " is yes and no. We know that for the softmax, the particular phi function that we would need"}, {"start": 1168.72, "end": 1174.64, "text": " would map to an infinite dimensional space. Usually this is applied in reverse. It's like, oh,"}, {"start": 1174.64, "end": 1182.0, "text": " here, instead, usually in machine learning, they say, you know, we want to do this. We want to map"}, {"start": 1182.0, "end": 1186.56, "text": " it into a high-dimensional space such as linear, but we can't because these spaces are too high-dimensional,"}, {"start": 1186.56, "end": 1193.44, "text": " therefore we find an equivalent kernel function. And it's usually said, well, we use an RBF kernel"}, {"start": 1193.44, "end": 1198.1599999999999, "text": " that corresponds to an infinite dimensional space and so on. That's pretty cool. Here it's the"}, {"start": 1198.1599999999999, "end": 1206.24, "text": " reverse. Here it's, we want to do, we want the linear function and the equivalent of the softmax"}, {"start": 1206.24, "end": 1213.9199999999998, "text": " function is an infinite dimensional function, which we can't do, right? We can't feasibly compute"}, {"start": 1213.92, "end": 1223.1200000000001, "text": " an infinite dimensional space explicitly. So it's not possible to just do the equivalent thing"}, {"start": 1223.1200000000001, "end": 1229.52, "text": " than in a transformer. However, you can still do something else. You can still use polynomial"}, {"start": 1229.52, "end": 1234.88, "text": " kernels. You can still use any kind of kernels that have corresponding functions that map to a"}, {"start": 1234.88, "end": 1242.5600000000002, "text": " finite dimensional space. And that's what this paper does. So here they say, if we have such a function,"}, {"start": 1242.56, "end": 1249.9199999999998, "text": " that maps these things into a higher-dimensional space, such that they're inner product,"}, {"start": 1250.56, "end": 1255.76, "text": " such that the similarity function in this higher-dimensional space is an inner product,"}, {"start": 1255.76, "end": 1261.52, "text": " then we can write it as just this inner product right here explicitly. And then because of the"}, {"start": 1261.52, "end": 1267.9199999999998, "text": " associativity, you can see that here is an i and here there is no i. So we can just sort of pull"}, {"start": 1267.92, "end": 1274.72, "text": " this out of the sum and as well right here. It doesn't, don't, don't cross this away, these are"}, {"start": 1274.72, "end": 1281.92, "text": " vectors, right? But you can see, especially here, you can see pretty clear, why is there a cursor? Stop!"}, {"start": 1282.96, "end": 1290.16, "text": " You can see that this here, you have to pay attention to the matrix dimension. So if we use"}, {"start": 1290.16, "end": 1302.72, "text": " like Brakat notation, this is like this, like this, like this, and like this. Okay, so here on the"}, {"start": 1302.72, "end": 1310.3200000000002, "text": " bottom, you see that there is an inner product. So each output will be normalized by this inner"}, {"start": 1310.3200000000002, "end": 1317.52, "text": " product right here. However, the top is going to be a vector. We know that each output is a vector."}, {"start": 1317.52, "end": 1324.32, "text": " So the top will aggregate these vectors right here according to this routing."}, {"start": 1325.28, "end": 1330.56, "text": " Okay, but if we write it like this, you can see that what we could technically do is we could"}, {"start": 1330.56, "end": 1337.2, "text": " technically compute this part here once because it doesn't contain any i. So there is no i in that"}, {"start": 1337.2, "end": 1343.68, "text": " part. So we could just compute it once because we have these two, these two layers of the attention"}, {"start": 1343.68, "end": 1354.64, "text": " mechanism and these k and v, they just refer to this lower layer right here. We could just compute"}, {"start": 1354.64, "end": 1358.88, "text": " that thing on the right ones. That's going to give us a matrix as you can see right here from the"}, {"start": 1358.88, "end": 1365.44, "text": " dimensions. And then we can simply take the product of that vector right here, of the vector on the"}, {"start": 1365.44, "end": 1372.0, "text": " left with the matrix on the right. And we'd be done. It's one operation, right? Instead of for each"}, {"start": 1372.0, "end": 1378.96, "text": " thing, you know, going and attending to each other and then do the softmax. Without the softmax,"}, {"start": 1378.96, "end": 1386.0, "text": " we can all do this in a linear fashion. So that makes it a lot easier. In fact, it makes the"}, {"start": 1386.0, "end": 1397.36, "text": " computation linear in. So this is now all of n. Okay. Plus, of course, the work that you have to do"}, {"start": 1397.36, "end": 1402.32, "text": " for mapping this into the higher dimensional space. But this is also not quadratic. This is done"}, {"start": 1402.9599999999998, "end": 1413.52, "text": " to each of these elements individually. Okay. So this, this is now, as we said, it's pretty easy."}, {"start": 1413.52, "end": 1417.9199999999998, "text": " You can calculate the matrix on the top. You can actually also calculate this part right here,"}, {"start": 1417.9199999999998, "end": 1423.76, "text": " this vector. You can aggregate over the bottom. And then if you go through the top, it's simply a"}, {"start": 1423.76, "end": 1432.32, "text": " inner product with the vector of the queries. And you're done. And this is it in fact, in matrix form."}, {"start": 1433.36, "end": 1438.8799999999999, "text": " You can simply write it down as one matrix multiplication. Seems pretty easy."}, {"start": 1440.16, "end": 1448.0, "text": " So the computational cost goes way down. And they use the following function right here."}, {"start": 1448.0, "end": 1454.72, "text": " Okay. This is their map to the higher dimensional, to the higher dimensional space."}, {"start": 1456.08, "end": 1460.24, "text": " So they say for our experiments that deal with smaller sequences, we employ a feature map that"}, {"start": 1460.24, "end": 1467.28, "text": " results in a positive similarity function as defined below. So right here, you have to pay attention."}, {"start": 1467.28, "end": 1473.04, "text": " You can't just pick any function. But you can, you can pick a lot of different functions."}, {"start": 1473.04, "end": 1480.8, "text": " Where LL denotes the exponential linear unit activation function. Okay. Like this seems,"}, {"start": 1482.0, "end": 1487.2, "text": " this seems fine. They also say in our experimental section, we show that the feature map of equation"}, {"start": 1487.2, "end": 1492.3999999999999, "text": " seven performs on par with the full transformer, while significantly reducing the computational"}, {"start": 1492.3999999999999, "end": 1498.6399999999999, "text": " memory requirements. This, you know, it seems, it seems like the original transformer,"}, {"start": 1498.64, "end": 1504.16, "text": " this choice of the softmax function, even though it's, you know, powerful and can't be approximated"}, {"start": 1504.16, "end": 1509.2, "text": " with this trick right here. It is also somewhat arbitrary. I mean, there is a reasoning behind it,"}, {"start": 1509.2, "end": 1519.3600000000001, "text": " but it's also somewhat like, and it's entirely possible, right, that, that this here is way faster."}, {"start": 1519.3600000000001, "end": 1525.6000000000001, "text": " So I want to jump this causal masking thing for now and look at the results where you can see"}, {"start": 1525.6, "end": 1534.32, "text": " they verify the fact that in terms of time, in terms of GPU memory, if they apply their"}, {"start": 1534.32, "end": 1541.28, "text": " transformer and here on the x axis, you see sequence length. And you can see that the, this is log"}, {"start": 1541.28, "end": 1548.0, "text": " plot, right? These are log plots. You can see that the original transformer right here has a"}, {"start": 1548.0, "end": 1555.68, "text": " way steeper slope than their transformer, which is the black line right here. The blue lines are"}, {"start": 1555.68, "end": 1561.76, "text": " the reformers, which we've also, I've also done a video on reformer. If you want to check that out,"}, {"start": 1561.76, "end": 1568.24, "text": " that is also a trick that uses locality sensitive hashing to get rid of the quadratic"}, {"start": 1568.88, "end": 1575.68, "text": " attention mechanism. Now, the locality sensitive hashing also means that you kind of lose some"}, {"start": 1575.68, "end": 1582.88, "text": " accuracy. So that's the trade off right here. But you can see that is also linear. Actually,"}, {"start": 1582.88, "end": 1589.8400000000001, "text": " it's n log n, depending on the sequence length, but the log n is negligible. So you see GPU memory"}, {"start": 1589.8400000000001, "end": 1596.64, "text": " and time weigh down. And in terms of experiments, it does perform on par. It seems like it has different"}, {"start": 1596.64, "end": 1602.24, "text": " optimization trajectory, but they show that, you know, there is this trade off for the reformer,"}, {"start": 1602.24, "end": 1608.16, "text": " where you lose in accuracy. They do not experience that trade off in the linear transformer,"}, {"start": 1608.16, "end": 1616.24, "text": " compared to the original transformer in their particular experiments. Now, they do their"}, {"start": 1616.24, "end": 1623.68, "text": " experiments sort of show that they are not on par with the original transfer, like they are on par"}, {"start": 1623.68, "end": 1628.8, "text": " in some of the tasks, but also in some of the tasks they are not on par. For example,"}, {"start": 1628.8, "end": 1636.0, "text": " this speech data set right here, where they do fairly well, they actually beat the"}, {"start": 1636.0, "end": 1642.08, "text": " biolistem baseline and the reformer, but they do not beat the softmax transformer. So there,"}, {"start": 1642.96, "end": 1649.52, "text": " it is still the case that the softmax transformer is more powerful than the thing here. And we'll"}, {"start": 1649.52, "end": 1657.12, "text": " give some intuition very shortly on that. But the linear transformer is way faster. Here,"}, {"start": 1657.12, "end": 1665.84, "text": " it's three times faster. And up here, it is 300 times faster. And on M-ness, then if you go on C"}, {"start": 1665.84, "end": 1672.32, "text": " for 10, it is 4,000 times faster. Simply by the property of the longer either sequences are that"}, {"start": 1672.32, "end": 1678.56, "text": " you input, the much more matters, the fact that the softmax transformer has a quadratic"}, {"start": 1679.4399999999998, "end": 1686.08, "text": " runtime, whereas the linear transformer has a linear runtime. And I was also surprised here to see"}, {"start": 1686.08, "end": 1692.72, "text": " that the reformer wasn't that much faster. That's probably due to the fact that it already has"}, {"start": 1692.72, "end": 1699.36, "text": " like a big overhead in these hashing rounds and so on. That probably is hurting it at sort of"}, {"start": 1699.36, "end": 1705.12, "text": " a constant level. I guess if you were to up the sequence length, even more than the reformer would"}, {"start": 1705.12, "end": 1714.72, "text": " also improve a lot more over the softmax transformer. Okay, so what's happening here? What's happening"}, {"start": 1714.72, "end": 1722.32, "text": " with this attention? And why is it different? What does it make it different from the old attention?"}, {"start": 1722.32, "end": 1731.6000000000001, "text": " Now, I want to sort of connect this to the kind of olden, olden literature of topic modeling. So"}, {"start": 1732.56, "end": 1738.88, "text": " if you think of this transformer again, of this attention mechanism, what you'll have is a dynamic"}, {"start": 1738.88, "end": 1747.2, "text": " routing of information. So from each output token, you get to look at all the input tokens."}, {"start": 1747.92, "end": 1753.44, "text": " If we, for example, select this one, you get to look and you get to decide for each one,"}, {"start": 1753.44, "end": 1758.48, "text": " how do I want to aggregate my information? Okay, and this is what makes this quadratic from"}, {"start": 1758.48, "end": 1764.48, "text": " each of the output tokens. You get to look at all of the input tokens and decide how you want to"}, {"start": 1764.48, "end": 1772.0, "text": " do that. And that is can be very non-linear in terms of when we use the softmax and so on."}, {"start": 1772.88, "end": 1778.48, "text": " So that what makes it expensive. What this thing is doing is the following. It takes all the keys"}, {"start": 1778.48, "end": 1784.8, "text": " right here. So here we have all the keys. And it's going to map them through this five function."}, {"start": 1784.8, "end": 1790.88, "text": " Right? Each key is going to map through the five function and each query is also going to be"}, {"start": 1790.88, "end": 1797.2, "text": " mapped through the five function into these higher dimensional spaces. And then an inner product"}, {"start": 1797.2, "end": 1802.64, "text": " is performed between the two and that decides the routing. This is very similar to like topic"}, {"start": 1802.64, "end": 1813.2, "text": " models where if you interpret this, this right here can be a mapping of my dimension of these"}, {"start": 1813.2, "end": 1819.2, "text": " keys and queries to the topics. So essentially what's happening right here is for each of the input"}, {"start": 1819.2, "end": 1826.48, "text": " tokens. Sorry, with input tokens here, output tokens here. The dimension of this map defines"}, {"start": 1826.48, "end": 1834.88, "text": " is how many topics there are. So in these topics modeling, you would have things like I want to,"}, {"start": 1834.88, "end": 1842.0, "text": " I have news articles or words. And then I define like a set of topics. And I'm going to assign each"}, {"start": 1842.0, "end": 1852.24, "text": " word to a topic. And then I'm going to assign each news article to a topic and so on. And then you"}, {"start": 1852.24, "end": 1857.2, "text": " can't do this dimension reduction. But this can be done in many ways. So let's say this is a mapping"}, {"start": 1857.2, "end": 1864.16, "text": " to three dimensions. What this does is essentially this five function decides how you're going to map"}, {"start": 1864.16, "end": 1872.72, "text": " each of these inputs into these three topics. So you can say, oh, this token goes here and here,"}, {"start": 1872.72, "end": 1881.1200000000001, "text": " this one goes here and a bit here, this one goes here and so on. So again, this is a, this is a"}, {"start": 1881.1200000000001, "end": 1889.3600000000001, "text": " mapping into a, well, in this case, a lower dimensional space. And then this function decides how"}, {"start": 1889.36, "end": 1897.36, "text": " you're going to aggregate these topics over across here. And since this is, you know, this is now a"}, {"start": 1897.36, "end": 1902.6399999999999, "text": " linear multiplication between the two things. So these two are going to be your matrices. This here"}, {"start": 1902.6399999999999, "end": 1910.32, "text": " is going to be your phi of k and this here is going to be your phi of q. So you can see the"}, {"start": 1910.32, "end": 1916.1599999999999, "text": " difference here between the old attention mechanism and the new attention mechanism, right? The old"}, {"start": 1916.16, "end": 1921.8400000000001, "text": " attention mechanism, each token was directly able to look at all the input tokens and decide"}, {"start": 1922.4, "end": 1927.3600000000001, "text": " how to aggregate the information. And here, it's sort of, we have this in between,"}, {"start": 1928.4, "end": 1934.4, "text": " in between representation in this higher dimensional space. And we can aggregate in only a,"}, {"start": 1934.4, "end": 1940.4, "text": " we can distribute in a linear fashion and we can aggregate in a linear fashion in and from"}, {"start": 1940.4, "end": 1950.88, "text": " this higher dimensional space. That's sort of how I, sort of how I imagine that. Okay, so you get"}, {"start": 1950.88, "end": 1957.92, "text": " to distribute each token right here into these topics. And then the outputs, they don't see the"}, {"start": 1957.92, "end": 1964.16, "text": " inputs anymore, right? You see that in the formulation, there is a sum over j. So right here,"}, {"start": 1964.16, "end": 1973.44, "text": " there is this sum over j. And that means that the outputs here, they don't see the different"}, {"start": 1973.44, "end": 1979.28, "text": " inputs as different inputs. They only see the inputs through the map of the phi function."}, {"start": 1979.28, "end": 1984.8000000000002, "text": " So they can only see the individual dimensions of that phi function. They cannot see the outputs"}, {"start": 1984.8000000000002, "end": 1992.72, "text": " anymore. And therefore, yeah, therefore you don't have the dependence on the big quadratic dependence"}, {"start": 1992.72, "end": 2003.04, "text": " on this, on this n. Okay, however you do have a, of course, now it depends on this dimension"}, {"start": 2003.04, "end": 2008.0, "text": " of the intermediate representation. And they also, they say this, right, this is, you know,"}, {"start": 2008.0, "end": 2017.6000000000001, "text": " reasonable. Yeah. They do derive the gradients here to save even more memory. So you don't have to,"}, {"start": 2017.6, "end": 2024.56, "text": " um, search that you don't have to, let's say, store of all of these activations. That's pretty"}, {"start": 2024.56, "end": 2029.84, "text": " cool as well. And they implemented in kuda. There is code available for the linear transformer."}, {"start": 2029.84, "end": 2038.0, "text": " All of this pretty, pretty cool. Okay. So the last thing they say, they make the connections to"}, {"start": 2038.0, "end": 2046.3999999999999, "text": " R and N's. Now this is a bit, uh, detached from the linear transformer. But because they formulated"}, {"start": 2046.4, "end": 2053.2000000000003, "text": " how they do, they can make this connection. So this, now, this now is valid for all transformers."}, {"start": 2053.2000000000003, "end": 2060.08, "text": " What they say right here. But keep in mind, it is valid for the original transformers in practice"}, {"start": 2060.08, "end": 2065.28, "text": " if you can make this mapping phi to map to infinite dimensions, which you can't."}, {"start": 2067.04, "end": 2072.88, "text": " But the analysis is equivalent. So they say, look, if we write the attention mechanism like this,"}, {"start": 2072.88, "end": 2080.0, "text": " and therefore like this, um, what we can do is we can define these two quantities, right?"}, {"start": 2080.0, "end": 2085.6, "text": " S and Z. And this is what we said before. We can actually pre compute these quantities right here."}, {"start": 2087.04, "end": 2093.6, "text": " Okay. So that reduces to this right here. If now we are looking at a"}, {"start": 2094.2400000000002, "end": 2098.88, "text": " autoregressive transformer, and we said before what an autoregressive transformer was,"}, {"start": 2098.88, "end": 2103.92, "text": " an autoregressive transformer is you have a piece of sequence and you are tasked to predict this"}, {"start": 2103.92, "end": 2112.2400000000002, "text": " next thing right here. Now, usually if you want to train this using an R and N, um, you have to,"}, {"start": 2112.2400000000002, "end": 2118.96, "text": " you know, run your R and N input this hidden state and input that map forward the hidden state."}, {"start": 2118.96, "end": 2124.88, "text": " So you have to do all of this forward propagation, um, in order to derive at this hidden, at this"}, {"start": 2124.88, "end": 2129.44, "text": " output right here, make the output and then you need to backprop through time right here."}, {"start": 2130.08, "end": 2135.92, "text": " There is no way to what you would like to do is you would like to say here, I have a sentence."}, {"start": 2136.7200000000003, "end": 2143.04, "text": " I can actually make like five different training examples from that sentence. So the first one"}, {"start": 2143.04, "end": 2149.52, "text": " is the one you just saw, I just block off the last word, but I can also make that training example"}, {"start": 2149.52, "end": 2156.0, "text": " right here, right to go and I just cut a second to last word and so on. I can actually make all"}, {"start": 2156.0, "end": 2161.44, "text": " of these different training examples for a language modeling from a single sentence. And what I would"}, {"start": 2161.44, "end": 2167.04, "text": " like to do is I would like to train them all in parallel, right? I allowed my data point once. I"}, {"start": 2167.04, "end": 2173.68, "text": " already have it. Why can't I just train everything at the same time? Like predict this from this word."}, {"start": 2173.68, "end": 2180.08, "text": " Now predict also this from these two words and the transformers are, you know, very well,"}, {"start": 2181.2, "end": 2190.56, "text": " conditioned. They are very good at this basically. So what a transformer can do is if you input a"}, {"start": 2190.56, "end": 2198.8799999999997, "text": " sequence, uh, like, sorry, like the thing at the bottom, you can calculate the training signal for"}, {"start": 2198.88, "end": 2205.2000000000003, "text": " all of these different things at the same time. And okay, uh, this was maybe a mistake. You can"}, {"start": 2205.2000000000003, "end": 2211.28, "text": " calculate the training signal for all of this at the same time by using what's called causal"}, {"start": 2211.28, "end": 2219.36, "text": " masking in attention. So if I have my attention mechanism right here, let's consider it again."}, {"start": 2219.36, "end": 2224.7200000000003, "text": " Let's consider these two layers. If I have my attention mechanism, what I want to do is I want to"}, {"start": 2224.72, "end": 2231.2, "text": " constrain each token to only attend to tokens that came before it in the sequence. So for example,"}, {"start": 2231.2, "end": 2239.2, "text": " this token right here, I'm going to constrain it to only attend to itself and the past because it"}, {"start": 2240.24, "end": 2246.7999999999997, "text": " will, it will predict the next token in the sequence. And it would be, it would be really easy if"}, {"start": 2246.7999999999997, "end": 2253.7599999999998, "text": " you could attend to the input of that token, right? It could simply remember what that token is."}, {"start": 2253.76, "end": 2260.32, "text": " And then, um, aggregate that here and then predict that. So if for each token, we restrict the"}, {"start": 2260.32, "end": 2266.96, "text": " attention to the tokens that came before it, right? Also for this right here, we restrict the"}, {"start": 2266.96, "end": 2273.2000000000003, "text": " attention only to go backwards. Then we can train all of this in parallel. This is called causal"}, {"start": 2273.2000000000003, "end": 2279.0400000000004, "text": " masking. It's usually implemented with like a mask that is like an upper diagonal. And it's a"}, {"start": 2279.04, "end": 2285.2, "text": " bit unclear if you can attend to yourself because then I guess this will become the output. Then"}, {"start": 2285.2, "end": 2291.52, "text": " you can only attend to this. I don't know exactly how it is implemented, but there it is usually"}, {"start": 2291.52, "end": 2299.52, "text": " realized with an upper triangular matrix as a mask. And you apply this mask to each layer."}, {"start": 2300.24, "end": 2308.72, "text": " Now they say that this is actually like an Oranin. And with their formulation, you can make this"}, {"start": 2308.72, "end": 2316.8799999999997, "text": " pretty explicit. Namely, you have these two states S and a Z. And in each sequence element,"}, {"start": 2316.8799999999997, "end": 2324.72, "text": " it's actually like an Oranin where you update the S and the Z with these quantities right here."}, {"start": 2325.3599999999997, "end": 2332.48, "text": " And so it's like an Oranin where these are the hidden states that you pass forward, right?"}, {"start": 2332.48, "end": 2339.76, "text": " And then you can formulate any transformer as an Oranin that simply updates these two states."}, {"start": 2339.76, "end": 2347.12, "text": " But you see you need the explicit mapping of these of this kernel function. You need this explicit"}, {"start": 2347.92, "end": 2353.92, "text": " mapping in order to be able to do this because otherwise this is here. This is not going to be a"}, {"start": 2353.92, "end": 2360.48, "text": " linear addition. It is going to be a complicated. You can't do it by simply remembering the past"}, {"start": 2360.48, "end": 2366.48, "text": " state. So you need that formulation in order to be able to express it as an Oranin. But their"}, {"start": 2366.48, "end": 2373.44, "text": " analysis shows that this a transformer, all the regressive is essentially an Oranin. And you can,"}, {"start": 2373.44, "end": 2380.4, "text": " you can, so you can make a connection in that. And you can actually formulate this as an Oranin,"}, {"start": 2381.12, "end": 2387.76, "text": " which means that you can train in the transformer fashion everything at the same time. But what is"}, {"start": 2387.76, "end": 2394.1600000000003, "text": " cool about an Oranin? An Oranin at inference time. An Oranin once it has produced, you know,"}, {"start": 2394.1600000000003, "end": 2401.6800000000003, "text": " this word, it can then, because if you produce order aggressively, you simply say, hey, I have"}, {"start": 2401.6800000000003, "end": 2408.0, "text": " this beginning of my news article, please finish it. So the model must output the next word. And then"}, {"start": 2408.0, "end": 2412.96, "text": " from that sequence, it must output the next word, the next word, and then from that, the next word,"}, {"start": 2412.96, "end": 2418.88, "text": " and so on. An Oranin, because of the nature of simply passing forward hidden states at inference"}, {"start": 2418.88, "end": 2424.96, "text": " time can simply, you know, remember what the hidden states were, input those again, input the output"}, {"start": 2424.96, "end": 2432.88, "text": " here and go on. So it's pretty fast at inference time, which a transformer isn't with their formulation"}, {"start": 2432.88, "end": 2440.0, "text": " now. If they have the explicit function phi, they can use this at inference time to be so much"}, {"start": 2440.0, "end": 2446.56, "text": " faster. In fact, on their website, which I'll link, of course, in the description, you can play"}, {"start": 2446.56, "end": 2452.72, "text": " with image generation using one of these transformers in your browser. So you can simply start a"}, {"start": 2453.52, "end": 2461.92, "text": " transformer run in your browser. That's how easy this becomes. So you can see the linear transformer"}, {"start": 2461.92, "end": 2471.12, "text": " with causal masking. You'll simply update these states right here and then pass those forward. So"}, {"start": 2471.12, "end": 2476.48, "text": " easy. And the backward pass, as we said, I don't want to go into the gradient calculation, but they"}, {"start": 2476.48, "end": 2482.88, "text": " derive the gradient such that you don't have to remember these hidden states and it becomes, or it"}, {"start": 2482.88, "end": 2493.12, "text": " is linear in, or it saves a lot of more memory than before. Okay. Note. So this is the last comment"}, {"start": 2493.12, "end": 2501.76, "text": " from my side. Note that this, this causal masking transformers, they are, they are a bit of a"}, {"start": 2501.76, "end": 2511.6800000000003, "text": " hack in transformers. And because, so ultimately, let's say, let's say I have this sequence right here,"}, {"start": 2511.68, "end": 2521.68, "text": " this is given. And I want to predict this word right here. What? And okay, let's make it here."}, {"start": 2521.68, "end": 2529.12, "text": " So I need multiple layers for this. So I want to predict that next word. And I have multiple layers,"}, {"start": 2529.12, "end": 2535.2799999999997, "text": " right? So I want to predict this from, from the outputs right here. Let's say there is an output"}, {"start": 2535.28, "end": 2543.1200000000003, "text": " node right here. I want to predict that particular word. It's true that I should only be able to"}, {"start": 2543.1200000000003, "end": 2550.32, "text": " aggregate information from whatever was, you know, on the back right here. But technically,"}, {"start": 2550.32, "end": 2556.5600000000004, "text": " in a transformer, it would be completely valid to say that this node right here, which is,"}, {"start": 2556.5600000000004, "end": 2562.8, "text": " let's say that's an article. And it followed by a noun, right? Would be able to attend to that one."}, {"start": 2562.8, "end": 2569.92, "text": " And then that one would be able to attend to that one. And or sorry, the output right here would"}, {"start": 2569.92, "end": 2576.32, "text": " be able to attend to that one. This would not violate the order-aggressive property, right? You can,"}, {"start": 2576.32, "end": 2583.36, "text": " but you can see that in the intermediate layer, this node right here is attending to a forward node."}, {"start": 2583.36, "end": 2590.7200000000003, "text": " Now, if you do things like this, you can't do this trick anymore where you train everything at once."}, {"start": 2590.72, "end": 2598.56, "text": " Because if this connection exists, that also means that if in this other training sample,"}, {"start": 2598.56, "end": 2604.48, "text": " where this is the word to be predicted, then this node could aggregate information from that node"}, {"start": 2604.48, "end": 2613.12, "text": " and basically cheat. But the technical order-aggressive property is not violated by this connection"}, {"start": 2613.12, "end": 2620.16, "text": " right here. And you only get this RNN formulation if you do not have these connections, right?"}, {"start": 2620.16, "end": 2626.8799999999997, "text": " So this hack to make the order-aggressive transformers train in parallel is actually making"}, {"start": 2626.8799999999997, "end": 2633.04, "text": " the transformer formulation much weaker. And therefore, that's then equivalent to an RNN."}, {"start": 2633.7599999999998, "end": 2639.44, "text": " Okay? It's not that transformers in general are equivalent to an RNN, or at least this paper"}, {"start": 2639.44, "end": 2646.3999999999996, "text": " doesn't show that. It's just that these hacked transformers are. And I think that's an important"}, {"start": 2646.4, "end": 2653.52, "text": " distinction to make here, rather than saying transformers are RNNs if we could only approximate"}, {"start": 2653.52, "end": 2659.44, "text": " the softmax in these infinite dimensions. I don't think that's entirely true, but it is true"}, {"start": 2659.44, "end": 2663.44, "text": " for the transformers, the other aggressive transformers that we currently train."}, {"start": 2664.4, "end": 2674.1600000000003, "text": " Now, why is this connection so powerful? It allows a token to attend to tokens forward of it."}, {"start": 2674.16, "end": 2680.96, "text": " And what does it mean to be able to attend? Like, let's say it's really important that this token"}, {"start": 2680.96, "end": 2688.48, "text": " right here attends to that token right here. What would you need to do if you couldn't do that?"}, {"start": 2688.48, "end": 2696.7999999999997, "text": " If you... Let's say this is a program, right? So this token is the function F and it needs the input,"}, {"start": 2696.8, "end": 2705.1200000000003, "text": " this argument A of whatever token comes in front of it. And it needs to do something conditioned on A."}, {"start": 2705.1200000000003, "end": 2713.44, "text": " So if A is one, it does something, if A is two, it does something else, right? If you..."}, {"start": 2713.44, "end": 2719.76, "text": " If you don't have... If you can't input A, then you can't simply pass on the output value."}, {"start": 2719.76, "end": 2725.76, "text": " What you'll have to do is conceptually, is basically you'll have to store the entire code of the"}, {"start": 2725.76, "end": 2731.84, "text": " function into hidden state. If this is an RNN, right? You can't look forward. It needs to store the"}, {"start": 2731.84, "end": 2739.36, "text": " entire code of this function F. So all it needs to basically build this map, if A is one, then this,"}, {"start": 2739.36, "end": 2744.6400000000003, "text": " if A is two, then this if A is three, then this store that in the hidden state. And then once A"}, {"start": 2744.6400000000003, "end": 2749.28, "text": " comes around in the next time step, this can be resolved. You can see that this is infinitely more"}, {"start": 2749.28, "end": 2756.96, "text": " complicated than simply looking forward and outputting the value yourself. So that's sort of the"}, {"start": 2756.96, "end": 2765.1200000000003, "text": " difference in power that these two formulations are talking about. Okay? So yeah, two parts to this"}, {"start": 2765.1200000000003, "end": 2772.0800000000004, "text": " paper. First part, linear transformer through kernels. Second part, if you formulate it like this,"}, {"start": 2772.08, "end": 2779.68, "text": " it is equivalent. So a autoregressive transformer in this way becomes equivalent to an RNN. And here"}, {"start": 2779.68, "end": 2785.44, "text": " is some of the output samples. You know, they're pretty, pretty good. Though if you look at the"}, {"start": 2785.44, "end": 2792.08, "text": " more output samples they have here, it... So here this, this is the linear one. And you can see, for"}, {"start": 2792.08, "end": 2799.12, "text": " example, as already in this very bottom one, this one right here, it's the kind of all the other"}, {"start": 2799.12, "end": 2807.12, "text": " transformers get the slant to the right. And that the original has, whereas this one is simply"}, {"start": 2807.12, "end": 2811.12, "text": " straight. I mean, I don't want to I don't want to dunk on this like these others make a lot of"}, {"start": 2811.12, "end": 2816.72, "text": " mistakes mistakes right here. But here I also saw, you know, all of them get that this is going to be"}, {"start": 2816.72, "end": 2825.04, "text": " the number three while this one is somehow making this circle in here. So it is not perfect. And"}, {"start": 2825.04, "end": 2832.24, "text": " even though it's on par where in the tasks they see, you can see right here that especially in"}, {"start": 2832.24, "end": 2838.4, "text": " this speech recognition, the original transformer right here is significantly"}, {"start": 2840.16, "end": 2846.56, "text": " outperforming the linear transformer, which is the one in black right here. In fact, in all of the"}, {"start": 2846.56, "end": 2852.88, "text": " tasks, but ultimately it might not matter because they reach, you know, the same, they reach the same"}, {"start": 2852.88, "end": 2862.88, "text": " accuracy or whatnot and the linear transformers way, way faster. So I can see that this is going to be"}, {"start": 2862.88, "end": 2869.76, "text": " a I think that people apply. I guess time will tell. Right. I invite you to read the paper. Tell me"}, {"start": 2869.76, "end": 2876.2400000000002, "text": " what you think I might be totally wrong here with any of my formulations or my intuition about"}, {"start": 2876.24, "end": 2885.3599999999997, "text": " what this new attention mechanism does. Yeah, please let me know and I'll see you next time. Bye bye."}] |
Yannic Kilcher | 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 François Cholé. This last part concerns the arc challenge that Cholé has proposed or the arc data set, which stands for the abstraction and reasoning corpus. And we're just quickly going over the data set, 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 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 cackle challenge, but in essence, it is a data set. And let me just jump into one of the tasks of the data set. So in this data set, 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, of course, in the training data set, you do, but in the test, you don't. So each one of these, as I said, 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 these 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 cases, they always each of these training examples consists of these demonstration examples and these test example. Each of the demonstration examples consists of an input grid and an output grid. 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 grid. 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 with determined since they 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 test label, 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. And there 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 Sholei 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 just 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 Sholei 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. Quality 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 image net where you can go on the internet and find a whole bunch of images or 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 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 describe 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 task. 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. 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 explain like some tasks in the training set that where you can see these priors in actions. There is an object nest 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 write 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 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 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 task that objects 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, all there appears to be a blue thing and the red thing and 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 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 Shole or you know, by by actual humans. That's pretty cool. And a thousand tasks like this is 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 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 of 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. 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. But here and then as soon as it would hit the red thing, it bounces off in 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 a green red and then somehow the green connected to the red. Right. So this is an example of there has many of these priors in many of these concepts in there is gold erectedness. 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. And 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 he returned toward the left. So it goes somehow towards the red thing and so it's 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 and we hit an object and 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 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 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 year confirms our hypothesis that the it's the object that appears most often now I can see that there is this notion of objectness you just you need to upscale somehow no this is not upscale because the grid is the same size it's simply the image that's upscale 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 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 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 problems you get three three tries and humans can already solve it in one so that just show you shows you how cool humans are so here is a surely suggests 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 tax is purposely not formally definable this may be challenging the space of tasks is defined as anything expressable 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 geometries 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 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 a i progress basically 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 go how to build a g i step one build a g i that's sort of I mean 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 and I would have described human core knowledge in a sufficiently accurate degree that I could just you know build a g i 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 other tasks so 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 language 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 generate this these things based on a criterion such as a programs 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 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 demand given the input grid would produce the output grid 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 and 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 pause it at the existence of human level or resolver would represent the ability to program an AI from demonstration 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 intelligence test was a similar torque is predictive of success across all human cognitive tasks further we pause it that since an orc solver and human intelligence would be both founded on the same knowledge priors the scope of application of an orc solver would be closer to that of human cognition making 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 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 my proof incorrect much like new rules 1973 hopes that progress on chess playing with translating to meaningful progress and achieving a broad range of cognitive abilities especially if orc turns out to feature unforeseen vulnerabilities to on intelligent 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 would see oh that's not intelligence you can't hack your way to that and the expectation is that in this orc 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 orc 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 orc challenge is founded on the same priors as a human has it gives you the same amount of experience as a human has and therefore it is much more comparable to human intelligence alright they go over some weaknesses right here of that 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 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 GPT3 that has exactly this kind of structure where you train on a giant data set blah blah blah you pre-trained 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-trained this model on this GPT3 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 GPT3 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 Shole 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 challenges to try to as faithfully as possible implement something like an object-ness prior where cohesion and persistence are captured that would be the most scientifically sound approach to my approach alright 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.0, "text": " Hi there and welcome to the last part of on the measure of intelligence by Fran\u00e7ois Chol\u00e9."}, {"start": 9.0, "end": 16.0, "text": " This last part concerns the arc challenge that Chol\u00e9 has proposed or the arc data set,"}, {"start": 16.0, "end": 20.0, "text": " which stands for the abstraction and reasoning corpus."}, {"start": 20.0, "end": 25.0, "text": " And we're just quickly going over the data set, look how it's built,"}, {"start": 25.0, "end": 30.0, "text": " and discuss what kind of solutions might be relevant right here."}, {"start": 30.0, "end": 34.0, "text": " So if you haven't seen the last videos in this series,"}, {"start": 34.0, "end": 38.0, "text": " this is the last one of a series, you might not exactly know what's going on,"}, {"start": 38.0, "end": 45.0, "text": " but I think you can keep up pretty well because this part is fairly independent of the other parts."}, {"start": 45.0, "end": 49.0, "text": " And it's just cool to think about even if you haven't seen the other ones."}, {"start": 49.0, "end": 53.0, "text": " I encourage you to go see the other ones, but it's not necessary."}, {"start": 53.0, "end": 56.0, "text": " Okay, let's jump in."}, {"start": 56.0, "end": 61.0, "text": " So the arc is a challenge currently running a cackle challenge,"}, {"start": 61.0, "end": 64.0, "text": " but in essence, it is a data set."}, {"start": 64.0, "end": 68.0, "text": " And let me just jump into one of the tasks of the data set."}, {"start": 68.0, "end": 74.0, "text": " So in this data set, you always have the task in the following form."}, {"start": 74.0, "end": 80.0, "text": " So you always have multiple input examples like this, or say,"}, {"start": 80.0, "end": 85.0, "text": " these are called the training examples, and then you have a test example."}, {"start": 85.0, "end": 88.0, "text": " In this case, you have three training example, one test example."}, {"start": 88.0, "end": 91.0, "text": " So an entire, if you think of this in a machine learning way,"}, {"start": 91.0, "end": 99.0, "text": " this entire thing here is your x, and this thing here is your y."}, {"start": 99.0, "end": 104.0, "text": " Okay, so the label is going to be the output of the last example that you,"}, {"start": 104.0, "end": 106.0, "text": " you don't know that."}, {"start": 106.0, "end": 113.0, "text": " Now in the, of course, in the training data set, you do, but in the test, you don't."}, {"start": 113.0, "end": 118.0, "text": " So each one of these, as I said, is, is demonstrated."}, {"start": 118.0, "end": 120.0, "text": " These are the demonstration examples."}, {"start": 120.0, "end": 124.0, "text": " And then you're supposed to sort of learn the regularity out of the demonstration examples."}, {"start": 124.0, "end": 130.0, "text": " And then on this test example, you are supposed to apply this regularity that you learned."}, {"start": 130.0, "end": 138.0, "text": " So in here, a human can fairly accurately see that there are these black squares in each image."}, {"start": 138.0, "end": 146.0, "text": " And that in the training samples, the output will always sort of exactly match into the place of these black squares."}, {"start": 146.0, "end": 148.0, "text": " As you can see, this is like a high rectangle."}, {"start": 148.0, "end": 151.0, "text": " It goes here, it has the same amount of tiles and so on."}, {"start": 151.0, "end": 156.0, "text": " And you can also see that whatever colors are in here,"}, {"start": 156.0, "end": 161.0, "text": " sort of are the continuation of a symmetric pattern."}, {"start": 161.0, "end": 170.0, "text": " So here this is exactly the same as up here, but you know, flipped or turned by 180 degrees."}, {"start": 170.0, "end": 173.0, "text": " So there is a notion of symmetry right here."}, {"start": 173.0, "end": 176.0, "text": " So technically one could compute this."}, {"start": 176.0, "end": 183.0, "text": " One would say, oh, that's probably going to be the three rows and these bunch of things."}, {"start": 183.0, "end": 189.0, "text": " And it's probably going to be the same as this one down here, but just flipped on its head."}, {"start": 189.0, "end": 196.0, "text": " So as a human, you get this, even without a description, you realize like, oh, this is like a regular pattern."}, {"start": 196.0, "end": 198.0, "text": " It's symmetric. There's a hole in it."}, {"start": 198.0, "end": 201.0, "text": " And apparently the thing here always fills the hole."}, {"start": 201.0, "end": 206.0, "text": " I can see that, you know, three examples are enough for me to confirm that that's what's going on."}, {"start": 206.0, "end": 210.0, "text": " And I see the hole here. So I'm going to do the same thing."}, {"start": 210.0, "end": 215.0, "text": " So you can already see how these things are constructed in every."}, {"start": 215.0, "end": 219.0, "text": " This is not the only task, by the way, this is just one task."}, {"start": 219.0, "end": 225.0, "text": " Okay, there are 1000 tasks in this data set of this sort of nature."}, {"start": 225.0, "end": 228.0, "text": " Now, there are not always three demonstration examples."}, {"start": 228.0, "end": 232.0, "text": " I believe there can be more or less, but what's always the cases,"}, {"start": 232.0, "end": 238.0, "text": " they always each of these training examples consists of these demonstration examples and these test example."}, {"start": 238.0, "end": 244.0, "text": " Each of the demonstration examples consists of an input grid and an output grid."}, {"start": 244.0, "end": 251.0, "text": " The input grid and output grid, they can be anywhere from one by one to 30 by 30."}, {"start": 251.0, "end": 255.0, "text": " Okay, anywhere in between that."}, {"start": 255.0, "end": 260.0, "text": " And the colors here, I believe there are nine different colors that can go,"}, {"start": 260.0, "end": 266.0, "text": " they're just encoded by nine different numbers, but there are nine different colors that these things can have."}, {"start": 266.0, "end": 271.0, "text": " You can see black, blue, orange, red, dark blue, and so on."}, {"start": 271.0, "end": 275.0, "text": " And the output grid exactly the same."}, {"start": 275.0, "end": 280.0, "text": " Now, in this test example, you can only see the input grid."}, {"start": 280.0, "end": 282.0, "text": " You cannot see the output grid."}, {"start": 282.0, "end": 285.0, "text": " And that means you don't even know how large it should be."}, {"start": 285.0, "end": 288.0, "text": " You can see right here, they're not all the same size, the output grid."}, {"start": 288.0, "end": 292.0, "text": " In fact, not even the input grids have to be always the same size."}, {"start": 292.0, "end": 296.0, "text": " But you have to now come up with an output grid."}, {"start": 296.0, "end": 298.0, "text": " You have to first decide how big it is."}, {"start": 298.0, "end": 302.0, "text": " And we've here with determined since they whole has three rows, we're probably going to make three rows."}, {"start": 302.0, "end": 307.0, "text": " And it has like seven columns, we're probably going to make seven columns."}, {"start": 307.0, "end": 310.0, "text": " And that's the sort of thing you have to do."}, {"start": 310.0, "end": 317.0, "text": " 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."}, {"start": 317.0, "end": 328.0, "text": " And only if this thing exactly matches the test label, you get a point."}, {"start": 328.0, "end": 330.0, "text": " Otherwise, you get no point."}, {"start": 330.0, "end": 331.0, "text": " Okay."}, {"start": 331.0, "end": 337.0, "text": " So in the training task, there are, I believe, 400 of these tasks."}, {"start": 337.0, "end": 340.0, "text": " And then there are 400 more as test split."}, {"start": 340.0, "end": 342.0, "text": " But these are still public."}, {"start": 342.0, "end": 345.0, "text": " And then there are 200 that are secret."}, {"start": 345.0, "end": 350.0, "text": " And there are, I guess, part of this Kaggle challenge."}, {"start": 350.0, "end": 357.0, "text": " Yes, the training set features 400 tasks, while the evaluation set features 600 tasks."}, {"start": 357.0, "end": 364.0, "text": " The evaluation set is further split into a public evaluation set of 400 tasks and a private evaluation set of 200 tasks."}, {"start": 364.0, "end": 370.0, "text": " All tasks are unique, and the set of tasks and the set of training tasks are disjoint."}, {"start": 370.0, "end": 373.0, "text": " Sorry, of test tasks and training tasks."}, {"start": 373.0, "end": 379.0, "text": " The task data is available at this, as you can see, right here."}, {"start": 379.0, "end": 387.0, "text": " So I really hope that Sholei will keep these 200 tasks as a secret, even after the Kaggle challenge."}, {"start": 387.0, "end": 393.0, "text": " Because it's going to be fun for people that might want to get into this later."}, {"start": 393.0, "end": 395.0, "text": " So here are the goals of this data set."}, {"start": 395.0, "end": 400.0, "text": " They want to stay close to these psychometric intelligence tests."}, {"start": 400.0, "end": 406.0, "text": " They say in particular, it should be solvable by humans without any specific practice or training."}, {"start": 406.0, "end": 409.0, "text": " And probably also without any language instructions."}, {"start": 409.0, "end": 414.0, "text": " So you just be able to set a human in front of it, and the human should be able to solve it."}, {"start": 414.0, "end": 418.0, "text": " Or a large portion of humans should be able to solve it."}, {"start": 418.0, "end": 419.0, "text": " Right?"}, {"start": 419.0, "end": 422.0, "text": " Ideally, this test would also differentiate humans from each other."}, {"start": 422.0, "end": 426.0, "text": " But at this point, we want to simply assess machines."}, {"start": 426.0, "end": 432.0, "text": " So they say, focus on measuring developer aware generalization rather than task specific skill."}, {"start": 432.0, "end": 436.0, "text": " By only featuring novel tasks in the evaluation set."}, {"start": 436.0, "end": 441.0, "text": " And the novel tasks are unknown to the developer of a test taker."}, {"start": 441.0, "end": 447.0, "text": " So if I develop a system, I don't know what are these 200 tasks that Sholei keeps hidden."}, {"start": 447.0, "end": 454.0, "text": " I simply submit my code, and I'll figure out if my code does well on them."}, {"start": 454.0, "end": 460.0, "text": " So they say they want to feature highly abstract tasks."}, {"start": 460.0, "end": 464.0, "text": " Must be understood by a test taker using very few examples."}, {"start": 464.0, "end": 465.0, "text": " That's what you saw."}, {"start": 465.0, "end": 470.0, "text": " You don't have a big training example to learn that this task is about symmetry and whole filling."}, {"start": 470.0, "end": 472.0, "text": " You only have three."}, {"start": 472.0, "end": 478.0, "text": " And from three, you need to recognize what's going on and produce the output of the test sample."}, {"start": 478.0, "end": 485.0, "text": " Quality control for experience by only providing a fixed amount of training data for each task."}, {"start": 485.0, "end": 486.0, "text": " That's what we saw."}, {"start": 486.0, "end": 491.0, "text": " And only featuring tasks that do not lend themselves well to artificially generating new data."}, {"start": 491.0, "end": 503.0, "text": " So it's not like image net where you can go on the internet and find a whole bunch of images or some NLP tasks where people pre-train on all of Wikipedia and all of the books in the world"}, {"start": 503.0, "end": 505.0, "text": " because they want to understand language better."}, {"start": 505.0, "end": 517.0, "text": " These tasks are supposed to be such that it 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."}, {"start": 517.0, "end": 526.0, "text": " And then lastly, and this refers to the last few chapters we looked at, explicitly describe the complete set of priors that it assumes."}, {"start": 526.0, "end": 538.0, "text": " 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."}, {"start": 538.0, "end": 555.0, "text": " 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."}, {"start": 555.0, "end": 569.0, "text": " 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."}, {"start": 569.0, "end": 579.0, "text": " 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."}, {"start": 579.0, "end": 587.0, "text": " And here we control that by only providing a fixed amount of training data and also have the same prior knowledge."}, {"start": 587.0, "end": 594.0, "text": " And here we simply do that by listing the human priors that are required for the tasks that we think that humans have."}, {"start": 594.0, "end": 606.0, "text": " 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 task."}, {"start": 606.0, "end": 621.0, "text": " 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."}, {"start": 621.0, "end": 627.0, "text": " Each example consists of an input grid and an output grid. Each grid is a literal grid of symbols."}, {"start": 627.0, "end": 637.0, "text": " 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."}, {"start": 637.0, "end": 644.0, "text": " And as I said, you need to provide your own output grid as an AI taking this test."}, {"start": 644.0, "end": 656.0, "text": " So here are the priors that this test assumes. And we're going to look at some examples that make it explain like some tasks in the training set that where you can see these priors in actions."}, {"start": 656.0, "end": 667.0, "text": " There is an object nest prior where the task assumes that the AI or the task tests that the AI understands something about objects."}, {"start": 667.0, "end": 682.0, "text": " So these are tasks that you can only reasonably solve if you know something about objects like you would write a human would recognize or would you know would recognize that these things might represent different objects."}, {"start": 682.0, "end": 701.0, "text": " Right now that's mainly I think also due to the 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."}, {"start": 701.0, "end": 722.0, "text": " 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."}, {"start": 722.0, "end": 732.0, "text": " 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..."}, {"start": 732.0, "end": 742.0, "text": " 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."}, {"start": 742.0, "end": 752.0, "text": " 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."}, {"start": 752.0, "end": 769.0, "text": " 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."}, {"start": 769.0, "end": 783.0, "text": " The human understands that we need to remove the blue things going over and the human understands that somehow this inside relation, right?"}, {"start": 783.0, "end": 791.0, "text": " If something is inside or outside of one of these rectangles and that determines whether we have to turn the pixel green or black."}, {"start": 791.0, "end": 800.0, "text": " You can 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."}, {"start": 800.0, "end": 817.0, "text": " 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."}, {"start": 817.0, "end": 831.0, "text": " Here's another task that objects 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."}, {"start": 831.0, "end": 847.0, "text": " And then in the next thing, you see, all there appears to be a blue thing and the red thing and 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 along the grid."}, {"start": 847.0, "end": 869.0, "text": " 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."}, {"start": 869.0, "end": 884.0, "text": " 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."}, {"start": 884.0, "end": 894.0, "text": " And I believe the test these tests weren't procedurally generated. These tests were actually generated by Shole or you know, by by actual humans."}, {"start": 894.0, "end": 914.0, "text": " That's pretty cool. And a thousand tasks like this is 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."}, {"start": 914.0, "end": 931.0, "text": " So there is a notion of time involved maybe there's also counting and numbers numbers prior. So here you see like a time process. So in this demonstration example, you see blue things here red big thing."}, {"start": 931.0, "end": 946.0, "text": " 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."}, {"start": 946.0, "end": 972.0, "text": " 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 of the red thing if it hits the red thing."}, {"start": 972.0, "end": 985.0, "text": " Now here you can you can already see what's going to happen. Remember your AI would need to first determine. Okay, all of these output grids, they seem to be the same as the input grid."}, {"start": 985.0, "end": 994.0, "text": " 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."}, {"start": 994.0, "end": 1003.0, "text": " 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."}, {"start": 1003.0, "end": 1018.0, "text": " 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."}, {"start": 1018.0, "end": 1025.0, "text": " But here and then as soon as it would hit the red thing, it bounces off in the other direction."}, {"start": 1025.0, "end": 1037.0, "text": " 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."}, {"start": 1037.0, "end": 1055.0, "text": " 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."}, {"start": 1055.0, "end": 1062.0, "text": " Now let's look at some more examples. These are fun, right. Check out this one here."}, {"start": 1062.0, "end": 1075.0, "text": " So you see a green red and then somehow the green connected to the red. Right. So this is an example of there has many of these priors in many of these concepts in there is gold erectedness."}, {"start": 1075.0, "end": 1091.0, "text": " 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."}, {"start": 1091.0, "end": 1107.0, "text": " And 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."}, {"start": 1107.0, "end": 1112.0, "text": " Right. Always towards red thing because it's not always towards the right because he returned toward the left."}, {"start": 1112.0, "end": 1127.0, "text": " So it goes somehow towards the red thing and so it's 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."}, {"start": 1127.0, "end": 1144.0, "text": " So here again now we're actually confirming probably so we go towards the red thing which would be towards this direction and we hit an object and we go towards the red thing until we hit an object and then we go here."}, {"start": 1144.0, "end": 1171.0, "text": " All also see that these grids here are not the same size so it's not always the case that the grids of 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."}, {"start": 1171.0, "end": 1187.0, "text": " 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."}, {"start": 1187.0, "end": 1208.0, "text": " 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 these red and then the output grid is one of these blue objects."}, {"start": 1208.0, "end": 1233.0, "text": " 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."}, {"start": 1233.0, "end": 1261.0, "text": " And this year confirms our hypothesis that the it's the object that appears most often now I can see that there is this notion of objectness you just you need to upscale somehow no this is not upscale because the grid is the same size it's simply the image that's upscale 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."}, {"start": 1261.0, "end": 1290.0, "text": " 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"}, {"start": 1290.0, "end": 1317.0, "text": " 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"}, {"start": 1317.0, "end": 1343.0, "text": " they say we have found arc to be fully solvable by humans so they 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 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"}, {"start": 1343.0, "end": 1371.0, "text": " problems you get three three tries and humans can already solve it in one so that just show you shows you how cool humans are so here is a surely suggests a solution approach says by start by developing a domain specific language capable of expressing all possible situations all possible solution programs for any"}, {"start": 1371.0, "end": 1398.0, "text": " arc task since the exact set of arc tax is purposely not formally definable this may be challenging the space of tasks is defined as anything expressable 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"}, {"start": 1398.0, "end": 1425.0, "text": " geometries 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"}, {"start": 1425.0, "end": 1447.0, "text": " 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 a i progress"}, {"start": 1447.0, "end": 1475.0, "text": " basically 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"}, {"start": 1475.0, "end": 1502.0, "text": " how to how to go how to build a g i step one build a g i that's sort of I mean 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"}, {"start": 1502.0, "end": 1515.0, "text": " and I would have described human core knowledge in a sufficiently accurate degree that I could just you know build a g i"}, {"start": 1515.0, "end": 1529.0, "text": " 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"}, {"start": 1529.0, "end": 1546.0, "text": " other tasks so 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"}, {"start": 1546.0, "end": 1573.0, "text": " language 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"}, {"start": 1573.0, "end": 1600.0, "text": " and then he says select top candidates among these programs so you would generate multiple versions of source code that generate this these things based on a criterion such as a programs 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"}, {"start": 1600.0, "end": 1629.0, "text": " and 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"}, {"start": 1629.0, "end": 1651.0, "text": " 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"}, {"start": 1651.0, "end": 1678.0, "text": " you would generate all the programs that would produce these demonstration examples or that would given the demand given the input grid would produce the output grid 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"}, {"start": 1678.0, "end": 1690.0, "text": " and 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"}, {"start": 1690.0, "end": 1707.0, "text": " okay so they say they make some claims here and about what this what this would bring the community we pause it at the existence of human level or resolver would represent the ability to program an AI from demonstration"}, {"start": 1707.0, "end": 1723.0, "text": " 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"}, {"start": 1723.0, "end": 1734.0, "text": " as supporting evidence we note that human performance on psychometric intelligence test was a similar torque is predictive of success across all human cognitive tasks"}, {"start": 1734.0, "end": 1755.0, "text": " further we pause it that since an orc solver and human intelligence would be both founded on the same knowledge priors the scope of application of an orc solver would be closer to that of human cognition making such a solver both practically valuable and easy to interact with and would produce behavior that is in line with human expectations"}, {"start": 1755.0, "end": 1784.0, "text": " okay so they're 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 my proof incorrect much like new rules 1973 hopes that progress on chess playing with translating to meaningful progress and achieving a broad range of cognitive abilities"}, {"start": 1784.0, "end": 1794.0, "text": " especially if orc turns out to feature unforeseen vulnerabilities to on intelligent shortcuts"}, {"start": 1794.0, "end": 1812.0, "text": " 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"}, {"start": 1812.0, "end": 1822.0, "text": " so the human at first they would say oh this task really requires intelligence and then someone solves the task and they would see oh that's not intelligence you can't hack your way to that"}, {"start": 1822.0, "end": 1841.0, "text": " and the expectation is that in this orc 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 orc challenge here could that is there even a possibility of a task where you wouldn't say that"}, {"start": 1841.0, "end": 1856.0, "text": " and I'm not so sure about this they seem to be more hopeful than I am but at least they say the orc challenge is founded on the same priors as a human has it gives you the same amount of experience as a human has"}, {"start": 1856.0, "end": 1862.0, "text": " and therefore it is much more comparable to human intelligence"}, {"start": 1862.0, "end": 1879.0, "text": " alright they go over some weaknesses right here of that 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"}, {"start": 1879.0, "end": 1903.0, "text": " 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 exhibits intelligence"}, {"start": 1903.0, "end": 1926.0, "text": " 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 GPT3 that has exactly this kind of structure where you train on a giant data set"}, {"start": 1926.0, "end": 1954.0, "text": " blah blah blah you pre-trained 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-trained this model on this GPT3 for arc what's the pre-training data set for it"}, {"start": 1954.0, "end": 1983.0, "text": " 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 GPT3 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"}, {"start": 1983.0, "end": 1998.0, "text": " and that's not going to be easy because your best bet is to sort of put yourself into the shoes of Shole 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"}, {"start": 1998.0, "end": 2016.0, "text": " your most honest bet with respect to the challenges to try to as faithfully as possible implement something like an object-ness prior where cohesion and persistence are captured that would be the most scientifically sound approach to my approach"}, {"start": 2016.0, "end": 2036.0, "text": " alright 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"}] |
Yannic Kilcher | 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 Berkthology meets Biology, interpreting attention in protein language models. By Jesse Vigg, Ali Madani, Lav R. Varshani, Kaimim Siong, Richard Soccer, and Niznian Fatima Rajani. This paper is an investigative paper into models that are trained on biological data specifically into Berkth models. Actually into a one specific Berkth 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 Berkth model and read important biological data of these proteins, higher order data from the attention heads of the Berkth 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. Biology really quick for people who maybe never heard this in your every cell you have this thing called DNA, which basically is 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 it's 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 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. This one might be 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 can maybe 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. 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 are 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 birth model. A bird works a bit differently than a standard language model. Bird does what is called a masked language modeling. So you take this string, you feed it into a bird model right here. And I've made an entire video on bird 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 may be masked out this one, mask out this one, and then you ask the model to reconstruct those. We say that here is 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 bird 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 it we might hope that a bird trained on a amino acid sequence will learn something about the about the language of proteins, about the amino acid sequence. And our goal here is to be 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 bird model learn about the 3D shape? While only ever having been trained on predicting the next or predicting the sequence of amino acid. 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 structures. 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 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 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, well, 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 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. And it binds to other things. So think of your hemoglobin that traps 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. So we are interested, does Bert, the Bert that is only trained on a language modeling objective, no, which ones are the binding sites? Because, you know, that would be very interesting and not something Bert was trained on. By the way, a particularly light Richard soccer's tweet on this. I think he tweeted out, Bert trained only on language model can Burtic 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 Burtic 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 look at is the so called properties. 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 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 one 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 birth. If you don't know bird 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 one, two, three, four, five, and six. If molecule one and three are contact sites, then maybe we will find a layer where this connection between one and three is very strong. Right. That would indicate that there is a connection site. Or that would indicate that bird has learned something about the connection sites. 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 bird has learned something about contact between amino acids. The same goes for binding sites. So if a, if a, if four here is a binding site, and then all the connections, all the attention that the higher layer gets from four. So all the information routed away from four is very strong. That means all these other tokens are paying special attention to the token number four 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 bird has learned something about binding sites. Right. 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, bird 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 is a given amino acid, a binding site, or not is a given a 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 don't they take a pre-trained bird model. So there are these bird 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 fenyl alan, fenyl alanin is that the same in English. Yes, fenyl alanin, alala, fenyl alanin 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 one head number 11 focuses 78% of its attention on proline. And 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 is specially 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 vocabulary size is 20 instead of like 30,000 in natural language. And the same goes for this phenyl alanin where you can see that in the layer in the last layer and in the first layer you have attention and also in the proline you have in the last layer. So what 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 of 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 specialized 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 birth 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'll 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 what would you expect them we would expect the let's say the tertiary 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 because these are most highest level. And then 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 blue secondary this drawing is getting to two two weird but there could be multiple scenarios but that could fit here but until now it sort of makes sense. So in an additional investigation where as I told you sometimes you can substitute an amino acid and nothing really happens right and in fact 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 blossom 62 substitution scores which are very I guess very high if you can substitute to protein two amino acids with each other and the effect is negligible. And it's very low if it's 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 will 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 reconstructing these things so our language model is going to treat if in natural language is like 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 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 you'll see percentage of each head of each head's attention that is aligned with contact maps averaged over data set suggesting that had 12 for is uniquely specialized for contact prediction so look at 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 peak out whenever two things are in contact now you can see that it's not like always it's like 25% 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 this is a function of attention between the amino acids in head 12 for showing attention approximates perfectly calibrated estimator which would be the green line so here we simply for each pairs to 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 that 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 a higher level biological structure just from the language modeling objective how can we interpret this must somehow mean that it is it is possible it is vital to it is vital for reconstructing the sequence from its surrounding so if we delete this right here if if this if these two are in contact in the 3D structure that makes probably means that this thing right here is a very good predictor of what was here right 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 is 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 does I don't know I can't come up with with one right now but if it's like ta ta ta ta ta and then there is a name like mark and then da da da da da da da da da da da da da da and then there is him right and you would expect if I drop out okay let's do it the other way around 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, oh, 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. These are single properties of different amino acids. And we're simply looking at all the incoming or sorry, all the other tokens that focus is 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? 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 the 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. And 7-1 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. 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 last layer, which points to, points to rather maybe 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. 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 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. 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 eight. 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 the 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 on in places. But it sort of tends to be more towards the middle, certainly more 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 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 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. And it can tell us something about the nature of both these language models and the biological things that we care about in biology. OK, I'm just talking crap right now. Thanks for being here. I hope you enjoyed it. And bye-bye. | [{"start": 0.0, "end": 7.0, "text": " Hi there! Today we'll look at Berkthology meets Biology, interpreting attention in protein language models."}, {"start": 7.0, "end": 16.0, "text": " By Jesse Vigg, Ali Madani, Lav R. Varshani, Kaimim Siong, Richard Soccer, and Niznian Fatima Rajani."}, {"start": 16.0, "end": 26.0, "text": " This paper is an investigative paper into models that are trained on biological data specifically into Berkth models."}, {"start": 26.0, "end": 32.0, "text": " Actually into a one specific Berkth model that is trained on protein sequences."}, {"start": 32.0, "end": 39.0, "text": " Now, it is trained to simply perform language modeling on these protein sequences."}, {"start": 39.0, "end": 49.0, "text": " But out of this language model, you can then inspect this Berkth model and read important biological data of these proteins,"}, {"start": 49.0, "end": 55.0, "text": " higher order data from the attention heads of the Berkth model, which is pretty interesting."}, {"start": 55.0, "end": 67.0, "text": " 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."}, {"start": 67.0, "end": 75.0, "text": " So we're going to go through what this means and how this comes about and what they did in order to investigate."}, {"start": 75.0, "end": 84.0, "text": " I think this is a pretty cool investigative work and probably very promising for future research."}, {"start": 84.0, "end": 92.0, "text": " Yeah, as always if you like content like this, consider sharing it out and leaving a like."}, {"start": 92.0, "end": 95.0, "text": " Also tell me what you think in the comments."}, {"start": 95.0, "end": 113.0, "text": " Biology really quick for people who maybe never heard this in your every cell you have this thing called DNA, which basically is an encoding of all of your biological functions."}, {"start": 113.0, "end": 117.0, "text": " Now usually biological functions are realized through proteins."}, {"start": 117.0, "end": 122.0, "text": " So DNA is basically a building plan for all of your proteins."}, {"start": 122.0, "end": 125.0, "text": " This happens in the following two steps."}, {"start": 125.0, "end": 130.0, "text": " First, there is this transcription step where RNA is built."}, {"start": 130.0, "end": 136.0, "text": " This is basically a copy of your DNA, but it's only single strand as you can see right here."}, {"start": 136.0, "end": 143.0, "text": " And then there is a translation step that finally translates the RNA into the protein."}, {"start": 143.0, "end": 148.0, "text": " What will end up is just a sequence of these beads right here."}, {"start": 148.0, "end": 155.0, "text": " Now these beads are what are called amino acids. So a protein is simply a chain of these amino acids."}, {"start": 155.0, "end": 165.0, "text": " There are 20 different amino acids and the order of these amino acids in the chain makes the function of the protein."}, {"start": 165.0, "end": 174.0, "text": " Now specifically we know about these proteins that it seems to be very important how their three-dimensional shape is."}, {"start": 174.0, "end": 179.0, "text": " So a lot of these different amino acids have different chemical properties."}, {"start": 179.0, "end": 187.0, "text": " Some are sort of negatively charged, some are neutral, some are acids and so on."}, {"start": 187.0, "end": 189.0, "text": " So they have very different chemical properties."}, {"start": 189.0, "end": 197.0, "text": " So once you build this protein and you kind of release it into the cell, it will curl up into a three-dimensional structure."}, {"start": 197.0, "end": 206.0, "text": " This one might be doing something like this and sort of form a circle or something like this."}, {"start": 206.0, "end": 215.0, "text": " Just because these proteins here, they kind of attract each other maybe electrically and thus the protein forms a circle."}, {"start": 215.0, "end": 219.0, "text": " And the function of the protein is very much related to its shape."}, {"start": 219.0, "end": 224.0, "text": " So if it is a circle, it can maybe trap something else in here."}, {"start": 224.0, "end": 228.0, "text": " So you really have to think of these things like kind of tools."}, {"start": 228.0, "end": 242.0, "text": " 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."}, {"start": 242.0, "end": 249.0, "text": " So sometimes you can substitute an amino acid for a different amino acid like this here."}, {"start": 249.0, "end": 255.0, "text": " If it doesn't change the shape very often, you're fine."}, {"start": 255.0, "end": 258.0, "text": " The protein function isn't changed."}, {"start": 258.0, "end": 268.0, "text": " 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."}, {"start": 268.0, "end": 282.0, "text": " So mutations in DNA sometimes lead to mutations in protein, not always because there is some redundancy in this translation step from RNA."}, {"start": 282.0, "end": 287.0, "text": " But if they do lead to a different amino acid, it doesn't actually mean that the function changes."}, {"start": 287.0, "end": 298.0, "text": " There is sort of value in analyzing the sequence of the structure of proteins rather than the structure of DNA."}, {"start": 298.0, "end": 301.0, "text": " Of course it's also important to analyze the structure of DNA."}, {"start": 301.0, "end": 312.0, "text": " But it is also, it is equally important to analyze the structure of proteins because they, not all the information is in the sequence."}, {"start": 312.0, "end": 316.0, "text": " Not all the obvious information is in the sequence."}, {"start": 316.0, "end": 318.0, "text": " So what does this paper do?"}, {"start": 318.0, "end": 324.0, "text": " This paper goes and takes a model that has been trained on protein data."}, {"start": 324.0, "end": 329.0, "text": " So if you look at this protein, it is simply a sequence of amino acids."}, {"start": 329.0, "end": 331.0, "text": " And these amino acids they all have names."}, {"start": 331.0, "end": 334.0, "text": " I think I have a table somewhere here."}, {"start": 334.0, "end": 335.0, "text": " Yes."}, {"start": 335.0, "end": 338.0, "text": " So these are the different amino acids that exist."}, {"start": 338.0, "end": 345.0, "text": " And you can see a protein is simply a sequence of these names."}, {"start": 345.0, "end": 351.0, "text": " So usually they are abbreviated by like a three letter abbreviation or just a one letter abbreviation."}, {"start": 351.0, "end": 360.0, "text": " So a protein might be a, v, m, m, v, a, g, and so on."}, {"start": 360.0, "end": 363.0, "text": " And this is just a string of text, right?"}, {"start": 363.0, "end": 367.0, "text": " So what I can do is I can train a language model on this."}, {"start": 367.0, "end": 374.0, "text": " A language model is simply a model that takes a piece of text and tells you what's the next piece of text."}, {"start": 374.0, "end": 376.0, "text": " So what's the next letter? What's the next word?"}, {"start": 376.0, "end": 379.0, "text": " In this case, what's the next amino acid?"}, {"start": 379.0, "end": 383.0, "text": " And we can use tools from NLP for that."}, {"start": 383.0, "end": 386.0, "text": " Specifically, we can train a birth model."}, {"start": 386.0, "end": 390.0, "text": " A bird works a bit differently than a standard language model."}, {"start": 390.0, "end": 393.0, "text": " Bird does what is called a masked language modeling."}, {"start": 393.0, "end": 398.0, "text": " So you take this string, you feed it into a bird model right here."}, {"start": 398.0, "end": 402.0, "text": " And I've made an entire video on bird if you want to check that out."}, {"start": 402.0, "end": 407.0, "text": " And what you'll do by inputting that you'll mask out some of the tokens."}, {"start": 407.0, "end": 413.0, "text": " So you may be masked out this one, mask out this one, and then you ask the model to reconstruct those."}, {"start": 413.0, "end": 417.0, "text": " We say that here is an m and here is an a without seeing them."}, {"start": 417.0, "end": 423.0, "text": " So the model somehow has to learn from the surrounding amino acids."}, {"start": 423.0, "end": 427.0, "text": " What this amino acid could be, right?"}, {"start": 427.0, "end": 429.0, "text": " So it has to reconstruct this sequence."}, {"start": 429.0, "end": 438.0, "text": " So the hope here is in natural language is that bird somehow learns something about language itself."}, {"start": 438.0, "end": 443.0, "text": " By being able to reconstruct these things, it has learned something about language,"}, {"start": 443.0, "end": 446.0, "text": " about which words appear together and when."}, {"start": 446.0, "end": 450.0, "text": " It might even learn very long distance relationships between words,"}, {"start": 450.0, "end": 452.0, "text": " just because it has to predict those."}, {"start": 452.0, "end": 457.0, "text": " And the idea carries over to biology."}, {"start": 457.0, "end": 469.0, "text": " So it we might hope that a bird trained on a amino acid sequence will learn something about the about the language of proteins,"}, {"start": 469.0, "end": 471.0, "text": " about the amino acid sequence."}, {"start": 471.0, "end": 480.0, "text": " And our goal here is to be to ask, can we somehow infer the 3D shape of a protein,"}, {"start": 480.0, "end": 484.0, "text": " which is the important part from its sequence right here?"}, {"start": 484.0, "end": 489.0, "text": " So given its sequence, can we infer the 3D shape?"}, {"start": 489.0, "end": 494.0, "text": " Now as I understand it, usually this has to be done in like a simulation."}, {"start": 494.0, "end": 505.0, "text": " 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."}, {"start": 505.0, "end": 513.0, "text": " You could train a model to just predict the 3D shape, but in this case we're just interested what does the bird model learn about the 3D shape?"}, {"start": 513.0, "end": 522.0, "text": " While only ever having been trained on predicting the next or predicting the sequence of amino acid."}, {"start": 522.0, "end": 526.0, "text": " So it's never been trained to look at the 3D shape."}, {"start": 526.0, "end": 528.0, "text": " And that's our goal here."}, {"start": 528.0, "end": 531.0, "text": " So specifically we'll look at two different things."}, {"start": 531.0, "end": 535.0, "text": " So here you can see examples of proteins and their high level structures."}, {"start": 535.0, "end": 543.0, "text": " So in these proteins what you call the primary structure is this sequence of amino acid."}, {"start": 543.0, "end": 547.0, "text": " This is simply which amino acids are in which order?"}, {"start": 547.0, "end": 563.0, "text": " 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."}, {"start": 563.0, "end": 567.0, "text": " I don't know how they're strands in English."}, {"start": 567.0, "end": 573.0, "text": " We call them sheets, or I think these are the alpha helixes and these are the beta sheets."}, {"start": 573.0, "end": 577.0, "text": " And there is also a turns. I think this here might be a turn."}, {"start": 577.0, "end": 581.0, "text": " So there are these kind of secondary structures."}, {"start": 581.0, "end": 587.0, "text": " And then the tertiary structure is how these this is still one protein."}, {"start": 587.0, "end": 590.0, "text": " This is one unbroken chain of amino acid."}, {"start": 590.0, "end": 596.0, "text": " And you can see this here kind of forms this double ring, which would be its tertiary structure."}, {"start": 596.0, "end": 606.0, "text": " Very important for predicting the tertiary structure is to predict when two amino acids are close to each other."}, {"start": 606.0, "end": 618.0, "text": " 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."}, {"start": 618.0, "end": 628.0, "text": " And to predict which amino acids are in close contact to each other helps you determine the tertiary structure."}, {"start": 628.0, "end": 630.0, "text": " So that's a consequence of it."}, {"start": 630.0, "end": 643.0, "text": " 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?"}, {"start": 643.0, "end": 650.0, "text": " The second thing we're interested in are binding sites. So here, well, you might not be able to see."}, {"start": 650.0, "end": 657.0, "text": " But we made this example before where this sort of forms a loop and then I say can trap something here, right?"}, {"start": 657.0, "end": 659.0, "text": " Like another molecule."}, {"start": 659.0, "end": 663.0, "text": " And this is what we would call a binding site."}, {"start": 663.0, "end": 682.0, "text": " 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."}, {"start": 682.0, "end": 694.0, "text": " And it binds to other things. So think of your hemoglobin that traps the oxygen in your blood or something like this."}, {"start": 694.0, "end": 702.0, "text": " It is where a chemical reaction or a reaction with something else will happen. That's a binding site."}, {"start": 702.0, "end": 713.0, "text": " So we are interested, does Bert, the Bert that is only trained on a language modeling objective, no, which ones are the binding sites?"}, {"start": 713.0, "end": 719.0, "text": " Because, you know, that would be very interesting and not something Bert was trained on."}, {"start": 719.0, "end": 723.0, "text": " By the way, a particularly light Richard soccer's tweet on this."}, {"start": 723.0, "end": 732.0, "text": " I think he tweeted out, Bert trained only on language model can Burtic binding sites and biological properties."}, {"start": 732.0, "end": 736.0, "text": " And formulated it like it was, you know, like GPT-3 was formulated."}, {"start": 736.0, "end": 740.0, "text": " Like if we train on Wikipedia, our model can do math."}, {"start": 740.0, "end": 743.0, "text": " I thought it was kind of a satire headline."}, {"start": 743.0, "end": 747.0, "text": " If we train on Wikipedia, our model can Burtic biology."}, {"start": 747.0, "end": 751.0, "text": " And also it can tie your shoes and cook your dinner."}, {"start": 751.0, "end": 757.0, "text": " Yeah, but so it's trained on language modeling on biological data. And now that makes sense."}, {"start": 757.0, "end": 764.0, "text": " So they're going to look at two different things or actually more than two different things."}, {"start": 764.0, "end": 769.0, "text": " But they formulate this in an abstract way right here."}, {"start": 769.0, "end": 774.0, "text": " So what they look at is the so called properties."}, {"start": 774.0, "end": 783.0, "text": " And this property F can be, for example, that a amino acid is a binding site."}, {"start": 783.0, "end": 789.0, "text": " The property F can also be that two amino acids are in contact with each other."}, {"start": 789.0, "end": 792.0, "text": " So F always takes I and J."}, {"start": 792.0, "end": 803.0, "text": " 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."}, {"start": 803.0, "end": 812.0, "text": " And if it is just a binding site, then I think we are looking at J."}, {"start": 812.0, "end": 821.0, "text": " At the token level property, we define to be an indicator that returns one if the property is present in token J."}, {"start": 821.0, "end": 826.0, "text": " Okay. So whenever J is a binding site, then that holds."}, {"start": 826.0, "end": 841.0, "text": " So what we're looking at are these attention heads in birth. If you don't know bird has an attention mechanism, which basically means from layer to layer, each token can attend to all other tokens."}, {"start": 841.0, "end": 844.0, "text": " So here the amino acid sequence I've drawn it twice."}, {"start": 844.0, "end": 854.0, "text": " 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."}, {"start": 854.0, "end": 862.0, "text": " 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."}, {"start": 862.0, "end": 868.0, "text": " Now what we're interested in is the strength of these connections."}, {"start": 868.0, "end": 877.0, "text": " So the hypothesis is if molecule here is one, two, three, four, five, and six."}, {"start": 877.0, "end": 891.0, "text": " If molecule one and three are contact sites, then maybe we will find a layer where this connection between one and three is very strong."}, {"start": 891.0, "end": 895.0, "text": " Right. That would indicate that there is a connection site."}, {"start": 895.0, "end": 901.0, "text": " Or that would indicate that bird has learned something about the connection sites."}, {"start": 901.0, "end": 923.0, "text": " 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 bird has learned something about contact between amino acids."}, {"start": 923.0, "end": 938.0, "text": " The same goes for binding sites. So if a, if a, if four here is a binding site, and then all the connections, all the attention that the higher layer gets from four."}, {"start": 938.0, "end": 949.0, "text": " So all the information routed away from four is very strong. That means all these other tokens are paying special attention to the token number four to this amino acid."}, {"start": 949.0, "end": 961.0, "text": " And if we find that there is a big correlation with this being a binding site, then we can reasonably conclude that bird has learned something about binding sites."}, {"start": 961.0, "end": 981.0, "text": " Right. 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."}, {"start": 981.0, "end": 999.0, "text": " So we're going to look at the attention in a given attention head. So as you know, bird 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."}, {"start": 999.0, "end": 1009.0, "text": " 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."}, {"start": 1009.0, "end": 1025.0, "text": " 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."}, {"start": 1025.0, "end": 1044.0, "text": " 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 is a given amino acid, a binding site, or not is a given a pair a contact or not."}, {"start": 1044.0, "end": 1055.0, "text": " 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."}, {"start": 1055.0, "end": 1065.0, "text": " And that's already it. They don't they take a pre-trained bird model. So there are these bird models that are already trained on these protein databases."}, {"start": 1065.0, "end": 1081.0, "text": " 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."}, {"start": 1081.0, "end": 1094.0, "text": " And this is fenyl alan, fenyl alanin is that the same in English. Yes, fenyl alanin, alala, fenyl alanin and proline right here."}, {"start": 1094.0, "end": 1110.0, "text": " 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."}, {"start": 1110.0, "end": 1132.0, "text": " 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 one head number 11 focuses 78% of its attention on proline."}, {"start": 1132.0, "end": 1153.0, "text": " And 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 is specially specialized on like a very particular word in the language because that might just be a often occurring very particular word."}, {"start": 1153.0, "end": 1178.0, "text": " 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 vocabulary size is 20 instead of like 30,000 in natural language."}, {"start": 1178.0, "end": 1190.0, "text": " And the same goes for this phenyl alanin where you can see that in the layer in the last layer and in the first layer you have attention and also in the proline you have in the last layer."}, {"start": 1190.0, "end": 1199.0, "text": " So what does this make sense because what we would expect from like single tokens these are not interactions yet these are not biological functions yet."}, {"start": 1199.0, "end": 1218.0, "text": " So we know that in the lower layers of a neural network we have these kind of basic features of basic feature extractors and here these basic feature extractors appear to be simply paying attention to one specific token in the vocabulary a lot."}, {"start": 1218.0, "end": 1236.0, "text": " So they kind of these heads sort of specialized 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."}, {"start": 1236.0, "end": 1255.0, "text": " So if you remember the birth 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'll have to predict single amino acids again so if there's a proline masked here you'll have to predict the proline."}, {"start": 1255.0, "end": 1277.0, "text": " 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 what would you expect them we would expect the let's say the tertiary"}, {"start": 1277.0, "end": 1294.0, "text": " 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 because these are most highest level."}, {"start": 1294.0, "end": 1323.0, "text": " And then 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 blue secondary this drawing is getting to two two weird but there could be multiple scenarios but that could fit here but until now it sort of makes sense."}, {"start": 1323.0, "end": 1347.0, "text": " So in an additional investigation where as I told you sometimes you can substitute an amino acid and nothing really happens right and in fact 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."}, {"start": 1347.0, "end": 1374.0, "text": " No notice so the biologists can build these matrices of how much you can substitute proteins with each other so here you see this blossom 62 substitution scores which are very I guess very high if you can substitute to protein two amino acids with each other and the effect is negligible."}, {"start": 1374.0, "end": 1399.0, "text": " And it's very low if it's 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 will 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"}, {"start": 1399.0, "end": 1425.0, "text": " 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 reconstructing these things so our language model is going to treat"}, {"start": 1425.0, "end": 1445.0, "text": " if in natural language is like 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."}, {"start": 1445.0, "end": 1472.0, "text": " 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"}, {"start": 1472.0, "end": 1488.0, "text": " 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"}, {"start": 1488.0, "end": 1516.0, "text": " 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 functions so here we're interested in these contact maps right so how likely is it that two amino acids are in contact"}, {"start": 1516.0, "end": 1536.0, "text": " and we'll look at it through the lens of attention as we did before so here you'll see percentage of each head of each head's attention that is aligned with contact maps averaged over data set suggesting that had 12 for is uniquely specialized for contact prediction so look at this"}, {"start": 1536.0, "end": 1556.0, "text": " 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"}, {"start": 1556.0, "end": 1576.0, "text": " 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 peak out whenever two things are in contact"}, {"start": 1576.0, "end": 1586.0, "text": " now you can see that it's not like always it's like 25% of its attention but significantly more than anything else right here"}, {"start": 1586.0, "end": 1598.0, "text": " 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"}, {"start": 1598.0, "end": 1608.0, "text": " this is a function of attention between the amino acids in head 12 for showing attention approximates perfectly calibrated estimator which would be the green line"}, {"start": 1608.0, "end": 1624.0, "text": " so here we simply for each pairs to amino acids for each pair of amino acids we plot we make a histogram right here of what they're sorry not a histogram"}, {"start": 1624.0, "end": 1640.0, "text": " 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"}, {"start": 1640.0, "end": 1648.0, "text": " and we simply take this attention weight as a measure as a predictor of being in contact we get the blue curve"}, {"start": 1648.0, "end": 1658.0, "text": " and the green curve would be if we could perfectly predict from this attention head what the probability of contact would be"}, {"start": 1658.0, "end": 1666.0, "text": " and you can see that the fit is fairly good you can't predict with super high accuracy but the fit is fairly good"}, {"start": 1666.0, "end": 1676.0, "text": " and you can see that 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"}, {"start": 1676.0, "end": 1688.0, "text": " so we can sort of confidently say that Bert has learned something about a higher level"}, {"start": 1688.0, "end": 1696.0, "text": " a higher level biological structure just from the language modeling objective how can we interpret this"}, {"start": 1696.0, "end": 1712.0, "text": " must somehow mean that it is it is possible it is vital to it is vital for reconstructing the sequence from its surrounding so if we delete this right here"}, {"start": 1712.0, "end": 1720.0, "text": " if if this if these two are in contact in the 3D structure"}, {"start": 1720.0, "end": 1728.0, "text": " that makes probably means that this thing right here is a very good predictor of what was here right"}, {"start": 1728.0, "end": 1734.0, "text": " 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"}, {"start": 1734.0, "end": 1740.0, "text": " right it probably always helps to look at one's neighbors especially also in natural language"}, {"start": 1740.0, "end": 1754.0, "text": " but if these two are in contact they have very special connection to each other it is very you can basically read out from this one which one this was"}, {"start": 1754.0, "end": 1762.0, "text": " this is sort of like if you have a sentence and you say"}, {"start": 1762.0, "end": 1774.0, "text": " does I don't know I can't come up with with one right now but if it's like ta ta ta ta ta"}, {"start": 1774.0, "end": 1780.0, "text": " and then there is a name like mark and then da da da da da da da da da da da da da da and then there is him"}, {"start": 1780.0, "end": 1786.0, "text": " right and you would expect if I drop out okay let's do it the other way around"}, {"start": 1786.0, "end": 1792.68, "text": " the other way around, if I drop out him, then from the text right here, you can probably"}, {"start": 1792.68, "end": 1795.24, "text": " determine that it is some sort of pronoun."}, {"start": 1795.24, "end": 1797.8, "text": " But then you go back and you see, oh, it's Mark."}, {"start": 1797.8, "end": 1808.48, "text": " Okay, so it's not like it's not like it or some or she, it's probably he or him."}, {"start": 1808.48, "end": 1815.84, "text": " This is sort of the analogous structure right here in biology."}, {"start": 1815.84, "end": 1820.76, "text": " The second thing we're looking at is these binding sites."}, {"start": 1820.76, "end": 1825.76, "text": " These are single properties of different amino acids."}, {"start": 1825.76, "end": 1831.4399999999998, "text": " And we're simply looking at all the incoming or sorry, all the other tokens that focus"}, {"start": 1831.4399999999998, "end": 1832.4399999999998, "text": " is their attention."}, {"start": 1832.4399999999998, "end": 1834.1599999999999, "text": " Why is this important?"}, {"start": 1834.1599999999999, "end": 1840.3999999999999, "text": " Because these binding sites are central to the structure of the or to the function of"}, {"start": 1840.3999999999999, "end": 1841.56, "text": " the protein, right?"}, {"start": 1841.56, "end": 1847.76, "text": " This here is a binding site, then that's a very central important point of the protein."}, {"start": 1847.76, "end": 1855.1599999999999, "text": " So a lot of these other things are going to be determined by what the binding site is."}, {"start": 1855.1599999999999, "end": 1860.04, "text": " This binding site needs to have a very particular function and therefore probably needs to be"}, {"start": 1860.04, "end": 1863.28, "text": " a very particular amino acid."}, {"start": 1863.28, "end": 1868.28, "text": " And the other things here are sort of supporting this binding site because they form the 3D structure"}, {"start": 1868.28, "end": 1869.6, "text": " around it and so on."}, {"start": 1869.6, "end": 1876.7199999999998, "text": " So you would expect a lot of attention to be put on this binding site."}, {"start": 1876.7199999999998, "end": 1879.12, "text": " And what do we find?"}, {"start": 1879.12, "end": 1884.1599999999999, "text": " We find that it's a bit more murky than before."}, {"start": 1884.1599999999999, "end": 1887.9599999999998, "text": " So you can see that the attention is kind of spread out."}, {"start": 1887.9599999999998, "end": 1892.08, "text": " Percentage of each head's attention that focuses on binding sites, especially in the deeper"}, {"start": 1892.08, "end": 1897.84, "text": " layers, binding sites are targeted at much higher frequency than would occur by chance."}, {"start": 1897.84, "end": 1903.0, "text": " And 7-1 has the highest percentage with 34%."}, {"start": 1903.0, "end": 1909.4399999999998, "text": " So also here you can see that it is spread out, but this is because multiple heads are now"}, {"start": 1909.4399999999998, "end": 1915.1999999999998, "text": " focusing on these binding sites because probably binding sites come in different variations."}, {"start": 1915.1999999999998, "end": 1920.28, "text": " So you'll have lots of heads specializing on attending to binding sites."}, {"start": 1920.28, "end": 1924.1599999999999, "text": " And they say it is much higher frequency than would occur by chance."}, {"start": 1924.16, "end": 1931.76, "text": " You can see here this head is the highest with 34% of its attention focused on binding sites."}, {"start": 1931.76, "end": 1937.5600000000002, "text": " You can also see the general trend of the attention being rather in the later layers,"}, {"start": 1937.5600000000002, "end": 1941.2, "text": " which we would expect from a tertiary structure."}, {"start": 1941.2, "end": 1945.64, "text": " Now yeah, it would be interesting here."}, {"start": 1945.64, "end": 1952.28, "text": " Here you also see that actually most of the things are in the last layer, which points"}, {"start": 1952.28, "end": 1958.68, "text": " to, points to rather maybe lower level information because we reasoned before about the last"}, {"start": 1958.68, "end": 1959.68, "text": " layer."}, {"start": 1959.68, "end": 1960.68, "text": " Or I was just wrong."}, {"start": 1960.68, "end": 1965.48, "text": " But also in a general trend you can see that the attention is rather shifted towards"}, {"start": 1965.48, "end": 1973.44, "text": " the later layers because this is sort of a higher order function."}, {"start": 1973.44, "end": 1980.8799999999999, "text": " If you look at the same calibration experiment, you can see that the picture is not as clear."}, {"start": 1980.88, "end": 1984.8000000000002, "text": " There is the general trend at the beginning, but then it sort of flattens out."}, {"start": 1984.8000000000002, "end": 1992.24, "text": " So you can sort of differentiate the very probably not a binding site from the somewhat"}, {"start": 1992.24, "end": 1997.44, "text": " probably a binding site, but it's not a perfectly calibrated classifier."}, {"start": 1997.44, "end": 2002.72, "text": " And that might just be because there are many things specializing in different types of"}, {"start": 2002.72, "end": 2003.96, "text": " binding sites."}, {"start": 2003.96, "end": 2006.0400000000002, "text": " So you can't just go to this one head."}, {"start": 2006.0400000000002, "end": 2008.96, "text": " So this is just for this one head."}, {"start": 2008.96, "end": 2014.68, "text": " You can't just go to that one and expect that to classify all the binding sites because"}, {"start": 2014.68, "end": 2025.72, "text": " you might want to combine all of the high ranking ones here to form a classifier."}, {"start": 2025.72, "end": 2030.68, "text": " The last experiment they do is these linear probes, which where they just go and they just"}, {"start": 2030.68, "end": 2034.8400000000001, "text": " build classifiers from different parts of the network."}, {"start": 2034.84, "end": 2039.9599999999998, "text": " You can see right here that what is predicted and how well they work."}, {"start": 2039.9599999999998, "end": 2044.08, "text": " So each bar here is going to be the difference of performance."}, {"start": 2044.08, "end": 2049.84, "text": " So this is differential performance of diagnostic classifier by layer sorted by task order in"}, {"start": 2049.84, "end": 2051.44, "text": " figure eight."}, {"start": 2051.44, "end": 2058.2, "text": " Each plot shows the change in performance between the given layer and the previous layer."}, {"start": 2058.2, "end": 2063.08, "text": " So a bar up shows it's performing better than the previous layer, bar down shows it's"}, {"start": 2063.08, "end": 2065.72, "text": " performing worse than the previous layer."}, {"start": 2065.72, "end": 2071.4, "text": " So you see right here that the these are the secondary structures right here."}, {"start": 2071.4, "end": 2076.68, "text": " And you can see that there is a lot of performance in the earlier layers right here."}, {"start": 2076.68, "end": 2080.92, "text": " And sort of not that high performance in the later layers."}, {"start": 2080.92, "end": 2085.48, "text": " Whereas for the tertiary structures, the binding site and the contact, you can see that"}, {"start": 2085.48, "end": 2089.6, "text": " there is a bit of performance on in places."}, {"start": 2089.6, "end": 2095.96, "text": " But it sort of tends to be more towards the middle, certainly more towards the middle"}, {"start": 2095.96, "end": 2103.16, "text": " of the end of the network than the secondary structures, which sort of makes sense with"}, {"start": 2103.16, "end": 2104.68, "text": " our hypothesis."}, {"start": 2104.68, "end": 2110.52, "text": " You can also see this here where they show the percent of attention focused as a function"}, {"start": 2110.52, "end": 2112.36, "text": " of layer."}, {"start": 2112.36, "end": 2114.68, "text": " And the red is the center of mass."}, {"start": 2114.68, "end": 2122.2, "text": " And you can see that as the secondary structures, this their center of mass is at a lower"}, {"start": 2122.2, "end": 2127.8399999999997, "text": " layer in general than the tertiary functions."}, {"start": 2127.8399999999997, "end": 2130.6, "text": " All of this is not perfect, of course."}, {"start": 2130.6, "end": 2136.44, "text": " But it's still an open question, I guess, whether or not it's not perfect because we haven't"}, {"start": 2136.44, "end": 2140.64, "text": " built a strong enough language model yet."}, {"start": 2140.64, "end": 2145.7599999999998, "text": " Do I want to say GPT-4 is now for biology and not for language?"}, {"start": 2145.7599999999998, "end": 2155.4, "text": " Or is it because there is really, you really can't very well predict these things just"}, {"start": 2155.4, "end": 2156.4, "text": " from a language model."}, {"start": 2156.4, "end": 2163.3599999999997, "text": " I mean, you should, technically, all the information is there, but maybe the language model objective"}, {"start": 2163.3599999999997, "end": 2167.96, "text": " as such isn't able to capture that information."}, {"start": 2167.96, "end": 2170.6, "text": " So yeah, this was the paper."}, {"start": 2170.6, "end": 2171.6, "text": " It's pretty simple."}, {"start": 2171.6, "end": 2172.6, "text": " They have the appendix."}, {"start": 2172.6, "end": 2177.96, "text": " They have a lot of these additional experiments or full experiments, I believe, for all the amino"}, {"start": 2177.96, "end": 2179.8, "text": " acids and so on."}, {"start": 2179.8, "end": 2182.56, "text": " And I invite you to check that out."}, {"start": 2182.56, "end": 2188.8, "text": " In general, I like this kind of work because it's very applied."}, {"start": 2188.8, "end": 2195.64, "text": " And it can tell us something about the nature of both these language models and the biological"}, {"start": 2195.64, "end": 2201.2, "text": " things that we care about in biology."}, {"start": 2201.2, "end": 2205.72, "text": " OK, I'm just talking crap right now."}, {"start": 2205.72, "end": 2206.72, "text": " Thanks for being here."}, {"start": 2206.72, "end": 2208.24, "text": " I hope you enjoyed it."}, {"start": 2208.24, "end": 2234.9599999999996, "text": " And bye-bye."}] |
Yannic Kilcher | 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 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 you're 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 Dmitry Leppiken at Al of Google. This paper basically tells the story of how they built this 600 billion parameter model. How they attempted to build a model that had a trillion parameters but just didn't manage to quite train it. This is all using this system called G-shard. 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. This is basically describing a system on how to train these giant models. If you have watched my video on GPT-3, which of course was this 175 billion parameter model of OpenAI, which already was record-breaking, the paper was very much like, oh, we built a model and look at what things it can do. So that was the OpenAI paper. This paper here is like the complete opposite. It basically says, oh yeah, we do language model. But here is how we built the model, which is equally cool. So OpenAI basically just made everything bigger. And here they say to make everything even bigger, you need some tricks in how to build models. And they've basically 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 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 there 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. All right. 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 high level ideas and highlight a few things. Actually, let's not go into the abstract. Let's go into, yeah, these results first. So as you can see, they manage to continue the trend. The trend in NLP has always been in at least since, you know, transformers who are invented, the bigger the better, like larger model, larger data, more compute means better performance. And this is 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 blusk or though it sort of seems to be kind of a logarithmic scaling, like you have to keep doubling and doubling and doubling the number of weights, sort of like Moore's law and computation. You can 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, in traditional transformer looks like this. So it has 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 feet 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 is here. And then you have a feet forward network that is applied on a per token basis. So each of these tokens now goes through this feet forward network and is kind of transformed. So the embedding of that token is transformed by that feet forward network. Now every token does this and it's always the same feet 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 increase 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 transformers 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 GPT3, 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 1,024, so significantly smaller than the open AI context size. And they don't scale the layers. So they're largest transformers, 36 layers, whereas I believe GPT3 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. Now that might seem counterintuitive. But 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. So 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, which that'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. 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, then 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 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, 2000 and 48 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 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 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 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 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. Ultimately what you'll end up is 1000 times 10 tokens going to the first expert and so on. But still you can significantly parallelize this computation. So this, this, if you use G-shart, 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. Someone made a PowerPoint mistake. So you can see that the attention, everything is shared between the machines. So this here and this here, these are synchronized. The weights are synchronized. 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 a 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-shart 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 is I guess what open air 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 sharp 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 TPUV3 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. The TPU pipe is kind of a task runner that also distributes computation was trained with G-pipe on 2048 TPU course for six weeks or total of 235 TPU couriers. So if you have $1 per TPU hour that only costs, that only gets set you back about 2 million or so, easy peasy or even 200,000, just a tiny, tiny bit 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. In fact, it has 96 layers, their baseline, 96 layer transformer model. That's sort of what OpenAID, 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 sharded, which means it calculates this 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 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 so they've introduced that, you know, 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 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 set up 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 I invite you to look at the paper yourself if you really want to know what's going on right here. It's a fight 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 can 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 are at times there are two thousand 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 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 or 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 build 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. A mixture of experts as you would write it in code and they make use a lot of this Einstein some notation. If you don't know what the Einstein some 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 you could put the string a b. B c goes to a c. So this and then you put two matrices right here. This will tell it, okay, 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. 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 some 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. 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 I have a in the first input and here I have a again and 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, this describes an element wise product, you can go really funky with this. So this this here would be a row wise dot product where a is more for all the a's it's element wise. But then over b it's contracted so you can go you can go wild with the Einstein some notation you can describe a lot of things with it. And 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 we first of all we have these tensors this they have this 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 we have a group of groups 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 express this with an Einstein some notation then you have a top two gating which selects the top two from each of the last from from each of the entries. 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 some 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 some notations and the underlying the underlying 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 as 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 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 into 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 I have to so this goes here again and so this is just the reverse of what we did before. So you get all of the outputs again I hope you kind of can imagine how this happens so the first difference is 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 feet forward layer and we shard 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 next to X3 X4 but we always multiplied 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 sharded according to you know the first 10 go there the Lex 10 go there but here it's now crucially important where they are routed to to which expert and that's why we learned 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 feet forward layers on the expert you see that this WI and WO they are the weight matrices of the feet forward layers the feet forward layers are you have your input you multiplied by WI you have a relo and then you multiplied by WO so it's kind of a two layer feet forward network so this two layer feet 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 some notations there's no way to underline code and that magically happens 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 gshard system and as I said I don't know if the code is out or it will be out but with the gshard 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 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 some notation string on all of the machines and I'm going to keep this tensor in sync okay 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 expert inputs it splits it according to a axis index on to 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 on to 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 and you can see because we know Einstein some 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 converted 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 a also a general function that is more powerful yeah they and they you can auto partition and what not so they have a a they have this we implemented the practitioner in the XLA compiler which means that anything that can can translate to XLA is a target for the system and that's you know tensor flow and pi torch can do this so technically this can come to any of those systems but of course who who has their 2000 tp is lying around to make use of this but no I'm kidding I mean this I they hear use it for transformers but I am very excited to 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 okay 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 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 some 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 you know 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 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 okay 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 reshard operation where they do and you don't have to worry about this so from here to here there is this reshard operation that just shards it according to the according to e yeah 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 some across all of the machines and that will give you the full result so this is a this is 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 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 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 Y 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 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 Y 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 a memory it's even smarter than that and 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 you 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 try 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 one 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 expected to do in this sharded way completely crazy okay so they applied 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 I don't know if you have a lot of different languages like 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 so this 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 giant advantage for us but still it 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 you 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 so as the number of languages 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 A models trained on a single language pair 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 they'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 this giant model we could train that we know 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 and the rest of the 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 experts and all the German tokens are always routed to that expert there will be no sharing of 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 mine 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 translations it's kind of noisy translation because it's mine from the web but still it's a lot of data they have a 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 transformers possible and by that they mean we also include a variant of a dense 96 layer transformer encoder decoder network trained with G 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 we do 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 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 the 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 in machine learning because kind of the hip science fields being biology like genetics and machine learning I 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 all this time is over if you start a PhD now start 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 this 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 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 multi task training this multi-lingual translation improves significantly over the baseline where we only train a system for that language specifically and these 10k examples 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 multi-lingual 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 blow is and there's not really an end in sight so you can see say that they haven't seen convergence in training so you can technically train this 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 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 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 where the big models one the blue one is the one with 2048 experts and the green one is the one with 500 experts 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 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 2,500 experts 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 tried to build deeper models and why like okay this is more width but yeah 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 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 one trillion parameters and I'm pretty sure 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 have the paper 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 resonance 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 0.7 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 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 you're 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 a fish 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 achieving the best quality yes yes yes but this is just a yeah so here oh you can see the batch size in tokens is quite quite of it so yeah if you have a thousand if you have a context window of a thousand that means the batch size here was about 4,000 so as expected yeah this is just easy peasy 22 tpu couriers I've seen someone on Twitter saying this this is the new measure for companies no it's no longer like flops it's a tpu courier just mad mad and yeah so 42 days to train this thing right here crazy crazy crazy alright 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 36 60 layers your memory consumption increases for the weight and also this is the other big part in transformers and 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 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 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 to distribute along these actors sorry 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 the sharded machines so there are no experts anymore this is just G-shard the padding has to be correct this strides have to be correct data needs to be exchanged according to the machines the window size needs to be correct blah blah blah it's thank you for doing this and not having to do it myself yeah I'm excited as soon as as the codes out if I get a hold of it I'll you know 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 I 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": 5.0, "text": " OpenAI has 175 billion parameter model."}, {"start": 5.0, "end": 7.0, "text": " You thought that was large?"}, {"start": 7.0, "end": 8.0, "text": " That's cute."}, {"start": 8.0, "end": 12.0, "text": " Check out Google's 600 billion parameter model."}, {"start": 12.0, "end": 17.0, "text": " 600 billion floating point numbers doing things at the same time."}, {"start": 17.0, "end": 24.0, "text": " This has absolutely become a body part measuring competitions between companies."}, {"start": 24.0, "end": 27.0, "text": " Google be like, oh, GPT-3."}, {"start": 27.0, "end": 30.0, "text": " I spit on you."}, {"start": 30.0, "end": 34.0, "text": " I spit on you and you're little tiny 175 billion."}, {"start": 34.0, "end": 35.0, "text": " Okay."}, {"start": 35.0, "end": 36.0, "text": " Let's stop kidding."}, {"start": 36.0, "end": 40.0, "text": " This is a giant model that Google has trained right here."}, {"start": 40.0, "end": 46.0, "text": " The paper we're going to look at today is called G-shard Scaling Giant Models"}, {"start": 46.0, "end": 54.0, "text": " with Conditional Computation and Automatic Sharding by Dmitry Leppiken at Al of Google."}, {"start": 54.0, "end": 61.0, "text": " This paper basically tells the story of how they built this 600 billion parameter model."}, {"start": 61.0, "end": 69.0, "text": " How they attempted to build a model that had a trillion parameters but just didn't manage to quite train it."}, {"start": 69.0, "end": 74.0, "text": " This is all using this system called G-shard."}, {"start": 74.0, "end": 83.0, "text": " 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."}, {"start": 83.0, "end": 85.0, "text": " Who knows?"}, {"start": 85.0, "end": 88.0, "text": " Or maybe I just haven't seen it yet."}, {"start": 88.0, "end": 96.0, "text": " This is basically describing a system on how to train these giant models."}, {"start": 96.0, "end": 104.0, "text": " If you have watched my video on GPT-3, which of course was this 175 billion parameter model of OpenAI,"}, {"start": 104.0, "end": 109.0, "text": " which already was record-breaking,"}, {"start": 109.0, "end": 116.0, "text": " the paper was very much like, oh, we built a model and look at what things it can do."}, {"start": 116.0, "end": 122.0, "text": " So that was the OpenAI paper. This paper here is like the complete opposite."}, {"start": 122.0, "end": 126.0, "text": " It basically says, oh yeah, we do language model."}, {"start": 126.0, "end": 130.0, "text": " But here is how we built the model, which is equally cool."}, {"start": 130.0, "end": 133.0, "text": " So OpenAI basically just made everything bigger."}, {"start": 133.0, "end": 138.0, "text": " And here they say to make everything even bigger, you need some tricks in how to build models."}, {"start": 138.0, "end": 144.0, "text": " And they've basically developed this entire framework to build these giant models."}, {"start": 144.0, "end": 147.0, "text": " And this paper mainly describes that framework."}, {"start": 147.0, "end": 154.0, "text": " And the actual task here, which is machine translation, is almost sort of a side thing in the paper."}, {"start": 154.0, "end": 160.0, "text": " It's just a task to showcase what this system can do."}, {"start": 160.0, "end": 165.0, "text": " So this is very much an engineering paper rather than that much than a machine learning paper."}, {"start": 165.0, "end": 171.0, "text": " 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": 176.0, "text": " If you look at this graph here, you have a quality gain."}, {"start": 176.0, "end": 185.0, "text": " It's a difference in blue score. And this is a quality score for machine translation over the previous state of the art."}, {"start": 185.0, "end": 192.0, "text": " So over there baseline, which, as you can see here, you have 37 billion weights,"}, {"start": 192.0, "end": 199.0, "text": " 150 billion weights, and 600 billion weights, which they only train."}, {"start": 199.0, "end": 205.0, "text": " They train for, you know, 2000 and on 2048 TPUs for just four days."}, {"start": 205.0, "end": 212.0, "text": " That's they stress this is very efficient because they just have to train it for four days on 2000 TPUs."}, {"start": 212.0, "end": 214.0, "text": " Absolutely crazy."}, {"start": 214.0, "end": 225.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."}, {"start": 225.0, "end": 231.0, "text": " And tell me what you think about this stuff in the comments."}, {"start": 231.0, "end": 233.0, "text": " All right."}, {"start": 233.0, "end": 239.0, "text": " 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."}, {"start": 239.0, "end": 247.0, "text": " So I won't be able to cover everything, just kind of give you the high level ideas and highlight a few things."}, {"start": 247.0, "end": 250.0, "text": " Actually, let's not go into the abstract."}, {"start": 250.0, "end": 253.0, "text": " Let's go into, yeah, these results first."}, {"start": 253.0, "end": 256.0, "text": " So as you can see, they manage to continue the trend."}, {"start": 256.0, "end": 267.0, "text": " The trend in NLP has always been in at least since, you know, transformers who are invented, the bigger the better, like larger model, larger data, more compute means better performance."}, {"start": 267.0, "end": 269.0, "text": " And this is sort of unbroken here."}, {"start": 269.0, "end": 292.0, "text": " As you can see, if you increase the number of parameters in these models, you do get a very, very big gain in these blusk or though it sort of seems to be kind of a logarithmic scaling, like you have to keep doubling and doubling and doubling the number of weights, sort of like Moore's law and computation."}, {"start": 292.0, "end": 306.0, "text": " You can 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": 306.0, "end": 317.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."}, {"start": 317.0, "end": 323.0, "text": " So in a traditional, in traditional transformer looks like this."}, {"start": 323.0, "end": 326.0, "text": " So it has these blocks of attention."}, {"start": 326.0, "end": 330.0, "text": " If you don't know what this is, I have a video called attention is all you need."}, {"start": 330.0, "end": 335.0, "text": " I explain how the attention blocks in transformers work."}, {"start": 335.0, "end": 336.0, "text": " So this is nothing different."}, {"start": 336.0, "end": 338.0, "text": " These are just transformers, standard transformers."}, {"start": 338.0, "end": 341.0, "text": " There is an encoder and a decoder."}, {"start": 341.0, "end": 342.0, "text": " Everything works as you know."}, {"start": 342.0, "end": 347.0, "text": " So you have these blocks, you have n blocks, these are the number of layers that you have."}, {"start": 347.0, "end": 355.0, "text": " And in these blocks, you always have an attention layer and then a feet forward layer that acts on the tokens."}, {"start": 355.0, "end": 363.0, "text": " So without repeating too much, what an attention mechanism does basically in you have inputs tokens."}, {"start": 363.0, "end": 365.0, "text": " So this is a sequence."}, {"start": 365.0, "end": 369.0, "text": " It's technically a set processing unit, but we use it for sequences of text."}, {"start": 369.0, "end": 373.0, "text": " So here you have six tokens, a sentence of maybe six words."}, {"start": 373.0, "end": 385.0, "text": " 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."}, {"start": 385.0, "end": 388.0, "text": " Maybe like this route is here, route is here."}, {"start": 388.0, "end": 394.0, "text": " And then you have a feet forward network that is applied on a per token basis."}, {"start": 394.0, "end": 402.0, "text": " So each of these tokens now goes through this feet forward network and is kind of transformed."}, {"start": 402.0, "end": 406.0, "text": " So the embedding of that token is transformed by that feet forward network."}, {"start": 406.0, "end": 410.0, "text": " Now every token does this and it's always the same feet forward network."}, {"start": 410.0, "end": 414.0, "text": " So this network here is the same as this network."}, {"start": 414.0, "end": 419.0, "text": " Now usually when we talk about scaling transformers, we talk about this part right here."}, {"start": 419.0, "end": 425.0, "text": " We talk about the attention mechanism and also we talk about this part, the number of layers."}, {"start": 425.0, "end": 432.0, "text": " So you know, we talk about scaling the number of transformer layers, more layers, more layers, more layers."}, {"start": 432.0, "end": 441.0, "text": " And if we want to scale the attention mechanism, what that basically means is we have, we increase the context size of the text we can input."}, {"start": 441.0, "end": 458.0, "text": " So transformers are very limited by the size of this context right here that they can take the, like the original transformers started with something like 512 tokens that they were able to take because this attention mechanism has quadratic complexity."}, {"start": 458.0, "end": 470.0, "text": " This went up and the open AI GPT3, I believe, had a context size of 2048 tokens, which if it scales quadratically, that's quite an achievement."}, {"start": 470.0, "end": 475.0, "text": " And also it stacked the layers very, very deep."}, {"start": 475.0, "end": 479.0, "text": " Now in this paper, they scale the transformers differently."}, {"start": 479.0, "end": 489.0, "text": " They basically leave the context size and I believe that their context size is 1,024, so significantly smaller than the open AI context size."}, {"start": 489.0, "end": 505.0, "text": " And they don't scale the layers. So they're largest transformers, 36 layers, whereas I believe GPT3 was maybe correct me, but I think it was like 90 or 100 layers or something like this, at least significantly larger than this."}, {"start": 505.0, "end": 513.0, "text": " Instead, what they scale is this part right here, the feet forward layers. Now that might seem counterintuitive."}, {"start": 513.0, "end": 523.0, "text": " But they basically say, what if we didn't only have one feet forward network right here, but we had many, right?"}, {"start": 523.0, "end": 534.0, "text": " We don't always have the same. We have many, many feet forward networks, different ones that can do different things. So that's what they call experts."}, {"start": 534.0, "end": 546.0, "text": " 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."}, {"start": 546.0, "end": 562.0, "text": " 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": 562.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": 585.0, "text": " So what you'll have is you'll have all kinds of languages like French and German, which that's the and maybe like a lot of languages."}, {"start": 585.0, "end": 594.0, "text": " 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": " 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, then if it comes from French, you want to do it with the same model at the same time."}, {"start": 610.0, "end": 619.0, "text": " That means you maybe want to have one expert specialize in German pronouns and one expert specialize in French pronouns."}, {"start": 619.0, "end": 633.0, "text": " 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": 642.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."}, {"start": 642.0, "end": 656.0, "text": " They go up to 2000, 2000 and 48 experts in parallel. So that doesn't fit into a single accelerator anymore. And that's why the entire system has to be sharded."}, {"start": 656.0, "end": 672.0, "text": " And that's what they call G-shard. So G-shard, the main application here is going to be how can we build this giant model in on many, many distributed computers where the attention mechanism isn't the problem."}, {"start": 672.0, "end": 681.0, "text": " The attention mechanism we just distribute like we do data parallelism, the attention it lives on all of the accelerators, it synchronizes and so on."}, {"start": 681.0, "end": 694.0, "text": " 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."}, {"start": 694.0, "end": 702.0, "text": " 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": 710.0, "text": " So this is sent to these machines and then after the machines, you kind of gather all the results back right here."}, {"start": 710.0, "end": 719.0, "text": " So G-shard is the system that enables this sharding of these experts and the everything in between, everything that is necessary."}, {"start": 719.0, "end": 728.0, "text": " But it can also be applied to shard any computation and that's why it's so cool. So here you see what they do."}, {"start": 728.0, "end": 740.0, "text": " 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."}, {"start": 740.0, "end": 751.0, "text": " 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": 761.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."}, {"start": 761.0, "end": 771.0, "text": " 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": 771.0, "end": 788.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 those go to this one."}, {"start": 788.0, "end": 800.0, "text": " 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": 800.0, "end": 812.0, "text": " Ultimately what you'll end up is 1000 times 10 tokens going to the first expert and so on. But still you can significantly parallelize this computation."}, {"start": 812.0, "end": 824.0, "text": " So this, this, if you use G-shart, 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."}, {"start": 824.0, "end": 835.0, "text": " You can see that the machines will what happened here. Someone made a PowerPoint mistake."}, {"start": 835.0, "end": 844.0, "text": " So you can see that the attention, everything is shared between the machines. So this here and this here, these are synchronized. The weights are synchronized."}, {"start": 844.0, "end": 867.0, "text": " 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."}, {"start": 867.0, "end": 877.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": 877.0, "end": 888.0, "text": " So what's the problem here? The problem is that an operation like this is going to come to a incur significant sort of overhead in terms of communication and so on if you were to do it naively."}, {"start": 888.0, "end": 902.0, "text": " And it's going to be a real pain to program this. And that's why G-shart 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": 917.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 is I guess what open air into as well. If you make transformers simply larger in number of layers."}, {"start": 917.0, "end": 928.0, "text": " 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 sharp that somehow. And you can do this with G-shard."}, {"start": 928.0, "end": 940.0, "text": " 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 TPUV3 course for three days, a total cost of 22 TPU couriers."}, {"start": 979.0, "end": 990.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."}, {"start": 990.0, "end": 1001.0, "text": " 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": 1001.0, "end": 1014.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."}, {"start": 1014.0, "end": 1032.0, "text": " The TPU pipe is kind of a task runner that also distributes computation was trained with G-pipe on 2048 TPU course for six weeks or total of 235 TPU couriers."}, {"start": 1032.0, "end": 1053.0, "text": " So if you have $1 per TPU hour that only costs, that only gets set you back about 2 million or so, easy peasy or even 200,000, just a tiny, tiny bit of money."}, {"start": 1053.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": 1078.0, "text": " In fact, it has 96 layers, their baseline, 96 layer transformer model. That's sort of what OpenAID, they just kept stacking the transformer layers."}, {"start": 1078.0, "end": 1087.0, "text": " You get a model that has less parameters and trains for much longer and its performance is only about this good."}, {"start": 1087.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 sharded, which means it calculates this 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": 1126.0, "text": " Okay, so this is what is different here, it scales into these experts rather than scaling into depth or size of the attention mechanism itself."}, {"start": 1126.0, "end": 1134.0, "text": " Alright, the question, I guess that you come up with if you're a machine learner, is how do you back propagate?"}, {"start": 1134.0, "end": 1142.0, "text": " 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?"}, {"start": 1142.0, "end": 1155.0, "text": " 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."}, {"start": 1155.0, "end": 1165.0, "text": " And so they've introduced that, you know, it still works, so back prop still works through, so basically you have a back prop path through here."}, {"start": 1165.0, "end": 1177.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."}, {"start": 1177.0, "end": 1187.0, "text": " 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": 1187.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 set up 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": 1213.0, "text": " They really detail how they shard things and so on, which is pretty cool."}, {"start": 1213.0, "end": 1221.0, "text": " But 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": " It's a fight 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": 1246.0, "text": " So you have trainable weights that decide how to route the input, and that's dependent on the input."}, {"start": 1246.0, "end": 1254.0, "text": " So you have a bunch of inputs that comes from the lower layer, and this matrix right here determines where to route them."}, {"start": 1254.0, "end": 1264.0, "text": " 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": 1288.0, "text": " 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 can say, you collect the top two experts, and you only send it to the top two experts."}, {"start": 1288.0, "end": 1296.0, "text": " And you ignore all else, which is not a lot right there are at times there are two thousand experts in the system."}, {"start": 1296.0, "end": 1307.0, "text": " 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."}, {"start": 1307.0, "end": 1314.0, "text": " You just leave it at the first one. And with some noise, you send it also to the second one."}, {"start": 1314.0, "end": 1320.0, "text": " And I think that that noise is part of what it what makes the system work a bit."}, {"start": 1320.0, "end": 1329.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": 1329.0, "end": 1341.0, "text": " So this encourages the system to distribute the tokens evenly because sorry, what it penalizes is a."}, {"start": 1341.0, "end": 1351.0, "text": " This here is the mean assignment to each expert. 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 or one expert gets a lot of tokens because I don't know it happens to be really good at something."}, {"start": 1359.0, "end": 1369.0, "text": " 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."}, {"start": 1369.0, "end": 1383.0, "text": " And then there are also like upper limits where you drop tokens and so on. They really build a system that is out for performance rather than machine learning correctness."}, {"start": 1383.0, "end": 1394.0, "text": " 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."}, {"start": 1394.0, "end": 1404.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": 1404.0, "end": 1410.0, "text": " So this is pretty cool. So this here is this mixture of experts."}, {"start": 1410.0, "end": 1426.0, "text": " A mixture of experts as you would write it in code and they make use a lot of this Einstein some notation. If you don't know what the Einstein some notation is, it's a general notation to describe matrix or tensor multiplications."}, {"start": 1426.0, "end": 1444.0, "text": " 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."}, {"start": 1444.0, "end": 1457.0, "text": " So if you want to multiply two matrices, you can you could put the string a b. B c goes to a c."}, {"start": 1457.0, "end": 1474.0, "text": " So this and then you put two matrices right here. This will tell it, okay, 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."}, {"start": 1474.0, "end": 1489.0, "text": " 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."}, {"start": 1489.0, "end": 1502.0, "text": " So it should some 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."}, {"start": 1502.0, "end": 1522.0, "text": " 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"}, {"start": 1522.0, "end": 1537.0, "text": " I have a in the first input and here I have a again and 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."}, {"start": 1537.0, "end": 1548.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. But here we don't leave it away which simply means that these axes are going to be multiplied together."}, {"start": 1548.0, "end": 1570.0, "text": " And the same for b right here, so this describes an element wise, this describes an element wise product, you can go really funky with this. So this this here would be a row wise dot product where a is more for all the a's it's element wise."}, {"start": 1570.0, "end": 1582.0, "text": " But then over b it's contracted so you can go you can go wild with the Einstein some notation you can describe a lot of things with it."}, {"start": 1582.0, "end": 1602.0, "text": " And 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."}, {"start": 1602.0, "end": 1624.0, "text": " So we first of all we have these tensors this they have this 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."}, {"start": 1624.0, "end": 1653.0, "text": " So we have a group of groups 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."}, {"start": 1653.0, "end": 1669.0, "text": " So you can express this with an Einstein some notation then you have a top two gating which selects the top two from each of the last from from each of the entries."}, {"start": 1669.0, "end": 1685.0, "text": " 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."}, {"start": 1685.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 some notation."}, {"start": 1693.0, "end": 1716.0, "text": " 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 some notations and the underlying the underlying dimensions here are the dimensions where we want to shard the computation."}, {"start": 1716.0, "end": 1744.0, "text": " So here because we have this g underlined that means that we are interested in sharding the computation along this axis so this as 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."}, {"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": 1782.0, "text": " This is different 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 into these experts."}, {"start": 1782.0, "end": 1807.0, "text": " 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"}, {"start": 1807.0, "end": 1825.0, "text": " 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."}, {"start": 1825.0, "end": 1847.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 and then after that we're going to put back together from wherever we got them now I have to so this goes here again and so this is just the reverse of what we did before."}, {"start": 1847.0, "end": 1876.0, "text": " So you get all of the outputs again I hope you kind of can imagine how this happens so the first difference is 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 feet forward layer and we shard"}, {"start": 1876.0, "end": 1903.0, "text": " 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 next to X3 X4 but we always multiplied 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"}, {"start": 1903.0, "end": 1932.0, "text": " 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 sharded according to you know the first 10 go there the Lex 10 go there but here it's now crucially important"}, {"start": 1932.0, "end": 1948.0, "text": " where they are routed to to which expert and that's why we learned 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"}, {"start": 1948.0, "end": 1976.0, "text": " and we calculate your your we calculate the feet forward layers on the expert you see that this WI and WO they are the weight matrices of the feet forward layers the feet forward layers are you have your input you multiplied by WI you have a relo and then you multiplied by WO so it's kind of a two layer feet forward network"}, {"start": 1976.0, "end": 1996.0, "text": " so this two layer feet 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"}, {"start": 1996.0, "end": 2013.0, "text": " 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"}, {"start": 2013.0, "end": 2041.0, "text": " 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 some notations there's no way to underline code and that magically happens something that was simply for us to visualize now we want to apply their system in order to make this actually sharded"}, {"start": 2041.0, "end": 2056.0, "text": " and with the gshard system and as I said I don't know if the code is out or it will be out but with the gshard system this is basically all that you have to do so you have these functions they're called split and replicate"}, {"start": 2056.0, "end": 2074.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 this is a computation where we simply want to shard out the different to the different machines but keep it synchronized"}, {"start": 2074.0, "end": 2103.0, "text": " and you can see if you do this this is the operation then the system knows 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 some notation string on all of the machines and I'm going to keep this tensor in sync"}, {"start": 2103.0, "end": 2132.0, "text": " okay 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 expert inputs it splits it according to a axis index on to D different machines"}, {"start": 2132.0, "end": 2150.0, "text": " 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"}, {"start": 2150.0, "end": 2168.0, "text": " according to this first dimension on to 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"}, {"start": 2168.0, "end": 2189.0, "text": " and you can see because we know Einstein some 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"}, {"start": 2189.0, "end": 2217.0, "text": " converted 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"}, {"start": 2217.0, "end": 2231.0, "text": " and this thing here is where I want to split up and do different computation on the different parts and then they have a also a general function that is more powerful"}, {"start": 2231.0, "end": 2260.0, "text": " yeah they and they you can auto partition and what not so they have a a they have this we implemented the practitioner in the XLA compiler which means that anything that can can translate to XLA is a target for the system and that's you know tensor flow and pi torch can do this so technically this can come to any of those systems"}, {"start": 2260.0, "end": 2280.0, "text": " but of course who who has their 2000 tp is lying around to make use of this but no I'm kidding I mean this I they hear use it for transformers but I am very excited to 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"}, {"start": 2280.0, "end": 2304.0, "text": " and they have some you know they talk about okay 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 basically implement this for all of the operators"}, {"start": 2304.0, "end": 2328.0, "text": " 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 some notation"}, {"start": 2328.0, "end": 2350.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 so we want to start with something that is sharded according to the batch dimension that means that we you know we have different different parts of the batch on different machines"}, {"start": 2350.0, "end": 2366.0, "text": " 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"}, {"start": 2366.0, "end": 2386.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 so you have the zero is all on the same machine the one is all on the same machine and so on"}, {"start": 2386.0, "end": 2402.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 which we have we have omitted right here"}, {"start": 2402.0, "end": 2428.0, "text": " and if you multiply that sorry okay 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 reshard operation where they do and you don't have to worry about this so from here to here there is this reshard operation that just shards it according to the according to e"}, {"start": 2432.0, "end": 2450.0, "text": " yeah 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"}, {"start": 2450.0, "end": 2466.0, "text": " 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"}, {"start": 2466.0, "end": 2476.0, "text": " 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"}, {"start": 2476.0, "end": 2498.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 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": 2518.0, "text": " 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"}, {"start": 2518.0, "end": 2544.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 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 some across all of the machines and that will give you the full result"}, {"start": 2544.0, "end": 2560.0, "text": " so this is a this is 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"}, {"start": 2560.0, "end": 2568.0, "text": " so this system handles this transparently right if you're sharded like this this is what the system will do"}, {"start": 2568.0, "end": 2584.0, "text": " 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"}, {"start": 2584.0, "end": 2597.0, "text": " 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"}, {"start": 2597.0, "end": 2612.0, "text": " 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"}, {"start": 2612.0, "end": 2625.0, "text": " 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"}, {"start": 2625.0, "end": 2639.0, "text": " now this G shard system apparently realizes itself when something is out of memory and it can do a smart smart move around being out of memory using a loop"}, {"start": 2639.0, "end": 2652.0, "text": " 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"}, {"start": 2652.0, "end": 2664.0, "text": " 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"}, {"start": 2664.0, "end": 2681.0, "text": " so what this system does is it's going into a Y 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"}, {"start": 2681.0, "end": 2697.0, "text": " so here first we do this by this this is fine but then we grab ourselves from the we we grab ourselves this one here calculate the next little piece up here then we grab ourselves the number two"}, {"start": 2697.0, "end": 2714.0, "text": " 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"}, {"start": 2714.0, "end": 2725.0, "text": " okay so this goes in a Y 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 a memory"}, {"start": 2725.0, "end": 2741.0, "text": " it's even smarter than that and 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"}, {"start": 2741.0, "end": 2756.0, "text": " 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"}, {"start": 2756.0, "end": 2774.0, "text": " 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"}, {"start": 2774.0, "end": 2790.0, "text": " 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"}, {"start": 2790.0, "end": 2800.0, "text": " 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 you express this with these"}, {"start": 2800.0, "end": 2816.0, "text": " 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"}, {"start": 2816.0, "end": 2838.0, "text": " so there is a lot more to this system than I've just explained I just try 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 one single machine"}, {"start": 2838.0, "end": 2852.0, "text": " 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"}, {"start": 2852.0, "end": 2867.0, "text": " system it will do what you expected to do in this sharded way completely crazy okay so they applied this to massively multilingual massive machine translation so"}, {"start": 2867.0, "end": 2890.0, "text": " 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"}, {"start": 2890.0, "end": 2918.0, "text": " 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"}, {"start": 2918.0, "end": 2935.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 I don't know"}, {"start": 2935.0, "end": 2954.0, "text": " if you have a lot of different languages like 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"}, {"start": 2954.0, "end": 2974.0, "text": " so this 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 giant advantage for us but still it it shares a lot of similarities with German"}, {"start": 2974.0, "end": 3002.0, "text": " so if you learn a lot about German you can sort of transfer learn to Swiss German pretty easily so you 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"}, {"start": 3002.0, "end": 3026.0, "text": " 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"}, {"start": 3026.0, "end": 3040.0, "text": " 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"}, {"start": 3040.0, "end": 3056.0, "text": " so as the number of languages 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": 3080.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 resulting in lower translation quality compared to A models to A models trained on a single language pair"}, {"start": 3080.0, "end": 3090.0, "text": " 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": 3090.0, "end": 3109.0, "text": " so basically they'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 this giant model we could train that"}, {"start": 3109.0, "end": 3129.0, "text": " we know 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": 3129.0, "end": 3146.0, "text": " and the rest of the 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": 3146.0, "end": 3166.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 experts"}, {"start": 3166.0, "end": 3185.0, "text": " and all the German tokens are always routed to that expert there will be no sharing of 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 mine 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": 3220.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 translations"}, {"start": 3220.0, "end": 3230.0, "text": " it's kind of noisy translation because it's mine from the web but still it's a lot of data they have a baselines so the baselines are first of all"}, {"start": 3230.0, "end": 3242.0, "text": " 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"}, {"start": 3242.0, "end": 3257.0, "text": " 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 transformers possible"}, {"start": 3257.0, "end": 3273.0, "text": " and by that they mean we also include a variant of a dense 96 layer transformer encoder decoder network trained with G pipeline parallelism on the same data set as another baseline"}, {"start": 3273.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"}, {"start": 3287.0, "end": 3301.0, "text": " we do 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"}, {"start": 3301.0, "end": 3317.0, "text": " 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 the 2000 TPU course"}, {"start": 3317.0, "end": 3345.0, "text": " 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 in machine learning because kind of the hip science fields being biology like genetics and machine learning I was thought like oh but these biology people they always need like million dollar grants from"}, {"start": 3345.0, "end": 3357.0, "text": " government to run their experiments and we can just sit down with a laptop all this time is over if you start a PhD now start for money to get TPUs"}, {"start": 3357.0, "end": 3373.0, "text": " 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"}, {"start": 3373.0, "end": 3389.0, "text": " 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"}, {"start": 3389.0, "end": 3399.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"}, {"start": 3399.0, "end": 3413.0, "text": " 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"}, {"start": 3413.0, "end": 3427.0, "text": " 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 this 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": 3453.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": 3453.0, "end": 3465.0, "text": " 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"}, {"start": 3465.0, "end": 3479.0, "text": " 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"}, {"start": 3479.0, "end": 3491.0, "text": " 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"}, {"start": 3491.0, "end": 3501.0, "text": " 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"}, {"start": 3501.0, "end": 3511.0, "text": " 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": 3521.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": 3521.0, "end": 3539.0, "text": " so you can see that as we as we go to lower and lower resource languages this multi task training this multi-lingual translation improves significantly over the baseline where we only train a system for that language specifically"}, {"start": 3539.0, "end": 3547.0, "text": " and these 10k examples it's quite a bit but it's not that much especially since it's noisy data"}, {"start": 3547.0, "end": 3563.0, "text": " so this is specifically good for low resource languages but you can see also the high resource languages here benefit from the multi-lingual translation and that's a function of the fact that we have you know large enough models"}, {"start": 3563.0, "end": 3571.0, "text": " in fact you can see the larger the models the more the difference in blow is and there's not really an end in sight"}, {"start": 3571.0, "end": 3579.0, "text": " so you can see say that they haven't seen convergence in training so you can technically train this 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": 3611.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 whereas this 96 layer dense transformer took these six weeks to train"}, {"start": 3611.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": 3641.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"}, {"start": 3641.0, "end": 3659.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": 3659.0, "end": 3687.0, "text": " 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 where the big models one the blue one is the one with 2048 experts and the green one is the one with 500 experts"}, {"start": 3687.0, "end": 3709.0, "text": " 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 you see it actually hurts you to up the number of experts"}, {"start": 3709.0, "end": 3725.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 and that means you don't get any sharing benefit from the multilingual translation"}, {"start": 3725.0, "end": 3741.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 2,500 experts number"}, {"start": 3741.0, "end": 3769.0, "text": " 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 tried to build deeper models and why like okay this is more width but yeah I think there might be some breakthrough on the horizon where someone just figures out how to train these giant"}, {"start": 3769.0, "end": 3787.0, "text": " 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"}, {"start": 3787.0, "end": 3806.0, "text": " 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 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": 3850.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 one trillion parameters and I'm pretty sure they're cool"}, {"start": 3850.0, "end": 3862.0, "text": " 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 have the paper"}, {"start": 3862.0, "end": 3876.0, "text": " 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"}, {"start": 3876.0, "end": 3891.0, "text": " 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"}, {"start": 3891.0, "end": 3901.0, "text": " like we made the training for almost infinitely deep CNNs possible with resonance"}, {"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": 3947.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"}, {"start": 3947.0, "end": 3966.0, "text": " 0.7 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"}, {"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": 4002.0, "text": " so here you can see let's just look at the 12 layers for now let's look 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"}, {"start": 4002.0, "end": 4017.0, "text": " but then you hurt upping the number of experts to 2000 right so that's that's sort of you're you're hurting efficiency by upping the number of experts too much"}, {"start": 4017.0, "end": 4030.0, "text": " 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 a fish part of that efficiency again by increasing it even more"}, {"start": 4030.0, "end": 4045.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"}, {"start": 4045.0, "end": 4055.0, "text": " 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 achieving the best quality yes yes yes but this is just a yeah"}, {"start": 4081.0, "end": 4096.0, "text": " so here oh you can see the batch size in tokens is quite quite of it so yeah if you have a thousand if you have a context window of a thousand"}, {"start": 4096.0, "end": 4105.0, "text": " that means the batch size here was about 4,000 so as expected"}, {"start": 4105.0, "end": 4120.0, "text": " yeah this is just easy peasy 22 tpu couriers I've seen someone on Twitter saying this this is the new measure for companies no it's no longer like flops it's a tpu courier"}, {"start": 4120.0, "end": 4131.0, "text": " just mad mad and yeah so 42 days to train this thing right here crazy crazy crazy"}, {"start": 4131.0, "end": 4140.0, "text": " alright they also have a number of investigations in other parts of efficiency like per device memory consumption"}, {"start": 4140.0, "end": 4153.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"}, {"start": 4153.0, "end": 4169.0, "text": " 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"}, {"start": 4169.0, "end": 4174.0, "text": " so you can just add machines and you keep your weight requirements the same"}, {"start": 4174.0, "end": 4188.0, "text": " 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"}, {"start": 4188.0, "end": 4202.0, "text": " so you go deeper right here you see 36 60 layers your memory consumption increases for the weight and also this is the other big part in transformers"}, {"start": 4202.0, "end": 4210.0, "text": " and 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": 4227.0, "text": " and that's why also the activation here increases as I go deeper now you can see percentually it decreases again here"}, {"start": 4227.0, "end": 4238.0, "text": " 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"}, {"start": 4238.0, "end": 4256.0, "text": " 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"}, {"start": 4256.0, "end": 4268.0, "text": " so all of this is pretty crazy honestly and they look at where the where the different computations go"}, {"start": 4268.0, "end": 4283.0, "text": " 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"}, {"start": 4283.0, "end": 4292.0, "text": " because that's how long it takes to distribute to distribute along these actors sorry along these experts"}, {"start": 4292.0, "end": 4300.0, "text": " 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"}, {"start": 4300.0, "end": 4309.0, "text": " 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"}, {"start": 4309.0, "end": 4318.0, "text": " 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"}, {"start": 4318.0, "end": 4328.0, "text": " this is so ugly how you have to implement the convolution because you have to padding must be correct across these experts across the the sharded machines"}, {"start": 4328.0, "end": 4335.0, "text": " so there are no experts anymore this is just G-shard the padding has to be correct this strides have to be correct"}, {"start": 4335.0, "end": 4343.0, "text": " data needs to be exchanged according to the machines the window size needs to be correct blah blah blah it's"}, {"start": 4343.0, "end": 4353.0, "text": " thank you for doing this and not having to do it myself yeah I'm excited as soon as as the codes out if I get a hold of it"}, {"start": 4353.0, "end": 4360.0, "text": " I'll you know link it or you'll find it once it's out if it's already out I'm just too dumb to see it"}, {"start": 4360.0, "end": 4368.0, "text": " I enjoyed reading this it's different than a machine learning paper I kind of shows you what goes into engineering a system like this"}, {"start": 4368.0, "end": 4377.0, "text": " 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"}, {"start": 4377.0, "end": 4392.0, "text": " and with that said 23 pages later see you next time bye bye"}] |
Yannic Kilcher | 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 Locotello, Thomas Kip and others of Google Brain, ETH Zurich and MPI. On 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 ends on supervised 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 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 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. 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'll 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 kind of a mesh 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 tasker 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 this into a CNN. This CNN will probably down sample the image a bit and 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. Two, 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 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. 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 the 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 is 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 a generator in GANs for example. It takes a hidden representation as input. Now the hidden representation here is going to be these slots and it's going to up sample it into an image. If we train the whole, 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 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 autoencoder or just autoencoder objective in this case. All right, 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 multi same feature assigned to multiple slots. So each slot takes in many features, but the features should be 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 information is now routed by agreement of key and query. In this case, this thing, 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 soft max, 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. OK? 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 outtimes slot 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 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. 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 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 a 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 these 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 to be routed for the features to be routed to them. And then this is simply the second part of the attention mechanism. And 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'll 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 wait 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'll 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 again. 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. 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 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 defunctions 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 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 waychaired. It's a transformer with weight sharing between the modules and the inputs. They are also copied up here. This is the side inputs. All right? It's... Otherwise it's the... It's the same thing. But 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 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 really stress this random initialization because this differs from the DETR paper in that... In the DTR paper, these things here are learned. In 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 what not. 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 the iterative routing, via the way-charing, they will be sort of assigned correctly. All right. I hope you could follow this. Yeah. If you want to anthropomorphize this, you could think if 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 more of that. And then in the next layer, even more of that, even more of that. And you'll see 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 maps of these slots, you can see that in after the first step, you can see that it's slot 2 right here is assigned these both of these objects. slot 3 is already pretty. So the first step learns to segment a little bit of the image, but not too well. slot 4, also the attention map here is pretty wonky. But if you in the next step, and this is kind of crucial, basically these slots, they specialize. So slot 2 realizes, well, I have a lot of these blue pixels. So give me more of those, right? Give me more of those. So it gets all the blue pixel. Well, slot 4 has a lot of these golden pixels. Give me more of those golden stuff. That's also regionally right next to that. And since these two compete, I'm pretty sure slot 2 would also ask for more of the golden pixels because it has a lot of golden pixels. But it competes with slot 4 because of the softmax. So all of the golden pixels are assigned to slot 4 and not slot 2. Well, all of the blue pixels that slot 4 surely asks for as well are assigned to slot 2 in the next iteration. So I actually consider iteration 1 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 2 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. 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. But I might even, you might even be able to think that you might want to separate step 1 and the subsequent steps because step 1 is sort of seems fundamentally different from steps 2, 3, 4 and so on because step 1 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 way chairing between steps, the first step and the subsequent steps. But what do I know? This 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 the 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 4 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 here might be okay. Everything here is alpha one, 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. But that means you can basically reconstruct from the slots where the objects are. Now you'll notice, this is this thing here, you'll notice that they often use, for example, here four different slots, 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 little ball, slot four 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 datasets. So these kinds of datasets, they come, you know, they're produced by a generator, and the generator specifically has these objects right here. And it sort of arranges them in an independent fashion. The background is really clean, right? The objects themselves are really clean, a geometric, and so on. And they're kind of arranged in a random fashion. And then there's a render of that. So this is like super, super, super clean dataset. 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 dataset. So I wouldn't yet apply this much 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 these in the unsupervised object discovery experiments, they have this dataset called clever. And this dataset has these images with sort of, I believe, clever six has 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 dataset has six things, they give like, they give seven slots because they know that the dataset 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 mone. And they say, this replaces slot, no, that's not it. For the mone, iodine, DSPN 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 re-implement 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 it's a lot to run these things. However, here I'm a bit skeptical, first, yes, because it is Google, so they do have a lot of resources available to technically run these things. I've seen at least mone 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, yeah, this would be okay, they say as we use the same experimental setup, so even 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 mone 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 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 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 notes that one outlier was excluded from evaluation. I guess it is valid if it's a super outlier, but in this case, I would categorize this model as a different way of doing things and not necessarily outperforming the others. So this, also if you look at 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 be fair. But I do have more of a problem with a little bit is this here. On clever six, 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 ion ion are modally significantly more efficient in terms of both memory consumption and runtime, which is something I believe, but this characterization that they use a batch size of four, and here in this paper they can use 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 four on one GPU, so they also use one GPU, but they say their GPU has a RAM of 12 gigabytes. And 12 gigabytes RAM GPUs, that points to something like a 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 ten 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 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 a batch size of four, but I highly doubt it, because in their paper, they explicitly name that they use a batch size of four for their 12 gigabyte GPUs. So yeah, that just kind of pulls through. So there is the minuscule improvements and then there is 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 words, Smithy, a bit, which gives a bit of a, a bit of a 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 dataset has six objects and this dataset 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 will 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 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 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. These results are pretty cool. They respect the property that sets should be permutation invariant and so on. This routing view of the transformer is pretty cool even though you can look at it as a transformer with weight-sharing or an iterative routing protocol like in capsules. All of this I find to be a very, very cool idea. I think that's how we should look at 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. That was the paper. At last, I actually want to look at the broader impact statement. Just because I've complained about the need for broader impact statement. So I just want to kind of go, just read them and just like look how the different companies, how 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. 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 follow the bit what the broader impact statement is supposed to be, this is not one. 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. 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 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 NURRIPS, 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 this is clearly not 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 abolations. This is something I do appreciate. And with that, bye-bye and see you next time. | [{"start": 0.0, "end": 5.44, "text": " Hi there, today we'll look at object-centric learning with slot attention by Francesco"}, {"start": 5.44, "end": 11.44, "text": " Locotello, Thomas Kip and others of Google Brain, ETH Zurich and MPI."}, {"start": 11.44, "end": 17.32, "text": " On high level, this paper recognizes scenes of objects from single pixels and it's best"}, {"start": 17.32, "end": 20.52, "text": " I show you a picture of what's going on."}, {"start": 20.52, "end": 26.28, "text": " So you have scenes like this where there is some sort of an arrangement of objects and"}, {"start": 26.28, "end": 31.880000000000003, "text": " there are multiple tasks you can do here specifically they consider the task of unsupervised recognition"}, {"start": 31.880000000000003, "end": 37.2, "text": " of objects which they call object discovery and supervised classification of objects."}, {"start": 37.2, "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.760000000000005, "text": " They do this via a thing they call slot attention that basically is a permutation invariant"}, {"start": 50.76, "end": 57.76, "text": " attention mechanism over these objects in both the supervised ends on supervised domain and"}, {"start": 57.76, "end": 62.96, "text": " they do this in a fashion where they iteratively route the attention in order to make the"}, {"start": 62.96, "end": 68.52, "text": " different 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.8, "text": " If you are in this field you probably know right now what's going on."}, {"start": 74.8, "end": 78.0, "text": " If you're not, we'll dive into it together."}, {"start": 78.0, "end": 80.28, "text": " So stay tuned."}, {"start": 80.28, "end": 85.4, "text": " If you like content like this consider sharing it out leaving a like or tell me what you"}, {"start": 85.4, "end": 87.0, "text": " think about it in the comment."}, {"start": 87.0, "end": 94.44, "text": " I appreciate any suggestion for making these videos better so people can learn more from"}, {"start": 94.44, "end": 95.44, "text": " it."}, {"start": 95.44, "end": 100.64, "text": " Alright, so the problem I've already described the problem a little bit but let's go"}, {"start": 100.64, "end": 102.08, "text": " a bit deeper here."}, {"start": 102.08, "end": 106.8, "text": " You have images like this and the images we're considering are going to be images that"}, {"start": 106.8, "end": 111.8, "text": " have some sort of arrangement of objects or what we humans would call objects."}, {"start": 111.8, "end": 118.39999999999999, "text": " In this case you can see there is this gray cube right here."}, {"start": 118.39999999999999, "end": 124.03999999999999, "text": " There is a smaller green cube and then there is a yellow cylinder."}, {"start": 124.03999999999999, "end": 130.35999999999999, "text": " Now in the task of object discovery what you're supposed to do is you're simply supposed"}, {"start": 130.36, "end": 137.36, "text": " to say that there is an object right here, there is an object about here and there is"}, {"start": 137.36, "end": 139.68, "text": " an object here."}, {"start": 139.68, "end": 145.72000000000003, "text": " So basically you're supposed to point to the pixels where there are objects and you're"}, {"start": 145.72000000000003, "end": 148.76000000000002, "text": " supposed to segment the objects from each other."}, {"start": 148.76000000000002, "end": 154.36, "text": " You can see right here that this model, we don't know how it works yet but it separates"}, {"start": 154.36, "end": 162.44000000000003, "text": " the left cube here, the bottom cube here and the top right cylinder right here."}, {"start": 162.44000000000003, "end": 170.0, "text": " In the task of set prediction you're supposed to say what objects there are."}, {"start": 170.0, "end": 175.20000000000002, "text": " So you're supposed to say there is a gray cube right here, a green cube right here"}, {"start": 175.20000000000002, "end": 178.68, "text": " and there is a yellow cylinder right there."}, {"start": 178.68, "end": 182.76000000000002, "text": " Actually you don't have to say where they are I guess."}, {"start": 182.76, "end": 187.88, "text": " There are many different variants of this task but mainly you're supposed to classify them"}, {"start": 187.88, "end": 193.0, "text": " meaning you have to say there is a gray cube there."}, {"start": 193.0, "end": 196.88, "text": " I believe in this case it's with coordinates but you can do it without."}, {"start": 196.88, "end": 202.04, "text": " The difficulty here of course being that these are sets so there is no natural order in"}, {"start": 202.04, "end": 203.04, "text": " it."}, {"start": 203.04, "end": 207.92, "text": " So if you say there is a green cube and a yellow cylinder it's going to be the same as"}, {"start": 207.92, "end": 212.64, "text": " there is a yellow cylinder and a green cube."}, {"start": 212.64, "end": 217.95999999999998, "text": " So you'll have to build an architecture that is somehow invariant with respect to the"}, {"start": 217.95999999999998, "end": 219.35999999999999, "text": " labels."}, {"start": 219.35999999999999, "end": 224.04, "text": " And we've seen a lot of the concepts in this video in this paper before."}, {"start": 224.04, "end": 230.76, "text": " This video is sort of a kind of a mesh together of different concepts of other places."}, {"start": 230.76, "end": 237.95999999999998, "text": " So what you'll see is for example this property of the fact that here you see are the labels"}, {"start": 237.95999999999998, "end": 238.95999999999998, "text": " for these objects."}, {"start": 238.95999999999998, "end": 241.56, "text": " This could be there is a green cube."}, {"start": 241.56, "end": 247.8, "text": " There is a gray cube and you'll have to come up with an architecture that if here you"}, {"start": 247.8, "end": 254.2, "text": " predict that green cube you consider it correct even though the corresponding label isn't"}, {"start": 254.2, "end": 256.0, "text": " the one for the green cube."}, {"start": 256.0, "end": 261.56, "text": " And we saw this for example in this DETR architecture by Facebook where they use a matching"}, {"start": 261.56, "end": 263.4, "text": " loss but we'll get into that."}, {"start": 263.4, "end": 265.2, "text": " Okay, so these are the tasks."}, {"start": 265.2, "end": 268.64, "text": " The tasker object discovery and set prediction."}, {"start": 268.64, "end": 271.64, "text": " So how does this paper deal with this?"}, {"start": 271.64, "end": 277.03999999999996, "text": " They use this thing called a slot attention module."}, {"start": 277.03999999999996, "end": 281.96, "text": " Now the slot attention module is in essence it's pretty simple."}, {"start": 281.96, "end": 288.0, "text": " What it does is it has these different slots right here as you can see."}, {"start": 288.0, "end": 291.71999999999997, "text": " And it divides the input into features."}, {"start": 291.71999999999997, "end": 295.91999999999996, "text": " So you can see there is a CNN encoder because we're working with pixels."}, {"start": 295.92, "end": 299.36, "text": " It's natural that we want to encode this into a CNN."}, {"start": 299.36, "end": 308.04, "text": " This CNN will probably down sample the image a bit and subdivided into this grid right here."}, {"start": 308.04, "end": 309.6, "text": " So you have a fairly coarse grid."}, {"start": 309.6, "end": 313.0, "text": " The grid is actually not a bit finer than you see here."}, {"start": 313.0, "end": 315.84000000000003, "text": " This is just for example."}, {"start": 315.84000000000003, "end": 319.36, "text": " But you'll have ultimately a number of features."}, {"start": 319.36, "end": 322.20000000000005, "text": " So each pixel right here is going to be a feature."}, {"start": 322.2, "end": 327.96, "text": " Each feature will have not only this one channel as you see here but many, many channels of"}, {"start": 327.96, "end": 330.0, "text": " information down here."}, {"start": 330.0, "end": 337.15999999999997, "text": " So the CNN will encode each of these regions in the picture into a feature vector."}, {"start": 337.15999999999997, "end": 340.03999999999996, "text": " And then you have these slots."}, {"start": 340.03999999999996, "end": 342.68, "text": " So what you'll want to do, we maybe look at this."}, {"start": 342.68, "end": 346.28, "text": " So you'll have the features right here."}, {"start": 346.28, "end": 349.15999999999997, "text": " These are your features."}, {"start": 349.15999999999997, "end": 351.48, "text": " And you'll have the slots."}, {"start": 351.48, "end": 355.52000000000004, "text": " And the slots, let's say there are fewer slots than features."}, {"start": 355.52000000000004, "end": 360.6, "text": " Two, three, three slots, four slots as in this case."}, {"start": 360.6, "end": 363.04, "text": " Four slots."}, {"start": 363.04, "end": 368.36, "text": " What you'll want to do is you'll want to assign the features to the slots."}, {"start": 368.36, "end": 374.44, "text": " So you maybe say, okay, this feature right here and this feature right here, they go to"}, {"start": 374.44, "end": 375.72, "text": " this slot."}, {"start": 375.72, "end": 379.56, "text": " And then these two features go to this slot."}, {"start": 379.56, "end": 383.28000000000003, "text": " And this, these two go to this and that feature goes to that."}, {"start": 383.28000000000003, "end": 388.68, "text": " And that's equivalent to basically subdividing the picture into these slots."}, {"start": 388.68, "end": 393.0, "text": " Ultimately, your goal is going to be to say that these features right here, these pixels"}, {"start": 393.0, "end": 397.96, "text": " right here are going maybe into that slot."}, {"start": 397.96, "end": 402.32, "text": " And then these ones right here are going into that slot."}, {"start": 402.32, "end": 404.52, "text": " And these ones here going into that slot."}, {"start": 404.52, "end": 408.64, "text": " And the rest, so all of their background is going into that one."}, {"start": 408.64, "end": 413.24, "text": " You can see that if you have a system like this, if you can train it correctly, then it"}, {"start": 413.24, "end": 418.47999999999996, "text": " becomes pretty easy to, so it becomes super easy to classify it right here."}, {"start": 418.47999999999996, "end": 422.76, "text": " Because you can just take each slot and independently classify it, right?"}, {"start": 422.76, "end": 427.64, "text": " Because you already know, you already have assigned all the pixels where the object appears"}, {"start": 427.64, "end": 429.56, "text": " into that slot."}, {"start": 429.56, "end": 434.68, "text": " You can just super easily predict a class from it."}, {"start": 434.68, "end": 436.08, "text": " So we're almost at the end."}, {"start": 436.08, "end": 441.28, "text": " So you now predict for each slot a class or a description of the object, whatever you"}, {"start": 441.28, "end": 442.8, "text": " want to predict."}, {"start": 442.8, "end": 450.12, "text": " And this is the exact same thing as in this Facebook paper now, where for each of these slots"}, {"start": 450.12, "end": 452.84, "text": " we've predicted a bounding box."}, {"start": 452.84, "end": 457.0, "text": " The question is how do you assign this to the labels?"}, {"start": 457.0, "end": 458.0, "text": " And that's pretty easy."}, {"start": 458.0, "end": 466.6, "text": " There's this thing called the Hungarian matching that basically what you're saying is you want"}, {"start": 466.6, "end": 469.72, "text": " to be as forthcoming as possible, right?"}, {"start": 469.72, "end": 475.36, "text": " So if you predict a gray cube somewhere and there is a gray cube somewhere here, you want"}, {"start": 475.36, "end": 476.36, "text": " to match them."}, {"start": 476.36, "end": 482.28, "text": " You'll say, okay, I'm going to give you the benefit of the doubt and I'm going to do your"}, {"start": 482.28, "end": 483.28, "text": " model."}, {"start": 483.28, "end": 487.84, "text": " I'm going to assume with the gray cube you meant that gray cube right here."}, {"start": 487.84, "end": 494.15999999999997, "text": " And if there is the yellow rectangle and the yellow rectangle somewhere over there, you"}, {"start": 494.15999999999997, "end": 497.84, "text": " don't incur any penalty as long as you predict the correct things."}, {"start": 497.84, "end": 503.03999999999996, "text": " Now only whenever you predict like a second yellow rectangle."}, {"start": 503.03999999999996, "end": 509.12, "text": " So both of these slots now, so this slot and this slot for some reason they predict a"}, {"start": 509.12, "end": 510.47999999999996, "text": " yellow rectangle."}, {"start": 510.47999999999996, "end": 515.92, "text": " This one correctly and this one was assigned this object and it incorrectly predicts a yellow"}, {"start": 515.92, "end": 518.64, "text": " rectangle, sorry, other way around."}, {"start": 518.64, "end": 522.76, "text": " This one incorrectly predicts a yellow rectangle where there is no second yellow rectangle in"}, {"start": 522.76, "end": 523.76, "text": " our label set."}, {"start": 523.76, "end": 527.8399999999999, "text": " There's only this, maybe this green cube."}, {"start": 527.8399999999999, "end": 531.68, "text": " Then this will be a mistake because it can't be matched."}, {"start": 531.68, "end": 535.3199999999999, "text": " It will be matched to the one where it has the least loss but it will be matched to something"}, {"start": 535.3199999999999, "end": 539.9599999999999, "text": " that's not a yellow rectangle and therefore that's going to be a mistake."}, {"start": 539.9599999999999, "end": 544.12, "text": " So this is how you calculate the loss function with this matching algorithm."}, {"start": 544.12, "end": 549.24, "text": " And you can calculate that matching in a deterministic fashion so you can back propagate"}, {"start": 549.24, "end": 550.8, "text": " through it."}, {"start": 550.8, "end": 558.08, "text": " So you can see if this slot assignment works, we'll have a pretty easy time then calculating"}, {"start": 558.08, "end": 560.24, "text": " the classes coming up with a loss."}, {"start": 560.24, "end": 564.08, "text": " The same for the unsupervised object discovery."}, {"start": 564.08, "end": 568.84, "text": " What we'll do is we'll run these things through this slot decoder."}, {"start": 568.84, "end": 575.72, "text": " Now this slot decoder is very similar to a generator in GANs for example."}, {"start": 575.72, "end": 578.44, "text": " It takes a hidden representation as input."}, {"start": 578.44, "end": 585.24, "text": " Now the hidden representation here is going to be these slots and it's going to up sample"}, {"start": 585.24, "end": 587.52, "text": " it into an image."}, {"start": 587.52, "end": 594.2800000000001, "text": " If we train the whole, if we have a good slot assignment mechanism, we can pretty easily"}, {"start": 594.2800000000001, "end": 596.64, "text": " train a decoder like this, right?"}, {"start": 596.64, "end": 598.36, "text": " With any method you want."}, {"start": 598.36, "end": 603.76, "text": " In this case, I believe they use some sort of up sampling, up convolution architecture"}, {"start": 603.76, "end": 605.0, "text": " right here."}, {"start": 605.0, "end": 614.48, "text": " And they use the L2, they minimize the reconstruction error between the end, the output image and"}, {"start": 614.48, "end": 616.0, "text": " the input image."}, {"start": 616.0, "end": 623.48, "text": " So it's sort of like a variational autoencoder or just autoencoder objective in this case."}, {"start": 623.48, "end": 630.24, "text": " All right, so we know how to encode a picture into hidden representation using a standard"}, {"start": 630.24, "end": 632.2, "text": " convolutional neural network."}, {"start": 632.2, "end": 638.16, "text": " And we know once our slot attention mechanism works, we pretty much know how to go from"}, {"start": 638.16, "end": 639.16, "text": " there."}, {"start": 639.16, "end": 642.5600000000001, "text": " So the question is what is this slot attention mechanism?"}, {"start": 642.5600000000001, "end": 649.6, "text": " Now what we're supposed to do is we're supposed to again assign each one of the features into"}, {"start": 649.6, "end": 650.6, "text": " a slot."}, {"start": 650.6, "end": 655.1, "text": " And in a very specific fashion, so if you think about the pixels right here, there can be"}, {"start": 655.1, "end": 660.5600000000001, "text": " multiple of these pixels or multiple of the regions, multiple features can be assigned"}, {"start": 660.5600000000001, "end": 662.08, "text": " to one slot."}, {"start": 662.08, "end": 669.96, "text": " But we'd rather not have multi same feature assigned to multiple slots."}, {"start": 669.96, "end": 679.2, "text": " So each slot takes in many features, but the features should be divided between the"}, {"start": 679.2, "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": 695.72, "text": " feature for now."}, {"start": 695.72, "end": 702.2, "text": " What we'll do is we'll have an attention mechanism from the slots going 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": 713.08, "text": " all you need, where I explain this, but briefly the features, they will emit something that's"}, {"start": 713.08, "end": 716.24, "text": " called a key, which is a vector."}, {"start": 716.24, "end": 722.0400000000001, "text": " And then the slots will emit a query, which are also vectors."}, {"start": 722.0400000000001, "end": 730.64, "text": " And the information is now routed by agreement of key and query."}, {"start": 730.64, "end": 736.28, "text": " In this case, this thing, this feature right here would be routed to this slot."}, {"start": 736.28, "end": 740.9599999999999, "text": " Now it would be routed to both slots, but it wouldn't be routed as much to the bottom"}, {"start": 740.9599999999999, "end": 742.24, "text": " slot."}, {"start": 742.24, "end": 747.52, "text": " And we make sure that this happens by using a softmax assignment."}, {"start": 747.52, "end": 753.04, "text": " So if this is like nine and this is four, what we'll do is a softmax assignment such"}, {"start": 753.04, "end": 759.36, "text": " that after that, so we have a proper distribution, which would be something like after the soft"}, {"start": 759.36, "end": 763.48, "text": " max, be something like 0.9 and 0.1 right here."}, {"start": 763.48, "end": 769.2, "text": " So you can see that the attention is fairly hard."}, {"start": 769.2, "end": 773.96, "text": " So this is basically, it's a differentiable way to assign these things."}, {"start": 773.96, "end": 774.96, "text": " OK?"}, {"start": 774.96, "end": 781.2, "text": " So an attention mechanism fulfills the property that we want to basically assign features"}, {"start": 781.2, "end": 786.0, "text": " 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 outtimes"}, {"start": 793.44, "end": 798.44, "text": " slot competes the other slot because at the end, this has to be normalized to one because"}, {"start": 798.44, "end": 799.8800000000001, "text": " of the softmax."}, {"start": 799.8800000000001, "end": 806.6, "text": " So this competition is the heart of the slot attention mechanism."}, {"start": 806.6, "end": 812.44, "text": " And this is how it works."}, {"start": 812.44, "end": 817.0, "text": " So this is the slot attention module, as you can see."}, {"start": 817.0, "end": 821.36, "text": " So you'll take your inputs and they have lots of layer norms in here, but disregard the"}, {"start": 821.36, "end": 823.24, "text": " layer norms."}, {"start": 823.24, "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.88, "text": " Now you might wonder in a standard attention mechanism, you'll have input signal coming"}, {"start": 836.88, "end": 840.24, "text": " from here, which is like, maybe these are the input signals."}, {"start": 840.24, "end": 845.6, "text": " And then you construct the keys and the queries for the next layer."}, {"start": 845.6, "end": 849.64, "text": " You construct all from that input signal."}, {"start": 849.64, "end": 851.36, "text": " And also the values, by the way."}, {"start": 851.36, "end": 854.88, "text": " You construct everything from that input signal."}, {"start": 854.88, "end": 861.28, "text": " But in this case, we'll have many features and we'll only have a fixed amount of slots"}, {"start": 861.28, "end": 862.28, "text": " right here."}, {"start": 862.28, "end": 864.2, "text": " So where do these slots come from?"}, {"start": 864.2, "end": 867.72, "text": " Where do the signal for the keys come from?"}, {"start": 867.72, "end": 871.92, "text": " In the Facebook DETR paper, we saw that these are learned embeddings."}, {"start": 871.92, "end": 876.24, "text": " However, in this case right here, these are not learned."}, {"start": 876.24, "end": 878.6, "text": " The slots are initialized randomly."}, {"start": 878.6, "end": 883.5600000000001, "text": " So at the beginning of each thing, the slots are initialized randomly."}, {"start": 883.5600000000001, "end": 889.0400000000001, "text": " You can think of this as an attention mechanism where you have the attention module right"}, {"start": 889.0400000000001, "end": 890.16, "text": " here."}, {"start": 890.16, "end": 895.6, "text": " And then at the beginning, you simply have a 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.92, "end": 908.5999999999999, "text": " of these features."}, {"start": 908.5999999999999, "end": 913.4799999999999, "text": " And then you'll have cross-attention between these features and these slots."}, {"start": 913.4799999999999, "end": 918.0, "text": " And that will give you the next layer right here."}, {"start": 918.0, "end": 920.0, "text": " Okay?"}, {"start": 920.0, "end": 921.88, "text": " All right."}, {"start": 921.88, "end": 928.5999999999999, "text": " So you want to calculate the routing between the inputs and the slots."}, {"start": 928.5999999999999, "end": 933.76, "text": " And then you want to perform a softmax over the slots, which will give you this competitive"}, {"start": 933.76, "end": 934.9599999999999, "text": " nature between the slots."}, {"start": 934.96, "end": 942.52, "text": " So all the slots are going to compete to be routed for the features to be routed to them."}, {"start": 942.52, "end": 946.2800000000001, "text": " And then this is simply the second part of the attention mechanism."}, {"start": 946.2800000000001, "end": 949.6, "text": " And so you will have a weighted mean."}, {"start": 949.6, "end": 953.84, "text": " Now this is a slightly different from an attention mechanism because in a real attention mechanism,"}, {"start": 953.84, "end": 956.0400000000001, "text": " you'll have a weighted sum right here."}, {"start": 956.0400000000001, "end": 957.72, "text": " Here you'll have a weighted mean."}, {"start": 957.72, "end": 963.12, "text": " But it's basically such that you can have a different amount of slots and the kind of"}, {"start": 963.12, "end": 965.96, "text": " values will stay the same."}, {"start": 965.96, "end": 967.52, "text": " That's why you do the mean."}, {"start": 967.52, "end": 973.2, "text": " So you wait them up and the values are simply a function of the inputs."}, {"start": 973.2, "end": 976.84, "text": " This is like in a standard attention mechanism."}, {"start": 976.84, "end": 981.88, "text": " Then what you'll do, you can see that this is now called updates."}, {"start": 981.88, "end": 982.88, "text": " Okay?"}, {"start": 982.88, "end": 986.08, "text": " So you start with the slots randomly."}, {"start": 986.08, "end": 991.6800000000001, "text": " And then you use the slots to route the information."}, {"start": 991.68, "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": 1010.28, "text": " And then you'll add that to the slots."}, {"start": 1010.28, "end": 1015.3599999999999, "text": " Either this says optional residual MLP."}, {"start": 1015.3599999999999, "end": 1020.8399999999999, "text": " So what you can do is you will have a residual MLP or not."}, {"start": 1020.84, "end": 1025.16, "text": " This is a fairly complicated thing."}, {"start": 1025.16, "end": 1032.64, "text": " But if you think of it, it is just a transformer."}, {"start": 1032.64, "end": 1035.96, "text": " So what they describe here, sorry."}, {"start": 1035.96, "end": 1040.6000000000001, "text": " The purpose of this GRU here of course is that the GRU is a recurrent unit."}, {"start": 1040.6000000000001, "end": 1044.32, "text": " And you can see right here that they do this multiple times."}, {"start": 1044.32, "end": 1048.6000000000001, "text": " So once you start with the random slots, right?"}, {"start": 1048.6, "end": 1054.28, "text": " But then you update the slots and you go again."}, {"start": 1054.28, "end": 1060.48, "text": " So you do this, first of all, you'll have the features and you'll just have random slots."}, {"start": 1060.48, "end": 1063.4399999999998, "text": " And then you do a bit of routing."}, {"start": 1063.4399999999998, "end": 1065.52, "text": " So now we have a bit of routing."}, {"start": 1065.52, "end": 1066.52, "text": " Cool."}, {"start": 1066.52, "end": 1072.8799999999999, "text": " You update these slots to be the next set of slots."}, {"start": 1072.8799999999999, "end": 1078.48, "text": " And then you take the same features and route them again."}, {"start": 1078.48, "end": 1080.08, "text": " So you route them again."}, {"start": 1080.08, "end": 1083.48, "text": " And this is supposed to be kind of this iterative procedure."}, {"start": 1083.48, "end": 1085.48, "text": " You might have seen this in capsule networks."}, {"start": 1085.48, "end": 1090.04, "text": " I've done a video on capsule networks where exactly this type of iterative routing, you"}, {"start": 1090.04, "end": 1092.52, "text": " always have the same routing functions, right?"}, {"start": 1092.52, "end": 1100.68, "text": " These defunctions for value and key and query are always the same."}, {"start": 1100.68, "end": 1104.6, "text": " But you do this iteratively many times in a row."}, {"start": 1104.6, "end": 1108.56, "text": " This is like a transformer with weight sharing."}, {"start": 1108.56, "end": 1110.32, "text": " It's exactly the same, right?"}, {"start": 1110.32, "end": 1113.1599999999999, "text": " So you have these slots."}, {"start": 1113.1599999999999, "end": 1115.24, "text": " You initialize them randomly."}, {"start": 1115.24, "end": 1122.9199999999998, "text": " You do your query times keys, your softmax times the value right here."}, {"start": 1122.9199999999998, "end": 1127.56, "text": " And this transformer even has this plus this MLP layer right here, right?"}, {"start": 1127.56, "end": 1131.56, "text": " This transformer has that in there."}, {"start": 1131.56, "end": 1135.04, "text": " And then you simply do it again."}, {"start": 1135.04, "end": 1141.48, "text": " So up here you have the next transformer layer, but instead of being its own layer, you'll"}, {"start": 1141.48, "end": 1143.12, "text": " copy the..."}, {"start": 1143.12, "end": 1145.1599999999999, "text": " So it's waychaired."}, {"start": 1145.1599999999999, "end": 1150.9199999999998, "text": " It's a transformer with weight sharing between the modules and the inputs."}, {"start": 1150.9199999999998, "end": 1153.72, "text": " They are also copied up here."}, {"start": 1153.72, "end": 1156.04, "text": " This is the side inputs."}, {"start": 1156.04, "end": 1158.08, "text": " All right?"}, {"start": 1158.08, "end": 1159.08, "text": " It's..."}, {"start": 1159.08, "end": 1160.08, "text": " Otherwise it's the..."}, {"start": 1160.08, "end": 1161.08, "text": " It's the same thing."}, {"start": 1161.08, "end": 1164.56, "text": " But these aren't produced by an encoder that is also a transformer."}, {"start": 1164.56, "end": 1166.9199999999998, "text": " They're actually produced by a CNN."}, {"start": 1166.9199999999998, "end": 1169.0, "text": " And the weights here are shared."}, {"start": 1169.0, "end": 1175.76, "text": " The only difference is that in between here they also have like this GRU, this GRU thing."}, {"start": 1175.76, "end": 1179.28, "text": " But they do an ablation on it and it's actually not that important."}, {"start": 1179.28, "end": 1180.28, "text": " So you could..."}, {"start": 1180.28, "end": 1182.32, "text": " Might as well just leave it away."}, {"start": 1182.32, "end": 1186.8, "text": " It brings only very few benefits."}, {"start": 1186.8, "end": 1190.0, "text": " So this is how I think of this model."}, {"start": 1190.0, "end": 1198.64, "text": " This is a multi-layer, a T-layer transformer with weight sharing in for the individual layers"}, {"start": 1198.64, "end": 1208.04, "text": " where the inputs, the input positional encoding are randomly initialized each time."}, {"start": 1208.04, "end": 1209.04, "text": " Okay."}, {"start": 1209.04, "end": 1215.44, "text": " Now they really stress this random initialization because this differs from the DETR paper"}, {"start": 1215.44, "end": 1216.44, "text": " in that..."}, {"start": 1216.44, "end": 1219.08, "text": " In the DTR paper, these things here are learned."}, {"start": 1219.08, "end": 1223.32, "text": " In the DETR paper, we have also this kind of object detection thing."}, {"start": 1223.32, "end": 1224.32, "text": " And it..."}, {"start": 1224.32, "end": 1230.08, "text": " What will happen when you learn these is that for example this one right here might specialize"}, {"start": 1230.08, "end": 1234.52, "text": " in objects that are sort of on the top left of the image."}, {"start": 1234.52, "end": 1238.76, "text": " And this one might specialize in objects that are kind of long and in the middle and so"}, {"start": 1238.76, "end": 1239.76, "text": " on."}, {"start": 1239.76, "end": 1241.84, "text": " And this one might specialize to something else."}, {"start": 1241.84, "end": 1245.6, "text": " Now I can't tell you what works better or what not."}, {"start": 1245.6, "end": 1251.32, "text": " It seems like you can... if I were to implement something like this, I might want to go with"}, {"start": 1251.32, "end": 1255.36, "text": " the Facebook one and then just have more right here."}, {"start": 1255.36, "end": 1258.24, "text": " In this paper, they opt for having fewer."}, {"start": 1258.24, "end": 1263.9599999999998, "text": " But because they're fewer, if you learn them, they become I guess too specialized and you"}, {"start": 1263.9599999999998, "end": 1266.32, "text": " will need to keep them agnostic."}, {"start": 1266.32, "end": 1268.04, "text": " So you don't want to learn them."}, {"start": 1268.04, "end": 1271.04, "text": " You simply want to randomly initialize them each time."}, {"start": 1271.04, "end": 1279.96, "text": " And via the iterative routing, via the way-charing, they will be sort of assigned correctly."}, {"start": 1279.96, "end": 1282.32, "text": " All right."}, {"start": 1282.32, "end": 1285.52, "text": " I hope you could follow this."}, {"start": 1285.52, "end": 1287.04, "text": " Yeah."}, {"start": 1287.04, "end": 1291.92, "text": " If you want to anthropomorphize this, you could think if each of these slots starts out"}, {"start": 1291.92, "end": 1293.6, "text": " just randomly."}, {"start": 1293.6, "end": 1298.36, "text": " And then just by sheer coincidence through this attention mechanism, they happen to be"}, {"start": 1298.36, "end": 1301.36, "text": " assigned a couple of these features."}, {"start": 1301.36, "end": 1305.6, "text": " Now because we train the model to perform well, because they're already assigned these"}, {"start": 1305.6, "end": 1309.32, "text": " features in the next layer, they'll basically ask through the query function."}, {"start": 1309.32, "end": 1311.1599999999999, "text": " They'll ask for more of that."}, {"start": 1311.1599999999999, "end": 1315.3999999999999, "text": " They'll basically say, oh, I'm now responsible kind of for the gray pixels."}, {"start": 1315.3999999999999, "end": 1317.24, "text": " Give me more of the gray pixels, right?"}, {"start": 1317.24, "end": 1318.9199999999998, "text": " Give me more of that."}, {"start": 1318.9199999999998, "end": 1321.84, "text": " And then in the next layer, even more of that, even more of that."}, {"start": 1321.84, "end": 1329.32, "text": " And you'll see in the investigations into what happens exactly this type of thing happening."}, {"start": 1329.32, "end": 1335.6399999999999, "text": " So if we skip ahead to the experiments where they show what happens through the iterations,"}, {"start": 1335.6399999999999, "end": 1337.3999999999999, "text": " you can see this right here."}, {"start": 1337.3999999999999, "end": 1347.0, "text": " So the attention maps of these slots, you can see that in after the first step, you can"}, {"start": 1347.0, "end": 1352.76, "text": " see that it's slot 2 right here is assigned these both of these objects."}, {"start": 1352.76, "end": 1354.44, "text": " slot 3 is already pretty."}, {"start": 1354.44, "end": 1360.76, "text": " So the first step learns to segment a little bit of the image, but not too well."}, {"start": 1360.76, "end": 1366.08, "text": " slot 4, also the attention map here is pretty wonky."}, {"start": 1366.08, "end": 1374.84, "text": " But if you in the next step, and this is kind of crucial, basically these slots, they specialize."}, {"start": 1374.84, "end": 1378.8, "text": " So slot 2 realizes, well, I have a lot of these blue pixels."}, {"start": 1378.8, "end": 1380.8, "text": " So give me more of those, right?"}, {"start": 1380.8, "end": 1381.8, "text": " Give me more of those."}, {"start": 1381.8, "end": 1383.08, "text": " So it gets all the blue pixel."}, {"start": 1383.08, "end": 1386.6399999999999, "text": " Well, slot 4 has a lot of these golden pixels."}, {"start": 1386.6399999999999, "end": 1389.08, "text": " Give me more of those golden stuff."}, {"start": 1389.08, "end": 1391.8, "text": " That's also regionally right next to that."}, {"start": 1391.8, "end": 1396.6399999999999, "text": " And since these two compete, I'm pretty sure slot 2 would also ask for more of the golden"}, {"start": 1396.6399999999999, "end": 1399.84, "text": " pixels because it has a lot of golden pixels."}, {"start": 1399.84, "end": 1403.56, "text": " But it competes with slot 4 because of the softmax."}, {"start": 1403.56, "end": 1408.08, "text": " So all of the golden pixels are assigned to slot 4 and not slot 2."}, {"start": 1408.08, "end": 1414.56, "text": " Well, all of the blue pixels that slot 4 surely asks for as well are assigned to slot 2"}, {"start": 1414.56, "end": 1416.04, "text": " in the next iteration."}, {"start": 1416.04, "end": 1422.96, "text": " So I actually consider iteration 1 is for you take the randomly initialized slots and"}, {"start": 1422.96, "end": 1426.2, "text": " you kind of assign them stuff."}, {"start": 1426.2, "end": 1432.44, "text": " So this is mainly the, this is now mainly the transformer layer learning to segment."}, {"start": 1432.44, "end": 1439.56, "text": " But then step 2 is where the magic really happens is where the slots, they kind of realize"}, {"start": 1439.56, "end": 1442.68, "text": " what's assigned to them and they ask for more of it."}, {"start": 1442.68, "end": 1448.3600000000001, "text": " And through the competition, you'll get this separation into objects."}, {"start": 1448.3600000000001, "end": 1452.72, "text": " So the whole thing is trained end to end, which basically means that these functions get"}, {"start": 1452.72, "end": 1456.6000000000001, "text": " really good at doing this kind of segmentation."}, {"start": 1456.6000000000001, "end": 1461.8400000000001, "text": " And then in subsequent iterations, you can just see this effect multiplying even more"}, {"start": 1461.84, "end": 1464.1599999999999, "text": " and more."}, {"start": 1464.1599999999999, "end": 1469.6, "text": " But I might even, you might even be able to think that you might want to separate step"}, {"start": 1469.6, "end": 1475.48, "text": " 1 and the subsequent steps because step 1 is sort of seems fundamentally different from"}, {"start": 1475.48, "end": 1481.28, "text": " steps 2, 3, 4 and so on because step 1 is this kind of assignment process and then the"}, {"start": 1481.28, "end": 1483.48, "text": " other steps are refinement."}, {"start": 1483.48, "end": 1490.56, "text": " So if I were to take this model and make it better, I would try to have a special, like,"}, {"start": 1490.56, "end": 1497.44, "text": " not way chairing between steps, the first step and the subsequent steps."}, {"start": 1497.44, "end": 1498.44, "text": " But what do I know?"}, {"start": 1498.44, "end": 1500.6399999999999, "text": " This apparently it works."}, {"start": 1500.6399999999999, "end": 1506.9199999999998, "text": " Okay, you can also look at the reconstruction since their objective is to reconstruct."}, {"start": 1506.9199999999998, "end": 1514.32, "text": " So basically what each slot outputs, each slot out, if you reconstruct each slot here,"}, {"start": 1514.32, "end": 1515.9199999999998, "text": " these are the different slots."}, {"start": 1515.9199999999998, "end": 1520.12, "text": " Each slot is supposed to output a picture of the reconstruction."}, {"start": 1520.12, "end": 1525.7199999999998, "text": " Now if we consider that each slot is responsible for an object, you might very well say, okay,"}, {"start": 1525.7199999999998, "end": 1531.84, "text": " this slot here gives me a picture with just the object in it that it's supposed to reconstruct."}, {"start": 1531.84, "end": 1537.1999999999998, "text": " And then this slot here gives me a picture with just the object that it is supposed to reconstruct."}, {"start": 1537.1999999999998, "end": 1542.6799999999998, "text": " Now how do you know how to combine these pictures, especially since they might be overlapping"}, {"start": 1542.6799999999998, "end": 1545.08, "text": " and so on."}, {"start": 1545.08, "end": 1548.8799999999999, "text": " So the way you do it is you actually output 4 channels."}, {"start": 1548.88, "end": 1553.16, "text": " So you output r, g, b and a."}, {"start": 1553.16, "end": 1555.0, "text": " So a being the alpha channel."}, {"start": 1555.0, "end": 1560.88, "text": " So each slot also has to decide where the object is that it reconstructs."}, {"start": 1560.88, "end": 1565.7600000000002, "text": " And so each, so this here might be okay."}, {"start": 1565.7600000000002, "end": 1573.72, "text": " Everything here is alpha one, including the shadow maybe, maybe there's a little shadow."}, {"start": 1573.72, "end": 1577.5600000000002, "text": " And everything else is alpha zero."}, {"start": 1577.56, "end": 1583.1599999999999, "text": " And then the alpha maps you combine also via a softmax to ensure that they sum up to one."}, {"start": 1583.1599999999999, "end": 1587.56, "text": " So you combine the pictures, including their alpha maps."}, {"start": 1587.56, "end": 1596.9199999999998, "text": " But that means you can basically reconstruct from the slots where the objects are."}, {"start": 1596.9199999999998, "end": 1602.96, "text": " Now you'll notice, this is this thing here, you'll notice that they often use, for example,"}, {"start": 1602.96, "end": 1608.2, "text": " here four different slots, even though the image has three different objects."}, {"start": 1608.2, "end": 1609.52, "text": " Why is that?"}, {"start": 1609.52, "end": 1613.0, "text": " Because you need to reconstruct the entire image."}, {"start": 1613.0, "end": 1616.76, "text": " So you need at least one slot for the background."}, {"start": 1616.76, "end": 1619.92, "text": " And that's always what you can see right here."}, {"start": 1619.92, "end": 1625.96, "text": " So if you have the, sorry, the reconstruction, you'll see that slot two."}, {"start": 1625.96, "end": 1629.04, "text": " With time, with iterations, it reconstructs this cube."}, {"start": 1629.04, "end": 1633.68, "text": " slot three reconstructs the little ball, slot four reconstructs the yellow cylinder,"}, {"start": 1633.68, "end": 1637.08, "text": " and slot one reconstructs the background."}, {"start": 1637.08, "end": 1639.32, "text": " Okay."}, {"start": 1639.32, "end": 1648.6, "text": " Also here, if you see the attention masks, you see that the slot one will be responsible"}, {"start": 1648.6, "end": 1649.6, "text": " for the background."}, {"start": 1649.6, "end": 1653.0, "text": " Here the background is significantly darker than in these others."}, {"start": 1653.0, "end": 1657.8799999999999, "text": " Though they do say the background doesn't really tend to go to one slot in particular."}, {"start": 1657.88, "end": 1661.0800000000002, "text": " It tends to kind of spread out across all the slots."}, {"start": 1661.0800000000002, "end": 1664.96, "text": " And this might mean more investigation."}, {"start": 1664.96, "end": 1665.96, "text": " Yeah."}, {"start": 1665.96, "end": 1668.64, "text": " So they have these different tasks right here."}, {"start": 1668.64, "end": 1675.3200000000002, "text": " For example, to segment these Tetris blocks here, and you can see the segmentations."}, {"start": 1675.3200000000002, "end": 1677.4, "text": " It works pretty, pretty well."}, {"start": 1677.4, "end": 1680.8000000000002, "text": " Now why does this work so well?"}, {"start": 1680.8000000000002, "end": 1683.48, "text": " It's probably because of the datasets."}, {"start": 1683.48, "end": 1687.8000000000002, "text": " So these kinds of datasets, they come, you know, they're produced by"}, {"start": 1687.8, "end": 1693.0, "text": " a generator, and the generator specifically has these objects right here."}, {"start": 1693.0, "end": 1697.52, "text": " And it sort of arranges them in an independent fashion."}, {"start": 1697.52, "end": 1699.52, "text": " The background is really clean, right?"}, {"start": 1699.52, "end": 1703.12, "text": " The objects themselves are really clean, a geometric, and so on."}, {"start": 1703.12, "end": 1706.8, "text": " And 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, super clean dataset."}, {"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.24, "text": " just assume, okay, an object is generally, you know, spatially something, some geometric"}, {"start": 1724.24, "end": 1729.6, "text": " shape that I know, it's close together, it's pretty independent from its surrounding,"}, {"start": 1729.6, "end": 1734.08, "text": " and it's trained with objects that are almost zero correlated."}, {"start": 1734.08, "end": 1739.04, "text": " Like there's zero correlation between the objects in the training dataset."}, {"start": 1739.04, "end": 1748.28, "text": " So I wouldn't yet apply this much to real world problems, but it is an interesting thought"}, {"start": 1748.28, "end": 1749.8799999999999, "text": " right here."}, {"start": 1749.8799999999999, "end": 1753.28, "text": " So that's the sort of idea behind the paper."}, {"start": 1753.28, "end": 1754.6, "text": " I hope you got that."}, {"start": 1754.6, "end": 1762.84, "text": " They do a lot of experiments, and here is a bit where my quarrels start."}, {"start": 1762.84, "end": 1773.12, "text": " So they say that they compare, for example, with these in the unsupervised object discovery"}, {"start": 1773.12, "end": 1777.32, "text": " experiments, they have this dataset called clever."}, {"start": 1777.32, "end": 1784.76, "text": " And this dataset has these images with sort of, I believe, clever six has up to six different"}, {"start": 1784.76, "end": 1785.76, "text": " objects."}, {"start": 1785.76, "end": 1788.08, "text": " Now this is already one of the things."}, {"start": 1788.08, "end": 1792.8799999999999, "text": " This is not a specifically quarrel with this model, but if your dataset has six things,"}, {"start": 1792.8799999999999, "end": 1800.0, "text": " they give like, they give seven slots because they know that the dataset has at most six"}, {"start": 1800.0, "end": 1803.28, "text": " things, which means they can always cover all the things."}, {"start": 1803.28, "end": 1807.84, "text": " Now it works when there's less objects, but I think the knowledge of how many objects"}, {"start": 1807.84, "end": 1813.32, "text": " there's going to be is also a big part of why these models work, and why maybe it's"}, {"start": 1813.32, "end": 1818.72, "text": " 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": 1830.0, "text": " They're called iodine, which also employs kind of a recurrent architecture, but not with"}, {"start": 1830.0, "end": 1833.4399999999998, "text": " an attention mechanism and mone."}, {"start": 1833.4399999999998, "end": 1841.56, "text": " And they say, this replaces slot, no, that's not it."}, {"start": 1841.56, "end": 1847.76, "text": " For the mone, iodine, DSPN baselines, we compare with the published numbers as we use the"}, {"start": 1847.76, "end": 1850.48, "text": " same experimental setup."}, {"start": 1850.48, "end": 1854.8799999999999, "text": " So they say they use the same experimental setup, and that's why they don't re-implement"}, {"start": 1854.8799999999999, "end": 1862.28, "text": " these models, but they use the published numbers in their respective papers, which is something"}, {"start": 1862.28, "end": 1863.28, "text": " you can do."}, {"start": 1863.28, "end": 1869.0, "text": " This is often, I guess, these machine translation papers and so on, they do this just because"}, {"start": 1869.0, "end": 1872.72, "text": " it's a lot to run these things."}, {"start": 1872.72, "end": 1878.92, "text": " However, here I'm a bit skeptical, first, yes, because it is Google, so they do have a"}, {"start": 1878.92, "end": 1883.84, "text": " lot of resources available to technically run these things."}, {"start": 1883.84, "end": 1889.92, "text": " I've seen at least mone has an implementation by the author, or I've seen one of them,"}, {"start": 1889.92, "end": 1894.48, "text": " the other one also, there is an implementation, and there's eight authors on this particular"}, {"start": 1894.48, "end": 1895.48, "text": " paper."}, {"start": 1895.48, "end": 1903.4, "text": " So, yeah, this would be okay, they say as we use the same experimental setup, so even"}, {"start": 1903.4, "end": 1910.48, "text": " in that case, if you have the same setup, it's more okay, but it really depends on you"}, {"start": 1910.48, "end": 1912.76, "text": " really having the same setup."}, {"start": 1912.76, "end": 1918.44, "text": " And this is a bit where it kind of falls."}, {"start": 1918.44, "end": 1925.4, "text": " So for example, one example right here is they say we train the mone using the atom optimizer"}, {"start": 1925.4, "end": 1929.3600000000001, "text": " with a learning rate and 60 so on, they use a single GPU."}, {"start": 1929.3600000000001, "end": 1934.1200000000001, "text": " We further make use of learning rate warm up to prevent early saturation of the attention"}, {"start": 1934.1200000000001, "end": 1941.44, "text": " mechanism and an exponential decay schedule in the learning rate, which we found to reduce"}, {"start": 1941.44, "end": 1942.44, "text": " variance."}, {"start": 1942.44, "end": 1946.48, "text": " So I've checked these other models and none of them talks about learning rate warm up,"}, {"start": 1946.48, "end": 1950.0800000000002, "text": " and nowhere in their code is their learning rate warm up."}, {"start": 1950.08, "end": 1957.24, "text": " Now, you might argue, okay, this is specific to this model, it might need this, but if you"}, {"start": 1957.24, "end": 1963.8, "text": " look at the results right here, for example, you see that they don't outperform these other"}, {"start": 1963.8, "end": 1964.8, "text": " models by too much."}, {"start": 1964.8, "end": 1969.1999999999998, "text": " So you can see right here, this is on par."}, {"start": 1969.1999999999998, "end": 1974.48, "text": " This here outperforms this one a little bit, but then also the star here means that they"}, {"start": 1974.48, "end": 1981.32, "text": " have left out one of the notes that one outlier was excluded from evaluation."}, {"start": 1981.32, "end": 1989.88, "text": " I guess it is valid if it's a super outlier, but in this case, I would categorize this"}, {"start": 1989.88, "end": 1998.6, "text": " model as a different way of doing things and not necessarily outperforming the others."}, {"start": 1998.6, "end": 2005.52, "text": " So this, also if you look at the differences here are minuscule, and in these ablations"}, {"start": 2005.52, "end": 2011.3999999999999, "text": " that they show, every single thing they do, like gives them a little bit of a boost,"}, {"start": 2011.3999999999999, "end": 2016.0, "text": " and you just make it kind of across the line to reach state of the art."}, {"start": 2016.0, "end": 2020.48, "text": " I'd rather have research move in a direction where we just show cool ideas and that they"}, {"start": 2020.48, "end": 2024.9199999999998, "text": " work, and that's what this paper does to be fair."}, {"start": 2024.92, "end": 2030.72, "text": " But I do have more of a problem with a little bit is this here."}, {"start": 2030.72, "end": 2037.0, "text": " On clever six, we can use a batch size of up to 64 on a single V100 GPU as opposed to"}, {"start": 2037.0, "end": 2040.6000000000001, "text": " four in this iodine baseline, right?"}, {"start": 2040.6000000000001, "end": 2044.92, "text": " Compared to ion ion are modally significantly more efficient in terms of both memory consumption"}, {"start": 2044.92, "end": 2052.92, "text": " and runtime, which is something I believe, but this characterization that they use a batch"}, {"start": 2052.92, "end": 2060.0, "text": " size of four, and here in this paper they can use size up to 64 on a single V100 GPU."}, {"start": 2060.0, "end": 2068.08, "text": " I've read the iodine paper, and the iodine paper says yes, they do use a batch size four"}, {"start": 2068.08, "end": 2077.92, "text": " on one GPU, so they also use one GPU, but they say their GPU has a RAM of 12 gigabytes."}, {"start": 2077.92, "end": 2084.92, "text": " And 12 gigabytes RAM GPUs, that points to something like a TI, either I guess a 1080 or"}, {"start": 2084.92, "end": 2087.64, "text": " a 2080 or something like this."}, {"start": 2087.64, "end": 2088.96, "text": " This is not a V100."}, {"start": 2088.96, "end": 2095.2400000000002, "text": " The V100 come in 16, or probably Google has the 32 gigabyte version."}, {"start": 2095.2400000000002, "end": 2105.36, "text": " So this is a 32 gigabyte GPU that is significantly better than the TI GPUs."}, {"start": 2105.36, "end": 2112.48, "text": " These V100 they cost like five or ten times more than the TI GPUs, and to simply say we"}, {"start": 2112.48, "end": 2117.0, "text": " have also one GPU and we can run up to a batch size of 64 and they can only run a batch"}, {"start": 2117.0, "end": 2118.92, "text": " size of four."}, {"start": 2118.92, "end": 2123.96, "text": " It seems sort of overstating what you can do."}, {"start": 2123.96, "end": 2128.56, "text": " Now maybe I'm wrong, maybe they have actually tested this other model and concluded also"}, {"start": 2128.56, "end": 2135.04, "text": " on their GPUs, it can only run to a batch size of a batch size of four, but I highly doubt"}, {"start": 2135.04, "end": 2144.72, "text": " it, because in their paper, they explicitly name that they use a batch size of four for"}, {"start": 2144.72, "end": 2147.7599999999998, "text": " their 12 gigabyte GPUs."}, {"start": 2147.7599999999998, "end": 2154.08, "text": " So yeah, that just kind of pulls through."}, {"start": 2154.08, "end": 2159.36, "text": " So there is the minuscule improvements and then there is the ablations of all these"}, {"start": 2159.36, "end": 2162.4, "text": " tricks where everyone just gives you a little bit."}, {"start": 2162.4, "end": 2169.8, "text": " And then there is this kind of very, very, very favorable comparison words, Smithy, a bit,"}, {"start": 2169.8, "end": 2177.84, "text": " which gives a bit of a, a bit of a taste to what I think is actually a very, very cool"}, {"start": 2177.84, "end": 2181.32, "text": " method, because why is this method so cool?"}, {"start": 2181.32, "end": 2188.12, "text": " Because for example, these slots here, they are trained to also absorb the background,"}, {"start": 2188.12, "end": 2189.12, "text": " right?"}, {"start": 2189.12, "end": 2195.24, "text": " So you can technically at inference time increase the number of slots, even though you've trained"}, {"start": 2195.24, "end": 2197.72, "text": " with just, with a few slots, right?"}, {"start": 2197.72, "end": 2202.7599999999998, "text": " You can, you can increase the number of slots and the model can just handle it and they"}, {"start": 2202.7599999999998, "end": 2209.08, "text": " show it right here in these results."}, {"start": 2209.08, "end": 2215.96, "text": " Here, you can, this dataset has six objects and this dataset has 10 objects."}, {"start": 2215.96, "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.68, "text": " of slots at inference time and it will work also very well."}, {"start": 2224.68, "end": 2227.2400000000002, "text": " Also they can now up the number of iterations."}, {"start": 2227.2400000000002, "end": 2229.68, "text": " Since these are all weight-shared, these iterations, right?"}, {"start": 2229.68, "end": 2231.0, "text": " We've looked at it."}, {"start": 2231.0, "end": 2234.84, "text": " There's weight sharing between the iterations."}, {"start": 2234.84, "end": 2239.84, "text": " There is nothing stopping you from just piling on here because it's weight-shared."}, {"start": 2239.84, "end": 2242.0, "text": " You don't need any more weights."}, {"start": 2242.0, "end": 2247.08, "text": " You can just refine this iteration and since the iteration themselves are refining these"}, {"start": 2247.08, "end": 2252.96, "text": " attention masks anyway, you might as well at inference time refine them some more."}, {"start": 2252.96, "end": 2258.08, "text": " They have an ablation where they show that technically like two or three iterations at"}, {"start": 2258.08, "end": 2260.24, "text": " training time gives them the best result."}, {"start": 2260.24, "end": 2265.12, "text": " I guess just because of gradient propagation, because more layers means you have to propagate"}, {"start": 2265.12, "end": 2267.36, "text": " the gradient back more."}, {"start": 2267.36, "end": 2271.12, "text": " But at inference time, you can just up these iterations and as you can see right here,"}, {"start": 2271.12, "end": 2273.2799999999997, "text": " you get better and better."}, {"start": 2273.2799999999997, "end": 2276.3199999999997, "text": " These results are pretty cool."}, {"start": 2276.3199999999997, "end": 2282.88, "text": " They respect the property that sets should be permutation invariant and so on."}, {"start": 2282.88, "end": 2288.64, "text": " This routing view of the transformer is pretty cool even though you can look at it as a"}, {"start": 2288.64, "end": 2294.44, "text": " transformer with weight-sharing or an iterative routing protocol like in capsules."}, {"start": 2294.44, "end": 2299.3199999999997, "text": " All of this I find to be a very, very cool idea."}, {"start": 2299.32, "end": 2303.28, "text": " I think that's how we should look at this paper."}, {"start": 2303.28, "end": 2311.2400000000002, "text": " So before I am too critical of this paper, I want to say that I really like the idea and"}, {"start": 2311.2400000000002, "end": 2315.1200000000003, "text": " the algorithm here, the implementation."}, {"start": 2315.1200000000003, "end": 2317.1600000000003, "text": " Yeah."}, {"start": 2317.1600000000003, "end": 2318.1600000000003, "text": " That was the paper."}, {"start": 2318.1600000000003, "end": 2321.6000000000004, "text": " At last, I actually want to look at the broader impact statement."}, {"start": 2321.6000000000004, "end": 2326.36, "text": " Just because I've complained about the need for broader impact statement."}, {"start": 2326.36, "end": 2333.88, "text": " So I just want to kind of go, just read them and just like look how the different companies,"}, {"start": 2333.88, "end": 2338.84, "text": " how the different institutions, how the different people, how the community reacts to them, crafts"}, {"start": 2338.84, "end": 2340.1200000000003, "text": " them and so on."}, {"start": 2340.1200000000003, "end": 2342.84, "text": " So this one I find particularly interesting."}, {"start": 2342.84, "end": 2343.84, "text": " Let's go through it."}, {"start": 2343.84, "end": 2347.96, "text": " It says, the slot detention module allows to learn object-centric representation from"}, {"start": 2347.96, "end": 2350.1600000000003, "text": " perceptual input."}, {"start": 2350.1600000000003, "end": 2355.76, "text": " As such, it is a general module that can be used in a wide range of domains and applications."}, {"start": 2355.76, "end": 2359.88, "text": " In our paper, we only consider artificially generated data set under well-controlled"}, {"start": 2359.88, "end": 2363.6400000000003, "text": " settings, where slots are expected to specialize to objects."}, {"start": 2363.6400000000003, "end": 2367.6800000000003, "text": " However, the specializations of our model is implicit and fully driven by the downstream"}, {"start": 2367.6800000000003, "end": 2368.6800000000003, "text": " task."}, {"start": 2368.6800000000003, "end": 2374.0400000000004, "text": " We remark that as a concrete measure to assess whether the module is specialized in unwanted"}, {"start": 2374.0400000000004, "end": 2375.0400000000004, "text": " ways."}, {"start": 2375.0400000000004, "end": 2379.6000000000004, "text": " One can visualize the attention masks to understand how the input features are distributed across"}, {"start": 2379.6000000000004, "end": 2380.92, "text": " the slots."}, {"start": 2380.92, "end": 2386.64, "text": " While more work is required to properly address the usefulness of the attention coefficients"}, {"start": 2386.64, "end": 2391.16, "text": " in explaining the overall predictions of the network, especially if the input features"}, {"start": 2391.16, "end": 2396.2400000000002, "text": " are not human-interpretable, we argue that they may serve as a step towards more transparent"}, {"start": 2396.2400000000002, "end": 2399.0, "text": " and interpretable predictions."}, {"start": 2399.0, "end": 2403.84, "text": " This is a, I mean, it's a fine statement, but it's not a broader impact statement, right?"}, {"start": 2403.84, "end": 2408.96, "text": " If you follow the bit what the broader impact statement is supposed to be, this is not one."}, {"start": 2408.96, "end": 2413.84, "text": " The closest this comes to a broader impact statement is said as such, it is a general"}, {"start": 2413.84, "end": 2417.8, "text": " model that can be used in a wide range of domains and applications."}, {"start": 2417.8, "end": 2422.88, "text": " Maybe a little bit that you can visualize the attention masks to understand how the"}, {"start": 2422.88, "end": 2425.16, "text": " input features are distributed."}, {"start": 2425.16, "end": 2430.64, "text": " But the broader impact statement is supposed to give you a preview of how this might affect"}, {"start": 2430.64, "end": 2432.6, "text": " society at large."}, {"start": 2432.6, "end": 2438.12, "text": " While this here just kind of lists properties of the model for the research community and"}, {"start": 2438.12, "end": 2445.12, "text": " sort of for this, for the application of this model as, as you know, the introspection"}, {"start": 2445.12, "end": 2449.48, "text": " of the model itself, this says nothing about society as such."}, {"start": 2449.48, "end": 2456.8399999999997, "text": " So maybe, you know, maybe that's, I think the smarter people will turn the broader impact"}, {"start": 2456.8399999999997, "end": 2460.6, "text": " statement into more of an introduction section."}, {"start": 2460.6, "end": 2465.12, "text": " Because that's something you usually put in a conclusion or in an introduction where"}, {"start": 2465.12, "end": 2468.12, "text": " you say, look, here are some things our model can do."}, {"start": 2468.12, "end": 2469.88, "text": " And this is what we might be useful for."}, {"start": 2469.88, "end": 2474.08, "text": " And this is how you could introspect it and so on."}, {"start": 2474.08, "end": 2479.72, "text": " And since the broader impact statement, especially at NURRIPS, you were allowed to put the broader"}, {"start": 2479.72, "end": 2482.2, "text": " impact statement on the main paper."}, {"start": 2482.2, "end": 2486.52, "text": " So not in the appendix, but it wouldn't count towards your page limit."}, {"start": 2486.52, "end": 2492.2, "text": " It's, I guess, pretty foreseeable that what people are going to start to do is simply put"}, {"start": 2492.2, "end": 2499.8799999999997, "text": " more of their paper into the broader impact section kind of cloaked in the veneer of a broader"}, {"start": 2499.8799999999997, "end": 2501.2, "text": " impact statement."}, {"start": 2501.2, "end": 2509.96, "text": " But this is clearly not what the broader impact statement was originally supposed to be."}, {"start": 2509.96, "end": 2512.24, "text": " Now, I don't know if this is good or bad."}, {"start": 2512.24, "end": 2518.48, "text": " I just think these authors are, you know, they're doing, I think, a good thing here by simply"}, {"start": 2518.48, "end": 2524.72, "text": " telling us actually something useful about the model, but that's just my opinion."}, {"start": 2524.72, "end": 2528.12, "text": " I do thank you for being with me here."}, {"start": 2528.12, "end": 2532.44, "text": " I know this was a bit ranty flip-flopping back and forth between the different things."}, {"start": 2532.44, "end": 2535.64, "text": " We haven't looked at set prediction at all."}, {"start": 2535.64, "end": 2541.28, "text": " We've only looked at these kind of masks, but I invite you to go through the paper yourself"}, {"start": 2541.28, "end": 2542.56, "text": " and check it out."}, {"start": 2542.56, "end": 2544.12, "text": " It's pretty cool."}, {"start": 2544.12, "end": 2548.12, "text": " And they do describe a lot of things in pretty detail."}, {"start": 2548.12, "end": 2551.8399999999997, "text": " The appendix is very long and has very many abolations."}, {"start": 2551.8399999999997, "end": 2554.88, "text": " This is something I do appreciate."}, {"start": 2554.88, "end": 2583.4, "text": " And with that, bye-bye and see you next time."}] |
Yannic Kilcher | 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 Schwungfeich Chai, Walter Tablet, Miguel Angel Bautista, Carlos Gastron, 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 help 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 again, 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'll 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, 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 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 looks like a class conditional again, 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 they will produce a the same truck and hear that and hear the bench and so on. The problem I guess becomes more apparent where you go to this different data set. So this is a 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 not Ali. So um, 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 um, 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 of this must be some sort of glamour model and um, 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 a double like two people with one being sort of half in frame and it leads to fairly uh, fairly strange thing. I'm going to guess the model hasn't seen lots of that during trade. I like I particularly like this. This is pretty good. Also here, uh, we know that a lot of these uh, 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, richer brands and type picture. In any case, it does, it does a fairly good job, right? As you can see right here. Um, 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. Uh, 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, right? We simply want it 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 ones, unseen ones during testing. So how do we go about something like this? And here, here's where the things start. So we're going to dive into a bit of of the math here and then into a bit of the reasoning. Um, but ultimately, what they're 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 proper DB 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 an embedding for each image. And then they have this operation called pool and binarize. And so these, this does two things, namely, first of all, it pools. It simply averages these things. So it goes one over n, c i of x i or c of x i, 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 ordering, 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 binarize. 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, Ganesh, 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. 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 wouldn't really encode the identity of the set. You would encode more of a, you would encode more 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 four. This can be, you know, whatever. Just let's say it's 10 again, 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, 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 two to the 10 classes, right? And that's, so it's not like, it's not, 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 binaries 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 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 generator's 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, 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, um, one different view right here. Okay? So the generator's task is simply take the set identity and combine each with some noise and produce some views of that set. Now the discriminator's task right here is going to be to decide it's going to get a set of views of, or 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 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. The 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 as 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 if there's an MLP, there's 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 de 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 cannot. 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, images, 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. 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, we'll 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 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 or 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 a 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 a regular auto encoder 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 Z 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 are 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 of a caveat here also is that this here they mentioned 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 you're latent you're 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 GAN as I said you have your noise distribution and so on what is a prior on that thing. Now you can say 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 auto regressively so it will output one of them and then conditioned 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 1 1 1 1 minus 1 and so on is going to be decomposed into the probability that there's a minus 1 here times the probability that there is a 1 here given that there is a minus 1 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 concentration 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 here 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 Jan LeCan 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 um 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 um no maybe I have it wrong maybe you output really high number when you're really happy I'm not sure but it's one of the two so um 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 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 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 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 mapped 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 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 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 they 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 the P 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 if it comes from the generator of course you want to do the exact opposite you want to sign it high value remember energy low means happy with the input okay um and then the normalization down here is as I said the problem uh so you'll see it as stated right here uh because it's under the the the division it's going to get a pick up a negative sign which combines with this negative sign which gives you 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 uh 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 um 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 uh this is called a variational approximation uh so we bound this quantity and we can only bound this quantity if we down here introduce the 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 uh VAE explain variational autoencoders explained or anything like this will teach you how how these methods work 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 uh set or for each noise it's going to produce an output image very cool so that's that's the 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 learn the prior on the z space so you see you have z being this binary vectors um they say we use a standard auto regressive model made with three fully connected layers mainly for 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 gain by basically making a gain 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 V A E's than it is in GANS but it exists so encoder um say as a necessary option encoder for a set needs to satisfy the permutation varying and 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 um things discriminators job is to assign low energy to observed images and high energy to generate the images given a set code z we use an auto encoder based energy function implementations similar to 25 and here they say we have found that this choice is important as it enables effective learning in early stages of training um 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 it's kind of uh you can maybe think of it as a another little again uh another another another little generator or the the generator part of a VIE or of an auto encoder sorry not a VIE an auto encoder that 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 see 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 uh view some thing that corresponds to this particular identity vector okay uh 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 wapada the losses they they they now introduce some margin losses on the things here um 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 um to train the prior you what you or to train to train the encoder I think uh you have to make a bit of an approximation in that the encoder is supposed to match this the z vector right and that's not differentiable by itself so they have this sort of l1 approximation right here they leave away the entropy from the loss and they have found that to work well they introduce this margin losses right here I I don't want to go into that too much uh but basically they simply in a way with some approximations they approximate oh yeah here it is the indicator function they approximate it as 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 and the prior and then they keep that rest um fixed and they encode the generator so what does that do before we remember right here we had this this approximation right here where we said you know what comes out of this we we're not really optimizing is 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 now 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 um we'll 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 um 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 gapier 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 um here on top you have a set and you feed that through the encoder you 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 produce like a hundred images and then selected wherever the car looked like the closest to so they ordered them by hand and that is to show that for example look at the the lighting on the car right here um it's it's fairly similar I guess this one has red tail lights 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 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 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 um we've already looked at that but again to evaluate this they 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 um you can evaluate are these right here all the same people so you can have a a face detector kind of uh 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 the kind 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 um if you if you want more true positives right so this is a a standard curve right here because these face detectors are not perfect so in a given row right here um 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 um 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 um 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 um 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 uh so this might be an indication that this prior isn't really um 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 uh the reason you know the reason why you do one-hot encoding in class conditional ganzes you could you could simply say what 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 i have class three and then i have class uh 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 um so the 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 uh 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 a blonde hair and the second thing might be does the image look generally bright or the images the 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 in ill it'll sort of just end up being kind of a discrete uh can or a discrete autoencoder um rather than what they believe but maybe that was their goal all along and um uh mis 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 uh whether or not a particular thing is on or off okay but enough uh ranting right here um 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 um 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 um you know if i learn the prior really really well that basically means i'm only going to ever produce sets that were in the training data right uh 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 uh prior so it's just going to give you kind of crap and um here in the in the faces you you see the same thing now again what i think i don't think that's happening what i think is happening is is encoding these kind of microcharacteristics not per se identity but it's encoding probably you know a hair color what not a head shape and so on uh 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 uh 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 uh prior now you also see here first of all that approximately identity is preserved but not as much uh in this uniform prior that's first and second uh you'll 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 uh 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 um that this uh increases with number of views so the the accuracy of this identity increases the more views uh you input of the set and they have a bunch of other uh things right here in the appendix i i do invite you to uh 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 uh challenging the math because i'm mainly not used to this kind of variational math uh but i hope this gives you sort of an impression all right uh this was it from me um tell me what you think and i'll see you next time bye bye | [{"start": 0.0, "end": 6.48, "text": " Hi there. Today we're looking at set distribution networks, a generative model for sets of images by"}, {"start": 6.48, "end": 13.76, "text": " Schwungfeich Chai, Walter Tablet, Miguel Angel Bautista, Carlos Gastron, and Josh M. Suskind of Apple."}, {"start": 13.76, "end": 21.84, "text": " So this paper introduces a generative model for sets, and it does so in an energy-based model"}, {"start": 21.84, "end": 29.44, "text": " fashion. It will have an encoder, a decoder, in form of a generator, it will have a discriminator,"}, {"start": 29.44, "end": 36.16, "text": " and it will help all kinds of math. But the end result is a model that can generate"}, {"start": 36.16, "end": 45.44, "text": " sets of images. And by sets we mean it can generate different kind of views on the same identity"}, {"start": 45.44, "end": 51.6, "text": " of image, and you'll see what that means. And it can generate even sets that it has never seen"}, {"start": 51.6, "end": 56.160000000000004, "text": " before, which makes it different from a class conditional again, or something like this."}, {"start": 57.52, "end": 64.32000000000001, "text": " So if I can't really describe it on a high level in a very concise fashion, you'll just have to"}, {"start": 64.32000000000001, "end": 71.12, "text": " stick around and see what's going on right here. So if you like content like this, feel also"}, {"start": 71.12, "end": 75.92, "text": " free to share it out, and leave it a like. Tell me in the comments what you like. This is going to be"}, {"start": 75.92, "end": 82.56, "text": " a fairly math heavy paper, and I'll try my best to kind of distill it down to what's happening."}, {"start": 83.28, "end": 88.96000000000001, "text": " Because ultimately it's not that difficult. All right, so if you have a look at these samples"}, {"start": 88.96000000000001, "end": 94.88, "text": " right here, these are examples of sets of images. Now without actually caring for top and bottom"}, {"start": 94.88, "end": 100.88, "text": " row, they will have some meaning right here. Top row is always a row from the actual data set,"}, {"start": 100.88, "end": 108.56, "text": " and the bottom row is the reconstruction of that set. Now you'll see that the images don't"}, {"start": 108.56, "end": 113.52, "text": " really have a correspondence. So you'll see it's the same truck in the top and the bottom row,"}, {"start": 113.52, "end": 118.64, "text": " but the orientation here isn't really shared or anything. And that's because as we said,"}, {"start": 118.64, "end": 124.64, "text": " this is a set network. So what you want to do in this problem setting is you want to take,"}, {"start": 124.64, "end": 128.72, "text": " you want to build a model that can take this set right here from the data set."}, {"start": 128.72, "end": 139.36, "text": " And it can encode it into a latent description that we call Z. Z simply describes the set as a whole."}, {"start": 139.36, "end": 148.8, "text": " So Z here would be, sorry, would be truck. Right, it would sort of be the 3D model,"}, {"start": 148.8, "end": 156.8, "text": " so not the class truck, but the 3D information of the truck without having any information of"}, {"start": 156.8, "end": 162.72, "text": " the different views. And then you want to build another model that can generate from this"}, {"start": 163.52, "end": 169.84, "text": " low level representation of the set can generate the different views, like each one of these"}, {"start": 170.88000000000002, "end": 177.20000000000002, "text": " by sort of rotating it. So we want to build a model that understands just from the pixels"}, {"start": 177.20000000000002, "end": 184.24, "text": " that here we have sets of things that they somehow always share a commonality. And in this case,"}, {"start": 184.24, "end": 190.48000000000002, "text": " they always share their 3D structure, right? What they don't share is the view where they rendered"}, {"start": 190.48000000000002, "end": 197.20000000000002, "text": " from. So our model supposed to kind of parse the two apart and encode that 3D structure just"}, {"start": 197.20000000000002, "end": 204.0, "text": " from the pixels in this Z variable. And then encode the fact that you can rotate it and look at it"}, {"start": 204.0, "end": 209.84, "text": " from different views into the generative model that then produces the different views."}, {"start": 209.84, "end": 218.08, "text": " Okay, and the reason why there is no correspondence between the views is we simply regard these things"}, {"start": 218.08, "end": 226.56, "text": " as sets. So our final objective is simply going to be that the set on top is different views of"}, {"start": 226.56, "end": 233.04, "text": " that particular truck is going to be very similar to the set on the bottom, which is also different"}, {"start": 233.04, "end": 240.56, "text": " views of that particular truck. And that's what our model is supposed to do. Now you might know"}, {"start": 240.56, "end": 246.32, "text": " something like this from we can simply say, well, this looks like a class conditional again, right?"}, {"start": 246.32, "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": 260.24, "text": " and my encoder and so on and they will produce a the same truck and hear that and hear the bench"}, {"start": 260.24, "end": 265.92, "text": " and so on. The problem I guess becomes more apparent where you go to this different data set. So"}, {"start": 265.92, "end": 274.56, "text": " this is a a face data set. And again, top row being the input and bottom row being the output."}, {"start": 274.56, "end": 280.96000000000004, "text": " Now what is here, what is supposed to be preserved, you can kind of see in the images is sort of"}, {"start": 280.96000000000004, "end": 286.48, "text": " the identity of the person on the photo. Now you have to kind of glass and gloss around your"}, {"start": 286.48, "end": 294.64000000000004, "text": " human bias here. You as a human can tell extremely tiny differences between faces and therefore"}, {"start": 294.64000000000004, "end": 300.64000000000004, "text": " none of the actual identities are going to be preserved, right? So this on the top I believe is"}, {"start": 300.64000000000004, "end": 310.32, "text": " Ali and on on the bottom here it's not not Ali. So um, but you'll have to sort of gloss around this"}, {"start": 310.32, "end": 316.32, "text": " and you'll see that what is preserved or what is supposed to be preserved is something like the"}, {"start": 316.32, "end": 323.28, "text": " rough identity of the person on the picture and also a little bit of the image compositions. So"}, {"start": 323.28, "end": 330.8, "text": " you see here in the background you often have um, sort of these sports backgrounds right where"}, {"start": 330.8, "end": 336.56, "text": " there's kind of a washed out stadium or whatnot and you can see that this is also preserved. Here"}, {"start": 336.56, "end": 341.52, "text": " I think it's kind of a glamour glamour shots of of this must be some sort of glamour model"}, {"start": 341.52, "end": 350.0, "text": " and um, you'll see that this as well is preserved. What is different within each set is of course"}, {"start": 350.0, "end": 356.0, "text": " the different views on the same identity, right? So you have the same person and you have pictures"}, {"start": 356.0, "end": 361.35999999999996, "text": " of them in different of different views, different lighting, different hairstyles and so on. Here"}, {"start": 361.35999999999996, "end": 366.79999999999995, "text": " you even see you have the black and white image and the set that is produced also contains some"}, {"start": 366.8, "end": 374.16, "text": " black and white images. So this model, this is already the trained model here, is doing a fairly"}, {"start": 374.16, "end": 380.32, "text": " good job here. You can see that almost all the pictures have some sort of a double like two people"}, {"start": 380.32, "end": 387.36, "text": " with one being sort of half in frame and it leads to fairly uh, fairly strange thing. I'm going to"}, {"start": 387.36, "end": 394.8, "text": " guess the model hasn't seen lots of that during trade. I like I particularly like this. This is"}, {"start": 394.8, "end": 401.2, "text": " pretty good. Also here, uh, we know that a lot of these uh, face data sets, they don't really have"}, {"start": 402.0, "end": 408.16, "text": " bald people all too often. So you can see here this results in sort of kind of a weird, richer"}, {"start": 408.16, "end": 416.96000000000004, "text": " brands and type picture. In any case, it does, it does a fairly good job, right? As you can see"}, {"start": 416.96, "end": 425.44, "text": " right here. Um, and what's the problem with with these faces? Can't we just do a class conditional"}, {"start": 425.44, "end": 432.4, "text": " again where we basically say here, this is Ali, right? And that's one class in our latent vector"}, {"start": 432.4, "end": 438.56, "text": " and then and so on. Uh, what we want to do is we want to train something like this that where we"}, {"start": 438.56, "end": 444.32, "text": " can give in a new identity that we haven't seen during training. In fact, we want to train something"}, {"start": 444.32, "end": 449.36, "text": " where we don't even know how many sets there are going to be in the end, right? We simply want it"}, {"start": 449.36, "end": 455.68, "text": " 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,"}, {"start": 455.68, "end": 463.36, "text": " you know, images of the same person and you're going to sort of reconstruct that in a way where you"}, {"start": 463.36, "end": 470.15999999999997, "text": " output a set of images of that person concerning, conserving the identity of the person and the rough"}, {"start": 470.16, "end": 476.56, "text": " style of the picture. So this is really different from a class conditional again, as in we don't"}, {"start": 476.56, "end": 482.32000000000005, "text": " know how many classes there are and there can be new ones, unseen ones during testing."}, {"start": 483.76000000000005, "end": 491.76000000000005, "text": " So how do we go about something like this? And here, here's where the things start. So we're going"}, {"start": 491.76000000000005, "end": 497.52000000000004, "text": " to dive into a bit of of the math here and then into a bit of the reasoning. Um, but ultimately,"}, {"start": 497.52, "end": 506.64, "text": " what they're going to do is they're going to build and they're going to build three things. They're"}, {"start": 506.64, "end": 514.96, "text": " going to build an encoder, a discriminator and a generator. So what does the encoder do?"}, {"start": 516.3199999999999, "end": 521.68, "text": " And remember, our task here is going to be the way we train it is going to be by"}, {"start": 521.68, "end": 529.76, "text": " reconstruction, at least one way we train it. So the encoder is going to take this set of images"}, {"start": 529.76, "end": 536.3199999999999, "text": " that we give it. For example, here, different views of this car and is going to produce this"}, {"start": 536.3199999999999, "end": 543.52, "text": " representation, this set representation. Now, what should this, what should a proper DB of the"}, {"start": 543.52, "end": 549.76, "text": " set representation? For example, it should be independent of the ordering of these inputs,"}, {"start": 549.76, "end": 555.28, "text": " right? A set is simply a collection of objects. It's independent of the ordering and it's also"}, {"start": 555.28, "end": 561.4399999999999, "text": " independent of the size in some way. Of course, a bigger set gives you more information, but the set"}, {"start": 561.4399999999999, "end": 567.52, "text": " identity, the fact that this is this particular car is independent of how many views you have."}, {"start": 568.08, "end": 576.3199999999999, "text": " So what they do is they build and they put each image through an encoder, which is a convolutional"}, {"start": 576.32, "end": 584.96, "text": " neural network. And I guess that gives them a hidden representation and encoding an embedding"}, {"start": 584.96, "end": 590.48, "text": " for each image. And then they have this operation called pool and binarize. And so these,"}, {"start": 590.48, "end": 596.4000000000001, "text": " this does two things, namely, first of all, it pools. It simply averages these things. So"}, {"start": 596.4, "end": 613.1999999999999, "text": " it goes one over n, c i of x i or c of x i, I guess. So this simply averages the, these encodings"}, {"start": 613.1999999999999, "end": 620.64, "text": " right here. And this already fulfills our property. So this average is independent of the order"}, {"start": 620.64, "end": 627.4399999999999, "text": " of the images. And also I can add more and I can add less in expectation. The average will result"}, {"start": 627.4399999999999, "end": 635.28, "text": " in the same thing, right? So this here. Now we have basically lost the information of the ordering,"}, {"start": 635.28, "end": 641.36, "text": " the exact ordering and so on. This is simply an average of these images. It's a good representation"}, {"start": 641.36, "end": 648.56, "text": " for a set. This is now if we give enough images, this will be independent of the particular rendering"}, {"start": 648.56, "end": 655.1999999999999, "text": " position. And it will only depend on the fact that this is that particular car. If it's trained,"}, {"start": 655.1999999999999, "end": 663.1999999999999, "text": " well, of course. And then the second thing is binarize. And here you have to understand how these,"}, {"start": 663.8399999999999, "end": 672.64, "text": " what exactly this set latent representation is, how do we encode a set in latent space? And"}, {"start": 672.64, "end": 679.04, "text": " as far as I understand it, as far as I understand it, what they do is they do the following."}, {"start": 680.24, "end": 687.12, "text": " So since they don't know how many sets there are, they can't simply do the classic one-hot vector."}, {"start": 687.12, "end": 691.4399999999999, "text": " So what you would do in a class conditional, Ganesh, you would say, I have a vector. And maybe I"}, {"start": 691.4399999999999, "end": 698.48, "text": " have 10 classes. So I'll make 10 entries right here. Is that 10? I don't know. I'll make, so if I"}, {"start": 698.48, "end": 708.08, "text": " have C classes, I'll make C entries. And I'll put a zero in all of them. And a one in where"}, {"start": 709.6800000000001, "end": 715.36, "text": " a one where my classes or something like this. So this would be a valid encoding for a class"}, {"start": 715.36, "end": 725.44, "text": " conditional again to represent the identity of the class. Here, however, no, we don't know. And also,"}, {"start": 725.44, "end": 729.84, "text": " we can't really make this continuous because other, if you make this continuous,"}, {"start": 731.84, "end": 736.5600000000001, "text": " you wouldn't really encode the identity of the set. You would encode more of a,"}, {"start": 738.32, "end": 744.8000000000001, "text": " you would encode more of a continuous latent space. And then that becomes kind of different when"}, {"start": 744.8000000000001, "end": 751.36, "text": " you have new sets and so on. So what they really want to do is they want to make this representation"}, {"start": 751.36, "end": 758.96, "text": " here be a description of the set itself, but not a one hot. So what do we do? What they do is they"}, {"start": 758.96, "end": 765.84, "text": " do the same thing. They have a vector, but not of size C, because they don't know C, but of"}, {"start": 765.84, "end": 773.28, "text": " some dimensionality D. Okay, this can be 10. This can be four. This can be, you know, whatever."}, {"start": 773.28, "end": 778.8000000000001, "text": " Just let's say it's 10 again, but we don't know how many classes there are."}, {"start": 778.8, "end": 787.52, "text": " What the model can do is it can encode each class as a binary vector, a binary combination of"}, {"start": 787.52, "end": 793.52, "text": " negative ones and ones. So it can put like a negative one here, a one, negative one, negative one,"}, {"start": 793.52, "end": 802.56, "text": " negative one, one, one, negative one, and so on. So what, what does that give you? Now you,"}, {"start": 802.56, "end": 808.7199999999999, "text": " you can encode much more than 10 classes. In fact, you can, with this, you can encode two to the 10"}, {"start": 808.7199999999999, "end": 818.7199999999999, "text": " classes, right? And that's, so it's not like, it's not, it's not that they can encode an unlimited"}, {"start": 818.7199999999999, "end": 825.8399999999999, "text": " set of sets, I have set identities, but they can encode in this manner. They can encode a lot,"}, {"start": 825.8399999999999, "end": 832.3199999999999, "text": " right? They can encode this many sets using a representation like this. So this binaries"}, {"start": 832.32, "end": 839.2800000000001, "text": " operation, it will take this output right here and basically clamp it to either one or negative one."}, {"start": 839.84, "end": 845.6, "text": " So the set will be encoded by a binary vector like this. And then the generator and the"}, {"start": 845.6, "end": 853.6, "text": " discriminator take that information. Okay? And we'll go, we'll go over what, what this architectural"}, {"start": 853.6, "end": 861.9200000000001, "text": " choice means. But right now this, you know, see that this is a, this is a way to encode a large"}, {"start": 861.9200000000001, "end": 872.16, "text": " number of set identities in a low dimensional vector. All right. So there are two things now."}, {"start": 872.16, "end": 879.52, "text": " There are the discriminator and the generator. So first of all, the generator is pretty easy."}, {"start": 879.52, "end": 889.6, "text": " The generator's task is to take this Z that we just saw, which is the set identity and to"}, {"start": 890.56, "end": 898.0799999999999, "text": " generate different instances of that set, right? And for that, it needs this noise here. So if you"}, {"start": 898.0799999999999, "end": 904.0, "text": " know a generator from a from a, from a GAN, this, it always kind of needs input noise in order to"}, {"start": 904.0, "end": 908.4, "text": " produce different outputs. And that's this thing on the right here. This Z prime, they simply come"}, {"start": 908.4, "end": 916.64, "text": " from some sort of latent distribution. I think they call this P of psi, which is some, like a uniform"}, {"start": 916.64, "end": 921.52, "text": " or a Gaussian or something. You just sample some noise, right? And you combine it with this thing"}, {"start": 921.52, "end": 927.36, "text": " right here, which is the set identity. You concatenate it. And then each one of these different Z"}, {"start": 927.36, "end": 937.36, "text": " will produce one different, um, one different view right here. Okay? So the generator's task is"}, {"start": 937.36, "end": 947.6, "text": " simply take the set identity and combine each with some noise and produce some views of that set."}, {"start": 948.48, "end": 957.84, "text": " Now the discriminator's task right here is going to be to decide it's going to get a set of views"}, {"start": 957.84, "end": 965.76, "text": " of, or a set of pictures. And it's going to have to decide is this set coming from the generator"}, {"start": 965.76, "end": 973.2, "text": " or is this set coming from the data set? Right? Now you can simply compare images to each other,"}, {"start": 973.2, "end": 978.16, "text": " like you would do in a regular GAN, because they don't correspond to each other, right? But what"}, {"start": 978.16, "end": 985.92, "text": " should correspond to each other is this identity, this Z identity. So the discriminator is going to"}, {"start": 985.92, "end": 994.24, "text": " take also two inputs. It's going to take this set right here or, you know, from the data set."}, {"start": 994.24, "end": 1004.72, "text": " And it's going to take this right here, this Z. Now this Z is going to be the set identity. And"}, {"start": 1004.72, "end": 1010.48, "text": " that you get from the encoder, right? It's the same as you get right here. You get it from the"}, {"start": 1010.48, "end": 1018.24, "text": " encoder, which set you should produce and the same goes here. So the discriminator knows the set."}, {"start": 1018.24, "end": 1024.4, "text": " The discriminator knows, for example, I'm trying to produce that particular car and it gets a set of"}, {"start": 1024.4, "end": 1029.44, "text": " images that is supposedly of that particular car needs to decide as it come from the data set or"}, {"start": 1029.44, "end": 1036.64, "text": " from the generator. So it uses the same encoder pipeline here. It's just like a CNN giving you a"}, {"start": 1036.64, "end": 1044.32, "text": " latent representation. And then it has two tasks. The discriminator has two different tasks. First of all,"}, {"start": 1044.32, "end": 1054.8, "text": " this here is the regular GAN path. So if there's an MLP, there's simply a pipeline that outputs a"}, {"start": 1054.8, "end": 1060.96, "text": " number. And the number is does this come from the data set or does this come from the generator."}, {"start": 1060.96, "end": 1066.8799999999999, "text": " But then there is an additional pipeline that they have found to be vital to train the objective,"}, {"start": 1066.8799999999999, "end": 1072.6399999999999, "text": " which is a reconstruction pipeline. So this is more like a sort of like an auto encoder pipeline,"}, {"start": 1072.64, "end": 1080.72, "text": " where they have a decoder. They try to reconstruct the input set and they then compare it using"}, {"start": 1080.72, "end": 1087.2, "text": " mean squared error. Now here, they try to reconstruct the input set really picture by picture,"}, {"start": 1087.2, "end": 1093.8400000000001, "text": " not as a set, but picture by picture. So that's it's different from the set generator. Okay. And this"}, {"start": 1093.8400000000001, "end": 1100.96, "text": " is this pipeline is just to stabilize the training, but it also goes into this the output of the"}, {"start": 1100.96, "end": 1111.2, "text": " discriminator. So sort of the discriminator is happier. The more it can de the more it can reconstruct"}, {"start": 1111.2, "end": 1117.52, "text": " the images, which seems kind of weird at the beginning, but it you know, they say it has helped"}, {"start": 1117.52, "end": 1122.96, "text": " in other GANs. I'm not super familiar with GAN literature, but it's just a another objective"}, {"start": 1122.96, "end": 1129.1200000000001, "text": " that you cannot. So this is going to be the overview right here. So if everything works well,"}, {"start": 1129.12, "end": 1138.1599999999999, "text": " we should be able to take a set from the data set X, right, which is going to be you know,"}, {"start": 1138.1599999999999, "end": 1143.6799999999998, "text": " images, different images from the same person. We should be able to feed that to the encoder,"}, {"start": 1143.6799999999998, "end": 1150.6399999999999, "text": " get a latent representation Z for that set that somehow encodes here the identity of the person."}, {"start": 1150.6399999999999, "end": 1157.28, "text": " Now we don't, if the encoder works really well, we don't have to have seen that person before."}, {"start": 1157.28, "end": 1164.8, "text": " It will simply somehow encode the identity in that binary vector. Then we feed that to the generator"}, {"start": 1165.6, "end": 1173.28, "text": " together with some noise and we'll get out a set of pictures of different views of that same"}, {"start": 1173.28, "end": 1179.76, "text": " person or the person with a similar identity and pictures with similar kind of picture style."}, {"start": 1179.76, "end": 1189.36, "text": " And that if our discriminator works well, we'll look very, very similar to or will be images"}, {"start": 1189.36, "end": 1195.36, "text": " really of that same person. And our discriminator, if we plug that in right here, will agree and we"}, {"start": 1195.36, "end": 1202.56, "text": " plug in the Z right here. Okay, okay. That's the overview. Now the math."}, {"start": 1202.56, "end": 1211.84, "text": " So, think about this in this sort of probabilistic framework. What they say is we have,"}, {"start": 1212.56, "end": 1220.0, "text": " we denote an image set of size n as X and that it comes from the space of sets of images. So"}, {"start": 1220.8, "end": 1229.52, "text": " capital X right here is going to be a set of images as you see here. And this here is the space"}, {"start": 1229.52, "end": 1236.8, "text": " of all sets of images. Okay, so what they want to do is they want to build a probabilistic model"}, {"start": 1236.8, "end": 1244.56, "text": " of that. So a model where you can input a set and it'll tell you how likely is that. Now you don't"}, {"start": 1244.56, "end": 1250.0, "text": " you don't actually have to have a number as an output right here. What they often do is they start"}, {"start": 1250.0, "end": 1255.92, "text": " with a formulation like this and what they end up with is simply a model that allows you to sample"}, {"start": 1255.92, "end": 1262.3200000000002, "text": " from this distribution right from which you can estimate the probability. But ultimately what we"}, {"start": 1262.3200000000002, "end": 1271.44, "text": " want is a generator that can sample from this. Okay, so how do they build it? They decompose this"}, {"start": 1271.44, "end": 1276.24, "text": " into two parts and this is just a you know a decomposition. This is standard decomposition of"}, {"start": 1276.24, "end": 1285.2, "text": " probability where you'll say okay, what's the probability of a set X? The probability of a set"}, {"start": 1285.2, "end": 1294.64, "text": " X is the probability of the latent code of that set times the conditional probability of that set"}, {"start": 1294.64, "end": 1300.72, "text": " given the latent code. So already we we have we ask ourselves what's the probability of X?"}, {"start": 1301.92, "end": 1311.04, "text": " And what we might ask is huh well X you know if I look at X it has these different images of"}, {"start": 1311.04, "end": 1319.52, "text": " this this it has these different images of that thing whatever is on the image. I can first ask"}, {"start": 1319.52, "end": 1326.32, "text": " what is the probability of that particular thing on the image and then conditioned on that what"}, {"start": 1326.32, "end": 1336.24, "text": " is the probability that I'll get these particular images right. This is this simple decomposition"}, {"start": 1336.24, "end": 1343.36, "text": " already kind of builds up this model of encoding decoding. So we'll go through that step."}, {"start": 1345.36, "end": 1350.48, "text": " This here is going to be a deterministic function or encoder and this here is going to be a"}, {"start": 1350.48, "end": 1356.32, "text": " probabilistic function the the decoder and it's probabilistic because every time you call it"}, {"start": 1356.32, "end": 1360.48, "text": " basically every time you call the generator it's going to give you a different output because"}, {"start": 1360.48, "end": 1368.88, "text": " you you're going to feed a different noise at the beginning okay. So so this is going to be"}, {"start": 1369.76, "end": 1374.88, "text": " this is going to be our encoder here and this is going to be our decoder."}, {"start": 1380.48, "end": 1388.24, "text": " So they say here X is a Z is a deterministic function that maps a set X to an element in a discrete"}, {"start": 1388.24, "end": 1396.48, "text": " space Z okay. This is a discrete space as opposed to maybe a a regular auto encoder where you have"}, {"start": 1396.48, "end": 1404.4, "text": " a continuous space. So here we want to discrete space and a lot of mathematical problems are going"}, {"start": 1404.4, "end": 1411.68, "text": " to arise from the fact that this Z is a discrete space and not a and not a continuous space."}, {"start": 1411.68, "end": 1423.1200000000001, "text": " So here P is a prior distribution with the support given by Z which means all the Z vectors that"}, {"start": 1423.76, "end": 1432.16, "text": " have some sort of set associated with them which is a subset of all the Z. So that basically means"}, {"start": 1432.16, "end": 1439.44, "text": " that if if we have a given encoder there are not all of these binary vectors are going to be filled"}, {"start": 1439.44, "end": 1448.0, "text": " even you know with if we plug in all the world's faces into our encoder it might not fill all of the"}, {"start": 1448.0, "end": 1456.16, "text": " binary capabilities that we have. So this prior is only defined on this support of this and here"}, {"start": 1456.16, "end": 1461.52, "text": " you already kind of see what what kind of mathematical hurdles you have to go through if you do"}, {"start": 1461.52, "end": 1466.3200000000002, "text": " something like this and all the math here is going or most of the math here is going to deal with"}, {"start": 1466.32, "end": 1474.0, "text": " the fact that we have this discrete thing and so on and a bit of a bit of a little bit of"}, {"start": 1476.72, "end": 1483.76, "text": " of a caveat here also is that this here they mentioned this here is a prior you need a prior"}, {"start": 1483.76, "end": 1494.3999999999999, "text": " distribution on your Z variables and this is also not easy. So really quickly what does it mean to"}, {"start": 1494.4, "end": 1500.5600000000002, "text": " have a prior distribution on this kind of thing because usually in a regular like auto encoder"}, {"start": 1500.5600000000002, "end": 1507.6000000000001, "text": " variational auto encoder right you're latent you're latent code you'll have a prior on it and"}, {"start": 1508.16, "end": 1514.96, "text": " that prior can be you know some some continuous thing like a Gaussian and even in a regular"}, {"start": 1514.96, "end": 1523.1200000000001, "text": " GAN as I said you have your noise distribution and so on what is a prior on that thing. Now you can"}, {"start": 1523.12, "end": 1530.4799999999998, "text": " say a uniform prior but again we would like to learn this prior such that it matches the data set"}, {"start": 1530.4799999999998, "end": 1538.08, "text": " well. Now they use a prior from a paper that's called made M A D E and really quickly what it does"}, {"start": 1538.08, "end": 1546.08, "text": " is it sort of kind of decomposes this thing so what you'll have is a neural network that outputs"}, {"start": 1546.08, "end": 1554.48, "text": " binary vectors like this and it will sort of output them in a fashion auto regressively so it will"}, {"start": 1554.48, "end": 1559.76, "text": " output one of them and then conditioned on that it will output the next condition on that it will"}, {"start": 1559.76, "end": 1566.1599999999999, "text": " output the next and this is such that the probability of this binary vector minus 1 1 1 1 minus 1"}, {"start": 1566.1599999999999, "end": 1572.6399999999999, "text": " and so on is going to be decomposed into the probability that there's a minus 1 here times the"}, {"start": 1572.64, "end": 1577.8400000000001, "text": " probability that there is a 1 here given that there is a minus 1 here and so on and in different"}, {"start": 1577.8400000000001, "end": 1583.76, "text": " order I don't really want to go into this but just to show you that there is a lot of concentration"}, {"start": 1583.76, "end": 1589.68, "text": " of mathematical consideration if you really want to go about really want to go about this sort of"}, {"start": 1589.68, "end": 1597.44, "text": " thing in a formal fashion so they define two things first of all this prior okay it's a prior"}, {"start": 1597.44, "end": 1604.88, "text": " distribution that they can learn from the data set and then there is this conditional distribution"}, {"start": 1604.88, "end": 1613.2, "text": " this what you might call a generator right if you're given a z a one of these binary codes what's"}, {"start": 1613.2, "end": 1621.04, "text": " the probability of a given set so here I tell you here it's a I don't know Scarlett Johansson"}, {"start": 1621.04, "end": 1628.1599999999999, "text": " what's the probability of these pictures being different views of Scarlett Johansson so"}, {"start": 1629.84, "end": 1637.28, "text": " that is going to be simply we're going to build this as an energy based model you can you can do"}, {"start": 1637.28, "end": 1643.68, "text": " this what you'll have to do is you'll have to define an energy and we'll just quickly discuss"}, {"start": 1643.68, "end": 1650.6399999999999, "text": " what that is and then you can build a construct like this where you'll say the probability of a given set"}, {"start": 1650.64, "end": 1658.0800000000002, "text": " is going to be the energy that assigned to that set divided by the energy that I'm going to assign"}, {"start": 1658.0800000000002, "end": 1666.24, "text": " to all of these other sets so this is it's a form of an energy based model you can phrase very many"}, {"start": 1666.24, "end": 1672.8000000000002, "text": " things in terms of these energy based models and Jan LeCan gave a talk about this at iClear I believe"}, {"start": 1673.5200000000002, "end": 1677.92, "text": " where he gives a lot of different examples of energy based models so I invite you to"}, {"start": 1677.92, "end": 1685.1200000000001, "text": " um check this out I've also done a video on some of these energy based models and what you can"}, {"start": 1685.1200000000001, "end": 1694.0800000000002, "text": " do with them here it's simply to define this probabilistic model so what we need to do are two"}, {"start": 1694.0800000000002, "end": 1701.1200000000001, "text": " things we need to know what is this energy so what is this energy supposed to do this energy"}, {"start": 1701.12, "end": 1708.1599999999999, "text": " is going to be a function that gives you and now I have to think so its energy is going to be a"}, {"start": 1708.1599999999999, "end": 1717.9199999999998, "text": " function that gives you a high value if you are unhappy with the input and it gives you a low value"}, {"start": 1717.9199999999998, "end": 1726.1599999999999, "text": " if you are happy with the input okay so you see the negative exponential here which basically means"}, {"start": 1726.16, "end": 1734.4, "text": " if and also the energy is always positive so the best if you are super duper happy with what"}, {"start": 1734.4, "end": 1741.52, "text": " is what your input is into the function you'll output zero so if you output zero here you'll see that"}, {"start": 1741.52, "end": 1751.52, "text": " e to the exponential function of negative something is going to be quite small and um"}, {"start": 1751.52, "end": 1757.44, "text": " no maybe I have it wrong maybe you output really high number when you're really happy"}, {"start": 1759.44, "end": 1769.76, "text": " I'm not sure but it's one of the two so um this comes this comes from from a physics from a physics"}, {"start": 1769.76, "end": 1777.2, "text": " background no no no I'm right so if you if you output if you're not happy you'll output a super"}, {"start": 1777.2, "end": 1783.2, "text": " high number here which will make this negative exponential be really close to zero and therefore"}, {"start": 1783.2, "end": 1791.52, "text": " the probability you say if I'm not happy the probability should be close to zero however if you're"}, {"start": 1791.52, "end": 1797.6000000000001, "text": " really happy you'll output a low number right here now the energy always has to be greater or"}, {"start": 1797.6000000000001, "end": 1804.4, "text": " equal to zero but the lower you go the higher this probability is going to be the bottom thing here"}, {"start": 1804.4, "end": 1810.3200000000002, "text": " is simply to normalize the distribution because in a probability distribution you always have to"}, {"start": 1810.96, "end": 1819.76, "text": " normalize because otherwise it's not a probability and this is what most of these models basically"}, {"start": 1819.76, "end": 1825.76, "text": " are are fighting over how to normalize the distribution and what we're going to do is simply"}, {"start": 1825.76, "end": 1830.96, "text": " normalize it by sampling which is what most of these things do you can build energy based"}, {"start": 1830.96, "end": 1839.92, "text": " models without this which gans are a variant of that but okay so what we need to do is we need to"}, {"start": 1839.92, "end": 1846.16, "text": " come up with this energy function that is going to be a high number when we're not happy with the"}, {"start": 1846.16, "end": 1852.88, "text": " input now what is the input the input is x and z x and z what does it mean we're not happy with"}, {"start": 1852.88, "end": 1860.4, "text": " the input it means that the the image x and you see x here is one of the images of the set"}, {"start": 1860.4, "end": 1867.2, "text": " that particular image isn't really congruent with the z with the identity so you either you say what"}, {"start": 1867.2, "end": 1875.76, "text": " this this isn't really a picture of Scarlett Johansson so I'm going to assign this a high value however"}, {"start": 1875.76, "end": 1882.64, "text": " if you know if this is really any sort of picture of of that person then you're going to assign it"}, {"start": 1882.64, "end": 1889.0400000000002, "text": " a low value and how better to do this than to build a neural network to do that and this is going"}, {"start": 1889.04, "end": 1897.6, "text": " to be our discriminator so our discriminator is going to take the role of this energy function okay"}, {"start": 1900.24, "end": 1907.68, "text": " cool now I said you need to normalize and I kind of set it off the cuff and so on but the problem"}, {"start": 1907.68, "end": 1915.52, "text": " here is again we have this kind of sets and and so on so our probability as you'll notice is the"}, {"start": 1915.52, "end": 1926.08, "text": " probability of x given z so we are already given the the identity of the person so what do we"}, {"start": 1926.08, "end": 1932.8, "text": " need to normalize by we can't simply normalize by all the sets of images in the world like here it's"}, {"start": 1932.8, "end": 1941.92, "text": " in the integral we need to normalize by all the sets of images that are mapped to that same identity"}, {"start": 1941.92, "end": 1950.72, "text": " okay so in order to normalize the distribution we basically ask how likely is this set how happy are"}, {"start": 1950.72, "end": 1958.96, "text": " you with this particular set right here compared to all the sets that could exist that would map"}, {"start": 1958.96, "end": 1967.6000000000001, "text": " to the same identity all right that's why these indicator functions are here and as you can see"}, {"start": 1967.6, "end": 1974.7199999999998, "text": " the part here is simply a normalization where you say I'm just going to produce other I'll consider"}, {"start": 1974.7199999999998, "end": 1980.0, "text": " all the other possible sets of images that mapped to the same person and I'll simply divide by"}, {"start": 1980.0, "end": 1989.6, "text": " the energy of those in fact if you do it correctly this particular x is also in that particular set"}, {"start": 1989.6, "end": 1995.6, "text": " but usually it's going to be a fairly small part but to properly normalize of course you have to"}, {"start": 1995.6, "end": 2001.4399999999998, "text": " consider it as well now this bottom part here as I already said is going to be the main problem"}, {"start": 2001.4399999999998, "end": 2007.28, "text": " of most of these probabilistic methods and as I already said again it's usually approximated by"}, {"start": 2007.28, "end": 2014.6399999999999, "text": " simply sampling a bunch of these sets and not sampling a bunch of these sets and not a"}, {"start": 2015.52, "end": 2022.24, "text": " enumerating all the possible sets of images and this sampling is going to make some further problems"}, {"start": 2022.24, "end": 2036.64, "text": " as we'll see I guess down here so here is what we optimize ultimately we optimize or one of the"}, {"start": 2036.64, "end": 2047.68, "text": " things we optimize is are we okay yeah so they say we apply maximum likelihood estimation to"}, {"start": 2047.68, "end": 2053.36, "text": " estimate the parameters of the thing we just defined where where the negative log likelihood"}, {"start": 2053.36, "end": 2059.52, "text": " loss for an observed set in the training split is this so this is simply the negative log"}, {"start": 2059.52, "end": 2067.2000000000003, "text": " likelihood the log decomposes into a sum so this is going to be your prior and this is going to be"}, {"start": 2067.2000000000003, "end": 2077.44, "text": " your generator discriminator combo okay it's the generator producing images from that binary code"}, {"start": 2077.44, "end": 2083.68, "text": " and then the discriminator assigning high or low values to that produced images and also to"}, {"start": 2083.68, "end": 2091.44, "text": " images from the data set and the thing over here is simply going to be the prior over the Z"}, {"start": 2091.44, "end": 2099.2000000000003, "text": " distribution that we briefly discussed now again they have to they have to do some tricks here"}, {"start": 2099.2000000000003, "end": 2106.32, "text": " where they say okay we can get rid of this support by using a normalized distribution over Z which"}, {"start": 2106.32, "end": 2116.7200000000003, "text": " is a bound on that true prior and so on so they're going to replace the the P with a P bar which"}, {"start": 2116.7200000000003, "end": 2127.2000000000003, "text": " is over the entire space of Z and that's going to be a bound but the interesting part I feel more"}, {"start": 2127.2000000000003, "end": 2133.76, "text": " is here where they consider the loss again of this conditional distribution on Z so you'll see the"}, {"start": 2133.76, "end": 2141.0400000000004, "text": " exact same quantity right here but now our loss is going to be the negative log of that now since"}, {"start": 2141.0400000000004, "end": 2149.44, "text": " it's the negative log you can decompose the division into a sum and this part up here you will"}, {"start": 2149.44, "end": 2158.2400000000002, "text": " see the indicator function here is a bit unnecessary because the the Z here is the Z that we're"}, {"start": 2158.24, "end": 2164.3199999999997, "text": " considering is going to be the Z of that particular set that we're considering and so this equality"}, {"start": 2164.3199999999997, "end": 2170.9599999999996, "text": " holds on the top so disregard this and this down here as I said is simply a filter to filter the"}, {"start": 2170.9599999999996, "end": 2178.56, "text": " space of all sets to the ones that correspond to the Z that we have in the energy function so this"}, {"start": 2178.56, "end": 2186.24, "text": " goes here because it's simply a log of an exponential and the negative signs cancel so you'll end up"}, {"start": 2186.24, "end": 2192.7999999999997, "text": " with this what does it mean you want to minimize this loss right here and part of that is going"}, {"start": 2192.7999999999997, "end": 2200.16, "text": " to be you want to minimize the energy function of these inputs okay you want you want to"}, {"start": 2200.9599999999996, "end": 2208.16, "text": " and this is now the case when it comes to from the data set right so when x and z come from the"}, {"start": 2208.16, "end": 2216.48, "text": " data set and e is your discriminator then you want to make the output of the discriminator really small"}, {"start": 2216.48, "end": 2221.7599999999998, "text": " which means that you you want to train the discriminator to say I'm really really happy that"}, {"start": 2221.7599999999998, "end": 2228.56, "text": " this particular image comes together with this particular identity encoding now the in the"}, {"start": 2229.52, "end": 2234.08, "text": " if it comes from the generator of course you want to do the exact opposite you want to"}, {"start": 2234.08, "end": 2243.36, "text": " sign it high value remember energy low means happy with the input okay um and then the normalization"}, {"start": 2243.36, "end": 2250.7999999999997, "text": " down here is as I said the problem uh so you'll see it as stated right here uh because it's under the"}, {"start": 2250.7999999999997, "end": 2256.96, "text": " the the division it's going to get a pick up a negative sign which combines with this negative"}, {"start": 2256.96, "end": 2263.7599999999998, "text": " sign which gives you positive sign right here now this part right here is going to be intractable"}, {"start": 2263.76, "end": 2270.32, "text": " because it it's not going to be feasible to enumerate all the sets of images it's not even going to be"}, {"start": 2270.32, "end": 2277.28, "text": " feasible to enumerate all the sets of images that just correspond to that particular uh identity"}, {"start": 2278.0, "end": 2283.84, "text": " and in fact it's not even going to be feasible to sample from that because we have no clue"}, {"start": 2283.84, "end": 2292.2400000000002, "text": " right we can't simply generate out of the ether true other pictures of the of a particular person"}, {"start": 2292.24, "end": 2302.0, "text": " what we can do of course is we can use our we can use our model to produce more images right of"}, {"start": 2302.0, "end": 2311.8399999999997, "text": " that particular identity so what we'll do is we'll replace this distribution with a variational"}, {"start": 2311.8399999999997, "end": 2319.9199999999996, "text": " distribution and we'll sample from that now this isn't exactly the same um this isn't this"}, {"start": 2319.92, "end": 2327.92, "text": " log probability anymore and that's why first of all we have a bound here and not an equality this"}, {"start": 2327.92, "end": 2336.4, "text": " is uh this is called a variational approximation uh so we bound this quantity and we can only"}, {"start": 2336.4, "end": 2343.12, "text": " bound this quantity if we down here introduce the the entropy of the variational distribution"}, {"start": 2343.12, "end": 2349.44, "text": " this is a fairly standard trick in variational approximation methods if you want to look more into"}, {"start": 2349.44, "end": 2356.0, "text": " this look into kind of uh VAE explain variational autoencoders explained or anything like this"}, {"start": 2356.48, "end": 2363.28, "text": " will teach you how how these methods work in case we replace a distribution with a distribution"}, {"start": 2363.28, "end": 2369.2000000000003, "text": " we can actually produce and what is that distribution look what we're supposed to do is we're supposed"}, {"start": 2369.2, "end": 2380.56, "text": " to produce a set of image given so sets of images here given particular z and we can do that"}, {"start": 2380.56, "end": 2387.6, "text": " that's our generator right so we can use our generator to produce those samples and that's what they"}, {"start": 2387.6, "end": 2393.9199999999996, "text": " say here here we have derived a lower bound by introducing a variational distribution which we"}, {"start": 2393.92, "end": 2401.76, "text": " parameterize in the form of a generator okay so the generator is going to produce that distribution"}, {"start": 2401.76, "end": 2409.28, "text": " it's going to use this noise production so as you know the generator takes two things it takes"}, {"start": 2409.84, "end": 2418.4, "text": " the identity encoding and a bit of noise and is going to produce an output uh set or for each"}, {"start": 2418.4, "end": 2426.08, "text": " noise it's going to produce an output image very cool so that's that's the the kind of math"}, {"start": 2426.08, "end": 2434.8, "text": " formulation behind this model now they have a model architectures right here but this is all"}, {"start": 2434.8, "end": 2440.8, "text": " fairly standard except for so for the prior they learn the prior on the z space so you see you have"}, {"start": 2440.8, "end": 2448.08, "text": " z being this binary vectors um they say we use a standard auto regressive model made"}, {"start": 2448.08, "end": 2454.4, "text": " with three fully connected layers mainly for simplicity and robustness and so again maybe you"}, {"start": 2454.4, "end": 2461.2799999999997, "text": " like it took me a while to get what this prior does this prior is supposed to say it's so it's not"}, {"start": 2461.2799999999997, "end": 2468.4, "text": " in again you have the z vectors always being some sort of from the standard noise but what you can"}, {"start": 2468.4, "end": 2476.88, "text": " also do is you can learn better noise distribution a better input distribution for your gain by basically"}, {"start": 2476.88, "end": 2484.8, "text": " making a gain for your input distribution so what you'll do is you'll have a z zero right here and"}, {"start": 2484.8, "end": 2493.44, "text": " then you'll use a you'll learn again to learn better input distributions okay and this is"}, {"start": 2494.0, "end": 2501.52, "text": " what you do here with these with this prior on z this is more standard in like V A E's than it is"}, {"start": 2501.52, "end": 2511.52, "text": " in GANS but it exists so encoder um say as a necessary option encoder for a set needs to satisfy"}, {"start": 2511.52, "end": 2516.96, "text": " the permutation varying and property we opt to use a simple architecture design where we let this"}, {"start": 2516.96, "end": 2526.16, "text": " be the average right here so as you can see this is the average and then they they use this"}, {"start": 2526.16, "end": 2532.8799999999997, "text": " binarize operation and the binarize operation here is clamping the values to one or negative one"}, {"start": 2532.8799999999997, "end": 2538.24, "text": " and it is a straight through estimator which means that you will you back prop through it as if"}, {"start": 2538.24, "end": 2544.3199999999997, "text": " you hadn't clamped but you forward prop through it with clamping this is kind of a trick to get"}, {"start": 2544.3199999999997, "end": 2553.12, "text": " through discretization um things discriminators job is to assign low energy to observed images"}, {"start": 2553.12, "end": 2558.4, "text": " and high energy to generate the images given a set code z we use an auto encoder based energy"}, {"start": 2558.4, "end": 2564.3199999999997, "text": " function implementations similar to 25 and here they say we have found that this choice is important"}, {"start": 2564.3199999999997, "end": 2571.92, "text": " as it enables effective learning in early stages of training um so that's why they do usually a"}, {"start": 2571.92, "end": 2579.12, "text": " discriminator would be the energy would be equal to this thing right here which is a small mlp"}, {"start": 2579.12, "end": 2587.44, "text": " that maps a the input to a real sorry you can't see that that maps the input to a real number"}, {"start": 2587.92, "end": 2594.4, "text": " either high energy i'm not happy low energy i'm very happy here they also include this thing"}, {"start": 2594.4, "end": 2602.0, "text": " right here which is a decoder so it's it's kind of uh you can maybe think of it as a another"}, {"start": 2602.0, "end": 2611.12, "text": " little again uh another another another little generator or the the generator part of a VIE or"}, {"start": 2611.12, "end": 2618.32, "text": " of an auto encoder sorry not a VIE an auto encoder that takes as input the encoding of the particular"}, {"start": 2618.32, "end": 2624.64, "text": " image and the identity and produces is going to produce something that's close to the output"}, {"start": 2625.28, "end": 2630.56, "text": " again see observe that this is now with respect to a particular image so here we're trying to"}, {"start": 2630.56, "end": 2636.24, "text": " reconstruct that particular image because we have its input thing right here and we're it's not"}, {"start": 2636.24, "end": 2645.04, "text": " the same as the generator that is just asked to produce a some uh view some thing that corresponds"}, {"start": 2645.04, "end": 2653.2799999999997, "text": " to this particular identity vector okay uh the generator generates a set conditioned on a set code"}, {"start": 2653.2799999999997, "end": 2658.64, "text": " by sampling and random variables each of which is concatenated with z and generates an image"}, {"start": 2658.64, "end": 2669.2799999999997, "text": " independently cool so wapada the losses they they they now introduce some margin losses on the"}, {"start": 2669.2799999999997, "end": 2676.24, "text": " things here um but basically you can just translate the what we have on top where we formulated"}, {"start": 2676.24, "end": 2681.7599999999998, "text": " negative log likelihood into the losses right here they do have some simplifications for"}, {"start": 2681.76, "end": 2693.36, "text": " example this um to train the prior you what you or to train to train the encoder I think uh you"}, {"start": 2693.36, "end": 2703.2000000000003, "text": " have to make a bit of an approximation in that the encoder is supposed to match this the z vector"}, {"start": 2703.2000000000003, "end": 2711.0400000000004, "text": " right and that's not differentiable by itself so they have this sort of l1 approximation right here"}, {"start": 2711.04, "end": 2716.96, "text": " they leave away the entropy from the loss and they have found that to work well they introduce"}, {"start": 2716.96, "end": 2723.68, "text": " this margin losses right here I I don't want to go into that too much uh but basically they simply"}, {"start": 2724.48, "end": 2730.4, "text": " in a way with some approximations they approximate oh yeah here it is the indicator function they"}, {"start": 2730.4, "end": 2736.8, "text": " approximate it as this I was looking for that they they they optimize this log likelihood from above"}, {"start": 2736.8, "end": 2742.6400000000003, "text": " in the way where they always optimize they keep the generator constant and they optimize the rest"}, {"start": 2742.6400000000003, "end": 2749.84, "text": " of the pipeline so the encoder and the discriminator and the prior and then they keep that rest um fixed"}, {"start": 2749.84, "end": 2757.6000000000004, "text": " and they encode the generator so what does that do before we remember right here we had this"}, {"start": 2757.6000000000004, "end": 2764.6400000000003, "text": " this approximation right here where we said you know what comes out of this we we're not really"}, {"start": 2764.64, "end": 2770.56, "text": " optimizing is we're optimizing we're minimizing a lower bound on it right so here's a quantity that"}, {"start": 2770.56, "end": 2776.56, "text": " we want to minimize but here's a lower bound and we'll just push that lower bound down by optimizing"}, {"start": 2776.56, "end": 2783.12, "text": " now that doesn't tell us anything about this thing right here but there is actually more to it so"}, {"start": 2783.12, "end": 2791.8399999999997, "text": " by optimizing the discriminator and the encoder and so on we do minimize this lower bound so that"}, {"start": 2791.84, "end": 2798.8, "text": " this this loss right here you see this energy function um we'll adjust that whenever we adjust our"}, {"start": 2800.48, "end": 2807.04, "text": " whenever we adjust our that particular loss our discriminator will adjust that energy function"}, {"start": 2807.04, "end": 2816.08, "text": " whenever we adjust our encoder um we are going to adjust the part that generates the z vectors"}, {"start": 2816.08, "end": 2824.0, "text": " right here so we'll push this down but whenever we optimize our generator that's when we make this"}, {"start": 2824.0, "end": 2833.04, "text": " gapier smaller okay so we always do two steps first we or first or second in one step we reduce"}, {"start": 2833.04, "end": 2838.72, "text": " this and in the other step we'll bring these two closer together and as a result of course we"}, {"start": 2838.72, "end": 2844.4, "text": " hope that it's not just the bottom one going to up down up down up down but we hope that both of"}, {"start": 2844.4, "end": 2850.4, "text": " them reduce with time because the top one is the one we'll actually want to reduce that's our actual"}, {"start": 2850.4, "end": 2860.2400000000002, "text": " loss or our log likelihood and that is I guess going to happen in practice so what does this do so"}, {"start": 2860.2400000000002, "end": 2867.6800000000003, "text": " as I as we already saw um here on top you have a set and you feed that through the encoder"}, {"start": 2867.68, "end": 2876.3999999999996, "text": " you feed that through the encoder that gives you a z identity and then you feed that to the generator"}, {"start": 2876.3999999999996, "end": 2881.2799999999997, "text": " and the generator you can ask it you don't have to produce the same amount of images you can produce"}, {"start": 2881.2799999999997, "end": 2886.24, "text": " any amount of images you like they just chose to produce the same amount there's no correspondence"}, {"start": 2886.24, "end": 2893.04, "text": " but you see it's the same truck and here they manually align these so they just produce a bunch"}, {"start": 2893.04, "end": 2898.16, "text": " of images on the left is the data set and on the right I guess they just produce like a hundred images"}, {"start": 2898.16, "end": 2906.0, "text": " and then selected wherever the car looked like the closest to so they ordered them by hand and that"}, {"start": 2906.0, "end": 2914.24, "text": " is to show that for example look at the the lighting on the car right here um it's it's fairly similar"}, {"start": 2914.88, "end": 2920.8, "text": " I guess this one has red tail lights and the other one hasn't but you can see that the the different"}, {"start": 2920.8, "end": 2929.2000000000003, "text": " views are pretty well captured by the generator and that just from all of these are created from one"}, {"start": 2930.0800000000004, "end": 2936.1600000000003, "text": " binary encoding of this here so this is binary encoded to z and then all of these different views"}, {"start": 2936.1600000000003, "end": 2944.0800000000004, "text": " are created there's no image correspondence so that's pretty cool and another problem when you"}, {"start": 2944.08, "end": 2950.96, "text": " have with sets is how do you evaluate sets you can't you can't go and check for images or image"}, {"start": 2951.68, "end": 2959.52, "text": " closeness and so on so they have to do some 3D modeling they actually take now they take"}, {"start": 2959.52, "end": 2965.92, "text": " these images right here and they have to approximate their 3D shape and then compare that 3D shape"}, {"start": 2965.92, "end": 2974.32, "text": " with the 3D shape of the original thing in order to just quantitatively estimate how well they're"}, {"start": 2974.32, "end": 2982.48, "text": " doing in the faces the the same thing you input the top row into the encoder and you get back the"}, {"start": 2982.48, "end": 2990.0, "text": " bottom row um we've already looked at that but again to evaluate this they you actually have to go"}, {"start": 2990.0, "end": 2997.68, "text": " and use some sort of a face detector to recognize is that even is that the same person always and is it"}, {"start": 2997.68, "end": 3005.36, "text": " so you can evaluate two things um you can evaluate are these right here all the same people"}, {"start": 3006.16, "end": 3012.08, "text": " so you can have a a face detector kind of uh tell you whether or not these are the same people"}, {"start": 3012.08, "end": 3020.64, "text": " and the second thing is are these down here the same person as these up here right so those are"}, {"start": 3020.64, "end": 3026.0, "text": " the the kind of things how you can evaluate this and they've done this and it's a fairly interesting"}, {"start": 3026.0, "end": 3033.2799999999997, "text": " and the results here are not surprising when you look at the the images so these are curves"}, {"start": 3033.2799999999997, "end": 3038.88, "text": " curves from this face detector and of course for real images as you can see the this is simply"}, {"start": 3038.88, "end": 3047.76, "text": " the performance of the face detector so you do get some false positives um if you if you want more"}, {"start": 3047.76, "end": 3053.44, "text": " true positives right so this is a a standard curve right here because these face detectors are"}, {"start": 3053.44, "end": 3061.6800000000003, "text": " not perfect so in a given row right here um in a given row even if that's from the real data set"}, {"start": 3061.6800000000003, "end": 3066.2400000000002, "text": " the face detector would sometimes fail and say no that's not the same person even though from the"}, {"start": 3066.24, "end": 3073.12, "text": " data set you know it is though the the to match the actual child photo from Ali with his adult"}, {"start": 3073.12, "end": 3081.3599999999997, "text": " photos is even like you can forgive the face detector um so that's sort of the the gold standard"}, {"start": 3081.3599999999997, "end": 3087.52, "text": " we're trying to achieve and you can see within the reconstructed sets that that is achieved"}, {"start": 3087.52, "end": 3096.64, "text": " fairly fairly well so compared to uniform samples this is you know fairly fairly cool fairly close"}, {"start": 3098.4, "end": 3106.64, "text": " what is less close is this reckon and real and I believe that's when you compare the identity"}, {"start": 3106.64, "end": 3114.64, "text": " of the real row with the identity of the reconstructed row and that's here so that tells you already"}, {"start": 3114.64, "end": 3121.2799999999997, "text": " that it's the gan or sorry the model doesn't always preserve the actual identity"}, {"start": 3121.8399999999997, "end": 3129.2, "text": " as seen by a face detector and I don't know what to say except yes that's what you see in the data"}, {"start": 3129.2, "end": 3137.12, "text": " right um also you see that free samples I guess so you can do two things right you can give it a set"}, {"start": 3137.12, "end": 3145.8399999999997, "text": " like a row and encode that into the z and then um you can decode that again and basically reconstruct"}, {"start": 3145.8399999999997, "end": 3152.4, "text": " or you can just sample since you've learned a prior on the z variable you can simply sample you can"}, {"start": 3152.4, "end": 3160.16, "text": " simply 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": 3175.3599999999997, "text": " sampled like this and you can see again here it's remarkable that within the same row it's pretty much"}, {"start": 3175.3599999999997, "end": 3183.52, "text": " the the rough identity of the person is conserved right and these are these free samples right here"}, {"start": 3183.52, "end": 3191.36, "text": " I guess and they they do better than whenever you compare the reconstructed and real but they don't"}, {"start": 3191.36, "end": 3199.44, "text": " do as well as when you actually input a real data and then reconstruct this uh so this might be"}, {"start": 3200.4, "end": 3209.52, "text": " an indication that this prior isn't really um working you know all too accurately and I do have"}, {"start": 3209.52, "end": 3217.68, "text": " my problems with this binary encoding right here because maybe I'm misunderstanding something"}, {"start": 3217.68, "end": 3224.24, "text": " but if you have these binary vectors as we said here uh the reason you know the reason why you do"}, {"start": 3224.24, "end": 3228.72, "text": " one-hot encoding in class conditional ganzes you could you could simply say what what am I doing"}, {"start": 3228.72, "end": 3235.52, "text": " a one-hot encoding I'll simply say z equals three for class three and z equals four for class four"}, {"start": 3235.52, "end": 3241.68, "text": " like that it should be so easy why am I doing one-hot and that's because these models see everything"}, {"start": 3241.68, "end": 3250.48, "text": " in a linear fashion so if you i have class three and then i have class uh four and then i have class"}, {"start": 3250.48, "end": 3257.92, "text": " nine the model doesn't see that as three different classes the model sees this as these two are somehow"}, {"start": 3257.92, "end": 3266.2400000000002, "text": " closer together than this right um so the the reason why we do one-hot vectors is that the model"}, {"start": 3266.2400000000002, "end": 3272.2400000000002, "text": " cannot do this the model has one independent dimension for each of the classes and whenever that"}, {"start": 3272.2400000000002, "end": 3279.6, "text": " particular dimension is high uh then it knows that that particular class is activated what this"}, {"start": 3279.6, "end": 3287.04, "text": " binary encoding here does is sort of it goes back to this thing right here where it says okay there are"}, {"start": 3287.04, "end": 3294.88, "text": " all of these different categories here it's like you have mini classes and the identity of whatever"}, {"start": 3294.88, "end": 3301.7599999999998, "text": " set you consider is now encoded in these mini classes so that i'm going to guess the first thing"}, {"start": 3301.7599999999998, "end": 3308.08, "text": " here might be something like does that person have a blonde hair and the second thing might be does"}, {"start": 3308.08, "end": 3314.64, "text": " the image look generally bright or the images the image set as a whole look generally bright or dark"}, {"start": 3314.64, "end": 3321.04, "text": " and and so on so i'm going to guess these things are encoded here in ill it'll sort of just end up"}, {"start": 3321.04, "end": 3331.2, "text": " being kind of a discrete uh can or a discrete autoencoder um rather than what they believe but maybe"}, {"start": 3331.2, "end": 3336.08, "text": " that was their goal all along and um uh mis misunderstanding right here i just don't think this"}, {"start": 3336.08, "end": 3344.3199999999997, "text": " this binarization is gives you this sort of hoped expressiveness i think there's still a lot of"}, {"start": 3344.3199999999997, "end": 3353.12, "text": " dependence of uh whether or not a particular thing is on or off okay but enough uh ranting"}, {"start": 3353.12, "end": 3360.16, "text": " right here um i want to look at the at some more of the samples because i've only shown you"}, {"start": 3360.16, "end": 3367.8399999999997, "text": " the reconstructions what i also find interesting is the free samples so here you can see uncurated um"}, {"start": 3367.8399999999997, "end": 3374.48, "text": " shape net samples and on the left so here you can see this effect on from the learned order"}, {"start": 3374.48, "end": 3380.3999999999996, "text": " regressive prior and a uniform prior on the right and here you can see this effect of learning this"}, {"start": 3380.3999999999996, "end": 3386.96, "text": " prior so if i learn the prior it's going to give me back fairly okay objects if i don't learn the"}, {"start": 3386.96, "end": 3397.2, "text": " prior oh but if i learn the prior um you know if i learn the prior really really well that basically"}, {"start": 3397.2, "end": 3403.6, "text": " means i'm only going to ever produce sets that were in the training data right uh if i learn like"}, {"start": 3403.6, "end": 3409.12, "text": " a perfect prior i'll see like wait this you know this particular identity here never shows up so"}, {"start": 3409.12, "end": 3414.7200000000003, "text": " i'm not going to output it and the uniform prior might actually output it and the generator is"}, {"start": 3414.72, "end": 3421.7599999999998, "text": " not going to be trained on that uniform uh prior so it's just going to give you kind of crap and"}, {"start": 3423.52, "end": 3430.3199999999997, "text": " um here in the in the faces you you see the same thing now again what i think i don't think"}, {"start": 3430.3199999999997, "end": 3435.4399999999996, "text": " that's happening what i think is happening is is encoding these kind of microcharacteristics not"}, {"start": 3435.4399999999996, "end": 3441.7599999999998, "text": " per se identity but it's encoding probably you know a hair color what not a head shape and so on"}, {"start": 3441.76, "end": 3449.2000000000003, "text": " uh things like this and in each of these dimensions and that's what is then going to produce so these"}, {"start": 3449.2000000000003, "end": 3457.76, "text": " each row here is in is one sample from that uh prior on the left is learned which you see is"}, {"start": 3457.76, "end": 3464.48, "text": " working pretty well in terms of the output and on the right you see it's from the uniform uh prior"}, {"start": 3464.48, "end": 3474.16, "text": " now you also see here first of all that approximately identity is preserved but not as much uh in"}, {"start": 3474.16, "end": 3480.0, "text": " this uniform prior that's first and second uh you'll see that the images are much worse which"}, {"start": 3480.0, "end": 3485.36, "text": " means that the generator doesn't have as much training on that particular thing because"}, {"start": 3485.92, "end": 3490.0, "text": " i guess it comes from a prior that it hasn't uh seen during training"}, {"start": 3490.0, "end": 3497.6, "text": " all right and here lastly they have reconstructions if you give different number of views so the top"}, {"start": 3497.6, "end": 3504.0, "text": " row i guess is the input the this row is when you just have four different views so i guess just"}, {"start": 3504.0, "end": 3508.88, "text": " the first four or something like this input and the bottom one is when you have the full eight"}, {"start": 3508.88, "end": 3519.04, "text": " views and you can i guess see or even more um that this uh increases with number of views so the"}, {"start": 3519.04, "end": 3527.6, "text": " the accuracy of this identity increases the more views uh you input of the set and they have a bunch"}, {"start": 3527.6, "end": 3535.68, "text": " of other uh things right here in the appendix i i do invite you to uh look at this and i hope you"}, {"start": 3535.68, "end": 3544.32, "text": " sort of saw into a bit how you would go about something like this i i found it quite uh challenging"}, {"start": 3544.32, "end": 3550.1600000000003, "text": " the math because i'm mainly not used to this kind of variational math uh but i hope this gives you"}, {"start": 3550.1600000000003, "end": 3556.2400000000002, "text": " sort of an impression all right uh this was it from me um tell me what you think and i'll see you"}, {"start": 3556.24, "end": 3585.3599999999997, "text": " next time bye bye"}] |
Yannic Kilcher | 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 Huang Wu, Vivek Rathad, Ronnie Votel and Jonathan Huang. So on a high level this paper tries to do object detection for cameras where 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, take 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 simply, you want to do object detection in images. Object detection is the task of basically 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 R CNN and this is the model that we're going to extend. So the R CNN model or specifically the faster R CNN model that we're going to build on is a model that simply detects these bounding boxes 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 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 is regular route. So in order to classify if whether or not this here it is a bus it might be very helpful to also look at this picture right here and see how 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 consider maybe you know this is the same thing so it's not a car. So this is not the same then 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 IID training data. And with animals as well like often the same animal has like its regular route or within these 10 these burst of tens the same 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 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 will 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 f or CNN this faster or CNN object detector that's an object detector 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 and stuff stuff stuff there stuff. Okay. 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 what 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. So it extracts these regions of interest and each region of interest gets features assigned to it. So well these are I think these are like seven by seven by 2048 features but let's just say for the sake of the 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. 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 dear right here. 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 not 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. So we're going to pimp these features by incorporating in because these features right now if we just do it 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 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 key frame. 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 key frame. And this you can see right here the current window around the key frame 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 key frame 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 one two three 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 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 this 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 then 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-trained it on cocoa and then fine-tune it on a detasque you're interested in in a single frame fashion in what for whatever way will 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 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 rcnn it's rcnn with long and short-term context so they describe very different ways of you know how they build the memory and so on how they build the features I didn't I kind of glossed over this right now there's a lot of consideration in building this 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 or these wildlife data sets whereas this cc I think this is the city something city cam this 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 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 um so they they do 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 to only if we only have self attention that means attention only into the current frame but of the 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 dataset and the short-term attention helps helps a lot in this data set if you just compare to the other owner these are two different metrics not datasets sorry about that um 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 time frame I think an entire month in this uh 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 uh 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 um the most attended two pictures are spread across the entire month and almost or 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 uh 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 the 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 uh 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 uh they visualize the top attention um where the top attention weights go in terms of how long the frames where the attention goes to is a way from the frame that they're trying to classify so on the 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 key frame 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 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 uh you're trying to classify the current frame and it kind of falls off as you go further and further away and this is across the entire data sets 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 um through the days so that means the model tends to pay attention to images that are from the same time of day uh compared to the current key frame that's 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 uh and the single frame detector wasn't able to recognize this but probably because it's you know 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 um it could correctly classify it well that's well um just disregard my drawings uh 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 um object poorly lit this is particularly impressive um 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 uh camera and by aggregating information from different frames you can see that maybe it's always the same patch of the deer that comes by and here the single frame detector detects this uh patch here as a vehicle where it shouldn't and of course the new modely context rcnn is able to recognize that this is present in all of the frames and in most frames the single the single object detector doesn't uh 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 frames 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 uh 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 um they have this this curve of on the bottom you have confidence uh threshold so how confident the model is and on the y axis you have the number of false positives and you can see that um in the low confidence regime the context r 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 um 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 r cnn and i like the text uh that they have to this um 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 r cnn and 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 these 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 i find that to be uh pretty pretty impressive and here you can see failure modes where they say for example when exploring the confident false positives on these snapshots are getting dataset um yada yada yada the three out of a hundred images so whatever was not uh fail human failure were were context r cnn and erroneously detected an animal where were 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 um across the frames uh to be said of course their train test split is such that uh there's not the same camera in the training data as in the testing data they have different different entirely different cameras uh 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 uh single frame object detector that has these two stages and you know it's a pretty neat idea to bring in context from uh from the past or even the future of the same camera uh 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 still worked the camera the system was still able to kind of uh do attention across this failure this kind of tipping over off the camera um they have more of examples right here which I find pretty impressive like these super low light um 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.74, "text": " Hi there, today we'll look at context R-CNN long-term temporal context for per camera object"}, {"start": 6.74, "end": 13.4, "text": " detection by Sarah Beery, Guan Huang Wu, Vivek Rathad, Ronnie Votel and Jonathan Huang."}, {"start": 13.4, "end": 19.96, "text": " So on a high level this paper tries to do object detection for cameras where the camera"}, {"start": 19.96, "end": 22.12, "text": " is in the same place for a long time."}, {"start": 22.12, "end": 27.080000000000002, "text": " For example these wild trap cameras or traffic cameras right here."}, {"start": 27.08, "end": 34.28, "text": " It proposes to do object detection by incorporating data from the images that the camera has seen"}, {"start": 34.28, "end": 39.16, "text": " in the past to help the detection in the current frame."}, {"start": 39.16, "end": 47.4, "text": " And it does so via an attention mechanism that it runs over a memory of past data."}, {"start": 47.4, "end": 52.86, "text": " So we're going to take a look at how this is done and how well it works and yes, take"}, {"start": 52.86, "end": 54.92, "text": " around if you want to know."}, {"start": 54.92, "end": 60.28, "text": " As always if you enjoy content like this then consider sharing it out, telling your friends"}, {"start": 60.28, "end": 66.68, "text": " about it, subscribe if you haven't and tell me what you think in the comments."}, {"start": 66.68, "end": 72.6, "text": " So the paper starts off and describes the problem and the problem is fairly simply, you"}, {"start": 72.6, "end": 75.2, "text": " want to do object detection in images."}, {"start": 75.2, "end": 80.36, "text": " Object detection is the task of basically if I give you an image you should tell me what"}, {"start": 80.36, "end": 82.0, "text": " 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": 92.64, "text": " On the bottom you would have to draw bounding boxes."}, {"start": 92.64, "end": 96.52, "text": " Maybe they have to be rectangular maybe not and say this is a bus."}, {"start": 96.52, "end": 103.48, "text": " And here is a truck and here is another truck and here is a car and so on."}, {"start": 103.48, "end": 106.44, "text": " So there can be many objects in an image."}, {"start": 106.44, "end": 107.72, "text": " There can be one object."}, {"start": 107.72, "end": 113.56, "text": " There can be objects of different classes or there can be no objects at all."}, {"start": 113.56, "end": 118.72, "text": " So this is just object detection and there have been many papers on this and specifically"}, {"start": 118.72, "end": 124.0, "text": " there has been this R CNN and this is the model that we're going to extend."}, {"start": 124.0, "end": 130.6, "text": " So the R CNN model or specifically the faster R CNN model that we're going to build on is"}, {"start": 130.6, "end": 138.24, "text": " a model that simply detects these bounding boxes in single images."}, {"start": 138.24, "end": 144.16, "text": " But now we consider the situation where we have a camera that records images for a long,"}, {"start": 144.16, "end": 145.88, "text": " long time."}, {"start": 145.88, "end": 153.48, "text": " So in these wild trap cameras they often sit there for months and it's not that easy"}, {"start": 153.48, "end": 160.04, "text": " to make use of them because in addition to there being a lot of data they have motion"}, {"start": 160.04, "end": 161.04, "text": " triggers."}, {"start": 161.04, "end": 166.23999999999998, "text": " So that could be there is no nothing for a long time and then there's the animal walks"}, {"start": 166.23999999999998, "end": 173.56, "text": " in the trap and then you have a bunch of images like one per second for 10 seconds and then"}, {"start": 173.56, "end": 178.28, "text": " you have nothing again for like a day or two days and then you have 10 images again because"}, {"start": 178.28, "end": 182.79999999999998, "text": " another animal walks in or maybe doesn't and so on and another."}, {"start": 182.79999999999998, "end": 185.84, "text": " So you have irregular sampling frequencies."}, {"start": 185.84, "end": 191.0, "text": " You have very, very different distance between the frames."}, {"start": 191.0, "end": 198.4, "text": " All of this makes it very, very not suited for models like temporal convolutions or things"}, {"start": 198.4, "end": 202.96, "text": " like LSTMs because they don't work super well with data like this."}, {"start": 202.96, "end": 210.36, "text": " Now I know there are formulations where LSTMs can do this but they don't work very well"}, {"start": 210.36, "end": 215.4, "text": " with these super long contexts and irregular sampling frequencies and so on."}, {"start": 215.4, "end": 222.16, "text": " So the idea is if we have a frame right here like this one and we want to detect what's"}, {"start": 222.16, "end": 228.52, "text": " on it we should be able to pull information from other frames that the same camera has"}, {"start": 228.52, "end": 235.20000000000002, "text": " seen like from this one or from this one or from this one right here and we should be"}, {"start": 235.20000000000002, "end": 237.04000000000002, "text": " able to do so in a dynamic way."}, {"start": 237.04000000000002, "end": 238.68, "text": " Now why could that help?"}, {"start": 238.68, "end": 244.32, "text": " If you look at for example down here these images have been taken they say images were"}, {"start": 244.32, "end": 251.56, "text": " taken on separate days but you can see this thing right here is in both images so or a"}, {"start": 251.56, "end": 256.68, "text": " very similar thing is probably that bus is regular route."}, {"start": 256.68, "end": 263.84, "text": " So in order to classify if whether or not this here it is a bus it might be very helpful"}, {"start": 263.84, "end": 269.36, "text": " to also look at this picture right here and see how you know it's about at the same location"}, {"start": 269.36, "end": 272.6, "text": " it looks the same and also it looks like a bus."}, {"start": 272.6, "end": 277.96000000000004, "text": " So you know that that kind of gives evidence that this could be this other thing could also"}, {"start": 277.96000000000004, "end": 279.44, "text": " be a bus."}, {"start": 279.44, "end": 286.88, "text": " Then also there are background objects so sometimes the single frame detectors get confused"}, {"start": 286.88, "end": 292.20000000000005, "text": " it might be labeling this here as a car because just the lighting the exact lighting in this"}, {"start": 292.20000000000005, "end": 298.44, "text": " picture is just off by the correct amount that it is confused but considering this picture"}, {"start": 298.44, "end": 302.36, "text": " over here maybe it recognizes here no that's not a car."}, {"start": 302.36, "end": 310.96000000000004, "text": " And it can bring over this evidence to that frame and consider maybe you know this is"}, {"start": 310.96000000000004, "end": 314.72, "text": " the same thing so it's not a car."}, {"start": 314.72, "end": 318.12, "text": " So this is not the same then simply adding training data."}, {"start": 318.12, "end": 323.76, "text": " We really consider the fact here that these images they come from the same camera that"}, {"start": 323.76, "end": 330.84000000000003, "text": " is in the same location or maybe you know that is filming the same thing."}, {"start": 330.84, "end": 338.03999999999996, "text": " So this all of this is going to be within the same camera not just adding IID training"}, {"start": 338.03999999999996, "end": 339.08, "text": " data."}, {"start": 339.08, "end": 345.35999999999996, "text": " And with animals as well like often the same animal has like its regular route or within"}, {"start": 345.35999999999996, "end": 352.64, "text": " these 10 these burst of tens the same animal will kind of walk around a bit and maybe you"}, {"start": 352.64, "end": 357.96, "text": " know here it's half occluded but maybe in a different image you see ah here I see the"}, {"start": 357.96, "end": 364.0, "text": " nose so it helps you make a better prediction."}, {"start": 364.0, "end": 370.88, "text": " Also animals are often in kind of crowds and that helps if you see that there are other"}, {"start": 370.88, "end": 377.56, "text": " deer around the probability that this is a deer increases rapidly."}, {"start": 377.56, "end": 382.88, "text": " So how are we going to do this what we're going to do is we're going to build an attention"}, {"start": 382.88, "end": 391.0, "text": " mechanism that can do these kinds of look into the past and some also a little bit of"}, {"start": 391.0, "end": 398.68, "text": " the future as we will see but mainly will look into other images from the same camera in"}, {"start": 398.68, "end": 405.52, "text": " a dynamic way and will learn how to address those other images from a memory bank."}, {"start": 405.52, "end": 410.71999999999997, "text": " So the architecture is described right here."}, {"start": 410.72, "end": 416.44000000000005, "text": " Now as you can see we are still in the business of doing object detection."}, {"start": 416.44000000000005, "end": 422.76000000000005, "text": " So what we'll do is we'll sort of hijack a existing object detector and the object detector"}, {"start": 422.76000000000005, "end": 429.56, "text": " we're going to hijack is going to be this f or CNN this faster or CNN object detector"}, {"start": 429.56, "end": 435.48, "text": " that's an object detector detector for a single frame problem."}, {"start": 435.48, "end": 440.04, "text": " So that means you have one image and you're supposed to detect what's on it."}, {"start": 440.04, "end": 442.24, "text": " It has two stages as you can see."}, {"start": 442.24, "end": 448.48, "text": " So stage one if you have an image and let's say there's some stuff on it and stuff stuff"}, {"start": 448.48, "end": 449.64000000000004, "text": " stuff there stuff."}, {"start": 449.64000000000004, "end": 450.88, "text": " Okay."}, {"start": 450.88, "end": 456.28000000000003, "text": " What stage one is supposed to do is it's supposed to extract regions of interest."}, {"start": 456.28000000000003, "end": 457.44, "text": " This could be okay."}, {"start": 457.44, "end": 460.12, "text": " All of these are regions of interest."}, {"start": 460.12, "end": 466.0, "text": " So it simply says what there is something there might be something right here in these regions"}, {"start": 466.0, "end": 467.56, "text": " of interest."}, {"start": 467.56, "end": 474.0, "text": " And then it describes each of these regions of interest using features."}, {"start": 474.0, "end": 479.48, "text": " So it extracts these regions of interest and each region of interest gets features assigned"}, {"start": 479.48, "end": 480.48, "text": " to it."}, {"start": 480.48, "end": 488.2, "text": " So well these are I think these are like seven by seven by 2048 features but let's just"}, {"start": 488.2, "end": 495.24, "text": " say for the sake of the of describing it that these are just a vector of features for"}, {"start": 495.24, "end": 496.48, "text": " each region of interest."}, {"start": 496.48, "end": 502.96000000000004, "text": " So each region of interest is going to be associated with one vector of features that this model"}, {"start": 502.96000000000004, "end": 505.52000000000004, "text": " extracts."}, {"start": 505.52000000000004, "end": 510.32, "text": " And the next region of interest also has a vector and the next region of interest also"}, {"start": 510.32, "end": 513.24, "text": " has a vector and so on."}, {"start": 513.24, "end": 522.04, "text": " Stage two then takes each one of these takes each one of these vectors and assigns a class"}, {"start": 522.04, "end": 523.04, "text": " to it."}, {"start": 523.04, "end": 525.48, "text": " So this would be dear right here."}, {"start": 525.48, "end": 529.0, "text": " So stage one proposes regions of interest along with features."}, {"start": 529.0, "end": 536.6800000000001, "text": " Then stage two takes each of these regions of interest and classifies them basically."}, {"start": 536.6800000000001, "end": 540.72, "text": " And I guess there's there's many in between stage like this is massively simplified."}, {"start": 540.72, "end": 542.24, "text": " There's not maximum suppression."}, {"start": 542.24, "end": 549.28, "text": " There is kind of an alignment stage where you can refine the the bounding box and so on."}, {"start": 549.28, "end": 555.36, "text": " But in essence these are two stages and you can see that this system here it goes in between"}, {"start": 555.36, "end": 556.36, "text": " the two stages."}, {"start": 556.36, "end": 562.28, "text": " So all of this right here we shove in between the two stages."}, {"start": 562.28, "end": 569.6, "text": " So we'll still use the stage one and we'll still use the stage two but in between in this"}, {"start": 569.6, "end": 575.28, "text": " thing right here we'll try to sort of pimp these features such that the stage two detector"}, {"start": 575.28, "end": 578.28, "text": " has an easier time classifying."}, {"start": 578.28, "end": 584.76, "text": " So we're going to pimp these features by incorporating in because these features right now if we"}, {"start": 584.76, "end": 588.84, "text": " just do it vanilla these are just from the current frame."}, {"start": 588.84, "end": 594.92, "text": " And we're going to add to them information from other frames of the same camera."}, {"start": 594.92, "end": 598.4399999999999, "text": " And we're going to do it in two different ways."}, {"start": 598.4399999999999, "end": 604.4, "text": " So the first way as you can see here the first way is this short term memory and the second"}, {"start": 604.4, "end": 607.84, "text": " way is the long term memory."}, {"start": 607.84, "end": 612.6, "text": " Now the two are slightly different as you can guess the short term memory is going to"}, {"start": 612.6, "end": 618.88, "text": " be only over a short time period around the current frame and the long term memory is"}, {"start": 618.88, "end": 625.12, "text": " going to be basically across a very long time horizon into the past."}, {"start": 625.12, "end": 631.5600000000001, "text": " You can see we're trying to classify this blue frame right here what we call the key frame."}, {"start": 631.5600000000001, "end": 634.08, "text": " So what we'll do is we'll run it through stage one."}, {"start": 634.08, "end": 635.08, "text": " Cool."}, {"start": 635.08, "end": 640.24, "text": " So we have features for each region of interest and then you can see this goes here and through"}, {"start": 640.24, "end": 645.6800000000001, "text": " these residual connections this goes into stage two over here."}, {"start": 645.6800000000001, "end": 652.32, "text": " So basically stage two still receives the same input it receives whatever stage one outputs"}, {"start": 652.32, "end": 653.84, "text": " for the key frame."}, {"start": 653.84, "end": 656.88, "text": " But we're going to add to that twice."}, {"start": 656.88, "end": 660.92, "text": " So we're going to add two things as I as I said."}, {"start": 660.92, "end": 665.08, "text": " So the short term memory is added right here."}, {"start": 665.08, "end": 668.36, "text": " Now how do we build the short term memory?"}, {"start": 668.36, "end": 673.84, "text": " We build the short term memory simply by considering all the frames around the key frame."}, {"start": 673.84, "end": 678.88, "text": " And this you can see right here the current window around the key frame which can be like"}, {"start": 678.88, "end": 684.5600000000001, "text": " one frame around it or two frames or three frames just a few frames around the current"}, {"start": 684.5600000000001, "end": 685.5600000000001, "text": " frame."}, {"start": 685.5600000000001, "end": 690.92, "text": " And this can be fairly helpful as we said for example if the deer moves a bit the car"}, {"start": 690.92, "end": 696.0, "text": " moves a bit you know it gets into a slightly different lighting and so on."}, {"start": 696.0, "end": 703.52, "text": " This can help us very much to classify the current key frame if we also have features"}, {"start": 703.52, "end": 705.56, "text": " from the surrounding frames."}, {"start": 705.56, "end": 713.32, "text": " So for each of these surrounding frames we also run them through the stage one detector"}, {"start": 713.32, "end": 721.48, "text": " to also extract regions of interest and that all of these features go into this memory"}, {"start": 721.48, "end": 723.8, "text": " short term memory bank right here."}, {"start": 723.8, "end": 728.24, "text": " There's different strategies you don't always have to extract all of the regions of interest."}, {"start": 728.24, "end": 734.56, "text": " You can also extract just the top one and so on or you can extract the mean since these"}, {"start": 734.56, "end": 737.92, "text": " are fairly you know consistent the cameras at the same place."}, {"start": 737.92, "end": 742.0, "text": " There are many ways you can do this but what you ultimately end up with is a short term"}, {"start": 742.0, "end": 751.0, "text": " memory bank that kind of is so you'll have a bank and you have lots of these feature"}, {"start": 751.0, "end": 757.96, "text": " vectors in here for your region your regions of interest of the surrounding frames."}, {"start": 757.96, "end": 764.2, "text": " Now if this here if this here is your half occluded deer right so this is the half occluded"}, {"start": 764.2, "end": 772.32, "text": " deer and you want to consider information from the surrounding frames maybe in the next"}, {"start": 772.32, "end": 777.92, "text": " frame so maybe this is three frames like one two three and two is the key frame maybe"}, {"start": 777.92, "end": 783.24, "text": " in the next frame the deer moves a bit and you see its nose and that this particular"}, {"start": 783.24, "end": 790.5999999999999, "text": " region of interest here is relevant so how do you know how do you now get from this entire"}, {"start": 790.5999999999999, "end": 798.0, "text": " memory this feature vector that would be helpful and the answer is you get it through an"}, {"start": 798.0, "end": 803.16, "text": " attention mechanism you can see that right here the way the short term memory is added"}, {"start": 803.16, "end": 808.88, "text": " is through this attention block they describe the attention block right here it is a fairly"}, {"start": 808.88, "end": 813.48, "text": " standard attention mechanism so I've done a video on attention is all you need if you"}, {"start": 813.48, "end": 820.6, "text": " don't know what an attention mechanism is go check it out but you can see it's it's very"}, {"start": 820.6, "end": 825.4, "text": " very standard so you have these input features which are the features that come from the"}, {"start": 825.4, "end": 831.16, "text": " key frame and you have the context features which are all the features in your memory"}, {"start": 831.16, "end": 837.9599999999999, "text": " bank you encode the input features with into a query using a fully connected layers and"}, {"start": 837.9599999999999, "end": 844.04, "text": " the context features into keys and then you you match the queries with the keys and the"}, {"start": 844.04, "end": 849.7199999999999, "text": " softmax in order to get a weighting over the context features and then you aggregate the"}, {"start": 849.7199999999999, "end": 855.76, "text": " values from the context features so this is a standard attention mechanism what does it"}, {"start": 855.76, "end": 863.52, "text": " mean it basically means that each of these vectors right here they will emit a key that"}, {"start": 863.52, "end": 870.3199999999999, "text": " kind of describes what kind of information is contained in that vector the vector over"}, {"start": 870.3199999999999, "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.8, "text": " order to describe what's in the region of interest as well as possible and then you simply"}, {"start": 882.8, "end": 889.76, "text": " match the query with the keys to determine which key fits best to that query and whichever"}, {"start": 889.76, "end": 896.24, "text": " one fits best let's say this one here then you take that vector from the memory bank and"}, {"start": 896.24, "end": 904.56, "text": " incorporate it together with your current information that you already have so that's how you"}, {"start": 904.56, "end": 913.3599999999999, "text": " address things that from other frames using an attention mechanism okay now if this were all"}, {"start": 913.3599999999999, "end": 919.92, "text": " you know we could train this right now we could train all of this because all of this is"}, {"start": 919.92, "end": 926.8, "text": " differentiable right this stage one detector right here is differentiable it goes here and here"}, {"start": 926.8, "end": 933.68, "text": " you know the information the attention mechanism is differentiable the stage two detector is"}, {"start": 933.68, "end": 939.52, "text": " differentiable all differentiable cool we can train this end to end now what's the problem the"}, {"start": 939.52, "end": 946.9599999999999, "text": " problem is this long-term memory right here so in this memory ideally we would want to fit let's"}, {"start": 946.9599999999999, "end": 953.5999999999999, "text": " say an entire day an entire week or even an entire month of data from one of these cameras and"}, {"start": 954.2399999999999, "end": 962.16, "text": " it's just not feasible that we expand this current window here to an entire month or an entire week"}, {"start": 962.16, "end": 968.0, "text": " for many of those of those cameras because even though they have a low frame rate and so on it's"}, {"start": 968.0, "end": 977.6, "text": " still too much in order to then be all differentiable all back propagatable and so on so we can't"}, {"start": 977.6, "end": 984.88, "text": " really back prop in for this long-term memory in essence what we want to do is exactly the same we"}, {"start": 984.88, "end": 992.96, "text": " want to build up a memory of all of the regions of interest or maybe selected regions or all of"}, {"start": 992.96, "end": 999.84, "text": " the best regions of interest whatever heuristic strategy we have of the past whatever this camera"}, {"start": 999.84, "end": 1004.88, "text": " has seen let's say in the last month or in the current week or something like this we want to"}, {"start": 1004.88, "end": 1011.6, "text": " build all of this up and then use an attention mechanism just the same in order to incorporate it"}, {"start": 1011.6, "end": 1019.6, "text": " but we we have to come up with these things right here in some other way then a way where we can"}, {"start": 1019.6, "end": 1027.84, "text": " back prop so we can't really use this stage one detector right here because this is this is the"}, {"start": 1027.84, "end": 1033.44, "text": " one we're training and so we have to back prop through it now an easy proposal is to simply use it"}, {"start": 1033.44, "end": 1040.48, "text": " anyway but do like a stop gradient on it so we don't back prop through it that is one way but this"}, {"start": 1040.48, "end": 1048.64, "text": " the paper decides on a different way the paper decides that all of the all of the past basically"}, {"start": 1048.64, "end": 1055.68, "text": " right here right here and so on we'll take a pre-trained object detector so not the one we're"}, {"start": 1055.68, "end": 1062.88, "text": " training currently but we'll take take a pre-trained one that was pre-trained either on something like"}, {"start": 1062.88, "end": 1069.84, "text": " cocoa which is an object detection data set or you can pre-trained it on cocoa and then fine-tune it"}, {"start": 1069.84, "end": 1075.9199999999998, "text": " on a detasque you're interested in in a single frame fashion in what for whatever way will take a"}, {"start": 1075.9199999999998, "end": 1085.36, "text": " pre-trained object detector or region of interest extractor and that will give us for each frame in"}, {"start": 1085.36, "end": 1094.1599999999999, "text": " the past will give us also the regions of interest along with the features okay and these are the"}, {"start": 1094.16, "end": 1103.3600000000001, "text": " features that we then go and put into put into the memory bank sorry my tablet just crashed a bit"}, {"start": 1103.3600000000001, "end": 1112.48, "text": " there we go okay so we'll take a pre-trained extractor right here that will give us features for"}, {"start": 1112.48, "end": 1118.0, "text": " regions of interest we'll put that into the memory bank and then we will use an attention mechanism"}, {"start": 1118.0, "end": 1125.6, "text": " to incorporate it now the attention mechanism we can train but we cannot train the extractor"}, {"start": 1125.6, "end": 1131.36, "text": " for the features and this is the difference to the short-term memory where we can actually train"}, {"start": 1131.36, "end": 1137.92, "text": " the feature extractor in order to help us with you know building the memory now the memory is"}, {"start": 1137.92, "end": 1145.6, "text": " simply built without a goal in mind basically and the attention mechanism basically has to learn"}, {"start": 1145.6, "end": 1152.1599999999999, "text": " that it doesn't work with features that are meant for its task it works with features that have been"}, {"start": 1152.1599999999999, "end": 1158.24, "text": " originally created for a different tasks and they're not going to change but as we'll see this"}, {"start": 1158.24, "end": 1166.32, "text": " you know can be handled so that's what they do they incorporate short-term and long-term memory"}, {"start": 1166.32, "end": 1171.1999999999998, "text": " into their stage two prediction and then the stage two prediction simply takes in all of those"}, {"start": 1171.2, "end": 1179.8400000000001, "text": " features and classifies the class of the object and that's the architecture of context rcnn it's"}, {"start": 1179.8400000000001, "end": 1189.28, "text": " rcnn with long and short-term context so they describe very different ways of you know how they"}, {"start": 1189.28, "end": 1195.44, "text": " build the memory and so on how they build the features I didn't I kind of glossed over this right"}, {"start": 1195.44, "end": 1201.8400000000001, "text": " now there's a lot of consideration in building this thing and you have to look at the paper how"}, {"start": 1202.56, "end": 1208.8, "text": " they exactly do this I'm more interested in the high-level architecture and the sort of ideas behind"}, {"start": 1208.8, "end": 1219.2, "text": " it so when they do this they do outperform the they do outperform the current or the single frame"}, {"start": 1219.2, "end": 1226.96, "text": " baselines by quite a bit so this SS and this cct or these wildlife data sets whereas this cc I think"}, {"start": 1226.96, "end": 1236.0, "text": " this is the city something city cam this are this street data set as you can see they do outperform"}, {"start": 1236.0, "end": 1242.16, "text": " the single frame baseline by quite a bit now interesting as you can see right here as they"}, {"start": 1242.16, "end": 1250.0800000000002, "text": " increase the time horizon of this long-term memory so they they can now choose how much information"}, {"start": 1250.0800000000002, "end": 1256.5600000000002, "text": " do they want to put in that long-term memory as they increase the time horizon for one minute one"}, {"start": 1256.5600000000002, "end": 1264.16, "text": " hour one day and so on the performance goes up and up and up which is you know a strong indication"}, {"start": 1264.16, "end": 1269.76, "text": " that these features actually help from the from the time horizon because you don't have more"}, {"start": 1269.76, "end": 1279.6, "text": " parameters you simply increase the amount of information in the memory bank and if the performance"}, {"start": 1279.6, "end": 1285.92, "text": " goes up you can make a very strong claim that these these this is actually due to the fact that"}, {"start": 1285.92, "end": 1291.36, "text": " you have more information in that memory bank couldn't really guess any other explanation right here"}, {"start": 1291.36, "end": 1300.0, "text": " um so they they do they do investigate different memory strategies they do a lot of ablations"}, {"start": 1300.0, "end": 1306.32, "text": " right here where they also say okay what if we only have the short-term attention what if we only"}, {"start": 1306.32, "end": 1311.9199999999998, "text": " have the long-term attention what to only if we only have self attention that means attention only"}, {"start": 1311.9199999999998, "end": 1317.9199999999998, "text": " into the current frame but of the across regions of interest that's interesting if you have like a"}, {"start": 1317.92, "end": 1324.0800000000002, "text": " herd of animals and so on and they all help but as you can see the long-term attention tends to"}, {"start": 1324.0800000000002, "end": 1332.16, "text": " help the most in this dataset and the short-term attention helps helps a lot in this data set if"}, {"start": 1332.16, "end": 1338.3200000000002, "text": " you just compare to the other owner these are two different metrics not datasets sorry about that"}, {"start": 1338.32, "end": 1347.9199999999998, "text": " um but in essence it helps the most when you combine the two and that's you know that's pretty"}, {"start": 1347.9199999999998, "end": 1358.0, "text": " cool to see so they do some qualitative results which I find very interesting for example they"}, {"start": 1358.0, "end": 1366.3999999999999, "text": " can visualize what the attention weights of their models are so here you always have a very long"}, {"start": 1366.4, "end": 1374.8000000000002, "text": " time frame I think an entire month in this uh in this memory bank of the long-term memory now in"}, {"start": 1374.8000000000002, "end": 1380.3200000000002, "text": " the top classification you see the large thing here the large frame is the one you actually want"}, {"start": 1380.3200000000002, "end": 1389.0400000000002, "text": " to classify and the other frames are the frames where the top attention score is uh so that the"}, {"start": 1389.04, "end": 1397.68, "text": " attention weights are the highest so here in order to classify this what does the model pay attention"}, {"start": 1397.68, "end": 1402.3999999999999, "text": " to or which other frames does the model pay attention to and you can see right here"}, {"start": 1403.6, "end": 1410.32, "text": " they are all spread across the entire month here is the timeline um the most attended two"}, {"start": 1410.32, "end": 1415.84, "text": " pictures are spread across the entire month and almost or all of them actually have that war"}, {"start": 1415.84, "end": 1425.76, "text": " talk in here so this must be like its regular route and the model recognizes that and pulls in"}, {"start": 1425.76, "end": 1433.76, "text": " information from all these other images in order to correctly classify it here on the other hand"}, {"start": 1433.76, "end": 1446.72, "text": " uh on the next example this gazelle and tablet crashed right here it also puts all the all the weight"}, {"start": 1447.44, "end": 1453.52, "text": " on top of the of images of that same gazelle but you can see maybe that gazelle was only there"}, {"start": 1453.52, "end": 1461.04, "text": " for this one particular moment and all the pictures the camera has of it is you know in the very"}, {"start": 1461.04, "end": 1467.92, "text": " few moments that the gazelle was around you can see they all come here from the same uh point in time"}, {"start": 1467.92, "end": 1477.04, "text": " or very very close points in time and you can see that it puts a lot of weight on wherever the gazelle is"}, {"start": 1477.04, "end": 1481.84, "text": " so you know that's a pretty strong indication that it actually learns to pull in the correct"}, {"start": 1481.84, "end": 1487.52, "text": " information be that from long time horizon or from a short time horizon if necessary"}, {"start": 1487.52, "end": 1497.36, "text": " you can also see right here uh they visualize the top attention um where the top attention"}, {"start": 1497.36, "end": 1506.6399999999999, "text": " weights go in terms of how long the frames where the attention goes to is a way from the frame"}, {"start": 1506.6399999999999, "end": 1513.76, "text": " that they're trying to classify so on the these graphics are somewhat kind of weird to interpret"}, {"start": 1513.76, "end": 1521.44, "text": " this here always means how much is the total time of the buffer so the memory buffer here contains"}, {"start": 1521.44, "end": 1528.8, "text": " always pictures from the total from one hour before until one hour after the key frame you want"}, {"start": 1528.8, "end": 1535.04, "text": " to classify so this is the frame you want to classify at minute zero and the memory buffer contains"}, {"start": 1535.6, "end": 1542.4, "text": " images from 60 minutes before to 60 minutes after so it's it's not real time right you go back"}, {"start": 1542.4, "end": 1547.8400000000001, "text": " to your through your footage and you try to classify so you can also pull out images from the future"}, {"start": 1549.52, "end": 1554.64, "text": " you can see there's most attention is on the current frame which makes sense uh you're trying to"}, {"start": 1554.64, "end": 1559.68, "text": " classify the current frame and it kind of falls off as you go further and further away"}, {"start": 1560.48, "end": 1565.2800000000002, "text": " and this is across the entire data sets so this is not a specific example which also makes sense"}, {"start": 1565.28, "end": 1572.8, "text": " probably in most of the time the relevant information is you know next closer in time rather than"}, {"start": 1572.8, "end": 1579.12, "text": " farther away but also you can see that the distribution is pretty spread out so it makes the"}, {"start": 1579.12, "end": 1584.8799999999999, "text": " model makes use of the entire range of time and you can see that throughout even if you have an"}, {"start": 1584.8799999999999, "end": 1590.3999999999999, "text": " entire day in the buffer or two days even if you have entire week before and week after in the"}, {"start": 1590.4, "end": 1598.16, "text": " buffer and even if you have an entire month here and especially if you look at when you have an"}, {"start": 1598.16, "end": 1607.6000000000001, "text": " entire week in the buffer you can see the periodicity um through the days so that means the model tends to"}, {"start": 1607.6000000000001, "end": 1614.8000000000002, "text": " pay attention to images that are from the same time of day uh compared to the current key frame"}, {"start": 1614.8, "end": 1622.32, "text": " that's fairly fairly good indication that the model has actually learned to address these this"}, {"start": 1622.32, "end": 1627.76, "text": " memory by its content right now night and day isn't super difficult because you can just go"}, {"start": 1628.48, "end": 1633.84, "text": " on the brightness and so on but still it's pretty cool to see that this is actually happening"}, {"start": 1634.96, "end": 1642.1599999999999, "text": " they do have some failure cases of the single frame model that their model is able to handle up here"}, {"start": 1642.16, "end": 1651.1200000000001, "text": " and they make a lot of sense so here you can see that there's an object that's moving out of frame"}, {"start": 1651.1200000000001, "end": 1658.8000000000002, "text": " uh and the single frame detector wasn't able to recognize this but probably because it's"}, {"start": 1658.8000000000002, "end": 1665.1200000000001, "text": " you know moving out of frame whereas this new this context rcnn is able to detect it probably"}, {"start": 1665.1200000000001, "end": 1670.96, "text": " because it looked at the frame just before it where the car was somewhere back here and um"}, {"start": 1670.96, "end": 1677.6000000000001, "text": " it could correctly classify it well that's well um just disregard my drawings"}, {"start": 1678.88, "end": 1686.88, "text": " uh here it managed to recognize this animal in the back whereas this old model the single frame"}, {"start": 1686.88, "end": 1695.6000000000001, "text": " model hasn't also probably by looking either at frames next to it or by looking at other frames of"}, {"start": 1695.6, "end": 1703.6799999999998, "text": " herds of animals and realizing that usually when there's two elephants there's more here you can"}, {"start": 1703.6799999999998, "end": 1709.52, "text": " see that the object highly occluded so we're talking about the object like at the very edge of the"}, {"start": 1709.52, "end": 1718.9599999999998, "text": " frame um object poorly lit this is particularly impressive um and also an example where the animals"}, {"start": 1718.9599999999998, "end": 1724.6399999999999, "text": " are often in herds and if you see one deer the likelihood that there's other deer"}, {"start": 1724.64, "end": 1732.16, "text": " is very high in this particular uh camera and by aggregating information from different frames"}, {"start": 1732.16, "end": 1736.4, "text": " you can see that maybe it's always the same patch of the deer that comes by"}, {"start": 1737.44, "end": 1745.76, "text": " and here the single frame detector detects this uh patch here as a vehicle where it shouldn't"}, {"start": 1745.76, "end": 1752.48, "text": " and of course the new modely context rcnn is able to recognize that this is present in all of the"}, {"start": 1752.48, "end": 1761.44, "text": " frames and in most frames the single the single object detector doesn't uh detect it as a vehicle"}, {"start": 1761.44, "end": 1768.24, "text": " and so it can kind of carry over that information now you can already see sort of what the downsides"}, {"start": 1768.24, "end": 1775.52, "text": " might be if the single object detector is like very very very sure that this is in in a single frame"}, {"start": 1775.52, "end": 1782.08, "text": " that this is a car it could carry over that information to the other frames so even though the"}, {"start": 1782.08, "end": 1788.56, "text": " single frame detector might have failed in that particular frame if it fails super hard it might"}, {"start": 1788.56, "end": 1792.6399999999999, "text": " you know shout that to all the other frames basically dominate the memory saying like look this"}, {"start": 1792.6399999999999, "end": 1800.72, "text": " is a car i'm like pretty sure uh and it will carry over that information to all of the other"}, {"start": 1800.72, "end": 1808.24, "text": " frames and they say in one of the in one of these high confidence mistakes it basically detected"}, {"start": 1808.24, "end": 1816.0, "text": " the same tree as a giraffe over and over again what i find particularly interesting is they do"}, {"start": 1816.0, "end": 1825.84, "text": " look at so here um they have this this curve of on the bottom you have confidence uh threshold so"}, {"start": 1825.84, "end": 1834.16, "text": " how confident the model is and on the y axis you have the number of false positives and you can see"}, {"start": 1834.16, "end": 1842.72, "text": " that um in the low confidence regime the context r cnn has lower false positives than the"}, {"start": 1842.72, "end": 1849.68, "text": " single frame detector and the green line here is when you only have positive boxes so when you"}, {"start": 1849.68, "end": 1858.16, "text": " only include um regions of interest where there is an actual object which in this case is sort of"}, {"start": 1858.16, "end": 1864.24, "text": " hurtful you also want the regions of interest where there is nothing because that helps you avoid"}, {"start": 1864.96, "end": 1870.16, "text": " false positives in other frames that's why the orange line is below the green line but strangely"}, {"start": 1870.16, "end": 1877.2, "text": " here in the high confidence regime you can see that the single frame model has fewer false positives"}, {"start": 1877.2, "end": 1886.0800000000002, "text": " than the context r cnn and i like the text uh that they have to this um in figure seven we can see"}, {"start": 1886.08, "end": 1891.12, "text": " that adding empty representations reduces the number of false positives across all confidence"}, {"start": 1891.12, "end": 1896.8, "text": " threshold compared to the same model with only positive representations we investigated the"}, {"start": 1896.8, "end": 1903.4399999999998, "text": " 100 highest confidence false positives from context r cnn and and found that in almost all of them"}, {"start": 1903.4399999999998, "end": 1910.08, "text": " in 97 out of 100 the model had correctly found and classified animals that were missed by human"}, {"start": 1910.08, "end": 1921.12, "text": " annotators so basically these these these graphs are even underestimating how good that model is"}, {"start": 1921.12, "end": 1928.96, "text": " because the model is seems appears to be better than the human annotators of the test set i find that"}, {"start": 1928.96, "end": 1937.28, "text": " i find that to be uh pretty pretty impressive and here you can see failure modes where they say for"}, {"start": 1937.28, "end": 1943.04, "text": " example when exploring the confident false positives on these snapshots are getting dataset um"}, {"start": 1943.76, "end": 1950.08, "text": " yada yada yada the three out of a hundred images so whatever was not uh fail human failure"}, {"start": 1950.08, "end": 1957.76, "text": " were were context r cnn and erroneously detected an animal where were all of the same tree"}, {"start": 1957.76, "end": 1964.6399999999999, "text": " highly confidently predicted to be a giraffe so this is a failure mode when when the model is"}, {"start": 1964.64, "end": 1970.8000000000002, "text": " highly confident it might spill that over to other frames because he we now aggregate the"}, {"start": 1970.8000000000002, "end": 1979.2800000000002, "text": " information within the same camera um across the frames uh to be said of course their train"}, {"start": 1979.2800000000002, "end": 1984.8000000000002, "text": " test split is such that uh there's not the same camera in the training data as in the testing"}, {"start": 1984.8000000000002, "end": 1991.2, "text": " data they have different different entirely different cameras uh in the testing data than in the"}, {"start": 1991.2, "end": 1999.52, "text": " training data just so there is no information leakage yeah so that is the that's the model right here"}, {"start": 2000.16, "end": 2006.96, "text": " how it works it's it's pretty cool it kind of wedges itself in between any uh single frame object"}, {"start": 2006.96, "end": 2013.2, "text": " detector that has these two stages and you know it's a pretty neat idea to bring in context from"}, {"start": 2013.2, "end": 2021.52, "text": " uh from the past or even the future of the same camera uh just a quick glance at the appendix they"}, {"start": 2021.52, "end": 2026.8, "text": " have lots of different examples right here in one example their camera kind of fell over and they"}, {"start": 2026.8, "end": 2034.24, "text": " say well it still worked the camera the system was still able to kind of uh do attention across this"}, {"start": 2034.24, "end": 2042.64, "text": " failure this kind of tipping over off the camera um they have more of examples right here which"}, {"start": 2042.64, "end": 2050.1600000000003, "text": " I find pretty impressive like these super low light um things where it correctly detects like the"}, {"start": 2050.1600000000003, "end": 2059.04, "text": " possum and yeah I invite you to check out the paper the code they say should be out soon and"}, {"start": 2059.04, "end": 2074.0, "text": " I'll see you next time bye bye"}] |
Yannic Kilcher | 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 Julia Lone, Jakob Opoli, François Bonifass and Floron Crizacala. So this paper on a high level it replaces the back propagation 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 back prop on modern deep learning tasks. This paper as I understand is the first one to demonstrate that it can do that. So this is very much an engineering paper and 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 back propagation 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 is you know essential otherwise how are you gonna hear from me in the future. Okay let's dive in they say despite being the work course of deep learning the back propagation 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 are findings show that it successfully trains a large range of state-of-the-art deep learning architectures with performance close to fine tuned back propagation 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 back propagation back propagation they have they have two corals right here first of all it's preventing efficient parallelization of the training process so what does that mean so in back propagation I'm pretty sure you all know basic back propagation but you have an input to a neural network and the neural network is 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 dataset 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 back propagation 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 back propagation that means you can take that loss and you can back propagate it down the layers in order to update each layer individually so the first problem they have here with the back propagation 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 back propagation isn't biologically plausible we know that in real neurons you have your your dendrites your inputs and your of 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 back propagation there's no nothing in the brain that would take the role of the back propagation algorithm specifically if each layer is characterized by a weight matrix right here what back propagation 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 law 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 analogy 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 WX plus B and then a nonlinearity it cannot even though you can write the 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 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 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 for feet forward layers fully connected layers you're going to lose already so yeah it's it's kind of an unfair fight in that in that sense but even an absence of that they say we apply this to neural view synthesis recommend their systems geometric learning and natural language processing so these are quite diverse tasks and they're going to be quite diverse architectures that they are applying it to for example in geometric learning I believe they do graph neural networks and there they replace 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 their your algorithm can shine okay so that's it and they basically going to show that this is performance is close to fine tuned back propagation alright 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 our not not blunt sorry not blunt and 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 backprop 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 gonna 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 gonna 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 a 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 let the change to the top layer so how do I need to change the top layer and it back propagates that in this global fashion to all the layers directly using random matrices okay and then this IFA we're not gonna 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 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 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 logits and that's the output of your last layer so if 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'll 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 how 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, Jack's 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 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 back prop 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 layers 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 back prop 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 gonna change the output of the layer into the direction of that green part now in back propagation the green part basically tells you how should the output of this layer change in order to make the loss as 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 log it's layer right what does it actually do let's say we had 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 see the class label equals zero this might be see equals one this might be see 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 see 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 so it's 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 B.I. matrix you fix it right this is really important you fix it at the beginning of trainings 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 you 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 around the matrix we don't know we know that the angle is approximately preserved okay but you know 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 in out 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 vectors 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 and if I consider now the red and the blue vector in this space right let's I just draw them at random like so okay what I do know actually that's that's for consistent 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 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 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 are now the things in the same class are already together pretty okay now you map it through a weight and then on the narity they might you know intertwine a bit again but they're they're 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 gonna 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 back prop and also in DFA is better and better so the reason why back prop is good maybe it's just that because it also really induces clustering like this I don't know maybe back prop does even does something on top of that because I mean back prop 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 back propagation 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 on a level that hasn't been seen before so here if you consider these results higher as better on the synthetic dataset here even you see that if you have the same model with back prop 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 back propagation 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 apply this to transformers and as I said it's 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 back prop within the attention mechanism but it is much more of a plausible algorithm than the back propagation 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 performed at least with this macro strategy now this is nowhere close to this is nowhere close to what the to what the back propagation 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 back propagation then probably will make a lot of like we could we could push this to a place where it does perform on par with back prop or very close to it so I do invite you to go and look at the experiments they have a lot of a lot of details on how they did it and exactly 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 it is respected 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'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 can be completely wrong or you know I yeah or this could be like well known to people already so yeah see you next time | [{"start": 0.0, "end": 4.72, "text": " Hi there! Today we'll look at direct feedback alignment scales to modern"}, {"start": 4.72, "end": 10.72, "text": " deep learning tasks and architectures by Julia Lone, Jakob Opoli, Fran\u00e7ois Bonifass"}, {"start": 10.72, "end": 16.92, "text": " and Floron Crizacala. So this paper on a high level it replaces the back"}, {"start": 16.92, "end": 21.56, "text": " propagation algorithm in deep learning architectures with this algorithm called"}, {"start": 21.56, "end": 27.04, "text": " direct feedback alignment which is more biologically plausible. The algorithm"}, {"start": 27.04, "end": 31.48, "text": " has been around for a while but it hasn't yet been shown to be applicable to"}, {"start": 31.48, "end": 37.32, "text": " really modern big deep learning architectures and then perform on par with"}, {"start": 37.32, "end": 42.6, "text": " back prop on modern deep learning tasks. This paper as I understand is the first"}, {"start": 42.6, "end": 48.08, "text": " one to demonstrate that it can do that. So this is very much an engineering paper"}, {"start": 48.08, "end": 55.76, "text": " and applied paper and we're going to mostly go into direct feedback alignment"}, {"start": 55.76, "end": 60.32, "text": " as such and I don't think we're going to go too much into what the actual"}, {"start": 60.32, "end": 65.64, "text": " empirical findings are because they even though they're impressive and it's a"}, {"start": 65.64, "end": 70.6, "text": " good piece of engineering I think they can be summarized pretty much by it it"}, {"start": 70.6, "end": 76.28, "text": " works not yet on par with back propagation but into a promising direction."}, {"start": 76.28, "end": 82.52, "text": " Alright as always if you like content like this consider sharing it out and"}, {"start": 82.52, "end": 88.11999999999999, "text": " leaving a like and tell me in the comments what you like of course subscribe if"}, {"start": 88.11999999999999, "end": 94.96, "text": " you aren't yet that is you know essential otherwise how are you gonna hear"}, {"start": 94.96, "end": 100.24, "text": " from me in the future. Okay let's dive in they say despite being the work"}, {"start": 100.24, "end": 104.52, "text": " course of deep learning the back propagation algorithm is no panacea it"}, {"start": 104.52, "end": 108.96, "text": " enforces sequential layer updates thus preventing efficient parallelization of"}, {"start": 108.96, "end": 113.6, "text": " the training process furthermore its biological plausibility is being"}, {"start": 113.6, "end": 118.88, "text": " challenged alternative schemes have been devised yet under the constraints of"}, {"start": 118.88, "end": 123.44, "text": " synaptic asymmetry none have scaled to modern deep learning tasks and"}, {"start": 123.44, "end": 128.68, "text": " architectures. Here we challenge this perspective and study the applicability"}, {"start": 128.68, "end": 133.88, "text": " of direct feedback alignment to neural view synthesis recommender systems"}, {"start": 133.88, "end": 139.72, "text": " geometric learning and natural language processing in contrast with previous"}, {"start": 139.72, "end": 143.88, "text": " studies limited to computer vision tasks are findings show that it"}, {"start": 143.88, "end": 147.12, "text": " successfully trains a large range of state-of-the-art deep learning"}, {"start": 147.12, "end": 152.0, "text": " architectures with performance close to fine tuned back propagation at"}, {"start": 152.0, "end": 157.51999999999998, "text": " variance with common beliefs our work supports that challenging tasks can be"}, {"start": 157.51999999999998, "end": 162.76, "text": " tackled in the absence of weight transport so there's a lot to unpack in this"}, {"start": 162.76, "end": 168.88, "text": " particular abstract right here so first of all what's the problem with back"}, {"start": 168.88, "end": 174.07999999999998, "text": " propagation back propagation they have they have two corals right here first of"}, {"start": 174.07999999999998, "end": 180.12, "text": " all it's preventing efficient parallelization of the training process so what"}, {"start": 180.12, "end": 186.16, "text": " does that mean so in back propagation I'm pretty sure you all know basic back"}, {"start": 186.16, "end": 189.79999999999998, "text": " propagation but you have an input to a neural network and the neural network is"}, {"start": 189.8, "end": 194.36, "text": " a bunch of layers so the input will travel layer by layer and at the end you'll"}, {"start": 194.36, "end": 199.28, "text": " get some output and your output y hat let's call it here what the neural network"}, {"start": 199.28, "end": 204.64000000000001, "text": " thinks the let's say it's a classifier thinks that the class of this particular"}, {"start": 204.64000000000001, "end": 209.84, "text": " x should be now in the dataset you have your true label and then you compare"}, {"start": 209.84, "end": 217.72000000000003, "text": " that to your output label and you can compute a loss function now the whole"}, {"start": 217.72, "end": 221.56, "text": " question of the back propagation algorithm is how do I need to change my"}, {"start": 221.56, "end": 226.04, "text": " layers of the neural network in order to make the loss as small as possible and"}, {"start": 226.04, "end": 230.68, "text": " for that you can use back propagation that means you can take that loss and you"}, {"start": 230.68, "end": 237.24, "text": " can back propagate it down the layers in order to update each layer individually"}, {"start": 237.24, "end": 241.44, "text": " so the first problem they have here with the back propagation algorithm and"}, {"start": 241.44, "end": 246.6, "text": " it's not I mean it's kind of a secondary problem but it is that is sequential so"}, {"start": 246.6, "end": 251.32, "text": " in order to update this layer right here you need to have already back"}, {"start": 251.32, "end": 255.84, "text": " propagated to this layer and then you need to back propagate further to this"}, {"start": 255.84, "end": 260.56, "text": " and to this layer so it's a sequential task you need to back propagate down the"}, {"start": 260.56, "end": 266.64, "text": " layers again whereas what is more plausible but what would be more efficient if"}, {"start": 266.64, "end": 271.56, "text": " if we could somehow update all the layers in parallel but this is a minor"}, {"start": 271.56, "end": 277.4, "text": " quarrel the bigger one is that back propagation isn't biologically plausible we"}, {"start": 277.4, "end": 282.96, "text": " know that in real neurons you have your your dendrites your inputs and your"}, {"start": 282.96, "end": 289.24, "text": " of your axon and the signal only travels in one direction we don't know of a"}, {"start": 289.24, "end": 293.92, "text": " feedback mechanism in true neurons in the brain that would allow for"}, {"start": 293.92, "end": 299.04, "text": " information sort of to flow in the opposite direction there is there is"}, {"start": 299.04, "end": 302.52000000000004, "text": " information flowing the opposite direction but it's it's I guess I think it's"}, {"start": 302.52000000000004, "end": 310.68, "text": " too slow and it's so it's not really it can't be there's no analogous way of"}, {"start": 310.68, "end": 316.28000000000003, "text": " back propagation there's no nothing in the brain that would take the role of"}, {"start": 316.28000000000003, "end": 321.88, "text": " the back propagation algorithm specifically if each layer is characterized by a"}, {"start": 321.88, "end": 329.96, "text": " weight matrix right here what back propagation does is it uses the"}, {"start": 329.96, "end": 337.36, "text": " transpose of that weight matrix to back propagate so these these arrows to the"}, {"start": 337.36, "end": 343.6, "text": " front right here they use the weight matrices and these arrows to the back they"}, {"start": 343.6, "end": 348.15999999999997, "text": " use the transposes of the weight matrices so the transposes of the weight"}, {"start": 348.16, "end": 354.28000000000003, "text": " matrices sort of relay the information of what needs to change that would be"}, {"start": 354.28000000000003, "end": 359.08000000000004, "text": " the law what needs to change to make the loss as small as possible they relay"}, {"start": 359.08000000000004, "end": 365.40000000000003, "text": " this information down to the other layers and we don't know of any biological"}, {"start": 365.40000000000003, "end": 371.0, "text": " analogy analogy to this mechanism right here this transpose it acts as sort of a"}, {"start": 371.0, "end": 378.72, "text": " layer inverse and that is called weight transport so weight transport means that"}, {"start": 378.72, "end": 383.52, "text": " you can you can do something like the transpose of the weights basically to"}, {"start": 383.52, "end": 389.96, "text": " carry to bring information from the next layer back to this layer and in"}, {"start": 389.96, "end": 394.56, "text": " biology we don't have this and in direct feedback alignment we don't have"}, {"start": 394.56, "end": 399.72, "text": " this either so direct feedback alignment the next thing here in this abstract is"}, {"start": 399.72, "end": 404.88000000000005, "text": " the algorithm that they are going to apply here direct feedback alignment and"}, {"start": 404.88000000000005, "end": 409.92, "text": " we'll go into what it is but it is more biologically plausible in that what it"}, {"start": 409.92, "end": 415.92, "text": " does is it takes the loss somehow and it distributes it globally to all of"}, {"start": 415.92, "end": 423.24, "text": " these layers like this and it does so without requiring these transposes and"}, {"start": 423.24, "end": 428.76000000000005, "text": " also without requiring these sequential steps so both of their proposed"}, {"start": 428.76, "end": 439.4, "text": " problems here would be solved by this they say they say that in contrast with"}, {"start": 439.4, "end": 443.71999999999997, "text": " previous studies limited to computer vision tasks so what people have tried to"}, {"start": 443.71999999999997, "end": 451.84, "text": " do is they have tried to apply this DFA algorithm to computer vision tasks but"}, {"start": 451.84, "end": 457.2, "text": " in computer vision most architectures are CNNs and as I understand it as far"}, {"start": 457.2, "end": 463.64, "text": " as I understand it DFA can only right now be applied to linear layers so"}, {"start": 463.64, "end": 470.71999999999997, "text": " something that is WX plus B and then a nonlinearity it cannot even though you"}, {"start": 470.71999999999997, "end": 476.2, "text": " can write the CNN as like a linear layer with constraints as I read this"}, {"start": 476.2, "end": 481.71999999999997, "text": " paper I think to interpret that you can only apply DFA to fully connected"}, {"start": 481.71999999999997, "end": 486.84, "text": " layers or things that look kind of like fully connected layers so what they're"}, {"start": 486.84, "end": 489.88, "text": " going to do in their experiments is they're going to take these big architectures"}, {"start": 489.88, "end": 496.0, "text": " like transformers and replace parts of them with the parts that act as fully"}, {"start": 496.0, "end": 501.44, "text": " connected layers with with DFA updates so well they're not going to replace the"}, {"start": 501.44, "end": 505.2, "text": " layers but they're going to replace the back propagation part of it with DFA"}, {"start": 505.2, "end": 510.55999999999995, "text": " updates remains to say that they still use back propagation at some places where"}, {"start": 510.55999999999995, "end": 516.6, "text": " they can't replace the updates with DFA and that means where the layer isn't"}, {"start": 516.6, "end": 520.76, "text": " you know a fully connected layer or I guess it's too big they they somehow have to"}, {"start": 520.76, "end": 524.36, "text": " make it work so often they will not update for example the embedding layers and"}, {"start": 524.36, "end": 530.36, "text": " things like this okay so what they're saying is they go away from computer"}, {"start": 530.36, "end": 535.8000000000001, "text": " vision tasks because if you go to computer vision and CNNs rule that world"}, {"start": 535.8000000000001, "end": 542.1600000000001, "text": " right you can only do for feet forward layers fully connected layers you're"}, {"start": 542.16, "end": 548.76, "text": " going to lose already so yeah it's it's kind of an unfair fight in that in"}, {"start": 548.76, "end": 554.4399999999999, "text": " that sense but even an absence of that they say we apply this to neural view"}, {"start": 554.4399999999999, "end": 559.36, "text": " synthesis recommend their systems geometric learning and natural language"}, {"start": 559.36, "end": 562.36, "text": " processing so these are quite diverse tasks and they're going to be quite"}, {"start": 562.36, "end": 566.36, "text": " diverse architectures that they are applying it to for example in geometric"}, {"start": 566.36, "end": 571.9599999999999, "text": " learning I believe they do graph neural networks and there they replace"}, {"start": 571.96, "end": 578.32, "text": " the usually in graph neural networks there are fully connected layers that"}, {"start": 578.32, "end": 583.0, "text": " connect the two the vertices and the edges together and compute properties of"}, {"start": 583.0, "end": 589.0400000000001, "text": " them so that's a pretty good point for using DFA right because what you're"}, {"start": 589.0400000000001, "end": 592.84, "text": " looking for is state-of-the-art tasks and architectures that still employ"}, {"start": 592.84, "end": 600.88, "text": " fully connected layers because their your algorithm can shine okay so that's"}, {"start": 600.88, "end": 605.52, "text": " it and they basically going to show that this is performance is close to fine"}, {"start": 605.52, "end": 613.4, "text": " tuned back propagation alright so what is DFA what is this direct feedback"}, {"start": 613.4, "end": 618.36, "text": " alignment and for that I actually want to jump papers right here and go to this"}, {"start": 618.36, "end": 625.08, "text": " other paper that describes DFA in a bit in a bit not more detail but in a"}, {"start": 625.08, "end": 629.44, "text": " graphic fashion so this paper right here direct feedback alignment provides"}, {"start": 629.44, "end": 637.44, "text": " learning in deep neural networks by our not not blunt sorry not blunt and shows"}, {"start": 637.44, "end": 642.0, "text": " some theoretical properties about DFA now I don't want to go into the theory"}, {"start": 642.0, "end": 647.24, "text": " right here or in the math but I mainly like this paper for this particular"}, {"start": 647.24, "end": 652.08, "text": " graphic right here so in the back propagation algorithm as you can see you"}, {"start": 652.08, "end": 656.6, "text": " forward propagate using these weight matrices and then you back propagate"}, {"start": 656.6, "end": 662.9200000000001, "text": " using the transposes of the weight matrices now one step after that is this"}, {"start": 662.9200000000001, "end": 666.9200000000001, "text": " thing right here it's called feedback alignment it's not the same thing as"}, {"start": 666.9200000000001, "end": 672.08, "text": " direct feedback alignment in feedback alignment you simply say well I won't"}, {"start": 672.08, "end": 676.12, "text": " backprop using these transposes because I can't because that's not biologically"}, {"start": 676.12, "end": 683.28, "text": " possible what I'll do is I'll use other matrices and these other matrices are"}, {"start": 683.28, "end": 688.88, "text": " going to be random matrices and by random matrices we really mean a matrix"}, {"start": 688.88, "end": 694.88, "text": " that is of you know the correct shape the same shape as this W transpose but"}, {"start": 694.88, "end": 701.16, "text": " each entry is going to be sampled from a like a random Gaussian right now I"}, {"start": 701.16, "end": 707.16, "text": " don't mean like the distribution of Gaussians but you fix this matrix once at"}, {"start": 707.16, "end": 712.48, "text": " the beginning of training by sampling from Gaussian and then you leave it"}, {"start": 712.48, "end": 717.44, "text": " there and that's going to be the matrix that you use for relaying the signal back"}, {"start": 717.44, "end": 722.76, "text": " through the layers now you might protest and say wait that's not gonna work"}, {"start": 722.76, "end": 728.64, "text": " because specifically this thing right here it you know that you need to know the"}, {"start": 728.64, "end": 733.0, "text": " weights here to know what you need to change in the lower layers you need to"}, {"start": 733.0, "end": 737.88, "text": " somehow have that information in there how are you gonna know what to change"}, {"start": 737.88, "end": 745.08, "text": " and that's a valid question and I will give my opinion of why this works okay in"}, {"start": 745.08, "end": 750.04, "text": " a second in two seconds first this is feedback alignment so simply use"}, {"start": 750.04, "end": 756.0, "text": " random matrices to back propagate so to say and then you have a direct feedback"}, {"start": 756.0, "end": 760.0, "text": " alignment and direct feedback alignment goes a step further because in feedback"}, {"start": 760.0, "end": 764.84, "text": " alignment you still do this in a sequential manner direct feedback alignment"}, {"start": 764.84, "end": 771.0, "text": " simply takes whatever the top change should be the let the change to the top"}, {"start": 771.0, "end": 776.84, "text": " layer so how do I need to change the top layer and it back propagates that in"}, {"start": 776.84, "end": 783.44, "text": " this global fashion to all the layers directly using random matrices okay and"}, {"start": 783.44, "end": 788.32, "text": " then this IFA we're not gonna look at today because that's not relevant for"}, {"start": 788.32, "end": 793.44, "text": " this other paper but I hope you can sort of see the overview here so let's go"}, {"start": 793.44, "end": 795.44, "text": " back"}, {"start": 797.72, "end": 803.0400000000001, "text": " scroll scroll scroll scroll scroll scroll okay so here is the mathematical"}, {"start": 803.0400000000001, "end": 808.44, "text": " formulation of all of this and it pays to look at it to understand what's going"}, {"start": 808.44, "end": 813.1600000000001, "text": " on so they characterize a neural network right here as having n layers each"}, {"start": 813.1600000000001, "end": 818.8000000000001, "text": " neural network is the following each neural each layer takes whatever is the"}, {"start": 818.8, "end": 824.28, "text": " output of the last layer multiplies it by a weight matrix and that's going to"}, {"start": 824.28, "end": 831.68, "text": " be your a quantity you put a through a non-linearity to obtain the next"}, {"start": 831.68, "end": 836.9599999999999, "text": " layers input okay so the h is the output of this layer and the input of the"}, {"start": 836.9599999999999, "end": 844.56, "text": " next layer at the very end your last output is going to be your estimation of"}, {"start": 844.56, "end": 850.68, "text": " the labels so your last non-linearity is probably going to be something like a"}, {"start": 850.68, "end": 858.3199999999999, "text": " a softmax or something like this okay so how can we how can we have this as a"}, {"start": 858.3199999999999, "end": 865.16, "text": " concept in our heads if you have the neural network right here what you want to"}, {"start": 865.16, "end": 872.04, "text": " do is you want to forward prop always using your weight matrix w and then your"}, {"start": 872.04, "end": 878.4, "text": " non-linearity of that particular layer and then the last in the last layer you"}, {"start": 878.4, "end": 885.88, "text": " get your y hat as we saw before now the question is how can we adjust how can"}, {"start": 885.88, "end": 893.64, "text": " we adjust this w right here to make y hat more into the direction of y and here"}, {"start": 893.64, "end": 900.3199999999999, "text": " it's here it's useful to think of the last layer as a vector output like"}, {"start": 900.32, "end": 907.2, "text": " usually we think of the loss function but in all of these algorithms they always"}, {"start": 907.2, "end": 912.2800000000001, "text": " start with the derivative of the loss function with respect to the last layer"}, {"start": 912.2800000000001, "end": 919.9200000000001, "text": " output so a y and a y is here right before the non-linearity if you remember"}, {"start": 919.9200000000001, "end": 927.6400000000001, "text": " this was f of a y and this here I guess is the softmax so if this is a"}, {"start": 927.64, "end": 933.0, "text": " classifier the a y here those are the logits and that's the output of your"}, {"start": 933.0, "end": 945.12, "text": " last layer so if instead of having y and y hat right sorry y hat right here it"}, {"start": 945.12, "end": 952.12, "text": " pays to maybe think of the output as a vector and the desired output as"}, {"start": 952.12, "end": 956.76, "text": " another vector and the desired output is of course going to be one hot vector"}, {"start": 956.76, "end": 963.8, "text": " in the case of in the case of a classification but it you know if you think of"}, {"start": 963.8, "end": 971.3199999999999, "text": " it like this then you'll recognize okay I need to change if this is my"}, {"start": 971.3199999999999, "end": 976.92, "text": " estimated output and I want to achieve this output I need to change it into this"}, {"start": 976.92, "end": 982.68, "text": " direction right to get more into the same direction as the output I want the"}, {"start": 982.68, "end": 988.56, "text": " entire question how becomes how do I tell the lower layers about this change"}, {"start": 988.56, "end": 994.3199999999999, "text": " right here this is the change that I want to make in the lower layers how do I"}, {"start": 994.3199999999999, "end": 1002.0, "text": " get the lower layers such that they provide me with that signal with with the"}, {"start": 1002.0, "end": 1006.16, "text": " green signal instead of the red signal so I need to propagate this blue"}, {"start": 1006.16, "end": 1012.3199999999999, "text": " difference in the back propagation algorithm you can simply ask the system"}, {"start": 1012.32, "end": 1017.44, "text": " right so we've built entire frameworks on being able to back propagate"}, {"start": 1017.44, "end": 1023.88, "text": " TensorFlow PyTorch, Jack's whatever because with back propagation we can simply"}, {"start": 1023.88, "end": 1029.88, "text": " ask the system this question so here is how should I change the weights of my"}, {"start": 1029.88, "end": 1035.28, "text": " layer to make the loss smaller you can just ask that you can say what's the"}, {"start": 1035.28, "end": 1041.92, "text": " gradient of the loss with respect to the to my weights and the negative sign"}, {"start": 1041.92, "end": 1047.44, "text": " here is because you want to make the loss smaller okay and that is going to be"}, {"start": 1047.44, "end": 1052.96, "text": " a straightforward calculation how does that calculation go it's going to"}, {"start": 1052.96, "end": 1063.6000000000001, "text": " involve this right here is the last layer's output this right here as you can"}, {"start": 1063.6000000000001, "end": 1071.9, "text": " see over here is going to be this is going to be whatever comes back from the"}, {"start": 1071.9, "end": 1076.52, "text": " back propagation so in back propagation you always have to think of if you want"}, {"start": 1076.52, "end": 1080.96, "text": " to update these weights you need two quantities you need whatever comes from"}, {"start": 1080.96, "end": 1085.5600000000002, "text": " the bottom or came from the bottom during the forward pass and whatever comes"}, {"start": 1085.5600000000002, "end": 1093.5600000000002, "text": " from the top during the backward pass and this quantity here is going to be the"}, {"start": 1093.5600000000002, "end": 1100.16, "text": " one that came from the top and it's basically how you need to change the next"}, {"start": 1100.16, "end": 1106.28, "text": " layer in order to make the loss happier and by using this right here you pull"}, {"start": 1106.28, "end": 1110.92, "text": " it back to this layer so how do I need to change this layer and here you see"}, {"start": 1110.92, "end": 1115.92, "text": " that dreaded transpose of that weight matrix this is what we can't do in"}, {"start": 1115.92, "end": 1121.0800000000002, "text": " biology but this is what back propagation does so it pulls back how you need to"}, {"start": 1121.0800000000002, "end": 1126.76, "text": " change the next layer it pulls it back to this layer so this quantity right here"}, {"start": 1126.76, "end": 1132.68, "text": " is basically how do I need to change the output of this particular layer in"}, {"start": 1132.68, "end": 1138.44, "text": " order to make the loss happier and then you multiply it by the signal that comes"}, {"start": 1138.44, "end": 1144.0, "text": " from the bottom and that will give you how you need to change your weights okay"}, {"start": 1144.0, "end": 1149.0, "text": " so the green part is how does the output of the layer need to change and the"}, {"start": 1149.0, "end": 1154.16, "text": " the multiplied by the blue part it's how do the weights need to change and of"}, {"start": 1154.16, "end": 1159.52, "text": " course the non-linearity is in there as well but let's let's just leave the"}, {"start": 1159.52, "end": 1163.88, "text": " non-linearity away because it's really not important for this particular"}, {"start": 1163.88, "end": 1172.76, "text": " thing so this is what back prop does what does DFA do DFA here again asks how"}, {"start": 1172.76, "end": 1179.44, "text": " should I change the weights of layer I and DFA says well first you need to"}, {"start": 1179.44, "end": 1184.6000000000001, "text": " compute this thing right here this is you see the derivative of the loss with"}, {"start": 1184.6000000000001, "end": 1191.16, "text": " respect to a y now a y is the output of the last layer these are in in our"}, {"start": 1191.16, "end": 1197.16, "text": " case for example your log it's okay note that this is still a gradient so it's"}, {"start": 1197.16, "end": 1202.0, "text": " not like we can't differentiate anymore we simply can't do back propagation"}, {"start": 1202.0, "end": 1208.16, "text": " from layer to layer okay so this is the quantity how do we need to change the"}, {"start": 1208.16, "end": 1214.64, "text": " last layers output and we're going to take that and simply feed it through this"}, {"start": 1214.64, "end": 1221.48, "text": " random matrix and then multiply again let's leave this away multiply it by the"}, {"start": 1221.48, "end": 1227.96, "text": " by this thing right here so if I get my colors correct like this again you have"}, {"start": 1227.96, "end": 1233.24, "text": " your neural network you want to update these weights the green is what comes"}, {"start": 1233.24, "end": 1237.8400000000001, "text": " from the top now it doesn't come from the next layer but the green actually comes"}, {"start": 1237.84, "end": 1244.32, "text": " from all the way at the end sorry you can't see that I still have to get used"}, {"start": 1244.32, "end": 1250.72, "text": " to that new frame of view so the green comes all the way from the end and the"}, {"start": 1250.72, "end": 1258.6, "text": " blue comes from down here okay so this is weird right because especially"}, {"start": 1258.6, "end": 1264.8799999999999, "text": " because this is just modulated by a random matrix so how can this possibly"}, {"start": 1264.88, "end": 1270.6000000000001, "text": " work that's the question and I you know I had some thoughts but I haven't read"}, {"start": 1270.6000000000001, "end": 1274.44, "text": " too much about it so I might be completely wrong or this might be completely"}, {"start": 1274.44, "end": 1281.2800000000002, "text": " known in the community I have no idea I'll just give my opinion right here so"}, {"start": 1281.2800000000002, "end": 1287.2, "text": " first of all you have to see if to compare this to back prop so what's actually"}, {"start": 1287.2, "end": 1292.48, "text": " changing is this green part right here right we agree that this is the thing"}, {"start": 1292.48, "end": 1297.2, "text": " that's changing and what do we say does the green part mean the green part"}, {"start": 1297.2, "end": 1304.6, "text": " basically tells you how do you how should the output of this layer change okay by"}, {"start": 1304.6, "end": 1309.32, "text": " adjusting the weights in the direction of the thing on the right side of the"}, {"start": 1309.32, "end": 1313.32, "text": " equality sign you're gonna change the output of the layer into the direction of"}, {"start": 1313.32, "end": 1319.32, "text": " that green part now in back propagation the green part basically tells you how"}, {"start": 1319.32, "end": 1325.1599999999999, "text": " should the output of this layer change in order to make the loss as happy as"}, {"start": 1325.1599999999999, "end": 1331.6799999999998, "text": " possible now we don't have that anymore here we simply change the output of the"}, {"start": 1331.6799999999998, "end": 1339.24, "text": " layer into the into the direction of a random transformation of the of the"}, {"start": 1339.24, "end": 1344.8, "text": " change we would like to have in the output now okay that's the the first thing is"}, {"start": 1344.8, "end": 1349.08, "text": " we understand what's different and we understand what the green quantity means"}, {"start": 1349.08, "end": 1355.76, "text": " green quantity means how should the output of our layer change okay second thing"}, {"start": 1355.76, "end": 1361.6, "text": " if you look at the last layer of a neural network that that log it's layer right"}, {"start": 1361.6, "end": 1366.6, "text": " what does it actually do let's say we had that's a three-dimensional last layer"}, {"start": 1366.6, "end": 1371.76, "text": " which means you have three classes right if your last layer is three-dimensional"}, {"start": 1371.76, "end": 1377.48, "text": " you have three classes each axis represents one class because you encode the"}, {"start": 1377.48, "end": 1383.32, "text": " classes as one hot vectors so this might be see the class label equals zero this"}, {"start": 1383.32, "end": 1391.16, "text": " might be see equals one this might be see equals two if you have something that you"}, {"start": 1391.16, "end": 1396.56, "text": " forward propagate through your neural network and let's say it comes out to be"}, {"start": 1396.56, "end": 1405.04, "text": " like this what would you classify that as now you classify that as the whatever"}, {"start": 1405.04, "end": 1411.2, "text": " class has the the biggest inner product with that vector which would be the"}, {"start": 1411.2, "end": 1418.12, "text": " see equals zero class right here and what is this quantity going to be how should"}, {"start": 1418.12, "end": 1423.48, "text": " you update this output in order to make the loss happier now that depends on"}, {"start": 1423.48, "end": 1428.84, "text": " your true label but let's say your true label is actually the zero label now"}, {"start": 1428.84, "end": 1434.6399999999999, "text": " what you want to do is you want to update that thing into the direction here right"}, {"start": 1434.6399999999999, "end": 1441.08, "text": " so it's that it is more aligned with the axis so what happens if you pull that"}, {"start": 1441.08, "end": 1445.32, "text": " back through a random matrix now the thing you have to know about random"}, {"start": 1445.32, "end": 1451.1599999999999, "text": " matrices like this is that they do approximately preserve distances and angles"}, {"start": 1451.16, "end": 1458.48, "text": " so technically if you pull this back what you're going to induce is another"}, {"start": 1458.48, "end": 1462.8400000000001, "text": " coordinate system in that other space now this can be a higher or lower"}, {"start": 1462.8400000000001, "end": 1470.16, "text": " dimensional space I frankly I don't care but what you're going to induce is a"}, {"start": 1470.16, "end": 1477.28, "text": " coordinate system and what do you pull through that B matrix so this is the B.I."}, {"start": 1477.28, "end": 1481.24, "text": " matrix you fix it right this is really important you fix it at the beginning of"}, {"start": 1481.24, "end": 1486.6, "text": " trainings always the same it preserves distances and angles approximately you"}, {"start": 1486.6, "end": 1492.32, "text": " pull back that quantity which is the okay my colors are all screwed which is the"}, {"start": 1492.32, "end": 1499.92, "text": " green arrow over here you pull back this green arrow here so what does it mean"}, {"start": 1499.92, "end": 1508.0800000000002, "text": " what so the output right here the output vector that came from the lower layers"}, {"start": 1508.0800000000002, "end": 1512.1200000000001, "text": " right that's you forward propagated that through your network so maybe in this"}, {"start": 1512.1200000000001, "end": 1519.0, "text": " layer it actually pointed here we don't know but let's say it pointed here if we"}, {"start": 1519.0, "end": 1525.88, "text": " pull back the green thing it might point here okay now this is since it's"}, {"start": 1525.88, "end": 1529.8000000000002, "text": " around the matrix we don't know we know that the angle is approximately preserved"}, {"start": 1529.8000000000002, "end": 1534.5200000000002, "text": " okay but you know the lengths are approximately preserved with relative to"}, {"start": 1534.5200000000002, "end": 1544.24, "text": " each other but it doesn't really tell you too much so why is this useful and to"}, {"start": 1544.24, "end": 1549.3200000000002, "text": " see why it's useful you need to consider other inputs we don't just in"}, {"start": 1549.32, "end": 1555.4399999999998, "text": " out input this one vector we input a whole bunch of data now let's consider two other"}, {"start": 1555.4399999999998, "end": 1563.3999999999999, "text": " vectors so first I want to consider this this blue vector right here now the blue"}, {"start": 1563.3999999999999, "end": 1569.36, "text": " vectors also going to have a label of zero so what does the blue vectors update"}, {"start": 1569.36, "end": 1574.96, "text": " look like the blue vector is going to be pulled into this direction and I also"}, {"start": 1574.96, "end": 1581.92, "text": " want to consider this red vector right here the red vector is of class one so"}, {"start": 1581.92, "end": 1588.8400000000001, "text": " what does the red vectors update going to look like like this and if I consider"}, {"start": 1588.8400000000001, "end": 1594.64, "text": " now the red and the blue vector in this space right let's I just draw them at"}, {"start": 1594.64, "end": 1602.72, "text": " random like so okay what I do know actually that's that's for consistent"}, {"start": 1602.72, "end": 1608.3600000000001, "text": " draw the blue somewhere here and the red somewhere here what I do know is"}, {"start": 1608.3600000000001, "end": 1613.48, "text": " that the angles and distances are preserved so what is the green thing going to"}, {"start": 1613.48, "end": 1617.24, "text": " look like the update for the blue vector is going to be something like this"}, {"start": 1617.24, "end": 1622.76, "text": " and the update for the red vector is going to maybe be something like this you"}, {"start": 1622.76, "end": 1629.72, "text": " know away from from those so what is happening in that lower space you'll"}, {"start": 1629.72, "end": 1634.84, "text": " notice that the two vectors that are supposed to be in the same class this and"}, {"start": 1634.84, "end": 1641.6000000000001, "text": " this they are going to be pulled together now the direction they're pulled in"}, {"start": 1641.6000000000001, "end": 1646.76, "text": " that's determined by this random matrix but we know they're going to be pulled"}, {"start": 1646.76, "end": 1653.44, "text": " together because they are pulled together in this space in the final space okay"}, {"start": 1653.44, "end": 1660.72, "text": " and they're going to be pulled apart from the red vector okay because that red"}, {"start": 1660.72, "end": 1665.0, "text": " vector is going to to be pulled towards a different class in the in the last"}, {"start": 1665.0, "end": 1669.52, "text": " space and since the distances and angles are approximately preserved it's"}, {"start": 1669.52, "end": 1677.1200000000001, "text": " going to be pulled away from these in in this space so what this induces in my"}, {"start": 1677.12, "end": 1686.1599999999999, "text": " opinion is some sort of it induces this coordinate system where if you make the"}, {"start": 1686.1599999999999, "end": 1692.0, "text": " last layer axis aligned because you want to classify it it kind of clusters"}, {"start": 1692.0, "end": 1698.56, "text": " things that belong in the same class in these previous weight spaces right and"}, {"start": 1698.56, "end": 1706.36, "text": " because and if you do this layer by layer so if you do this in layer K and then"}, {"start": 1706.36, "end": 1711.6399999999999, "text": " you make the job easier for any layer K plus one that's in between here right"}, {"start": 1711.6399999999999, "end": 1715.84, "text": " because they are now the things in the same class are already together pretty"}, {"start": 1715.84, "end": 1720.08, "text": " okay now you map it through a weight and then on the narity they might you know"}, {"start": 1720.08, "end": 1724.8799999999999, "text": " intertwine a bit again but they're they're more together than they would be"}, {"start": 1724.8799999999999, "end": 1730.56, "text": " otherwise so you make the job for the next layer easier which means that the"}, {"start": 1730.56, "end": 1736.52, "text": " next layer can also can even better cluster things and what you'll end up with"}, {"start": 1736.52, "end": 1744.96, "text": " in this last layer is the is a basically a class or next to last layer is"}, {"start": 1744.96, "end": 1748.48, "text": " basically a clustering where everything that's supposed to be in the same"}, {"start": 1748.48, "end": 1754.36, "text": " class is together and far apart from each other and since the last layer is the"}, {"start": 1754.36, "end": 1760.52, "text": " classification layer it's gonna have a really easy job separating those classes"}, {"start": 1760.52, "end": 1766.52, "text": " and performing good classification so that's what I think is happening in this"}, {"start": 1766.52, "end": 1772.12, "text": " algorithm so even though the layers don't know how to change to help the last"}, {"start": 1772.12, "end": 1779.6, "text": " layer by the fact that these random matrices induce a clustering together you"}, {"start": 1779.6, "end": 1786.16, "text": " know by back propagating these updates here it helps the last layer make it makes"}, {"start": 1786.16, "end": 1792.6000000000001, "text": " its job really easy and you know that's all the classifier needs and I want to"}, {"start": 1792.6000000000001, "end": 1799.24, "text": " I want to show again this is my opinion this is not anything of value it's just"}, {"start": 1799.24, "end": 1803.3600000000001, "text": " my hypothesis of why something like this could work I want to show you in this"}, {"start": 1803.3600000000001, "end": 1806.92, "text": " paper that I've shown you before right here they do actually do these"}, {"start": 1806.92, "end": 1814.88, "text": " experiments with DFA and they show that you can see top row shows feature obtained"}, {"start": 1814.88, "end": 1820.16, "text": " with back propagation bottom row shows features obtained with DFA I think these"}, {"start": 1820.16, "end": 1826.92, "text": " are input and features I'm not sure where exactly they are in the network but you"}, {"start": 1826.92, "end": 1833.7600000000002, "text": " can see that this clustering clearly emerges so oh yeah here from left to"}, {"start": 1833.7600000000002, "end": 1838.48, "text": " right input images first hidden layer second hidden layer third hidden layer so"}, {"start": 1838.48, "end": 1844.48, "text": " you can see that the clustering from layer to layer in back prop and also in DFA"}, {"start": 1844.48, "end": 1850.2, "text": " is better and better so the reason why back prop is good maybe it's just that"}, {"start": 1850.2, "end": 1855.2, "text": " because it also really induces clustering like this I don't know maybe back"}, {"start": 1855.2, "end": 1860.08, "text": " prop does even does something on top of that because I mean back prop has all the"}, {"start": 1860.08, "end": 1866.2, "text": " properties of this and more right but still this this is congruent with my"}, {"start": 1866.2, "end": 1874.44, "text": " hypothesis of what's happening so what do they do with it they take this algorithm"}, {"start": 1874.44, "end": 1881.92, "text": " and they apply it to these architectures now let's for example look at one of"}, {"start": 1881.92, "end": 1888.24, "text": " them this neural view synthesis with neural radiance fields so neural radiance"}, {"start": 1888.24, "end": 1894.8, "text": " fields is a type of model to do this task of where you get a bunch of views of an"}, {"start": 1894.8, "end": 1900.52, "text": " object in 3d or you know a bunch of views around an object and you're supposed"}, {"start": 1900.52, "end": 1908.12, "text": " to render a new view and you can see that the DFA parameter or the DFA updated"}, {"start": 1908.12, "end": 1915.16, "text": " nerve neural radiance field model is pretty close to the back"}, {"start": 1915.16, "end": 1920.44, "text": " propagation updated one you can see it's a bit more blurry but it it works"}, {"start": 1920.44, "end": 1925.56, "text": " right and I think the this paper is really trying to show that look this works"}, {"start": 1925.56, "end": 1932.1599999999999, "text": " it doesn't work you know extremely well but it works and it works on a on a"}, {"start": 1932.1599999999999, "end": 1937.04, "text": " level that hasn't been seen before so here if you consider these results higher"}, {"start": 1937.04, "end": 1942.24, "text": " as better on the synthetic dataset here even you see that if you have the same"}, {"start": 1942.24, "end": 1948.2, "text": " model with back prop it performs better than with DFA but the DFA for that"}, {"start": 1948.2, "end": 1953.72, "text": " model performs better than these other baseline models that have themselves"}, {"start": 1953.72, "end": 1959.24, "text": " been trained with back propagation so it's definitely in the direction of"}, {"start": 1959.24, "end": 1966.28, "text": " being competitive and that's the same thing they show with all of these"}, {"start": 1966.28, "end": 1971.04, "text": " experiments so they apply this to graph networks apply this to transformers and"}, {"start": 1971.04, "end": 1976.28, "text": " as I said it's it's not there yet you see that so in the transformers they have"}, {"start": 1976.28, "end": 1980.56, "text": " these settings where in macro they just use it DFA for the individual blocks"}, {"start": 1980.56, "end": 1985.8, "text": " and micro they use it for each layer and already told you that you still in"}, {"start": 1985.8, "end": 1990.0, "text": " the attention mechanism you still have to use back prop within the attention"}, {"start": 1990.0, "end": 1996.8799999999999, "text": " mechanism but it is much more of a plausible algorithm than the back"}, {"start": 1996.8799999999999, "end": 2001.76, "text": " propagation through the entire network and they show that if they appropriately"}, {"start": 2001.76, "end": 2007.52, "text": " tweak the hyper parameters they do get into the direction of something that's"}, {"start": 2007.52, "end": 2013.48, "text": " performed at least with this macro strategy now this is nowhere close to this"}, {"start": 2013.48, "end": 2020.08, "text": " is nowhere close to what the to what the back propagation algorithm achieves but"}, {"start": 2020.08, "end": 2026.28, "text": " it's sort of it's sort of an indication that if the community could work as"}, {"start": 2026.28, "end": 2031.8, "text": " much on this as it has worked on back propagation then probably will make a"}, {"start": 2031.8, "end": 2037.48, "text": " lot of like we could we could push this to a place where it does perform on par"}, {"start": 2037.48, "end": 2043.3999999999999, "text": " with back prop or very close to it so I do invite you to go and look at the"}, {"start": 2043.3999999999999, "end": 2050.72, "text": " experiments they have a lot of a lot of details on how they did it and exactly"}, {"start": 2050.72, "end": 2055.2799999999997, "text": " you have to change the architectures to make DFA work and the hyper parameters"}, {"start": 2055.2799999999997, "end": 2060.24, "text": " and so on so that's really cool and they have some more outputs right here of"}, {"start": 2060.24, "end": 2066.72, "text": " the view synthesis and so on yeah if you are interested in that thing I again"}, {"start": 2066.72, "end": 2070.4799999999996, "text": " I don't want it is respected it's just I don't think there is much point in me"}, {"start": 2070.4799999999996, "end": 2076.3199999999997, "text": " going over it it's the results are always sort of the same that DFA it's not"}, {"start": 2076.3199999999997, "end": 2083.04, "text": " there yet but it's a good direction yeah I hope this was informative let me"}, {"start": 2083.04, "end": 2088.8799999999997, "text": " know if you disagree about my assessment of DFA I can be completely wrong or"}, {"start": 2088.88, "end": 2096.8, "text": " you know I yeah or this could be like well known to people already so yeah see"}, {"start": 2096.8, "end": 2126.7200000000003, "text": " you next time"}] |
Yannic Kilcher | 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 the measure of intelligence by François Cholé. 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. There's 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. Today we're going to get into the formal definition of the intelligence that Cholé 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 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 are priors which is what is already built into 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 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 or we're going to watch surely 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. 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, which in a machine learning term, these are like your training examples. And on the other side, there is the intelligent system. 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 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. 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, 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. 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. 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. Now at test time, we severed this connection right here. So this is now severed at test time. At some point, the training is done. The task says, okay, 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. The intelligent system cannot intervene anymore. And in this loop here, 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. Okay, so there's always this training phase first and then there is the test phase. Now the training phase, these 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. Okay, so there's a lot of formalisms right here, like, okay, the task has a 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 for so shortly 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. Okay, and it generates the skill program and when it learns, when it learns, it updates the internal state, 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 it's 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, the log it's that the net neural network has produced the feedback, which is the loss and its internal state. Okay, 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. And then you can just, you don't, okay, this is not relevant. This is just me bickering. Cool. Let's actually jump all of this. This is boring. This is very boring. Okay. Blah blah blah blah. Lots of definitions. All right. Quantifying generalization difficulty experience and priors using algorithmic information theory. And once 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 is not very complicated. The main quantity is this age, the algorithmic complexity. So the language 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 touring machine. So basically if, if you have this string s right here, as is a bit string, the shortest program that can compute s or, you know, in the worst case, that's the string itself. But if the string is like 01010101 all the way, you can just say 010 times 50. And that's that would be like the shortest program to produce that. It isn't, 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. Okay. So it can never, 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. Okay. And s1 is 01001 01001. Okay. So it's just twice that. So you could, 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 two times s2. Okay. So the length of this is not part of the program. The program is just two times s2 because it's allowed to take s2 as an input. Okay. So this is the algorithmic, the relative algorithmic complexity is how, how much, how long is the, how complex is the program to get from s2 to s1. And so you can almost already see how that will relate now to, 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 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 don't, we consider tasks according to thresholds like, you know, you need to get a, I don't know what score of 9000 in pung or so. So the first of all programs that will, will optimize that will solve the task to a threshold t. Sorry, theta, which is the shortest scale program that achieves at least theta during evaluation. So the 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. Shortest scale program that achieves optimal training time performance over the situation in the curriculum. So this, 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 the task of, of determining cats from dogs and images. This is, this is, this would be the program that does it. Okay. You know, overall, over the entire, the entirety of the task, all cats and dog images there, there are. That's the solution. Now this quantity right here means sort of the one neural network that is best at determining cats from dogs in this particular training data set, this curriculum C. Okay. So this is the, 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. And 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 salty. 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 soul 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 tests at solution. Okay, this is, I mean, I do this train tests at 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 0.75 has a label false and x 0.15 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 a trade off, there's direct trade off to how much you optimize on the training data and how much generalization capability you have. 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 algorithm 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 an AlphaGo system that certainly has the rules of Go built into 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 tick-tack 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. So any prior you put in there will be captured by this. So otherwise it's the same metric. It's 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. 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 for a given system and a curiculum. Now what we want we want to characterize priors and experience now priors are pretty easy. What are what is a prior 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's no training data anymore. It simply says if I have, you know, if you give me your 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 you I gave you the source code is that 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 intelligence system for that given task. And the quantity is always of how to reach the threshold. The solution is always with respect to a threshold in skills. So you must reach like this many points. The important thing that Sholeh notes here is that the priors capture not not the amount of information in the program in the intelligence system, but the amount of relevant information for that task. You can make a super duper complex intelligence system. The only thing that matters for this quantity is the amount of information that's irrelevant to get to the solution of the task T. The last thing we need to capture is experience. Now experience basically means how how much during this learning phase from now we just talked about at the 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 in 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 about 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. 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. It's basically you can think of it as one additional training example right 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 see how much information did you get out of the training data at each step. Okay 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 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 you score a certain you score a certain you look score like 80% on the on the test set so that's basically how difficult it is. It's like you make you still make 20% 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% of error okay so the difference here would be like 2% so that's going to be your experience is going to be worth of 2% of errors. Now the important thing here is that it is it is different if we could have just written here minus H of you know so theta T given the intelligent system at time step T plus 1 right because the intelligent system at time step T plus 1 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 do. So we can see how difficult is it we assume that no God or Vapnik himself tells us how like the optimal way to use that information okay whereas this thing here the 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 system. 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 alright 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. Okay 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 in a simplistic sense alright so this is all we need intelligence boom this is it so there's a lot of stuff here okay intelligence of an intelligence. So we have 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 some 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 fresh I'm pretty sure this is just a name like here the name opt so yeah 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 PON and another task might be you need to achieve point two and that's really good 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 points of skill level of that particular task okay so but we're going to average over task now you can I guess disregard this this is not super this is just scaling we're going to average over task 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 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 more intelligent if it gets to a certain threshold with lower priors okay with the priors are low this the 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 for in the same curriculum like in the same training data they 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 the curricula are specific the curricula that you need to reach this certain threshold so it's not always doesn't always sum up to one with this probability 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 expectation and quotation marks under the training distribution of the generalization 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 suppose 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 prior 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 slide now of course these complexities and so on they're not exactly computable right so it 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 this scope so that means the validity it should be rep applicable it should be reproducible it should measure broad abilities and developer where 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 reverse 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 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 of 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 a 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 it 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 arc data set and the arc cackled 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 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 alright 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 the measure of intelligence by Fran\u00e7ois Chol\u00e9."}, {"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": 28.0, "text": " There's 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."}, {"start": 28.0, "end": 36.0, "text": " Today we're going to get into the formal definition of the intelligence that Chol\u00e9 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": 71.0, "text": " So how fast does it acquire new skills?"}, {"start": 71.0, "end": 76.0, "text": " Important here is that we are measuring it over a scope of tasks so it's not arbitrary skills."}, {"start": 76.0, "end": 89.0, "text": " It is a scope that we define and this is going to be mostly 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 are priors which is what is already built into 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": 120.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 you can simply rely on your experience."}, {"start": 120.0, "end": 124.0, "text": " And the third is generalization difficulty and that's a property of the task."}, {"start": 124.0, "end": 141.0, "text": " So if the task is very difficult to generalize, so 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": 158.0, "text": " So this is going to be the basis and today we're going to or we're going to watch surely define these things into a basically into a number that can give us the intelligence of any system with respect to these things."}, {"start": 158.0, "end": 171.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": 171.0, "end": 194.0, "text": " 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, which in a machine learning term, these are like your training examples."}, {"start": 194.0, "end": 216.0, "text": " And on the other side, there is the intelligent system. 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 gives something back like a response."}, {"start": 216.0, "end": 229.0, "text": " 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."}, {"start": 229.0, "end": 241.0, "text": " 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."}, {"start": 241.0, "end": 252.0, "text": " So in the classic machine learning sense, if we look at supervised learning, for example, the intelligent system would be the,"}, {"start": 252.0, "end": 261.0, "text": " would be like a ResNet, ResNet plus SGD, that is an intelligent system."}, {"start": 261.0, "end": 277.0, "text": " 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."}, {"start": 277.0, "end": 291.0, "text": " 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."}, {"start": 291.0, "end": 300.0, "text": " 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": 310.0, "text": " 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."}, {"start": 310.0, "end": 329.0, "text": " 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."}, {"start": 329.0, "end": 344.0, "text": " 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."}, {"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": 368.0, "text": " Now at test time, we severed this connection right here. So this is now severed at test time. At some point, the training is done. The task says, okay, now training is done."}, {"start": 368.0, "end": 381.0, "text": " 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."}, {"start": 381.0, "end": 401.0, "text": " The intelligent system cannot intervene anymore. And in this loop here, 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."}, {"start": 401.0, "end": 416.0, "text": " So the intelligent system must at this end step produce a skill program that by itself can achieve a high score. Okay, so there's always this training phase first and then there is the test phase."}, {"start": 416.0, "end": 427.0, "text": " Now the training phase, these situations that we get in a training phase, they are called a curriculum in this in this world."}, {"start": 427.0, "end": 442.0, "text": " 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."}, {"start": 442.0, "end": 460.0, "text": " Okay, so there's a lot of formalisms right here, like, okay, the task has a 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."}, {"start": 460.0, "end": 472.0, "text": " And I don't like this is all a bit too formal. You don't really need to understand it except if for so shortly is watching this, I think I have found."}, {"start": 472.0, "end": 485.0, "text": " 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."}, {"start": 485.0, "end": 499.0, "text": " Okay, and it generates the skill program and when it learns, when it learns, it updates the internal state, internal state according to, let me if I can find it."}, {"start": 499.0, "end": 508.0, "text": " Right here. A self update function. So this is how the intelligent system can update itself. So it's own state."}, {"start": 508.0, "end": 523.0, "text": " 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."}, {"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": 545.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, the log it's that the net neural network has produced the feedback, which is the loss and its internal state."}, {"start": 545.0, "end": 562.0, "text": " Okay, 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."}, {"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": 595.0, "text": " And then you can just, you don't, okay, this is not relevant. This is just me bickering. Cool. Let's actually jump all of this. This is boring. This is very boring."}, {"start": 595.0, "end": 606.0, "text": " Okay. Blah blah blah blah. Lots of definitions. All right. Quantifying generalization difficulty experience and priors using algorithmic information theory."}, {"start": 606.0, "end": 617.0, "text": " And once 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": 629.0, "text": " Algorithmic information theory in this case right here that we're using is not very complicated. The main quantity is this age, the algorithmic complexity."}, {"start": 629.0, "end": 639.0, "text": " So the language of s is the length of the shortest description of the string in a fixed universal language."}, {"start": 639.0, "end": 646.0, "text": " So it's the length of the shortest program that outputs the string when running on a fixed universal touring machine."}, {"start": 646.0, "end": 657.0, "text": " So basically if, if you have this string s right here, as is a bit string, the shortest program that can compute s or, you know,"}, {"start": 657.0, "end": 666.0, "text": " in the worst case, that's the string itself. But if the string is like 01010101 all the way, you can just say 010 times 50."}, {"start": 666.0, "end": 673.0, "text": " And that's that would be like the shortest program to produce that. It isn't, 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": 708.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."}, {"start": 708.0, "end": 723.0, "text": " But is allowed to take s2 as an input. Okay. So it can never, it can always ignore s2. That's always a possibility. So if s1 is like a super easy string, you can just output that."}, {"start": 723.0, "end": 744.0, "text": " But if s1, let's say s2 here is 01001. Okay. And s1 is 01001 01001. Okay. So it's just twice that. So you could, you could sort of output that string here."}, {"start": 744.0, "end": 758.0, "text": " You could write a program that just outputs this or you could write a program that just says two times s2. Okay. So the length of this is not part of the program."}, {"start": 758.0, "end": 776.0, "text": " The program is just two times s2 because it's allowed to take s2 as an input. Okay. So this is the algorithmic, the relative algorithmic complexity is how, how much, how long is the, how complex is the program to get from s2 to s1."}, {"start": 776.0, "end": 796.0, "text": " And so you can almost already see how that will relate now to, 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."}, {"start": 796.0, "end": 819.0, "text": " So 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 don't, we consider tasks according to thresholds like, you know, you need to get a, I don't know what score of 9000 in pung or so."}, {"start": 819.0, "end": 838.0, "text": " So the first of all programs that will, will optimize that will solve the task to a threshold t. Sorry, theta, which is the shortest scale program that achieves at least theta during evaluation."}, {"start": 838.0, "end": 852.0, "text": " So the 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": 852.0, "end": 862.0, "text": " Okay. The curriculum is the training data. So this quantity is the shortest optimal training time solution given a curriculum."}, {"start": 862.0, "end": 887.0, "text": " Shortest scale program that achieves optimal training time performance over the situation in the curriculum. So this, 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 the task of, of determining cats from dogs and images."}, {"start": 887.0, "end": 892.0, "text": " This is, this is, this would be the program that does it. Okay."}, {"start": 892.0, "end": 916.0, "text": " You know, overall, over the entire, the entirety of the task, all cats and dog images there, there are. That's the solution. Now this quantity right here means sort of the one neural network that is best at determining cats from dogs in this particular training data set, this curriculum C."}, {"start": 916.0, "end": 924.0, "text": " Okay. So this is the, the one neural network that is hyper optimized in this particular training data set."}, {"start": 924.0, "end": 941.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": 941.0, "end": 969.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. 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": 969.0, "end": 984.0, "text": " And 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": 993.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 salty."}, {"start": 993.0, "end": 1012.0, "text": " 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": 1023.0, "text": " So this quantity is in zero one with with, sorry, the quantity is one, of course, yes, because the shortest."}, {"start": 1023.0, "end": 1034.0, "text": " This thing up here will be equal to just H of soul T, because this doesn't help me in that case. And then this ratio will be one."}, {"start": 1034.0, "end": 1043.0, "text": " So generalization difficulty of one basically means that the training data solution doesn't help me at all."}, {"start": 1043.0, "end": 1055.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": 1055.0, "end": 1069.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": 1069.0, "end": 1074.0, "text": " And I require no work to get to the, to the tests at solution."}, {"start": 1074.0, "end": 1087.0, "text": " Okay, this is, I mean, I do this train tests at 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": 1102.0, "text": " 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."}, {"start": 1102.0, "end": 1118.0, "text": " Where x minus 0.75 has a label false and x 0.15 has a label true. And the shortest possible solution will not help you to generalize to the, to the other things."}, {"start": 1118.0, "end": 1140.0, "text": " So, the nearest neighbor program would be better prepared for future uncertainty, but would take significantly more space to write down. So there's a trade off, there's direct trade off to how much you optimize on the training data and how much generalization capability you have."}, {"start": 1140.0, "end": 1153.0, "text": " 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": 1179.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. 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 algorithm complexity, it tells you nothing about about this."}, {"start": 1179.0, "end": 1199.0, "text": " 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."}, {"start": 1199.0, "end": 1211.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."}, {"start": 1211.0, "end": 1220.0, "text": " So this is the intelligent system right here at time zero. This is basically whatever you pre build into the intelligent system."}, {"start": 1220.0, "end": 1237.0, "text": " 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."}, {"start": 1237.0, "end": 1251.0, "text": " If you build an AlphaGo system that certainly has the rules of Go built into 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": 1274.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, how much more work is it to get to the solution of the task."}, {"start": 1274.0, "end": 1295.0, "text": " And here you can clearly see if I have already built the solution into the system. So if I'm building a tick-tack 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": 1316.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, 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."}, {"start": 1316.0, "end": 1328.0, "text": " So any prior you put in there will be captured by this. So otherwise it's the same metric. It's zero means it's very easy to generalize to the entire solution."}, {"start": 1328.0, "end": 1343.0, "text": " 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."}, {"start": 1343.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 for a given system and a curiculum."}, {"start": 1361.0, "end": 1379.0, "text": " Now what we want we want to characterize priors and experience now priors are pretty easy. What are what is a prior prior we can capture by simply looking at the difference between how complex is the solution."}, {"start": 1379.0, "end": 1392.0, "text": " 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's no training data anymore."}, {"start": 1392.0, "end": 1403.0, "text": " It simply says if I have, you know, if you give me your source code of your learning system. Can I if I can already read out the solution."}, {"start": 1403.0, "end": 1417.0, "text": " 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."}, {"start": 1417.0, "end": 1435.0, "text": " 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."}, {"start": 1435.0, "end": 1450.0, "text": " 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."}, {"start": 1450.0, "end": 1456.0, "text": " If you I gave you the source code is that well, this is very general. This doesn't tell me anything about the task."}, {"start": 1456.0, "end": 1470.0, "text": " 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."}, {"start": 1470.0, "end": 1474.0, "text": " In this intelligence system for that given task."}, {"start": 1474.0, "end": 1487.0, "text": " And the quantity is always of how to reach the threshold. The solution is always with respect to a threshold in skills. So you must reach like this many points."}, {"start": 1487.0, "end": 1505.0, "text": " The important thing that Sholeh notes here is that the priors capture not not the amount of information in the program in the intelligence system, but the amount of relevant information for that task. You can make a super duper complex intelligence system."}, {"start": 1505.0, "end": 1515.0, "text": " The only thing that matters for this quantity is the amount of information that's irrelevant 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 how much during this learning phase from now we just talked about at the 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": 1555.0, "text": " And the question is of course if we are given a longer training phase it is easier to generalize generally right in more training data makes it makes our life easier makes it easier to generalize."}, {"start": 1555.0, "end": 1577.0, "text": " And the intelligence is inverse proportional to that so a system that had all else being equal that has less training data about 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": 1577.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": 1597.0, "text": " So the first quantity is this so here we consider at each time step T."}, {"start": 1597.0, "end": 1612.0, "text": " 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."}, {"start": 1612.0, "end": 1626.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 and this gives a feedback and all of this data that's called data."}, {"start": 1626.0, "end": 1646.0, "text": " It's basically you can think of it as one additional training example right 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": 1663.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 see how much information did you get out of the training data at each step."}, {"start": 1663.0, "end": 1676.0, "text": " Okay 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."}, {"start": 1676.0, "end": 1688.0, "text": " So 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."}, {"start": 1688.0, "end": 1703.0, "text": " So if you might have had some training data right and you you score a certain you score a certain you look score like 80% on the on the test set so that's basically how difficult it is."}, {"start": 1703.0, "end": 1724.0, "text": " It's like you make you still make 20% 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."}, {"start": 1724.0, "end": 1747.0, "text": " 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% of error okay so the difference here would be like 2% so that's going to be your experience is going to be worth of 2% of errors."}, {"start": 1747.0, "end": 1776.0, "text": " Now the important thing here is that it is it is different if we could have just written here minus H of you know so theta T given the intelligent system at time step T plus 1 right because the intelligent system at time step T plus 1 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 do."}, {"start": 1776.0, "end": 1805.0, "text": " So we can see how difficult is it we assume that no God or Vapnik himself tells us how like the optimal way to use that information okay whereas this thing here the 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 system."}, {"start": 1805.0, "end": 1833.0, "text": " 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 alright 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": 1862.0, "text": " Okay 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 in a simplistic sense alright so this is all we need intelligence boom this is it so there's a lot of stuff here okay intelligence of an intelligence."}, {"start": 1862.0, "end": 1882.0, "text": " So we have 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"}, {"start": 1882.0, "end": 1911.0, "text": " some 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 fresh I'm pretty sure this is just a name like here the name opt so"}, {"start": 1911.0, "end": 1940.0, "text": " yeah 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"}, {"start": 1940.0, "end": 1967.0, "text": " mapping this is a conversion rate because this might be you know 9000 points at PON and another task might be you need to achieve point two and that's really good 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 points of skill level of that particular task"}, {"start": 1967.0, "end": 1988.0, "text": " okay so but we're going to average over task now you can I guess disregard this this is not super this is just scaling we're going to average over task now in each task we're going to consider all curriculums that get you to this threshold so all"}, {"start": 1988.0, "end": 2009.0, "text": " 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"}, {"start": 2009.0, "end": 2025.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 this is the expectation over the training data distribution"}, {"start": 2025.0, "end": 2047.0, "text": " 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"}, {"start": 2047.0, "end": 2067.0, "text": " 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"}, {"start": 2067.0, "end": 2086.0, "text": " 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 the priors and this here is the amount of information that's contained in the experience in that"}, {"start": 2086.0, "end": 2102.0, "text": " 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"}, {"start": 2102.0, "end": 2122.0, "text": " more intelligent if it gets to a certain threshold with lower priors okay with the priors are low this the whole quantity is high and the system is also more intelligent if it gets to the threshold with less"}, {"start": 2122.0, "end": 2140.0, "text": " 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"}, {"start": 2140.0, "end": 2160.0, "text": " it down values actors that for in the same curriculum like in the same training data they 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"}, {"start": 2160.0, "end": 2176.0, "text": " it's hidden in the definitions for example these curricula are not all the same the curricula are specific the curricula that you need to reach this certain threshold so it's not always doesn't always sum up to one with this probability that's why it's not exactly an expectation let's call it an"}, {"start": 2176.0, "end": 2197.0, "text": " 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 expectation and quotation marks under the training distribution of the generalization"}, {"start": 2197.0, "end": 2216.0, "text": " 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"}, {"start": 2216.0, "end": 2245.0, "text": " p plus e prior suppose 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"}, {"start": 2245.0, "end": 2270.0, "text": " 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 prior plus experience that's kind of in words what we looked at"}, {"start": 2270.0, "end": 2291.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 slide now of course these complexities and so on they're not exactly"}, {"start": 2291.0, "end": 2305.0, "text": " computable right so it 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": 2318.0, "text": " 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 this scope so that means the validity it should be rep"}, {"start": 2318.0, "end": 2333.0, "text": " applicable it should be reproducible it should measure broad abilities and developer where generalization sorry it should it should set out to measure broad abilities and developer aware generalization"}, {"start": 2333.0, "end": 2356.0, "text": " 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 reverse directly to the developer aware generalization"}, {"start": 2356.0, "end": 2373.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 it should at least be made clear whether the benchmark seeks to measure local generalization"}, {"start": 2373.0, "end": 2382.0, "text": " broad generalization or extreme generalization so we've we've seen this in part one"}, {"start": 2382.0, "end": 2396.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": 2396.0, "end": 2421.0, "text": " 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 of the more unlabeled data from the internet"}, {"start": 2421.0, "end": 2434.0, "text": " 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"}, {"start": 2434.0, "end": 2445.0, "text": " 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"}, {"start": 2445.0, "end": 2468.0, "text": " 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 a 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": 2485.0, "text": " 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"}, {"start": 2485.0, "end": 2498.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 and it refers to core knowledge which we saw in the last part"}, {"start": 2498.0, "end": 2509.0, "text": " 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"}, {"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 arc data set and the arc cackled challenge"}, {"start": 2559.0, "end": 2572.0, "text": " 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"}, {"start": 2572.0, "end": 2579.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": 2579.0, "end": 2597.0, "text": " but 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"}, {"start": 2597.0, "end": 2612.0, "text": " sort of alright that was it thank you for watching and bye bye see you next time"}] |
Yannic Kilcher | 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 Kranmer, Alvaro Sunchez Gonzales, Peter Pitalia, Ruizu, Kyle Kranmer, David Spurgel, 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 that 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 distilled 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 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 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 turns 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 how the things move. So we're going to try to replicate that process 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 this 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 m1m2 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 we 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. So you can 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 going to just, okay, I'm going to x plus delta x minus a squared. 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 it like a small mutation, I'm you take this to a minus and so on. And if you do this with an entire population as it's common in these evolutionary methods, you'll you'll end up with something better at the end. Now this works until a point. So whenever 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 the 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 technical. 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 right 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. So 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. So that'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. Alright 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. 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 the 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 you the charge right so all of these things are properties of the vertex. Then the other component of a graph or of course the edges so the edges connect to all of the so each edge connects to vertices like this and in 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 everything 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. So 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 1 2 1 2 3 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 diagonal is only dependent on that particle there is no part of the particle up here that modulates the force of the particle. 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 these spaces 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 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 time frame 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 this 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 non-linear complicated function and we know how to compute non-linear complicated functions with neural networks we're indeed learning right here so the 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 e k 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 outcomes 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 okay 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 end points into that edge and then that 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 from all of the attached end points 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 the vertex is going to be in a form of an independent sum so this simplification means that this function should somehow be not of the edges but of the sum of the edges right some of ei so this sum here this is the simplification that we make to make it in accordance with the physical system we could do with this graph network we could do any sort of complicated thing right here 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 it 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 then 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 it was a fairly lengthy way but it's important that you kind of understand what's happening so you built 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't 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 ignoring that peach and each to answer neural network but in this case these neural networks are shared so the neural network the computes the identification for that edge is the same as the neural network the cape is 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. 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. So we train this end to end. And here's a little bit of an analogy where they say, this is how you can 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 independent forces without interaction effects. Then concatenate with node. I guess this, I left this out, but whenever you compute the vertex properties, right, here, I guess, what you want to do is not only input the edge messages, but each vertex has these features that we said. And these could also be fairly important. 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. 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 property. So that's a little detail I left out before. So you concatenate the edge messages with the node. Then you compute the node model, which in this case is the computation. It's simply the, you take this sum right here, and you divide it by the mass. And then, optional, 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 dataset, 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 physical reality comes in that these, like the independence assumptions of these realities, comes in. Because in physics, you know, 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 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 this symbolic equation that describes the neural network the best. 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. All right. So that's the entire system. I believe I've told you the entire paper right here without actually going into, into the paper. Scheme the paper a bit to see that they actually tell us the same thing. So, yeah. So the graph networks, they say are ideal candidate for our approach due to their inductive biases shared by many physics problems. A, they're equivalent under particle permutations. B, they are differentiable end to end and can be trained efficiently using gradient descent. And see they make use of three separate and interpretable internal functions to 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 and 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 ureca package to perform symbolic regression and fit compact, close form analytical expressions to these neural networks. Ureca 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 the 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 look 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 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. The 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 actual informational content of that edge message should be two dimensional right if this really describes the force in two dimensions, it should be two dimensional. There is 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, alright, 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 notice 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 a 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 can strain. So the edge message if you take the absolute value in each entry and some 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. 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 stored 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 a made such that 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, 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'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. Actually, if we go down, it gets even clear. So here they have the outputs of that. Yes. Alright, 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. 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 is this delta vector and it's a product, it's an inner product, a dot product with this a, which is numerical constants. 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 the same number and here it's 0.6.6. Okay, but 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, 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, has 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. And that's, that's fairly cool, right, that 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. 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 L1 regularization as I said, they've 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 non linear 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. Non linear basically means that you can't really it doesn't really describe what you want really well. 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": 7.0200000000000005, "text": " Hi there. Today we're looking at discovering symbolic models from deep learning with inductive biases by Miles Kranmer,"}, {"start": 7.0200000000000005, "end": 13.86, "text": " Alvaro Sunchez Gonzales, Peter Pitalia, Ruizu, Kyle Kranmer, David Spurgel, and Shirley Ho."}, {"start": 13.86, "end": 23.34, "text": " So this paper on a high level, it uses graph neural networks to fit a data set of observations of a physical system."}, {"start": 23.34, "end": 32.38, "text": " And then it uses symbolic regression in order to parse out equations, symbolic equations from the graph neural network."}, {"start": 32.38, "end": 38.519999999999996, "text": " And the symbolic equations that will are found such that describe the physical system."}, {"start": 38.519999999999996, "end": 47.5, "text": " And they do find, they do recover some known equations and they do find a new one in the field of cosmology."}, {"start": 47.5, "end": 56.5, "text": " So we'll go through how they do it, what these two steps are, and why this might work better than previous approaches."}, {"start": 56.5, "end": 63.5, "text": " So yeah, join me. If you like content like this, as always, feel free to share it."}, {"start": 63.5, "end": 70.5, "text": " Subscribe if you haven't, if you want more content like this, and tell me what you think in the comments."}, {"start": 70.5, "end": 81.5, "text": " Alright, so they claim we develop a general approach to distilled symbolic representation of a learned deep model by introducing strong inductive biases."}, {"start": 81.5, "end": 90.5, "text": " And this, it doesn't really, it doesn't really say a whole lot, but I think the abstract doesn't say a whole lot."}, {"start": 90.5, "end": 104.5, "text": " So let me give you an example. If you have three different, let's say, planets or stars, right? This is a, this three body problem is a unsolved problem, I think still."}, {"start": 104.5, "end": 111.5, "text": " So if you have these three stars and you just let the simulation run, they have gravity, they attract each other, right?"}, {"start": 111.5, "end": 116.5, "text": " So they are going to move around somehow. So this one's going to move here. This one's going to move like this."}, {"start": 116.5, "end": 121.5, "text": " This one's going to move like this and then it turns around and this one turns around and so on."}, {"start": 121.5, "end": 131.5, "text": " So there is a fairly complex motions in already three different things that are somehow in a physical system together."}, {"start": 131.5, "end": 143.5, "text": " 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,"}, {"start": 143.5, "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.5, "text": " So our goal is to derive equations that govern this behavior, right?"}, {"start": 154.5, "end": 171.5, "text": " 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 turns the mass of the second divided by the radius that they are apart squared."}, {"start": 171.5, "end": 178.5, "text": " Something like this, times like this gravitational constant. That's, we know the equation that governs these interactions."}, {"start": 178.5, "end": 185.5, "text": " We don't know the symbolic solution to the whole problem, but we know the equation that governs the interaction, right?"}, {"start": 185.5, "end": 191.5, "text": " Now, imagine if we didn't know the equation, what do we have to do? Well, what did Newton do?"}, {"start": 191.5, "end": 207.5, "text": " 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 how the things move."}, {"start": 207.5, "end": 217.5, "text": " So we're going to try to replicate that process in an AI system, the process of coming up with an equation that governs this behavior."}, {"start": 217.5, "end": 226.5, "text": " 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."}, {"start": 226.5, "end": 233.5, "text": " Okay. And then we let it run for the next time step. This goes here, this goes here, this goes here and so on."}, {"start": 233.5, "end": 242.5, "text": " So that will give us, basically it will give us frame by frame how this system evolves frame by frame."}, {"start": 242.5, "end": 253.5, "text": " 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."}, {"start": 253.5, "end": 267.5, "text": " 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 m1m2 divided by r squared, that governs this behavior."}, {"start": 267.5, "end": 281.5, "text": " 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."}, {"start": 281.5, "end": 299.5, "text": " 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."}, {"start": 299.5, "end": 317.5, "text": " 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."}, {"start": 317.5, "end": 331.5, "text": " So we 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."}, {"start": 331.5, "end": 350.5, "text": " So you can 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 going to just, okay, I'm going to x plus delta x minus a squared."}, {"start": 350.5, "end": 361.5, "text": " 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 it like a small mutation, I'm you take this to a minus and so on."}, {"start": 361.5, "end": 372.5, "text": " And if you do this with an entire population as it's common in these evolutionary methods, you'll you'll end up with something better at the end."}, {"start": 372.5, "end": 389.5, "text": " Now this works until a point. So whenever 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."}, {"start": 389.5, "end": 398.5, "text": " 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."}, {"start": 398.5, "end": 415.5, "text": " This paper right here goes a different route. It uses graph neural networks in order to describe the data set. So in between the step of collecting a data set and making the equation it fits another step."}, {"start": 415.5, "end": 429.5, "text": " 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 technical."}, {"start": 429.5, "end": 436.5, "text": " It's like a type of neural network and we're going to have that neural network learn the data set."}, {"start": 436.5, "end": 447.5, "text": " 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 right so"}, {"start": 447.5, "end": 465.5, "text": " 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."}, {"start": 465.5, "end": 488.5, "text": " So 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."}, {"start": 488.5, "end": 506.5, "text": " So that'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."}, {"start": 506.5, "end": 521.5, "text": " Alright 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."}, {"start": 521.5, "end": 547.5, "text": " 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."}, {"start": 547.5, "end": 566.5, "text": " 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."}, {"start": 566.5, "end": 593.5, "text": " 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 the graph network is something different than graph neural network I think graph network is a type of graph neural network."}, {"start": 593.5, "end": 607.5, "text": " 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."}, {"start": 607.5, "end": 636.5, "text": " 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."}, {"start": 636.5, "end": 643.5, "text": " 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."}, {"start": 643.5, "end": 662.5, "text": " 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."}, {"start": 662.5, "end": 680.5, "text": " 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 you the charge right so all of these things are properties of the vertex."}, {"start": 680.5, "end": 704.5, "text": " Then the other component of a graph or of course the edges so the edges connect to all of the so each edge connects to vertices like this and in 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."}, {"start": 704.5, "end": 724.5, "text": " 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 everything like this."}, {"start": 724.5, "end": 752.5, "text": " 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."}, {"start": 752.5, "end": 764.5, "text": " 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."}, {"start": 764.5, "end": 793.5, "text": " So 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 1 2 1 2 3 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."}, {"start": 793.5, "end": 822.5, "text": " 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 diagonal is only dependent on that particle there is no part of the particle up here that modulates the force of the particle."}, {"start": 822.5, "end": 850.5, "text": " 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 these spaces just too high of equations."}, {"start": 850.5, "end": 878.5, "text": " 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"}, {"start": 878.5, "end": 907.5, "text": " 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"}, {"start": 907.5, "end": 931.5, "text": " 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"}, {"start": 931.5, "end": 960.5, "text": " 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"}, {"start": 960.5, "end": 983.5, "text": " okay considering all you know all the interactions between the particles just tell me where does it go in the very next time frame 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"}, {"start": 983.5, "end": 1000.5, "text": " 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"}, {"start": 1000.5, "end": 1027.5, "text": " let's say each vertex has these properties like this 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"}, {"start": 1027.5, "end": 1054.5, "text": " 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"}, {"start": 1054.5, "end": 1074.5, "text": " the edge here already needs to compute some sort of non-linear complicated function and we know how to compute non-linear complicated functions with neural networks we're indeed learning right here so the the edge here is going to compute what's called this edge function"}, {"start": 1074.5, "end": 1094.5, "text": " 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 e k for the edge k"}, {"start": 1094.5, "end": 1112.5, "text": " 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"}, {"start": 1112.5, "end": 1141.5, "text": " 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 outcomes 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"}, {"start": 1141.5, "end": 1169.5, "text": " okay 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 end points into that edge and then that step one so step one compute the edge messages step two is going to be to compute the vertex messages or the vertex outputs"}, {"start": 1169.5, "end": 1182.5, "text": " 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"}, {"start": 1182.5, "end": 1195.5, "text": " 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"}, {"start": 1195.5, "end": 1214.5, "text": " so we've computed previously the edge messages by integrating the information from all of the from all of the attached end points now we're going to go backwards and distribute the information from the edges back to the vertices that are attached"}, {"start": 1214.5, "end": 1223.5, "text": " 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"}, {"start": 1223.5, "end": 1234.5, "text": " this means that in the two step process this vertex here aggregates information from the other vertices via these edges"}, {"start": 1234.5, "end": 1249.5, "text": " 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"}, {"start": 1249.5, "end": 1264.5, "text": " 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"}, {"start": 1264.5, "end": 1278.5, "text": " 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 the vertex"}, {"start": 1278.5, "end": 1298.5, "text": " is going to be in a form of an independent sum so this simplification means that this function should somehow be not of the edges but of the sum of the edges right some of ei"}, {"start": 1298.5, "end": 1311.5, "text": " so this sum here this is the simplification that we make to make it in accordance with the physical system we could do with this graph network we could do any sort of complicated thing right here"}, {"start": 1311.5, "end": 1322.5, "text": " 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"}, {"start": 1322.5, "end": 1340.5, "text": " 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"}, {"start": 1340.5, "end": 1355.5, "text": " 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"}, {"start": 1355.5, "end": 1367.5, "text": " yes so you still need to divide it by force and technically it 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"}, {"start": 1367.5, "end": 1385.5, "text": " 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"}, {"start": 1385.5, "end": 1408.5, "text": " 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"}, {"start": 1408.5, "end": 1435.5, "text": " then 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"}, {"start": 1435.5, "end": 1457.5, "text": " 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"}, {"start": 1457.5, "end": 1477.5, "text": " right here predict the numerical acceleration of the system right here okay it was a fairly lengthy way but it's important that you kind of understand what's happening so you built the graph network according to the physical system"}, {"start": 1477.5, "end": 1506.5, "text": " 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"}, {"start": 1506.5, "end": 1533.5, "text": " now you can't 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 ignoring that peach and each to answer neural network but in this case these neural networks are shared so the neural network the computes the identification for that edge is the same as the neural network the cape is the edge message for any of the edges you can think of it like weight sharing"}, {"start": 1533.5, "end": 1537.5, "text": " or you can think that it is actually the same neural network, it's equivalent."}, {"start": 1537.5, "end": 1541.5, "text": " And the same for the vertices, there's only one neural network"}, {"start": 1541.5, "end": 1546.5, "text": " that in the same fashion computes the output for each vertex."}, {"start": 1546.5, "end": 1549.5, "text": " Of course, the incoming edge messages are going to be different"}, {"start": 1549.5, "end": 1551.5, "text": " and that's why you have different outputs."}, {"start": 1551.5, "end": 1556.5, "text": " But the neural network itself is the same."}, {"start": 1556.5, "end": 1561.5, "text": " Okay, so we have a system that can describe"}, {"start": 1561.5, "end": 1565.5, "text": " this data set of physical observations really well."}, {"start": 1565.5, "end": 1568.5, "text": " It's this graph neural network."}, {"start": 1568.5, "end": 1570.5, "text": " So we train this end to end."}, {"start": 1570.5, "end": 1574.5, "text": " And here's a little bit of an analogy where they say,"}, {"start": 1574.5, "end": 1581.5, "text": " this is how you can analogize the neural network with a physical system."}, {"start": 1581.5, "end": 1583.5, "text": " So what are the analogies here?"}, {"start": 1583.5, "end": 1589.5, "text": " The nodes in the graph network correspond to the particles in Newtonian mechanics."}, {"start": 1589.5, "end": 1593.5, "text": " Pairs of nodes correspond to two interacting particles."}, {"start": 1593.5, "end": 1598.5, "text": " The edge model is the force between two particles."}, {"start": 1598.5, "end": 1603.5, "text": " Then the pooling operation, which is the summing up of the edge messages,"}, {"start": 1603.5, "end": 1607.5, "text": " right, that we found so important as a simplification."}, {"start": 1607.5, "end": 1612.5, "text": " This is the sum into the net force that is really given in the physical system."}, {"start": 1612.5, "end": 1621.5, "text": " So independent, sum of independent forces without interaction effects."}, {"start": 1621.5, "end": 1624.5, "text": " Then concatenate with node."}, {"start": 1624.5, "end": 1632.5, "text": " I guess this, I left this out, but whenever you compute the vertex properties,"}, {"start": 1632.5, "end": 1639.5, "text": " right, here, I guess, what you want to do is not only input the edge messages,"}, {"start": 1639.5, "end": 1643.5, "text": " but each vertex has these features that we said."}, {"start": 1643.5, "end": 1646.5, "text": " And these could also be fairly important."}, {"start": 1646.5, "end": 1652.5, "text": " You technically have that information in the edge messages because it started out from these."}, {"start": 1652.5, "end": 1660.5, "text": " But you can also just input that again into this neural network together with the edge properties."}, {"start": 1660.5, "end": 1662.5, "text": " And that will just make its job a bit easier."}, {"start": 1662.5, "end": 1671.5, "text": " 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 property."}, {"start": 1671.5, "end": 1675.5, "text": " So that's a little detail I left out before."}, {"start": 1675.5, "end": 1680.5, "text": " So you concatenate the edge messages with the node."}, {"start": 1680.5, "end": 1685.5, "text": " Then you compute the node model, which in this case is the computation."}, {"start": 1685.5, "end": 1692.5, "text": " It's simply the, you take this sum right here, and you divide it by the mass."}, {"start": 1692.5, "end": 1699.5, "text": " And then, optional, you can update the nodes, which is compute the next time step, which we don't do right here,"}, {"start": 1699.5, "end": 1703.5, "text": " because we simply want to output the acceleration."}, {"start": 1703.5, "end": 1708.5, "text": " I guess, I mean, it should be equivalent to output the next time step,"}, {"start": 1708.5, "end": 1713.5, "text": " and then compare, compare with the dataset, what the next time step was."}, {"start": 1713.5, "end": 1716.5, "text": " In any case, you have to have some kind of loss function."}, {"start": 1716.5, "end": 1722.5, "text": " And here you can see all the black squares right here are going to be neural networks."}, {"start": 1722.5, "end": 1729.5, "text": " So now, we have learned a graph network that can describe a system."}, {"start": 1729.5, "end": 1731.5, "text": " How do we make this into an equation?"}, {"start": 1731.5, "end": 1742.5, "text": " And again, here, our physical reality comes in that these, like the independence assumptions of these realities, comes in."}, {"start": 1742.5, "end": 1749.5, "text": " Because in physics, you know, the acceleration here is going to be a function of the sum and so on."}, {"start": 1749.5, "end": 1755.5, "text": " What we need to do is we don't need to develop an equation for the entire system."}, {"start": 1755.5, "end": 1761.5, "text": " Right? What we need to do is simply we need to develop an equation for each vertex."}, {"start": 1761.5, "end": 1767.5, "text": " So each vertex, we need to have an equation acceleration equals something."}, {"start": 1767.5, "end": 1775.5, "text": " And that something should include some of the edges."}, {"start": 1775.5, "end": 1778.5, "text": " And then the edges again should be something. Right?"}, {"start": 1778.5, "end": 1784.5, "text": " So we technically, as we had two neural networks, we technically need two symbolic equations."}, {"start": 1784.5, "end": 1788.5, "text": " One that represents that first neural network that computes the edge functions."}, {"start": 1788.5, "end": 1795.5, "text": " And one that represents that second neural network that aggregates the sum of the edge functions."}, {"start": 1795.5, "end": 1799.5, "text": " Or that computes the output from the sum of the edge functions."}, {"start": 1799.5, "end": 1802.5, "text": " And that, you know, it's an exact correspondence."}, {"start": 1802.5, "end": 1810.5, "text": " So what we need to do is we need to take that first neural network up here and do symbolic regression on that."}, {"start": 1810.5, "end": 1815.5, "text": " And the second neural network do symbolic regression on that."}, {"start": 1815.5, "end": 1818.5, "text": " So what does it mean to do symbolic regression?"}, {"start": 1818.5, "end": 1828.5, "text": " It basically means that we want to find this symbolic equation that describes the neural network the best."}, {"start": 1828.5, "end": 1832.5, "text": " And we do that in the exact same fashion as we started right here."}, {"start": 1832.5, "end": 1835.5, "text": " So we give it a bunch of these options."}, {"start": 1835.5, "end": 1840.5, "text": " And then we let the system describe the neural network as best as possible."}, {"start": 1840.5, "end": 1844.5, "text": " The way we do that again is we try out equations."}, {"start": 1844.5, "end": 1850.5, "text": " And if they just, if they get a low error, right, we, so we let the neural network run on the data set."}, {"start": 1850.5, "end": 1852.5, "text": " And we let this run on the data set."}, {"start": 1852.5, "end": 1855.5, "text": " If it outputs the same thing, it describes the neural network."}, {"start": 1855.5, "end": 1859.5, "text": " Well, and we can iterate that until we find a good equation."}, {"start": 1859.5, "end": 1864.5, "text": " So the difference here is that we don't need to find an equation that covers the whole system."}, {"start": 1864.5, "end": 1871.5, "text": " We just need to find two equations, one governing the edge model and one governing the vertex model."}, {"start": 1871.5, "end": 1875.5, "text": " And that's way, way easier than the whole system."}, {"start": 1875.5, "end": 1888.5, "text": " 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."}, {"start": 1888.5, "end": 1889.5, "text": " All right."}, {"start": 1889.5, "end": 1890.5, "text": " So that's the entire system."}, {"start": 1890.5, "end": 1899.5, "text": " I believe I've told you the entire paper right here without actually going into, into the paper."}, {"start": 1899.5, "end": 1904.5, "text": " Scheme the paper a bit to see that they actually tell us the same thing."}, {"start": 1904.5, "end": 1908.5, "text": " So, yeah."}, {"start": 1908.5, "end": 1916.5, "text": " So the graph networks, they say are ideal candidate for our approach due to their inductive biases shared by many physics problems."}, {"start": 1916.5, "end": 1919.5, "text": " A, they're equivalent under particle permutations."}, {"start": 1919.5, "end": 1924.5, "text": " B, they are differentiable end to end and can be trained efficiently using gradient descent."}, {"start": 1924.5, "end": 1932.5, "text": " And see they make use of three separate and interpretable internal functions to edge the node and the global model."}, {"start": 1932.5, "end": 1937.5, "text": " Now the global model here isn't really used in the cases we're going to look at."}, {"start": 1937.5, "end": 1949.5, "text": " So it's just going to be two different neural networks, which are targets for the symbolic regression graph networks and also be embedded with additional symmetries as in 2324."}, {"start": 1949.5, "end": 1951.5, "text": " But we don't implement these."}, {"start": 1951.5, "end": 1963.5, "text": " Okay. And then they say symbolic regression. So they use this ureca package to perform symbolic regression and fit compact, close form analytical expressions to these neural networks."}, {"start": 1963.5, "end": 1969.5, "text": " Ureca works by using a genetic algorithm to combine algebraic expression stochastically."}, {"start": 1969.5, "end": 1976.5, "text": " The technique is analogous to natural selection where the fitness of each expression is defined in terms of simplicity and accuracy."}, {"start": 1976.5, "end": 1983.5, "text": " The operations considered in the fitting process are plus minus times the if as well as real constants."}, {"start": 1983.5, "end": 1991.5, "text": " Alright. So if we look at the examples, they have three different examples."}, {"start": 1991.5, "end": 1998.5, "text": " First of all, they have Newtonian dynamics, which is for example this gravitational force we look at."}, {"start": 1998.5, "end": 2006.5, "text": " They have Hamiltonian dynamics, which describes the same systems, but in a different way in terms of the Hamiltonian."}, {"start": 2006.5, "end": 2015.5, "text": " And I don't want to go into this too much because I think the Newtonian dynamics already demonstrate really well what the system can do."}, {"start": 2015.5, "end": 2027.5, "text": " 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."}, {"start": 2027.5, "end": 2032.5, "text": " And they actually that's where they find a new unknown equation."}, {"start": 2032.5, "end": 2046.5, "text": " 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."}, {"start": 2046.5, "end": 2057.5, "text": " Right. But in between there is now you can put even more constraints to make the network really learn a physical equation."}, {"start": 2057.5, "end": 2062.5, "text": " So we said you're going to compute these edge functions right here."}, {"start": 2062.5, "end": 2071.5, "text": " 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."}, {"start": 2071.5, "end": 2086.5, "text": " The 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."}, {"start": 2086.5, "end": 2106.5, "text": " Now we know that for example in a 2d system, the actual informational content of that edge message should be two dimensional right if this really describes the force in two dimensions, it should be two dimensional."}, {"start": 2106.5, "end": 2121.5, "text": " There is 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, alright, I will choose the hidden dimension to be two."}, {"start": 2121.5, "end": 2127.5, "text": " And therefore I will force my neural network to just use two dimensions."}, {"start": 2127.5, "end": 2146.5, "text": " This however, they notice 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."}, {"start": 2146.5, "end": 2158.5, "text": " 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."}, {"start": 2158.5, "end": 2169.5, "text": " And this is probably more a property of the optimization procedure than the problem itself. It's a property of, you know, us training graph neural networks with SGD."}, {"start": 2169.5, "end": 2184.5, "text": " 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."}, {"start": 2184.5, "end": 2202.5, "text": " So L1 regularization simply means that you can strain. So the edge message if you take the absolute value in each entry and some 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."}, {"start": 2202.5, "end": 2220.5, "text": " 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."}, {"start": 2220.5, "end": 2235.5, "text": " 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."}, {"start": 2235.5, "end": 2251.5, "text": " 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 stored by largest standard deviation."}, {"start": 2251.5, "end": 2266.5, "text": " 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."}, {"start": 2266.5, "end": 2281.5, "text": " 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."}, {"start": 2281.5, "end": 2299.5, "text": " And here it's a made such that 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."}, {"start": 2299.5, "end": 2314.5, "text": " 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."}, {"start": 2314.5, "end": 2334.5, "text": " 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."}, {"start": 2334.5, "end": 2349.5, "text": " 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."}, {"start": 2349.5, "end": 2365.5, "text": " 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."}, {"start": 2365.5, "end": 2386.5, "text": " Now you might, 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'm not a big physics person."}, {"start": 2386.5, "end": 2402.5, "text": " 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."}, {"start": 2402.5, "end": 2416.5, "text": " This already looks okay. Actually, if we go down, it gets even clear. So here they have the outputs of that. Yes."}, {"start": 2416.5, "end": 2434.5, "text": " Alright, 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."}, {"start": 2434.5, "end": 2455.5, "text": " 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 is this delta vector and it's a product, it's an inner product, a dot product with this a, which is numerical constants."}, {"start": 2455.5, "end": 2472.5, "text": " 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 the same number and here it's 0.6.6."}, {"start": 2472.5, "end": 2500.5, "text": " Okay, but 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, 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."}, {"start": 2500.5, "end": 2515.5, "text": " 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."}, {"start": 2515.5, "end": 2536.5, "text": " 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."}, {"start": 2536.5, "end": 2557.5, "text": " 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."}, {"start": 2557.5, "end": 2577.5, "text": " If you simply consider so delta z here, I guess, is, has 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."}, {"start": 2577.5, "end": 2591.5, "text": " And that's, that's fairly cool, right, that 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."}, {"start": 2591.5, "end": 2616.5, "text": " 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."}, {"start": 2616.5, "end": 2627.5, "text": " 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."}, {"start": 2627.5, "end": 2638.5, "text": " 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."}, {"start": 2638.5, "end": 2647.5, "text": " So here the output for node I is going to be a sum over all the other nodes J."}, {"start": 2647.5, "end": 2665.5, "text": " 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."}, {"start": 2665.5, "end": 2672.5, "text": " As you know, the same here in this spring law, this came out of our edge model, this came out of our vertex model."}, {"start": 2672.5, "end": 2683.5, "text": " 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."}, {"start": 2683.5, "end": 2698.5, "text": " 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."}, {"start": 2698.5, "end": 2702.5, "text": " Yeah, but other than that, it's pretty straightforward."}, {"start": 2702.5, "end": 2714.5, "text": " Their appendix is also pretty detailed in how they do all the representations and so on. They have different formulations other than this L1 regularization as I said, they've bottleneck they have like a KL formulation."}, {"start": 2714.5, "end": 2722.5, "text": " They really describe how the graph neural network works here and so on. So all in all, I enjoyed reading this paper."}, {"start": 2722.5, "end": 2745.5, "text": " 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 non linear relationship where you can make the claim this doesn't really describe the force well because it's not"}, {"start": 2745.5, "end": 2753.5, "text": " linear relationship indicates that what the network found is a rotation of what you really want and that's good because it's equivalent."}, {"start": 2753.5, "end": 2762.5, "text": " Non linear basically means that you can't really it doesn't really describe what you want really well."}, {"start": 2762.5, "end": 2772.5, "text": " 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."}] |
Yannic Kilcher | 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've 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 I'll just go through it okay so first thing I do is of course read the title so the title has three parts and 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 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 N to end and even if they aren't if most systems aren't and to end a lot of people don't it's like end to end image classification on ImageNet like thanks so I was guessing that the reason they put in end to end into the title was because that's actually something that's special about the model so now I have like too 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 true fear is that the combination of N to N transformers all of that is what makes this model and I already form like hypothesis of whether I like this or not 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 all right 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 vineyards paper and 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 a like Joshua Benz or someone like really famous then of course that would catch my eye and but I also know that you know Joshua Benz's paper Joshua Benz'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 clue or Ken can ethos Stanley you know that there's there's going to be the certain type 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 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 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 air publishes a paper all of these all these pop sign magazines like diverge and this and life hacker and hacker news and well not they like like write a blurb about it so often they get much more scrutinized for these papers they got 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 meet 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 it's like blah blah blah a new method that views object detection as a direct set prediction problem I'm like oh yeah okay it's a 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 bi-pertype 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 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 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's not necessarily going to be better their argument is more that it's going to be easier right there 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 advantage 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 is 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 the 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 of 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. Dead or demonstrate accuracy and runtime performance on par with well established that further confirms my hypothesis that this is on par right they runtime performance on par with the current state of the art and at the end they say more over dead or can easily be generalized to proceed to produce panoptic segmentation in a unified manner we show that it's significantly outperforms competitive baselines training code and preacher models are okay now this last part when I first read it is 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 form 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 right here without knowing anything more would be to 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 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 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 knew that they're gonna 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 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 or so far so good then transformer encoder decoder then set of box predictions so all of them come out here and I already read their in parallel and then by part type 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 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 this this 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 birth 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 there are 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 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 then therefore I felt when I saw this and I just glance 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 and this here seems to be like of 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 of this and then back here in the appendix I find this here which I immediately map to the previous where this is the encoder and this is the decoder and I've already read the attention is already in the paper and that that point it clicked and he's like oh this is not a bird 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 like 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 form 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 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 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 this related work and honestly 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 review or 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 of may 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 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 to reference his oftentimes this is a good place but a lot of it is just blah blah blah blah okay I don't I don't disagree with me if you want oh yeah to maybe to read in 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 it 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 yeah okay I got it got it got it got it that's it's not helpful except related work skip completely cool then a lot of times in this paper now is the 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'd 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 max and question going for is this box loss that scores bounding boxes unlike many detectors that do box prediction with some initial the other the other they say the most common least one loss will have different scales for a small so here they basically talk about how they mix the losses they see 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 oh 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 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 on 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 in the backbone okay transformer encoder okay and now I understand much more closely a decoder okay and here I get now finally I get what this is about decodes and objects in parallel 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 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 these sometimes you have to pay attention to like 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 aren't the easiest thing that you would do when you would go about and do what they did okay so then you let's conclude 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 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 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 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 time the case 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 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 is 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 this 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 than 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-attentions 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 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 C410 dataset now if your baseline model has like a 90 192 percent accuracy on C410 when I know the state-of-the-art is 96 I don't care right I know like I've done C410 I know with like I don't know five six layers CNN you can reach these 91 92 93 percent accuracy and to get to the 96 97 you'd actually be like in the region of a wide resonant and whatnot so I you know 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 percent accuracy on C410 then I then I get a bit like I like it's pretty easy to get to 90 percent 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 keep 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 an add-on to the method or is was this appear 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 can 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 in first couple of reads and just I don't even think about the paper I just kind of it is 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 gonna explain this and so on but I just found the 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 enjoy 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.0, "text": " Hi there people, so a lot of you have asked me how I read papers and honestly I"}, {"start": 8.0, "end": 13.040000000000001, "text": " don't think there is any super special method to it but you know I've I thought"}, {"start": 13.040000000000001, "end": 17.64, "text": " because people have asked me to make a video on it so I'll make a video on it"}, {"start": 17.64, "end": 24.0, "text": " and I'll try to share my method of reading papers and hopefully this is going"}, {"start": 24.0, "end": 28.72, "text": " to be somewhat of a mini series or a series where I every now and then"}, {"start": 28.72, "end": 34.019999999999996, "text": " discuss how I read one of the papers that I make videos about and I'll try to"}, {"start": 34.019999999999996, "end": 38.96, "text": " select them such that different things are highlighted. Now I've selected this"}, {"start": 38.96, "end": 43.64, "text": " one right here for really for no particular reason other than I sort of"}, {"start": 43.64, "end": 50.120000000000005, "text": " remembered it and I'm going to try to go with you through how I read this and"}, {"start": 50.120000000000005, "end": 56.32, "text": " how I encountered this and kind of try to honestly share what I thought at"}, {"start": 56.32, "end": 62.96, "text": " the first time when I read it and I hope this helps some of you if it does help"}, {"start": 62.96, "end": 67.0, "text": " you and if you like content like this of course feel free to share this out"}, {"start": 67.0, "end": 73.6, "text": " and subscribe if you haven't seen my original video on this paper it might be"}, {"start": 73.6, "end": 81.28, "text": " worth to go watch it I'll link it and with that let's dive in so again this"}, {"start": 81.28, "end": 86.88, "text": " might be not really something new but I'll I'll just go through it okay so"}, {"start": 86.88, "end": 93.04, "text": " first thing I do is of course read the title so the title has three parts and to"}, {"start": 93.04, "end": 98.44, "text": " end object detection with transformers so what I noticed that I do myself is I"}, {"start": 98.44, "end": 104.04, "text": " like through reading a paper it's like read the paper with an open mind I don't"}, {"start": 104.04, "end": 109.36, "text": " do that I almost immediately form an opinion and a hypothesis of what's going"}, {"start": 109.36, "end": 114.64, "text": " on like so I see transformers so I know what transformers are if you don't I've"}, {"start": 114.64, "end": 118.24, "text": " made a video of my lots of videos on transformers attention is all you need is"}, {"start": 118.24, "end": 122.88, "text": " the base paper for that so I know what a transformer is okay and I know that"}, {"start": 122.88, "end": 129.64, "text": " transformers are usually in NLP are usually used in NLP there are things like"}, {"start": 129.64, "end": 136.72, "text": " you know other things with transformers but it's usually an NLP model then I read"}, {"start": 136.72, "end": 140.44, "text": " object detection and I know object detection is a computer vision task so"}, {"start": 140.44, "end": 146.52, "text": " immediately this here is sort of a a difference and I immediately try to"}, {"start": 146.52, "end": 152.28, "text": " assess what's the new idea in this paper and in this case it might be okay it"}, {"start": 152.28, "end": 156.4, "text": " might be applying transformers to object detection but then I also see end to"}, {"start": 156.4, "end": 161.8, "text": " end and the only reason to put that in a title is because that's the novelty"}, {"start": 161.8, "end": 165.88, "text": " because usually in deep learning we're sort of used to systems being N to end"}, {"start": 165.88, "end": 171.28, "text": " and even if they aren't if most systems aren't and to end a lot of people don't"}, {"start": 171.28, "end": 178.72, "text": " it's like end to end image classification on ImageNet like thanks so I was"}, {"start": 178.72, "end": 182.76, "text": " guessing that the reason they put in end to end into the title was because"}, {"start": 182.76, "end": 187.56, "text": " that's actually something that's special about the model so now I have like"}, {"start": 187.56, "end": 192.4, "text": " too competing hypotheses of why this paper matters first of all because it"}, {"start": 192.4, "end": 197.68, "text": " does it with transformers and second because it does it end to end and the of"}, {"start": 197.68, "end": 202.6, "text": " course the true fear is that the combination of N to N transformers all of"}, {"start": 202.6, "end": 208.68, "text": " that is what makes this model and I already form like hypothesis of whether I"}, {"start": 208.68, "end": 214.28, "text": " like this or not I have to be I have to be honest I have very quick judgment of"}, {"start": 214.28, "end": 219.56, "text": " papers of whether I like them or not and then I sort of catch myself each time"}, {"start": 219.56, "end": 225.92000000000002, "text": " and I still try to so there for most papers actually that I have sort of a"}, {"start": 225.92000000000002, "end": 230.72, "text": " negative opinion at the beginning where I will negative there are papers where I"}, {"start": 230.72, "end": 235.76, "text": " think like there is no way this is going to you know work or something like this"}, {"start": 235.76, "end": 242.36, "text": " I'm actually positively convinced throughout the paper so for most for most"}, {"start": 242.36, "end": 248.76, "text": " papers where I that I read I'm trying to find the positive things in there but I"}, {"start": 248.76, "end": 254.0, "text": " do form an opinion pretty quickly usually all right so the second thing this"}, {"start": 254.0, "end": 259.52, "text": " part right here I like I don't even see this is like advertisements on on like"}, {"start": 259.52, "end": 265.32, "text": " Twitter I like you just I have always had issues with author names like people"}, {"start": 265.32, "end": 272.03999999999996, "text": " will come to me and be like oh have you seen the new vineyards paper and no"}, {"start": 272.03999999999996, "end": 275.8, "text": " clue and then when they say like oh that's where they use this character level"}, {"start": 275.8, "end": 281.44, "text": " model to do that and I'm like oh that paper so I like do not care who the"}, {"start": 281.44, "end": 285.84000000000003, "text": " authors are of a paper like I don't I can't remember the papers by their"}, {"start": 285.84000000000003, "end": 290.56, "text": " author names I've gotten better at it I have to say but I've always had trouble"}, {"start": 290.56, "end": 295.68, "text": " with this now that's not to say that a name doesn't pop out to me like if this"}, {"start": 295.68, "end": 301.88, "text": " would be like a like Joshua Benz or someone like really famous then of course"}, {"start": 301.88, "end": 306.84, "text": " that would catch my eye and but I also know that you know Joshua Benz's"}, {"start": 306.84, "end": 312.71999999999997, "text": " paper Joshua Benz's lab is huge so just because a big name is on the paper"}, {"start": 312.71999999999997, "end": 317.64, "text": " doesn't mean that the paper is going to be of any good or bad quality"}, {"start": 317.64, "end": 322.12, "text": " sometimes the authors give you an indication of what kind of research is"}, {"start": 322.12, "end": 328.08, "text": " there like if you see Jeff clue or Ken can ethos Stanley you know that"}, {"start": 328.08, "end": 333.59999999999997, "text": " there's there's going to be the certain type of you know learning to explore"}, {"start": 333.59999999999997, "end": 339.64, "text": " and and and kind of a bit more out of the box thinking in their papers which I"}, {"start": 339.64, "end": 344.88, "text": " really like but it doesn't immediately give you clue maybe if you go by first"}, {"start": 344.88, "end": 350.28, "text": " authors it's much more indicative if you have already read some of their"}, {"start": 350.28, "end": 356.64, "text": " papers but most often I just ignore authors and go on the affiliation"}, {"start": 356.64, "end": 362.8, "text": " sometimes matters in that it's a bit of a vicious cycle if there's a big name"}, {"start": 362.8, "end": 369.44, "text": " affiliation like Facebook AI Google AI and so on these papers also they get"}, {"start": 369.44, "end": 373.71999999999997, "text": " more exposure in like the press and so on so whenever Google air publishes a"}, {"start": 373.71999999999997, "end": 378.47999999999996, "text": " paper all of these all these pop sign magazines like diverge and this and"}, {"start": 378.47999999999996, "end": 384.12, "text": " life hacker and hacker news and well not they like like write a blurb about it"}, {"start": 384.12, "end": 390.04, "text": " so often they get much more scrutinized for these papers they got much"}, {"start": 390.04, "end": 394.24, "text": " more they get much more the public attention but they also get much more"}, {"start": 394.24, "end": 400.24, "text": " scrutiny which in turn means that there is a bit more pressure on them to do"}, {"start": 400.24, "end": 406.16, "text": " good experiments so that biases meet like a little bit into the direction of"}, {"start": 406.16, "end": 412.76, "text": " believing their experimental evidence more now usually this is also backed up"}, {"start": 412.76, "end": 418.03999999999996, "text": " by the fact that I am actually convinced by their experiments usually so these"}, {"start": 418.03999999999996, "end": 424.59999999999997, "text": " these big name papers often I find myself even without or disregarding the"}, {"start": 424.59999999999997, "end": 431.08, "text": " affiliation to be convinced more than of like regular papers my most often"}, {"start": 431.08, "end": 436.28, "text": " issue with papers is that I don't believe the experiments and I make no"}, {"start": 436.28, "end": 440.96, "text": " difference like even if it's Facebook I still my prior is the experiments are"}, {"start": 440.96, "end": 446.03999999999996, "text": " crap and I don't believe them and they have to convince me of the opposite but"}, {"start": 446.03999999999996, "end": 451.56, "text": " some like I can't say that it doesn't affect me that it's like a big name"}, {"start": 451.56, "end": 457.79999999999995, "text": " affiliation okay so then the second thing is I sometimes I see the paper on"}, {"start": 457.79999999999995, "end": 464.03999999999996, "text": " archive and I skim the abstract sometimes the abstract is informative and"}, {"start": 464.03999999999996, "end": 469.76, "text": " sometimes not so here it's like blah blah blah a new method that views object"}, {"start": 469.76, "end": 474.84, "text": " detection as a direct set prediction problem I'm like oh yeah okay it's a"}, {"start": 474.84, "end": 478.08, "text": " streamlines the detection effectively removing the need for many hand"}, {"start": 478.08, "end": 482.68, "text": " design components like non-maximum suppression yada yada yada the main"}, {"start": 482.68, "end": 488.36, "text": " ingredients called detection transformer a set based global loss that forces"}, {"start": 488.36, "end": 492.08, "text": " unique prediction via bi-pertype matching and the transformer encoder decoder"}, {"start": 492.08, "end": 496.59999999999997, "text": " architecture so they make it clear here why it matters and that's that's what"}, {"start": 496.6, "end": 500.48, "text": " I what I want to get at is sort of what's the new thing in this paper most"}, {"start": 500.48, "end": 506.64000000000004, "text": " papers are even though they're all very long and have lots of math and so on"}, {"start": 506.64000000000004, "end": 514.52, "text": " they often have like one or maybe two new core things that they really tell"}, {"start": 514.52, "end": 520.6, "text": " you sometimes zero but a lot of times it's like one thing that they really do"}, {"start": 520.6, "end": 525.48, "text": " and you sort of have to but they're trying to cloak it often because they need"}, {"start": 525.48, "end": 531.0, "text": " to make their research as impactful as possible right but you need to sort of"}, {"start": 531.0, "end": 536.0, "text": " figure out what it is they're doing here they make it fairly easy for us in"}, {"start": 536.0, "end": 541.64, "text": " that they say okay they remove the need for many hand design components like"}, {"start": 541.64, "end": 545.36, "text": " non-maximum suppression which tells me that they're building something that's"}, {"start": 545.36, "end": 549.9200000000001, "text": " easier than what came before them and that already tells me it's not"}, {"start": 549.9200000000001, "end": 554.12, "text": " necessarily going to be better their argument is more that it's going to be"}, {"start": 554.12, "end": 560.08, "text": " easier right there there are sort of two kinds of experimental results the ones"}, {"start": 560.08, "end": 564.08, "text": " where you try to beat what came before you and the ones where you're trying to"}, {"start": 564.08, "end": 568.88, "text": " say look our thing works just as well as this other thing while being more"}, {"start": 568.88, "end": 574.28, "text": " advantage in some other metric so I would place this already in the sort of"}, {"start": 574.28, "end": 579.36, "text": " second category and then they say what are the actual ingredients it's a set"}, {"start": 579.36, "end": 585.52, "text": " based global loss that forces unique predictions via bipartite matching now I at"}, {"start": 585.52, "end": 588.52, "text": " this point I know what these terms mean but at this point I actually don't"}, {"start": 588.52, "end": 593.36, "text": " have to know what the terms mean what I need to recognize is that I simply"}, {"start": 593.36, "end": 599.6800000000001, "text": " have to go later and figure out what that is and a transformer based encoder"}, {"start": 599.6800000000001, "end": 606.9200000000001, "text": " decoder architecture okay so there are two things right here that I remember I"}, {"start": 606.92, "end": 610.92, "text": " need to pay attention to later there is this loss which seems to be special and"}, {"start": 610.92, "end": 616.36, "text": " there is the transformer architecture which seem which they say okay that"}, {"start": 616.36, "end": 621.36, "text": " that's the model basically consists of those two things and then they have a"}, {"start": 621.36, "end": 626.16, "text": " short description of what it does given a fixed small set of learned object"}, {"start": 626.16, "end": 630.92, "text": " queries that the reasons about the relations of the objects and the global"}, {"start": 630.92, "end": 635.64, "text": " image context to directly output the final set of predicted in parallel that"}, {"start": 635.64, "end": 641.64, "text": " almost tells me nothing of yeah okay the model reasons maybe this in parallel is"}, {"start": 641.64, "end": 647.64, "text": " something but the model is conceptually simple and does not require specialized"}, {"start": 647.64, "end": 652.08, "text": " library unlike many other modern detectors this sort of repeats this enforces my"}, {"start": 652.08, "end": 656.0, "text": " hypothesis that they're going with the hey this is a much easier way of doing"}, {"start": 656.0, "end": 661.4399999999999, "text": " things approach. Dead or demonstrate accuracy and runtime performance on par"}, {"start": 661.44, "end": 667.8000000000001, "text": " with well established that further confirms my hypothesis that this is on par"}, {"start": 667.8000000000001, "end": 673.9200000000001, "text": " right they runtime performance on par with the current state of the art and at the"}, {"start": 673.9200000000001, "end": 678.12, "text": " end they say more over dead or can easily be generalized to proceed to produce"}, {"start": 678.12, "end": 683.2, "text": " panoptic segmentation in a unified manner we show that it's significantly"}, {"start": 683.2, "end": 688.48, "text": " outperforms competitive baselines training code and preacher models are okay now"}, {"start": 688.48, "end": 692.8000000000001, "text": " this last part when I first read it is like okay can easily be generalized to"}, {"start": 692.8000000000001, "end": 698.44, "text": " produce this panoptic segmentation this is I didn't know yet whether this is"}, {"start": 698.44, "end": 702.4, "text": " like a central claim of their paper that it can do this segmentation or whether"}, {"start": 702.4, "end": 706.76, "text": " this is like an added benefit to their paper because you can read it in both"}, {"start": 706.76, "end": 712.8000000000001, "text": " ways and I'm just ready to find this out in the paper now after I've read the"}, {"start": 712.8000000000001, "end": 717.08, "text": " abstract and sort of already form the hypothesis of what's going on so here I"}, {"start": 717.08, "end": 722.72, "text": " already in my mind I already sort of have a model of how would I do that right"}, {"start": 722.72, "end": 730.64, "text": " how would I how would I do that and then what would I do so right now what I"}, {"start": 730.64, "end": 736.88, "text": " might be thinking is if I have a transformer over images that directly outputs"}, {"start": 736.88, "end": 744.84, "text": " the predictions in parallel I'm imagining like an image and the image somehow"}, {"start": 744.84, "end": 749.44, "text": " needs to go into a transformer so maybe there's like an encoder like a CNN"}, {"start": 749.44, "end": 756.9200000000001, "text": " encoder that gives me image features and then it's it's so maybe you sample"}, {"start": 756.9200000000001, "end": 761.36, "text": " this down this image this is just me hypothesizing what could be going on"}, {"start": 761.36, "end": 767.2, "text": " right and then I might be unrolling that right this image into a vector of these"}, {"start": 767.2, "end": 773.4000000000001, "text": " lower pixels and then so in my mind what I would do right here without"}, {"start": 773.4, "end": 777.9599999999999, "text": " knowing anything more would be to do something like Bert Span prediction so I"}, {"start": 777.9599999999999, "end": 784.1999999999999, "text": " would have Bert right here and I so for I would input the sequence right here"}, {"start": 784.1999999999999, "end": 791.04, "text": " and then to detect an object I would sort of think that maybe the Bert you"}, {"start": 791.04, "end": 796.68, "text": " know Bert has an output that is the same length as the input right so it's it's"}, {"start": 796.68, "end": 803.36, "text": " very good at sequence tagging and things like this so maybe how it detects an"}, {"start": 803.36, "end": 808.52, "text": " object is going to be that it sort of like tags the tags the center location in"}, {"start": 808.52, "end": 813.08, "text": " the pixel of an object right here or it tags somehow the corners of the of the"}, {"start": 813.08, "end": 816.84, "text": " bounding box but then I don't know how this is going to be in parallel maybe"}, {"start": 816.84, "end": 822.44, "text": " Bert outputs like a score for each location and then you do some kind of matching"}, {"start": 822.44, "end": 829.12, "text": " right here so this is my initial hypothesis of what's going on and then I scroll"}, {"start": 829.12, "end": 835.5600000000001, "text": " through and honestly the first thing I do is I go and find the pictures and no"}, {"start": 835.5600000000001, "end": 839.84, "text": " no different in all like since since your first book you read that's what you"}, {"start": 839.84, "end": 844.16, "text": " do I go and find the pictures because usually if someone proposes anything"}, {"start": 844.16, "end": 849.92, "text": " knew that they're gonna try to make a picture of it luckily I don't do like"}, {"start": 849.92, "end": 854.84, "text": " super theoretical what not your Bayesian generalization bounds and I don't"}, {"start": 854.84, "end": 861.4, "text": " know so most often papers I read have some sort of picture and that's very"}, {"start": 861.4, "end": 869.6800000000001, "text": " helpful to me I know I know but yeah so I find this picture and here I see okay"}, {"start": 869.6800000000001, "end": 876.0, "text": " you have image you have CNN okay gives you set of image features or so far"}, {"start": 876.0, "end": 881.72, "text": " so good then transformer encoder decoder then set of box predictions so all of"}, {"start": 881.72, "end": 886.2, "text": " them come out here and I already read their in parallel and then by part type"}, {"start": 886.2, "end": 891.2, "text": " matching loss so here they I can see they color these in different ways and these"}, {"start": 891.2, "end": 896.0, "text": " color appear to match with these colors right here right in the green here and"}, {"start": 896.0, "end": 900.6800000000001, "text": " these they they also this is a very good graphic right from this I can already"}, {"start": 900.6800000000001, "end": 906.0400000000001, "text": " read that these here go to the no object a lot of times the graphics aren't very"}, {"start": 906.0400000000001, "end": 911.0, "text": " good so this this is what I'm not saying in every paper you can learn by"}, {"start": 911.0, "end": 915.2, "text": " looking at the graphics like sometimes the graphics are terrible and you're"}, {"start": 915.2, "end": 920.2, "text": " like what's going on here I like I don't this this makes no sense this happens"}, {"start": 920.2, "end": 924.44, "text": " a lot in this paper right here this happens to be very very good explanatory"}, {"start": 924.44, "end": 930.48, "text": " graphics so I'll take advantage of that and I do the same thing in the other"}, {"start": 930.48, "end": 935.24, "text": " papers right but then later when it doesn't match what I read in the text I"}, {"start": 935.24, "end": 941.2, "text": " I'll have to you know update my belief and so on but here I see that these go to"}, {"start": 941.2, "end": 948.48, "text": " no object and this goes to no object so I don't know yet that this is the test"}, {"start": 948.48, "end": 953.28, "text": " set at the point where I read this I was sort of confused by this but I"}, {"start": 953.28, "end": 959.6, "text": " recognized that each of these boxes right here is going to be either"}, {"start": 959.6, "end": 965.52, "text": " resulting in a bounding box or in the no object prediction so from that I could"}, {"start": 965.52, "end": 971.96, "text": " conclude that these things here are maybe some sort of a fixed set right but I"}, {"start": 971.96, "end": 977.0400000000001, "text": " still thought that you know this this this would actually be the output of"}, {"start": 977.0400000000001, "end": 981.44, "text": " these image features so that in this case you'd have like six set of image"}, {"start": 981.44, "end": 986.6800000000001, "text": " features and then you'd have like birth here even though that's not an encoder"}, {"start": 986.68, "end": 991.3199999999999, "text": " decoder I still this was still my running hypothesis that somehow you'd"}, {"start": 991.3199999999999, "end": 997.76, "text": " map these image features to these boxes right here so and I didn't know what"}, {"start": 997.76, "end": 1003.16, "text": " to what to make of this this thing right here so then I went through some more"}, {"start": 1003.16, "end": 1008.92, "text": " and look for more pictures and there are not sometimes I also kind of"}, {"start": 1008.92, "end": 1013.4399999999999, "text": " glance at the formulas but okay when I ever I see this this is just I mean"}, {"start": 1013.44, "end": 1019.48, "text": " this is kind of useless like okay cool you minimize the loss thanks this okay"}, {"start": 1019.48, "end": 1024.8, "text": " didn't really pay attention to that new picture cool so this picture is much"}, {"start": 1024.8, "end": 1029.88, "text": " more informative than the other picture I believe with the other picture they"}, {"start": 1029.88, "end": 1035.76, "text": " were trying to showcase this loss how they do the matching and even though I"}, {"start": 1035.76, "end": 1040.92, "text": " could read a lot from that picture I did not get that part and then therefore I"}, {"start": 1040.92, "end": 1045.3600000000001, "text": " felt when I saw this and I just glance at it I'm like wait what's what's"}, {"start": 1045.3600000000001, "end": 1050.1200000000001, "text": " different than up here it seems like the same but okay let's look at this so"}, {"start": 1050.1200000000001, "end": 1055.0800000000002, "text": " again we see okay you have set of image features that comes out of the CNN so"}, {"start": 1055.0800000000002, "end": 1061.04, "text": " that conforms with my belief but then this here goes into a transformer encoder"}, {"start": 1061.04, "end": 1069.6000000000001, "text": " and this comes out so immediately I see oh this is not the same as these boxes"}, {"start": 1069.6, "end": 1073.6799999999998, "text": " here right that was my hypothesis that these things here would be the colored"}, {"start": 1073.6799999999998, "end": 1083.04, "text": " boxes so I I say okay obviously that's not what happens this thing here seems to"}, {"start": 1083.04, "end": 1090.04, "text": " be sort of the encoded image information then that's somehow fed into here"}, {"start": 1090.04, "end": 1095.76, "text": " and that then there are these object query things and they seem to correspond"}, {"start": 1095.76, "end": 1103.2, "text": " to this so I'm a bit more confused right now what I can see is that these then"}, {"start": 1103.2, "end": 1111.6, "text": " will result in these in these boxes okay so being confused by that I look for"}, {"start": 1111.6, "end": 1117.2, "text": " more pictures so I go look for more pictures and this here seems to be like"}, {"start": 1117.2, "end": 1120.48, "text": " of a visualization a lot of these papers have some sort of ablation"}, {"start": 1120.48, "end": 1125.52, "text": " experiments or so and so on this I just find really cool picture for now"}, {"start": 1125.52, "end": 1131.36, "text": " I don't know yet what it means this I don't know yet what it means and I go down"}, {"start": 1131.36, "end": 1139.48, "text": " skip of this and then back here in the appendix I find this here which I"}, {"start": 1139.48, "end": 1143.84, "text": " immediately map to the previous where this is the encoder and this is the decoder"}, {"start": 1143.84, "end": 1146.24, "text": " and I've already read the attention is already in the paper and that that"}, {"start": 1146.24, "end": 1150.48, "text": " point it clicked and he's like oh this is not a bird transformer this is one of"}, {"start": 1150.48, "end": 1153.84, "text": " these transformers that has an encoder in the decoder even though they told me"}, {"start": 1153.84, "end": 1159.4399999999998, "text": " like 50 billion times already I was too stupid until this point so now I know"}, {"start": 1159.4399999999998, "end": 1164.72, "text": " okay okay I see what's going on so the image goes through here and then this"}, {"start": 1164.72, "end": 1171.12, "text": " goes as a side input like as an attention from the decoder to the encoder like I"}, {"start": 1171.12, "end": 1177.04, "text": " know in NLP right so in NLP this here would be a source sequence like maybe if you"}, {"start": 1177.04, "end": 1183.0, "text": " do translation and this here would be a target sequence so now whenever I see a"}, {"start": 1183.0, "end": 1188.2, "text": " transformer like this and it outputs something like this I I look at it as okay"}, {"start": 1188.2, "end": 1196.16, "text": " this here is sort of the input that goes as like a side input over here and"}, {"start": 1196.16, "end": 1201.96, "text": " usually here you have the target sequence but that's not the case right here"}, {"start": 1201.96, "end": 1207.28, "text": " right you have these these object queries so this is how far I get from the"}, {"start": 1207.28, "end": 1215.32, "text": " pictures now I go up so I have a sort of I have questions now I have questions"}, {"start": 1215.32, "end": 1219.32, "text": " and that's when I start reading the paper only now do I start reading the paper"}, {"start": 1219.32, "end": 1223.92, "text": " after I've looked through all the images form the hypothesis and sort of have"}, {"start": 1223.92, "end": 1229.24, "text": " questions on how this works and we'll go a bit faster from now on to just not"}, {"start": 1229.24, "end": 1235.16, "text": " bore you with all the things so the introduction is often very important even"}, {"start": 1235.16, "end": 1239.4, "text": " though it's called introduction and maybe you know if you read a book like if"}, {"start": 1239.4, "end": 1244.2, "text": " there's like introduction or prologue or something like this it's often kind of"}, {"start": 1244.2, "end": 1249.8000000000002, "text": " pointless introduction in these research papers is one of the most important"}, {"start": 1249.8000000000002, "end": 1255.0800000000002, "text": " points because all of these papers they try basically all of them try to"}, {"start": 1255.0800000000002, "end": 1260.3600000000001, "text": " convince a reviewer to accept them and in order to do that they will set up"}, {"start": 1260.3600000000001, "end": 1264.96, "text": " their main points and their main story immediately in the introduction so"}, {"start": 1264.96, "end": 1270.3600000000001, "text": " what you usually have is a problem statement which is here like why what's"}, {"start": 1270.3600000000001, "end": 1276.68, "text": " what's wrong right now and then you have like a story of how their paper"}, {"start": 1276.68, "end": 1285.24, "text": " addresses the issue okay and that's that's here we streamline the training"}, {"start": 1285.24, "end": 1288.72, "text": " pipeline by viewing object prediction yada yada yada yada this is often"}, {"start": 1288.72, "end": 1295.2, "text": " formulates in words what the paper is about and what contribution the paper makes"}, {"start": 1295.2, "end": 1300.32, "text": " right this is like a this is like a longer abstract the abstract is often very"}, {"start": 1300.32, "end": 1305.68, "text": " very cryptic very dense this here is often much more informative of what the"}, {"start": 1305.68, "end": 1310.96, "text": " paper does so for understanding the paper and a high level the introduction is"}, {"start": 1310.96, "end": 1317.16, "text": " the best place but given that I've already looked at the images and so on I"}, {"start": 1317.16, "end": 1324.4, "text": " don't actually draw many new much new information from this thing then this"}, {"start": 1324.4, "end": 1330.88, "text": " related work and honestly I skip it like unless I'm the actual reviewer of a"}, {"start": 1330.88, "end": 1335.3600000000001, "text": " paper like when I'm the reviewer of a paper I read the related work but often"}, {"start": 1335.3600000000001, "end": 1339.52, "text": " related work is just like you first of all you cite a bunch of your friends"}, {"start": 1339.52, "end": 1344.64, "text": " and then you cite the mandatory papers and then you cite every single person"}, {"start": 1344.64, "end": 1349.3600000000001, "text": " that you think could be a reviewer because or you've actually been rejected"}, {"start": 1349.3600000000001, "end": 1352.64, "text": " from a conference with a review or claiming that you're you haven't compared"}, {"start": 1352.64, "end": 1356.1200000000001, "text": " or you haven't cited that or that paper you can pretty much be sure that"}, {"start": 1356.1200000000001, "end": 1361.0800000000002, "text": " that's the if if it's not a glaring of may omission if it's like a niche paper"}, {"start": 1361.0800000000002, "end": 1366.1200000000001, "text": " and you haven't cited it then you're like okay I'm gonna cite it just because"}, {"start": 1366.1200000000001, "end": 1372.88, "text": " the next conference you could be my reviewer again so I'm not I'm not sure that"}, {"start": 1372.88, "end": 1376.72, "text": " these related work sections they're necessary like if someone wants to write"}, {"start": 1376.72, "end": 1381.4, "text": " their thesis and they go and read this paper and they want to reference his"}, {"start": 1381.4, "end": 1386.6000000000001, "text": " oftentimes this is a good place but a lot of it is just blah blah blah blah"}, {"start": 1386.6000000000001, "end": 1394.16, "text": " okay I don't I don't disagree with me if you want oh yeah to maybe to read"}, {"start": 1394.16, "end": 1401.1200000000001, "text": " in quality so I tend to at this point I tend to not skim so at first I skim but"}, {"start": 1401.12, "end": 1407.1599999999999, "text": " at this point I tend to read every sentence and read it closely and understand"}, {"start": 1407.1599999999999, "end": 1411.9599999999998, "text": " it and when I realized like I'm tired or something I don't just skim the paper"}, {"start": 1411.9599999999998, "end": 1417.8, "text": " I've tried to skim papers and it doesn't it doesn't work try to read every"}, {"start": 1417.8, "end": 1422.1999999999998, "text": " sentence understand every sentence and okay if you don't understand it don't"}, {"start": 1422.1999999999998, "end": 1427.76, "text": " stop reading because of that but try to not skim and be like oh yeah yeah yeah"}, {"start": 1427.76, "end": 1434.8799999999999, "text": " okay I got it got it got it got it that's it's not helpful except related work"}, {"start": 1434.8799999999999, "end": 1440.96, "text": " skip completely cool then a lot of times in this paper now is the the model and"}, {"start": 1440.96, "end": 1446.08, "text": " this is the section I'm actually interested in right so I read very very"}, {"start": 1446.08, "end": 1452.76, "text": " closely here and then I find out what their their loss is all about and again I"}, {"start": 1452.76, "end": 1462.8, "text": " stress read these things and understand them right sometimes it's hard but if"}, {"start": 1462.8, "end": 1467.28, "text": " you're if you're confused that means you either they've done a bad job or they"}, {"start": 1467.28, "end": 1471.8799999999999, "text": " made a mistake or that you haven't understood something if you can't"}, {"start": 1471.8799999999999, "end": 1476.72, "text": " understand the sentence try to read on maybe it's clarified later and then you"}, {"start": 1476.72, "end": 1484.44, "text": " know go back but again do not do not like just start a lot of times when I read"}, {"start": 1484.44, "end": 1489.28, "text": " paper previously like I wouldn't understand something quite well yet and then"}, {"start": 1489.28, "end": 1494.04, "text": " I would be like oh yeah yeah yeah and then I noticed that I'd start skipping"}, {"start": 1494.04, "end": 1498.4, "text": " and skimming more and more because that would you know pop up again and again"}, {"start": 1498.4, "end": 1502.56, "text": " and I wouldn't understand it again and again and then at the end I would just be"}, {"start": 1502.56, "end": 1506.48, "text": " kind of glancing at the paper and I don't want to do that right here so I"}, {"start": 1506.48, "end": 1510.92, "text": " want to read every sentence and understand it okay so here then I find out"}, {"start": 1510.92, "end": 1518.32, "text": " about the loss and then I if I don't know something here then I'll go and"}, {"start": 1518.32, "end": 1523.32, "text": " look it up on maybe on Wikipedia or something like this now I don't need to"}, {"start": 1523.32, "end": 1529.4, "text": " actually I don't need to understand every single part of it right that's maybe"}, {"start": 1529.4, "end": 1534.52, "text": " I should correct myself so for example this bounding box loss here they talk"}, {"start": 1534.52, "end": 1539.04, "text": " about the second part of the max and question going for is this box loss that"}, {"start": 1539.04, "end": 1542.92, "text": " scores bounding boxes unlike many detectors that do box prediction with some"}, {"start": 1542.92, "end": 1547.44, "text": " initial the other the other they say the most common least one loss will have"}, {"start": 1547.44, "end": 1551.68, "text": " different scales for a small so here they basically talk about how they mix the"}, {"start": 1551.68, "end": 1557.0, "text": " losses they see overall our box loss is that defined as this and this now I"}, {"start": 1557.0, "end": 1561.8, "text": " haven't I don't know what these losses are I just assume there's some bounding"}, {"start": 1561.8, "end": 1567.56, "text": " box losses so when I it's not true when I say understand everything understand"}, {"start": 1567.56, "end": 1573.52, "text": " the things that are integral to the story of the paper right how exactly they"}, {"start": 1573.52, "end": 1577.9199999999998, "text": " compute bounding box losses at this point I don't care I just assume that"}, {"start": 1577.9199999999998, "end": 1584.36, "text": " there's some loss that I can back propagate right I what is important is that"}, {"start": 1584.36, "end": 1588.84, "text": " they do this Hungarian matching thing right as soon as I get that I'm like oh"}, {"start": 1588.84, "end": 1596.52, "text": " that was this you know this this thing no this thing up here this thing this"}, {"start": 1596.52, "end": 1601.1599999999999, "text": " with the matching thing now I get it now I know there are always the same"}, {"start": 1601.1599999999999, "end": 1606.08, "text": " amount of boxes here and there are always the same amount of labels here and"}, {"start": 1606.08, "end": 1611.28, "text": " all we need to do is somehow match them and I immediately think why is that"}, {"start": 1611.28, "end": 1616.1999999999998, "text": " relevant oh because when something is already matched to an object some other"}, {"start": 1616.2, "end": 1620.8400000000001, "text": " thing cannot be matched to the same object and that's how we you know prevent"}, {"start": 1620.8400000000001, "end": 1627.56, "text": " the fact that all the things predict the same thing right and so that immediately"}, {"start": 1627.56, "end": 1632.88, "text": " becomes clear and as I said there is usually like one or two ideas in a paper I"}, {"start": 1632.88, "end": 1637.72, "text": " don't assume or I don't care what their exact loss function is because I've"}, {"start": 1637.72, "end": 1644.2, "text": " sort of gotten the idea up here of what the loss is about all right so I hope"}, {"start": 1644.2, "end": 1649.56, "text": " that's clear on very closely read the things and understand the things that are"}, {"start": 1649.56, "end": 1656.0, "text": " necessary for the story if you find if you think something's not necessary for"}, {"start": 1656.0, "end": 1659.96, "text": " the story and then later end up not understanding that maybe come back and you"}, {"start": 1659.96, "end": 1666.2, "text": " know read it again in any case I would I would rather I would rather skip"}, {"start": 1666.2, "end": 1671.2, "text": " something and assume it's not necessary if I think so and then come back then"}, {"start": 1671.2, "end": 1677.1200000000001, "text": " trying to understand every everything but the things I do read I try to"}, {"start": 1677.1200000000001, "end": 1685.48, "text": " understand thoroughly okay then there's the architecture okay and that again I"}, {"start": 1685.48, "end": 1691.92, "text": " read closely in the backbone okay transformer encoder okay and now I understand"}, {"start": 1691.92, "end": 1698.92, "text": " much more closely a decoder okay and here I get now finally I get what this is"}, {"start": 1698.92, "end": 1706.1200000000001, "text": " about decodes and objects in parallel yada yada these input embeddings are"}, {"start": 1706.1200000000001, "end": 1709.96, "text": " learned positional encodings that we refer to as object queries and similarly"}, {"start": 1709.96, "end": 1714.48, "text": " to the encoder we add them to the input at each attention layer so now they"}, {"start": 1714.48, "end": 1719.4, "text": " name I've already seen these object queries here and the only word I actually"}, {"start": 1719.4, "end": 1724.3200000000002, "text": " need from this sentence are learned the fact that they're positional encodings"}, {"start": 1724.32, "end": 1730.24, "text": " I just kind of ignore as soon as they say learned I know aha these things here"}, {"start": 1730.24, "end": 1734.48, "text": " are learned they they have actually they're always the same for each of the"}, {"start": 1734.48, "end": 1739.8, "text": " images they're just overall learned okay so now I feel I understand the"}, {"start": 1739.8, "end": 1748.76, "text": " entire model and yeah so they then they say auxiliary decoding losses and"}, {"start": 1748.76, "end": 1755.0, "text": " these sometimes you have to pay attention to like auxiliary things because those"}, {"start": 1755.0, "end": 1760.04, "text": " are the the things that here they say explicitly we found helpful to use"}, {"start": 1760.04, "end": 1766.76, "text": " auxiliary losses sometimes they they won't say why they did it they'll just say"}, {"start": 1766.76, "end": 1772.04, "text": " our loss consists of three things and you know if you look at the three things"}, {"start": 1772.04, "end": 1776.84, "text": " only one of the things is really a part of their story so far and that you"}, {"start": 1776.84, "end": 1780.72, "text": " should immediately conclude that they've put in the other things because they"}, {"start": 1780.72, "end": 1785.6, "text": " tried it and it didn't work right so you can also kind of get an estimate of the"}, {"start": 1785.6, "end": 1791.28, "text": " brittleness and so on of the system in that you see how many unnecessary things"}, {"start": 1791.28, "end": 1795.36, "text": " are there or how many things are not straightforward how many things aren't the"}, {"start": 1795.36, "end": 1800.36, "text": " easiest thing that you would do when you would go about and do what they did"}, {"start": 1800.36, "end": 1807.4399999999998, "text": " okay so then you let's conclude this model or method usually this section is"}, {"start": 1807.4399999999998, "end": 1811.32, "text": " called like method or model or something like this and you go to experiments"}, {"start": 1811.32, "end": 1817.1999999999998, "text": " now the main question I have so far or I have maybe I have some more"}, {"start": 1817.1999999999998, "end": 1821.76, "text": " questions about the model itself that I haven't been able to pick up from this"}, {"start": 1821.76, "end": 1827.6, "text": " section which is not the case here but I simply keep those questions in mind"}, {"start": 1827.6, "end": 1834.4399999999998, "text": " and see whether they are resolved later right so I keep an awareness of what"}, {"start": 1834.4399999999998, "end": 1841.36, "text": " I don't understand but from here on my main issue is are they demonstrating"}, {"start": 1841.36, "end": 1847.1999999999998, "text": " that their story works right so they're here they're they're proposing a loss"}, {"start": 1847.1999999999998, "end": 1855.32, "text": " and a model and in my mind they now need to convince me that that works and"}, {"start": 1855.32, "end": 1861.04, "text": " that's that's it's not as easy as simply to show me some numbers that they are"}, {"start": 1861.04, "end": 1866.12, "text": " good at some benchmark they need to show me that they get those numbers"}, {"start": 1866.12, "end": 1873.28, "text": " because of what they claim so here they claim well okay they propose a new"}, {"start": 1873.28, "end": 1877.76, "text": " they propose a new architecture so what they need to convince me of is that the"}, {"start": 1877.76, "end": 1884.04, "text": " architecture itself makes sense right but in other papers when when you"}, {"start": 1884.04, "end": 1890.24, "text": " propose like and when you say like oh we for example in an LSTM when you"}, {"start": 1890.24, "end": 1895.12, "text": " build in an attention mechanism and you claim oh we you know the attention"}, {"start": 1895.12, "end": 1901.1599999999999, "text": " mechanism can look back at the source sequence in one step then you need to"}, {"start": 1901.1599999999999, "end": 1905.76, "text": " convince me that that actually happens right so you need to not only you need to"}, {"start": 1905.76, "end": 1911.8, "text": " perform well you need to convince me that you perform well because of what you"}, {"start": 1911.8, "end": 1917.96, "text": " claim your model does right so and that's often difficult and I specifically"}, {"start": 1917.96, "end": 1922.96, "text": " look out in the experiments for usually the question is like where are they"}, {"start": 1922.96, "end": 1929.52, "text": " trying to bullshit me right where are they trying to or are they trying to"}, {"start": 1929.52, "end": 1934.28, "text": " bullshit me are they trying to cover up the fact that something doesn't work"}, {"start": 1934.28, "end": 1938.44, "text": " now all the experiments are always in the best light possible of course and"}, {"start": 1938.44, "end": 1943.52, "text": " you have to keep that in mind but a lot of times you can also already see from"}, {"start": 1943.52, "end": 1950.92, "text": " the experiments that okay are they doing something weird are they not showing"}, {"start": 1950.92, "end": 1956.04, "text": " me some obvious experiment or and that's a lot of time the case is there an"}, {"start": 1956.04, "end": 1962.0, "text": " easier explanation for why they get the results that they get other than their"}, {"start": 1962.0, "end": 1967.16, "text": " explanation right and it is it is their job to convince you that their"}, {"start": 1967.16, "end": 1972.68, "text": " explanation is the correct one for these numbers and especially if there is an"}, {"start": 1972.68, "end": 1978.28, "text": " easier one that they haven't excluded and then I don't believe the experiments if"}, {"start": 1978.28, "end": 1983.48, "text": " that's the case right if there is an easier explanation for the effect I'm"}, {"start": 1983.48, "end": 1989.3200000000002, "text": " very skeptical but some papers have an easier job here than other papers so in"}, {"start": 1989.3200000000002, "end": 1996.64, "text": " this paper they basically show results on a on a on a task and since their paper"}, {"start": 1996.64, "end": 2002.5200000000002, "text": " is about hey our pipeline is just easier than other pipelines what they first of"}, {"start": 2002.5200000000002, "end": 2005.92, "text": " all need to do is they just need to like match the numbers of other pipelines"}, {"start": 2005.92, "end": 2011.44, "text": " and here I see that okay in these results often you have maybe a table or"}, {"start": 2011.44, "end": 2017.24, "text": " something here you see like this their model other models and their model is the"}, {"start": 2017.24, "end": 2023.5200000000002, "text": " best model in a lot of cases now if the best thing is of course if is their"}, {"start": 2023.52, "end": 2029.0, "text": " model throughout is the best the worst thing is if it's like scattered like this"}, {"start": 2029.0, "end": 2033.84, "text": " even if their model is the best but in every single benchmark a different"}, {"start": 2033.84, "end": 2038.6, "text": " configuration of their model is the best that's that's sort of a bad sign"}, {"start": 2038.6, "end": 2044.48, "text": " unless they can explicitly explain why that is and it's also not that good of"}, {"start": 2044.48, "end": 2050.28, "text": " a sign if these things are spread out like this like sometimes this"}, {"start": 2050.28, "end": 2055.0800000000004, "text": " baseline is good sometimes their model is better and so on so pay attention to"}, {"start": 2055.0800000000004, "end": 2058.92, "text": " that now in this paper it doesn't matter so much that's actually fine because"}, {"start": 2058.92, "end": 2065.0400000000004, "text": " what they're trying to show is that their model is on par and way easier and"}, {"start": 2065.0400000000004, "end": 2069.36, "text": " they've already made the case in what way it is easier it's easier in terms of"}, {"start": 2069.36, "end": 2074.0800000000004, "text": " architecture if they were to say it's much faster than after that I would expect"}, {"start": 2074.08, "end": 2081.12, "text": " you know an experiment in speed while these numbers are matched but since they"}, {"start": 2081.12, "end": 2085.2799999999997, "text": " say it's easier I've already seen the architecture I'm convinced of that now"}, {"start": 2085.2799999999997, "end": 2089.7599999999998, "text": " that they show okay our numbers match or actually I'm surprised they even"}, {"start": 2089.7599999999998, "end": 2095.48, "text": " outperform a lot of times then I'm quite happy with these experiments so also"}, {"start": 2095.48, "end": 2100.72, "text": " look for differences between numbers and the spread of numbers now it's not"}, {"start": 2100.72, "end": 2106.16, "text": " easy to say what if like point one is a big or a small difference that depends"}, {"start": 2106.16, "end": 2110.8799999999997, "text": " on the task but if you know pay attention to these things pay attention to the"}, {"start": 2110.8799999999997, "end": 2115.3199999999997, "text": " fact that these results are noisy and oftentimes there is a lot more hyper"}, {"start": 2115.3199999999997, "end": 2120.48, "text": " parameter tuning going into the model of the paper than into the baseline"}, {"start": 2120.48, "end": 2125.08, "text": " model so I do want to make your look your stuff look as good as possible and"}, {"start": 2125.08, "end": 2129.7999999999997, "text": " here is a little bit where the institutional credibility of someone like"}, {"start": 2129.8, "end": 2136.04, "text": " Facebook comes in in that I tend to believe their results a bit more than"}, {"start": 2136.04, "end": 2142.92, "text": " other results not mega but a bit more yeah also look at patterns that they"}, {"start": 2142.92, "end": 2146.88, "text": " don't point out in the text so if there is like a pattern if you see like an"}, {"start": 2146.88, "end": 2151.0800000000004, "text": " interaction between the number of parameters and the score or something like"}, {"start": 2151.0800000000004, "end": 2156.6400000000003, "text": " this just try to be on the lookout of that and see if you can spot something"}, {"start": 2156.64, "end": 2163.24, "text": " that you think or think about whether that makes sense or not in what your"}, {"start": 2163.24, "end": 2171.72, "text": " hypothesis would be so here we go on and okay then they go into"}, {"start": 2171.72, "end": 2176.68, "text": " ablations and a lot of a lot of these papers do ablations and I generally"}, {"start": 2176.68, "end": 2181.8399999999997, "text": " appreciate that so here they visualize that the attention mechanism in their"}, {"start": 2181.84, "end": 2187.8, "text": " model actually refers to different instances right encoder self-attentions for"}, {"start": 2187.8, "end": 2192.0, "text": " a set of reference points the encoder is able to separate individual instances"}, {"start": 2192.0, "end": 2198.48, "text": " and you can see that pretty clearly right here where and even here with the"}, {"start": 2198.48, "end": 2203.96, "text": " overlapping cows and this is the sort of experiment that I would expect that"}, {"start": 2203.96, "end": 2208.6000000000004, "text": " actually convinces me that their architecture does what it says that it does"}, {"start": 2208.6, "end": 2215.2799999999997, "text": " right and something like this where you see like totally overlapping things with"}, {"start": 2215.2799999999997, "end": 2219.96, "text": " the attention of the individual things visualized so telling me like especially"}, {"start": 2219.96, "end": 2225.08, "text": " this one right here the the foot of the back elephant actually being focused"}, {"start": 2225.08, "end": 2229.64, "text": " by the attention of the bounding box of the back elephant that's the sort of"}, {"start": 2229.64, "end": 2235.2, "text": " experiment that convinces me that their claims like that their numbers really"}, {"start": 2235.2, "end": 2241.8799999999997, "text": " come from what they claim it comes from okay so at the end of the experimental"}, {"start": 2241.8799999999997, "end": 2248.08, "text": " section you should always ask yourself have they really convinced me that their"}, {"start": 2248.08, "end": 2253.72, "text": " story is true right that the improvement or whenever they get an"}, {"start": 2253.72, "end": 2260.68, "text": " improvement or whatever they get what is is due to the story that they want to"}, {"start": 2260.68, "end": 2266.3999999999996, "text": " sell me or could there be like an easier explanation or does something not fit"}, {"start": 2266.3999999999996, "end": 2270.7599999999998, "text": " is like are there are the experiments different than from what you would"}, {"start": 2270.7599999999998, "end": 2276.7999999999997, "text": " expect here okay so these are these are my main questions are they are they"}, {"start": 2276.7999999999997, "end": 2281.16, "text": " convincing me of their story it's not do they have state-of-the-art numbers I"}, {"start": 2281.16, "end": 2288.7599999999998, "text": " don't care I don't care even though like sometimes so there is a bit of a"}, {"start": 2288.76, "end": 2294.8, "text": " catch I I don't care about state-of-the-art numbers now let's say you have a"}, {"start": 2294.8, "end": 2299.0800000000004, "text": " table like this and you have a computer vision model and one of the"}, {"start": 2299.0800000000004, "end": 2305.0800000000004, "text": " models is like on the C410 dataset now if your baseline model has like a 90"}, {"start": 2305.0800000000004, "end": 2311.48, "text": " 192 percent accuracy on C410 when I know the state-of-the-art is 96 I don't"}, {"start": 2311.48, "end": 2317.8, "text": " care right I know like I've done C410 I know with like I don't know five six"}, {"start": 2317.8, "end": 2324.0800000000004, "text": " layers CNN you can reach these 91 92 93 percent accuracy and to get to the 96"}, {"start": 2324.0800000000004, "end": 2330.6400000000003, "text": " 97 you'd actually be like in the region of a wide resonant and whatnot so I"}, {"start": 2330.6400000000003, "end": 2335.96, "text": " you know I know that even though you're a few points behind state-of-the-art I"}, {"start": 2335.96, "end": 2343.0800000000004, "text": " know you know this this is valid still so I don't care but if you were to be"}, {"start": 2343.08, "end": 2351.56, "text": " like at 80 percent accuracy on C410 then I then I get a bit like I like it's"}, {"start": 2351.56, "end": 2358.7599999999998, "text": " pretty easy to get to 90 percent plus with like a standard CNN so there I"}, {"start": 2358.7599999999998, "end": 2363.2, "text": " immediately start to wonder why is there an explanation now this could be like a"}, {"start": 2363.2, "end": 2368.7599999999998, "text": " theoretical paper that says oh we investigate MLPs and that's why we only get"}, {"start": 2368.76, "end": 2374.6400000000003, "text": " that number so that's that would be fine but if something is out of the"}, {"start": 2374.6400000000003, "end": 2380.2400000000002, "text": " ordinary like this then I pay attention but never because something isn't like"}, {"start": 2380.2400000000002, "end": 2387.0400000000004, "text": " the latest and greatest state-of-the-art that's just dumb okay and also if only"}, {"start": 2387.0400000000004, "end": 2391.6000000000004, "text": " evaluate what the paper claims it does right if the paper says we want to show"}, {"start": 2391.6000000000004, "end": 2397.92, "text": " that we are on par with current models then don't be mad if the paper doesn't"}, {"start": 2397.92, "end": 2405.0, "text": " outperform these models they didn't claim that right so yeah so after these"}, {"start": 2405.0, "end": 2409.6, "text": " ablations I'm actually pretty happy right here with the results and this right"}, {"start": 2409.6, "end": 2418.08, "text": " here when I saw this I didn't I didn't expect that but I read the experiment"}, {"start": 2418.08, "end": 2421.12, "text": " description that these are these different learned object queries and what"}, {"start": 2421.12, "end": 2426.2400000000002, "text": " they do and that gave me an increased understanding of how these object"}, {"start": 2426.24, "end": 2431.2, "text": " queries actually work right so at that point I still had like a vague I knew"}, {"start": 2431.2, "end": 2435.8399999999997, "text": " that these are learned but reading this and sort of looking at it studying it a"}, {"start": 2435.8399999999997, "end": 2441.52, "text": " bit I was like oh okay then I understood even better what they are so again"}, {"start": 2441.52, "end": 2447.12, "text": " when I say understand everything in the method section you can still have"}, {"start": 2447.12, "end": 2453.7599999999998, "text": " questions and but you just keep to keep it in mind for later and then here I go"}, {"start": 2453.76, "end": 2460.2000000000003, "text": " on and there's this DETR for panoptic segmentation and they here they"}, {"start": 2460.2000000000003, "end": 2465.0400000000004, "text": " propose like a new model so I first look at it and I'm like okay they propose a"}, {"start": 2465.0400000000004, "end": 2469.76, "text": " new model they can do stuff like this now this is not object detection and again"}, {"start": 2469.76, "end": 2477.0400000000004, "text": " I'm not sure is this like a is this like an add-on to the method or is was"}, {"start": 2477.0400000000004, "end": 2483.5200000000004, "text": " this appear just an intermediate step to this and honestly after reading that I"}, {"start": 2483.52, "end": 2488.0, "text": " still wasn't sure it seems like something in between of course the paper is also"}, {"start": 2488.0, "end": 2494.32, "text": " a bit longer than other papers it just it seems it's too long for just being a"}, {"start": 2494.32, "end": 2499.6, "text": " side note but it's too short for being its own thing so that was just a bit"}, {"start": 2499.6, "end": 2506.16, "text": " weird and I treated it as just like a oh we can also do this with our model but I"}, {"start": 2506.16, "end": 2514.04, "text": " didn't pay like too much attention to that okay so at the end I you know look at"}, {"start": 2514.04, "end": 2521.56, "text": " conclusions now the conclusions of a paper are much much often they are not"}, {"start": 2521.56, "end": 2526.7999999999997, "text": " nearly as informative as the introduction the conclusions they all often"}, {"start": 2526.7999999999997, "end": 2533.16, "text": " tend to be very generic and kind of hedging a bit against criticisms saying"}, {"start": 2533.16, "end": 2537.48, "text": " what would be up for future work which is again hedging against criticism"}, {"start": 2537.48, "end": 2543.96, "text": " because you can simply say well we didn't do this that's future work yeah so"}, {"start": 2543.96, "end": 2550.08, "text": " again I read it but I don't really pay attention to it and then I gloss over"}, {"start": 2550.08, "end": 2554.24, "text": " the abstract I just would kind of scroll through the abstract if there's"}, {"start": 2554.24, "end": 2561.2, "text": " something that catches my eye I would look at it and if not then not and then"}, {"start": 2561.2, "end": 2566.64, "text": " I basically go to the start and whenever I didn't understand something I go"}, {"start": 2566.64, "end": 2571.96, "text": " back I look at it again and I try to think are all my questions answered and"}, {"start": 2571.96, "end": 2577.68, "text": " have they sufficiently convinced me that their story is the thing that really"}, {"start": 2577.68, "end": 2585.16, "text": " has the effect right here and then if I now were to make a video of this I've"}, {"start": 2585.16, "end": 2590.96, "text": " often found it useful to just put the paper away for a while and it's I"}, {"start": 2590.96, "end": 2594.64, "text": " usually get the best results when I read the paper the day before and then make"}, {"start": 2594.64, "end": 2599.7200000000003, "text": " a video the day after or if not I'll just you know put it away do something"}, {"start": 2599.7200000000003, "end": 2605.48, "text": " else do some email responding programming going outside eating lunch just"}, {"start": 2605.48, "end": 2612.56, "text": " some kind of a break between first read or between in first couple of reads and"}, {"start": 2612.56, "end": 2620.32, "text": " just I don't even think about the paper I just kind of it is in the subconscious"}, {"start": 2620.32, "end": 2624.92, "text": " it kind of brews right and I happen to think about the paper every now and then"}, {"start": 2624.92, "end": 2628.0800000000004, "text": " but I don't make a conscious effort to be like oh how am I gonna explain this"}, {"start": 2628.0800000000004, "end": 2633.76, "text": " and so on but I just found the the worst videos are the ones where I immediately"}, {"start": 2633.76, "end": 2639.96, "text": " make the video after reading a paper and I've just discovered that if I kind of"}, {"start": 2639.96, "end": 2644.44, "text": " take a break and then I look at it again right I look I don't read it fully"}, {"start": 2644.44, "end": 2648.48, "text": " again but I if I have if I have the feeling I've understood it I don't read it"}, {"start": 2648.48, "end": 2653.6, "text": " fully again but I just kind of look at it and go again through the story and I"}, {"start": 2653.6, "end": 2657.96, "text": " think that's even if you you know want to if you want to talk about a paper in a"}, {"start": 2657.96, "end": 2662.8, "text": " reading group or tell you know explain it to your friends or whatnot this is"}, {"start": 2662.8, "end": 2670.96, "text": " often very useful just put it away for a while let it mellow and I find that helps"}, {"start": 2670.96, "end": 2678.08, "text": " a lot okay that was my process of reading this particular paper now we again"}, {"start": 2678.08, "end": 2683.7999999999997, "text": " this this is a high quality paper so it's I find it's a pretty easy read in that"}, {"start": 2683.7999999999997, "end": 2687.7999999999997, "text": " I simply need to understand what they did and I'm pretty happy with their"}, {"start": 2687.7999999999997, "end": 2694.04, "text": " experiments I maybe next time I can find an experiment or a paper where I'm"}, {"start": 2694.04, "end": 2701.0, "text": " initially more skeptical and not as happy with what I find but yeah let me"}, {"start": 2701.0, "end": 2705.48, "text": " know if you enjoy this or if you would like to see any other explanation I"}, {"start": 2705.48, "end": 2711.12, "text": " don't exactly know if this is what you expected from a video like this so let"}, {"start": 2711.12, "end": 2717.48, "text": " me know maybe I've misunderstood you completely or it's way too long way too"}, {"start": 2717.48, "end": 2722.48, "text": " detailed or way too undetailed yeah leave me a comment and I'll see you next time"}, {"start": 2722.48, "end": 2752.32, "text": " bye bye"}] |
Yannic Kilcher | 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 breathe different length and cannot always look the same and so on. So this paper uses 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 will look at is called counting out time class agnostic video repetition counting in the wild by Debedada Duibidi, Yosef Eitar, Jonathan Thompson, Pierre Cermonet and Andrew Zizerman of Google Research and Deep Mind. 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 and 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, 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 QVA 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, you know, large and diverse enough for these 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, 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 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 been as a classification task. It 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 come, as I said, we compare it with our labels and then we can calculate a loss. So this is the loss. The loss is 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. It's 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 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 doesn't tell you everything about that video frame. So 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 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. 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 pay attention here. 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 3 by 3 by 3 filter, or even more neighbors. But here we use a 3 by 3 by 3 filter. Okay, so 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, 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. And 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 distance to or the similarity with each of the other frames. So this is, as you can see, 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 it 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 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 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 square distance, but the effect is the same. So negative square distance followed by a row wise softmax operation. So you could say, hi, we're basically done. Using the self similarity matrix, what we could do, 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 is the diagonal is a bit higher. Okay. And we could just use a heuristic to detect these bumps here. Basically calculate the length count the bumps and calculate the period length, right? But 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, here 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 here at the bouncy ball example where you can see it starts out pretty slow, but it gets faster and faster and here. 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 in the middle of the videos, only between here and here. So it's going to be pretty difficult to just have a heuristic that reads out these periodic action, periodicity. And in a truly learning fashion, the authors here, oh sorry, maybe you can 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-deaf speeding up here and here, where 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 mirrors 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 forced the information through. Everything happening from here, no, 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 upsample that, not upsample, 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 convent 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 upsample 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-similar t 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, it consists 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 weights until the last classification phase. The share processing pipeline starts with starts with 32 2D convolutional filters of size 3 by 3, 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 learn 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 pipeline here is pretty simple. The question could be, why do they use a transformer and not simply another convolutional network? So here they upsample the image as we saw into 32 channels. And then they simply want to take one of these blocks here. And that corresponds a little bit. So we have four one frame. What does it mean? We have basically 64 by 32 things. So the 64 things, it's this one frame's temporal connection to each other frame. Then 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 these entries is a 32 size vector. This is sort of a, this is you can consider like a sequence of 64 things, 64 embeddings. So to use a transformer here, it's 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. All right. 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 backprop through everything. Everything here is differentiable. So all of this is trained to achieve minimum possible loss. And because you train everything to achieve minimum 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 dataset. 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 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 dataset. So they produce this countics dataset, but also on the other hand, which is something I also find very cool is they produce a synthetic dataset. 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 dataset. And 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 dataset 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 you jump from the end of one of those arrows to the beginning, right? You have kind of a hack in the individual because you know, it's not continuous. So what you can do, and this is 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 try 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, so 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 a rope training mount and a climb, but you have also things like playing ukulele exercising arms slicing and 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, a lot of ablations, but what I particularly appreciate is that they do something like this. So what they do at the end, once they've trained the architectures, they do a 1DPCA protection 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 1DPCA, 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 really shows that the model is doing what you claim that it's doing. Like I'm almost more interested in experiments like this than 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 bread? 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 pretty cool. So you can technically retrieve related things even though they visually, they don't look similar that much. Yeah. That's the kind of applications here are probably many, many fold. And I also think that, so in this measure of intelligence paper by Hauss-Wa Shouley, 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 we'll just fade into history. I think it's a pretty cool project, especially, you know, the architectural choice here to pull everything through this self-similarity matrix. And you know, 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 they're doing. I think the dataset as well. And yeah, I'll see you next time. Bye. | [{"start": 0.0, "end": 4.44, "text": " Hi there, check out these videos on the top."}, {"start": 4.44, "end": 7.78, "text": " Each one kind of contains a repeating action."}, {"start": 7.78, "end": 12.9, "text": " So on the left you see someone doing a jumping jacks in a fairly regular pattern."}, {"start": 12.9, "end": 18.46, "text": " In the middle it gets a bit more difficult because what you see is a tennis ball bouncing"}, {"start": 18.46, "end": 23.02, "text": " and it bounces faster and faster and faster as time goes on."}, {"start": 23.02, "end": 28.560000000000002, "text": " On the right you see that there is a short intro sequence before the repeating action,"}, {"start": 28.56, "end": 33.68, "text": " the person shoveling the cement is displayed."}, {"start": 33.68, "end": 39.68, "text": " So the goal here is to build an AI that can detect that a repeating action is happening"}, {"start": 39.68, "end": 46.36, "text": " and if it detects so that it can count how often this repeating action is happening."}, {"start": 46.36, "end": 51.96, "text": " You can already see the difficulties here is not only the recognition itself but the fact"}, {"start": 51.96, "end": 56.599999999999994, "text": " that the repeating actions can be different and can breathe different length and cannot"}, {"start": 56.6, "end": 58.88, "text": " always look the same and so on."}, {"start": 58.88, "end": 65.32000000000001, "text": " So this paper uses these temporal self-similarity matrices that you see at the bottom here to"}, {"start": 65.32000000000001, "end": 69.68, "text": " achieve this and we're going to explore how that's happening."}, {"start": 69.68, "end": 76.44, "text": " So the paper will look at is called counting out time class agnostic video repetition counting"}, {"start": 76.44, "end": 85.76, "text": " in the wild by Debedada Duibidi, Yosef Eitar, Jonathan Thompson, Pierre Cermonet and Andrew"}, {"start": 85.76, "end": 90.32000000000001, "text": " Zizerman of Google Research and Deep Mind."}, {"start": 90.32000000000001, "end": 96.08000000000001, "text": " So as I already said, this paper detects repeating actions and is able to count them and on"}, {"start": 96.08000000000001, "end": 102.48, "text": " a high level what they do is they encode the video using convolutional networks."}, {"start": 102.48, "end": 108.32000000000001, "text": " Then they build these temporal self-similarity matrices between the frames in order to detect"}, {"start": 108.32000000000001, "end": 115.72, "text": " the repetitions and they decode that into the predictions using another neural network."}, {"start": 115.72, "end": 122.08, "text": " This is all trained and to end and they also make a new data set for this task."}, {"start": 122.08, "end": 123.32, "text": " So that's the high level."}, {"start": 123.32, "end": 127.68, "text": " If you want to find out how exactly that's done, I invite you to stick around because we'll"}, {"start": 127.68, "end": 130.36, "text": " go into the paper."}, {"start": 130.36, "end": 135.4, "text": " If you like content like this, don't forget to share it out, leave a like and tell me what"}, {"start": 135.4, "end": 137.8, "text": " you think of the paper in the comments."}, {"start": 137.8, "end": 139.84, "text": " I do read the comments."}, {"start": 139.84, "end": 144.4, "text": " So yeah, I'm very happy to read what you all think about it."}, {"start": 144.4, "end": 152.6, "text": " Okay, so as we already said, they say we present an approach for estimating the period with"}, {"start": 152.6, "end": 155.04000000000002, "text": " which an action is repeated in a video."}, {"start": 155.04000000000002, "end": 158.84, "text": " And that's actually understating what the problem is here."}, {"start": 158.84, "end": 161.4, "text": " The problem is many, many fold."}, {"start": 161.4, "end": 166.96, "text": " As you can see on the right here, even if you don't get what this self-similarity matrix"}, {"start": 166.96, "end": 171.24, "text": " is yet, the outputs that you want are at the bottom."}, {"start": 171.24, "end": 178.28, "text": " So what you want is, first of all, a per frame periodicity prediction."}, {"start": 178.28, "end": 184.24, "text": " So that means that for each frame you want to know, is there even a repeating action happening"}, {"start": 184.24, "end": 186.08, "text": " or not in that particular frame?"}, {"start": 186.08, "end": 190.36, "text": " You can see here at the beginning at the end of the video, there's no repeating action."}, {"start": 190.36, "end": 193.28, "text": " And then in the middle, there is a repeating action."}, {"start": 193.28, "end": 195.0, "text": " So that's the first thing you want to know."}, {"start": 195.0, "end": 202.12, "text": " The second thing is this per frame period length prediction. So for each frame that is part"}, {"start": 202.12, "end": 208.36, "text": " of a repeating action, you want to know what is the period length of that repeating action."}, {"start": 208.36, "end": 210.04, "text": " And that can change throughout the video."}, {"start": 210.04, "end": 211.8, "text": " So you need it per frame."}, {"start": 211.8, "end": 218.24, "text": " And once you have it per frame, you can actually count the number of repetitions."}, {"start": 218.24, "end": 220.72, "text": " So those are two problems already."}, {"start": 220.72, "end": 226.56, "text": " The third problem that this paper solves is that there is no adequate data set to train"}, {"start": 226.56, "end": 228.52, "text": " a model like this, it seems."}, {"start": 228.52, "end": 237.04, "text": " For example, this model right here, this QVA data set, I believe has 100 data points."}, {"start": 237.04, "end": 239.32, "text": " And these are mostly, these are meant for testing."}, {"start": 239.32, "end": 243.76, "text": " So you would build your system somewhere and then you would test it on those 100 data"}, {"start": 243.76, "end": 245.24, "text": " points."}, {"start": 245.24, "end": 249.4, "text": " But they claim not even those are, you know, large and diverse enough for these systems"}, {"start": 249.4, "end": 250.72, "text": " to be evaluated."}, {"start": 250.72, "end": 257.4, "text": " So they build, we also collect a new challenging data set called Countix, which is 90 times"}, {"start": 257.4, "end": 263.32, "text": " larger than existing data sets, which captures the challenges of repetition counting in real"}, {"start": 263.32, "end": 264.4, "text": " world videos."}, {"start": 264.4, "end": 267.84000000000003, "text": " And that actually consists of a train and test split."}, {"start": 267.84000000000003, "end": 271.48, "text": " So you can also train a system using it."}, {"start": 271.48, "end": 273.72, "text": " Let's dive into the architecture."}, {"start": 273.72, "end": 280.8, "text": " I think this paper is a very, very, very cool example of even though we're in this deep"}, {"start": 280.8, "end": 286.40000000000003, "text": " learning paradigm where you just throw neural networks at a problem, it's a very cool example"}, {"start": 286.40000000000003, "end": 294.28000000000003, "text": " that you can still achieve a lot by smartly constructing this because we used to achieve"}, {"start": 294.28000000000003, "end": 297.8, "text": " a lot by smartly constructing features and so on."}, {"start": 297.8, "end": 302.84000000000003, "text": " In this case, the goal is achieved by smartly constructing the architecture of the neural"}, {"start": 302.84, "end": 309.44, "text": " network itself to give you back a good performance on the particular task right here."}, {"start": 309.44, "end": 310.44, "text": " Okay."}, {"start": 310.44, "end": 316.28, "text": " So if that tablet lets me actually scroll around, let's go to the architecture."}, {"start": 316.28, "end": 319.64, "text": " So figure two shows the architecture in more detail."}, {"start": 319.64, "end": 322.4, "text": " So we'll go through it from the beginning to the end."}, {"start": 322.4, "end": 324.88, "text": " Actually, let's go, let's go to the end."}, {"start": 324.88, "end": 327.28, "text": " So you know what is supposed to happen."}, {"start": 327.28, "end": 333.76, "text": " So for each frame in this video, what we'll need is a period length and a periodicity."}, {"start": 333.76, "end": 334.76, "text": " These are two."}, {"start": 334.76, "end": 341.59999999999997, "text": " So the bottom is a binary variable and the top is a, it's actually a number, but it is predicted"}, {"start": 341.59999999999997, "end": 345.0, "text": " in kind of been as a classification task."}, {"start": 345.0, "end": 346.23999999999995, "text": " It doesn't really matter."}, {"start": 346.23999999999995, "end": 350.28, "text": " We need two outputs that we can compare with the labels, right?"}, {"start": 350.28, "end": 353.15999999999997, "text": " In this case, the videos are of length 64."}, {"start": 353.15999999999997, "end": 355.59999999999997, "text": " So there's 64 frames per video."}, {"start": 355.6, "end": 360.64000000000004, "text": " And for each of those frames, we want a period length and for each of those frames, we want"}, {"start": 360.64000000000004, "end": 364.88, "text": " a periodicity binary prediction."}, {"start": 364.88, "end": 370.24, "text": " And that come, as I said, we compare it with our labels and then we can calculate a loss."}, {"start": 370.24, "end": 371.48, "text": " So this is the loss."}, {"start": 371.48, "end": 377.08000000000004, "text": " The loss is at the end comparing these labels and then everything else is trained using"}, {"start": 377.08000000000004, "end": 380.28000000000003, "text": " back propagation on that loss."}, {"start": 380.28000000000003, "end": 381.28000000000003, "text": " Okay."}, {"start": 381.28000000000003, "end": 384.56, "text": " So now with that in mind, let's go to the beginning."}, {"start": 384.56, "end": 391.8, "text": " So the video is taken and fed through an encoder in order to produce these per frame embeddings."}, {"start": 391.8, "end": 394.52, "text": " So we want an embedding for each frame."}, {"start": 394.52, "end": 401.52, "text": " That means for each of the 64 frames, we want to obtain one vector of length 512 that"}, {"start": 401.52, "end": 406.4, "text": " describes that particular frame in terms that the model can understand."}, {"start": 406.4, "end": 408.04, "text": " And we do that using an encoder."}, {"start": 408.04, "end": 411.52, "text": " Now the encoder, it has a bunch of parts to it."}, {"start": 411.52, "end": 416.47999999999996, "text": " It's not just a blob as you see right here."}, {"start": 416.47999999999996, "end": 419.56, "text": " So the encoder consists of three things."}, {"start": 419.56, "end": 425.35999999999996, "text": " First of all, there's this convolutional feature extractor, which is a resonant 50 architecture."}, {"start": 425.35999999999996, "end": 427.24, "text": " It's simply a convolution."}, {"start": 427.24, "end": 432.0, "text": " And you let the convolutional neural network run on each frame independently."}, {"start": 432.0, "end": 435.79999999999995, "text": " This is simply a feature extractor from images, right?"}, {"start": 435.79999999999995, "end": 441.32, "text": " Like you know it from any other image processing task."}, {"start": 441.32, "end": 443.68, "text": " But of course here we have a video."}, {"start": 443.68, "end": 453.92, "text": " So it would be nice if the frames knew something about the other frames, right?"}, {"start": 453.92, "end": 458.28, "text": " Especially if you think of something like a jumping jack."}, {"start": 458.28, "end": 465.52, "text": " If you are in this position right here, it doesn't tell you everything about that video"}, {"start": 465.52, "end": 466.52, "text": " frame."}, {"start": 466.52, "end": 471.24, "text": " So consider the frame before it, and maybe the frame before it is this, and maybe the"}, {"start": 471.24, "end": 480.03999999999996, "text": " frame after it is that you can clearly see that the hands or the arms are in an upward"}, {"start": 480.03999999999996, "end": 481.4, "text": " motion."}, {"start": 481.4, "end": 489.28, "text": " So the next step of the encoder tries to integrate that temporal information into the embeddings."}, {"start": 489.28, "end": 493.2, "text": " And that is achieved via a 3D convolution."}, {"start": 493.2, "end": 501.44, "text": " So once we process each frame individually, then we feed it into one layer through a layer"}, {"start": 501.44, "end": 507.59999999999997, "text": " of 3D convolution to add local temporal information to the per frame features."}, {"start": 507.59999999999997, "end": 512.56, "text": " So if you don't know what a 3D convolution is, oh, this already drew."}, {"start": 512.56, "end": 518.64, "text": " So in a 2D convolution, what you want to do is you want to have this filter right here,"}, {"start": 518.64, "end": 526.4, "text": " which is a 2D filter for each of the channels, and you slide it across the image like this."}, {"start": 526.4, "end": 530.96, "text": " And you can have multiple channels of the input image right here, and you can actually"}, {"start": 530.96, "end": 535.76, "text": " do this multiple times, which corresponds to multiple output channels of the filters,"}, {"start": 535.76, "end": 538.84, "text": " but the actual convolution is happening in two dimensions."}, {"start": 538.84, "end": 543.88, "text": " So the sliding is across the width and the height of the image."}, {"start": 543.88, "end": 550.2, "text": " In contrast to that, if you have a 3D convolution and you have the same input stack of images,"}, {"start": 550.2, "end": 553.88, "text": " and now this, we have to pay attention here."}, {"start": 553.88, "end": 562.6, "text": " This stack right here is the individual channels of one image, so of one video frame."}, {"start": 562.6, "end": 568.56, "text": " This stack right here that I'm drawing, these are the video frames stacked."}, {"start": 568.56, "end": 573.44, "text": " Now, each of these stacked video frames can have multiple channels resulting from its"}, {"start": 573.44, "end": 577.12, "text": " 2D convolution, or even just RGB."}, {"start": 577.12, "end": 582.8000000000001, "text": " So I can't really draw in four dimensions, but now we stack the video frames."}, {"start": 582.8000000000001, "end": 590.2, "text": " And now our kernel, our filter, will be also in the direction of the video frame."}, {"start": 590.2, "end": 596.8800000000001, "text": " So I don't know if this is really recognizable if I draw it like this, but as you can see,"}, {"start": 596.8800000000001, "end": 600.36, "text": " the kernel is not only 2D, but 3D."}, {"start": 600.36, "end": 605.96, "text": " And now the sliding, so if we have actually more than that, the sliding is not only done"}, {"start": 605.96, "end": 610.76, "text": " into the direction of height and width, but also into the direction of depth."}, {"start": 610.76, "end": 616.4, "text": " So that each of the frames, each of the video frames right here, can incorporate information"}, {"start": 616.4, "end": 623.16, "text": " from its immediate neighbors in case of a 3 by 3 by 3 filter, or even more neighbors."}, {"start": 623.16, "end": 626.12, "text": " But here we use a 3 by 3 by 3 filter."}, {"start": 626.12, "end": 630.72, "text": " Okay, so that's how we obtain these embeddings right here."}, {"start": 630.72, "end": 635.52, "text": " And at the end, there is a dimension reduction, like a max pooling or something, but ultimately,"}, {"start": 635.52, "end": 641.0, "text": " what you'll end up with is for each of the 64 video frames, you get one vector, and that"}, {"start": 641.0, "end": 647.28, "text": " vector mainly describes that particular video frame, like if you consider the green one"}, {"start": 647.28, "end": 653.6, "text": " here, but also contains information from the video frame before it and from the video"}, {"start": 653.6, "end": 655.12, "text": " frame after it."}, {"start": 655.12, "end": 662.24, "text": " Okay, so that's sort of, and that's, that's the, so the temporal convolution is not to"}, {"start": 662.24, "end": 666.72, "text": " detect the periodic actions, because it's just one frame into the future and into the past."}, {"start": 666.72, "end": 672.04, "text": " It is more like what we said here, in order to give you extra information of what's happening"}, {"start": 672.04, "end": 677.04, "text": " in a particular frame, because especially for periodicity, it's actually important if the"}, {"start": 677.04, "end": 679.12, "text": " arms are going up or down."}, {"start": 679.12, "end": 680.96, "text": " Cool."}, {"start": 680.96, "end": 683.6800000000001, "text": " So then comes the heart of the architecture."}, {"start": 683.68, "end": 687.8399999999999, "text": " The heart of the architecture is this temporal self similarity matrix."}, {"start": 687.8399999999999, "end": 689.4, "text": " Now what does this do?"}, {"start": 689.4, "end": 693.28, "text": " This is relating the frames to each other."}, {"start": 693.28, "end": 698.56, "text": " And important to note here, this is just a single channel image."}, {"start": 698.56, "end": 701.3199999999999, "text": " So there is no other ones of these."}, {"start": 701.3199999999999, "end": 708.9599999999999, "text": " For the entire video frame sequence, you have one 64 by 64 matrix, and all the signal"}, {"start": 708.9599999999999, "end": 712.3199999999999, "text": " has to go through this matrix, right?"}, {"start": 712.32, "end": 715.44, "text": " Everything from here is only through this matrix."}, {"start": 715.44, "end": 717.0400000000001, "text": " There's no residual connections."}, {"start": 717.0400000000001, "end": 719.5200000000001, "text": " There's no skip connections."}, {"start": 719.5200000000001, "end": 720.5200000000001, "text": " That's all."}, {"start": 720.5200000000001, "end": 721.8000000000001, "text": " That's your information bottleneck."}, {"start": 721.8000000000001, "end": 728.24, "text": " And by having a bottleneck like this, the authors here force the model to basically do"}, {"start": 728.24, "end": 734.88, "text": " a good job at making this temporal self similarity happen if it wants to achieve a low loss."}, {"start": 734.88, "end": 740.84, "text": " And that's what I mean by, you can achieve a lot by having a smart architecture."}, {"start": 740.84, "end": 743.84, "text": " This temporal self similarity matrix is actually not learned."}, {"start": 743.84, "end": 748.36, "text": " This can be computed deterministically from the embeddings right here."}, {"start": 748.36, "end": 753.84, "text": " So what you do is you each row here corresponds to one frame."}, {"start": 753.84, "end": 761.52, "text": " So you take each frame that corresponds to a row, and you calculate simply the distance"}, {"start": 761.52, "end": 765.84, "text": " to or the similarity with each of the other frames."}, {"start": 765.84, "end": 772.96, "text": " So this is, as you can see, 64 by 64, so frame I here is simply compared to each of the"}, {"start": 772.96, "end": 780.0, "text": " other frames, J. And it depending on whether that embedding is very similar to the embedding"}, {"start": 780.0, "end": 784.1600000000001, "text": " of frame J, this number is going to be high or low."}, {"start": 784.1600000000001, "end": 790.8000000000001, "text": " Now there's also a, after that you do a softmax across here such that this is going to be"}, {"start": 790.8, "end": 796.8, "text": " like a distribution and not just raw numbers, but that's ultimately not that important."}, {"start": 796.8, "end": 800.28, "text": " So what you can see is that the diagonal is very prominent."}, {"start": 800.28, "end": 806.7199999999999, "text": " And that makes sense because technically the diagonal is always one, right?"}, {"start": 806.7199999999999, "end": 810.4799999999999, "text": " If, for example, if you use the inner product as a similarity, the diagonal should always"}, {"start": 810.4799999999999, "end": 814.92, "text": " be one, but here we have the softmax, so it's not, but ultimately we can say that any"}, {"start": 814.92, "end": 818.8, "text": " frame should be very similar to it is going to be very similar to itself."}, {"start": 818.8, "end": 820.3599999999999, "text": " So that's why."}, {"start": 820.36, "end": 825.52, "text": " But then you can see right here there's a pattern emerging and that pattern is these"}, {"start": 825.52, "end": 830.4, "text": " diagonal lines in this direction as you can see."}, {"start": 830.4, "end": 832.2, "text": " And what does that mean?"}, {"start": 832.2, "end": 836.0, "text": " They actually have a larger version of this down here."}, {"start": 836.0, "end": 839.8000000000001, "text": " So what does the diagonal pattern mean?"}, {"start": 839.8000000000001, "end": 844.16, "text": " It means that, so here the diagonal, that's okay."}, {"start": 844.16, "end": 847.84, "text": " Frame I is very similar to frame I."}, {"start": 847.84, "end": 848.84, "text": " Cool."}, {"start": 848.84, "end": 851.8000000000001, "text": " But the other lines, what do they mean?"}, {"start": 851.8000000000001, "end": 857.12, "text": " So if I look at frame I right here, it is also very similar to this frame J."}, {"start": 857.12, "end": 863.64, "text": " Now this wouldn't be further, you know, frames are similar, but the line means that if I"}, {"start": 863.64, "end": 872.2800000000001, "text": " have, if I look 10 frames later, I plus 10, that's very similar to J plus 10."}, {"start": 872.28, "end": 879.24, "text": " And if I now look at I plus 20 frame, that's very similar to J plus 20."}, {"start": 879.24, "end": 885.92, "text": " So this is the, this is here why the pattern is emerging of a line, because if I go 10 frames"}, {"start": 885.92, "end": 891.48, "text": " into the future, it's similar to the other one 10 frames into the future and so on."}, {"start": 891.48, "end": 898.68, "text": " And that means the line indicates that this entire sequence starting from I, 20 frames"}, {"start": 898.68, "end": 902.76, "text": " into the future is repeated starting from J."}, {"start": 902.76, "end": 907.12, "text": " Actually J is earlier here, so, but you get the point."}, {"start": 907.12, "end": 912.0, "text": " And if I have a bunch of these lines, that means that this sub sequence is repeated again"}, {"start": 912.0, "end": 914.5999999999999, "text": " and again and again throughout the video."}, {"start": 914.5999999999999, "end": 921.04, "text": " So each of these lines is basically one repetition of the sequence from the middle here at some"}, {"start": 921.04, "end": 923.76, "text": " other point in the video."}, {"start": 923.76, "end": 926.9599999999999, "text": " And that's pretty fascinating."}, {"start": 926.96, "end": 934.72, "text": " And that's these, these self similarity matrices, that's what they're sort of showing."}, {"start": 934.72, "end": 938.2, "text": " Now they don't use the inner product here as a self similarity metric."}, {"start": 938.2, "end": 943.6, "text": " They actually use, as you can see right here, they use the negative square distance, but"}, {"start": 943.6, "end": 945.5600000000001, "text": " the effect is the same."}, {"start": 945.5600000000001, "end": 950.48, "text": " So negative square distance followed by a row wise softmax operation."}, {"start": 950.48, "end": 954.2, "text": " So you could say, hi, we're basically done."}, {"start": 954.2, "end": 958.48, "text": " Using the self similarity matrix, what we could do, let's say we could train it."}, {"start": 958.48, "end": 960.2, "text": " We don't worry about how to train it."}, {"start": 960.2, "end": 967.2, "text": " We could simply take each row right here and we plot the intensities across that row."}, {"start": 967.2, "end": 970.96, "text": " And that's maybe, you know, like something like this and then there is the diagonal is a"}, {"start": 970.96, "end": 971.96, "text": " bit higher."}, {"start": 971.96, "end": 972.96, "text": " Okay."}, {"start": 972.96, "end": 977.2800000000001, "text": " And we could just use a heuristic to detect these bumps here."}, {"start": 977.2800000000001, "end": 982.6400000000001, "text": " Basically calculate the length count the bumps and calculate the period length, right?"}, {"start": 982.64, "end": 988.8, "text": " But that should be pretty easy with like a simple heuristic, but the authors here, they"}, {"start": 988.8, "end": 991.64, "text": " want more, they want to solve more problems."}, {"start": 991.64, "end": 993.1999999999999, "text": " So what are some of the problems?"}, {"start": 993.1999999999999, "end": 998.84, "text": " We already saw some of the problems, namely, for example, here is the hammer throw."}, {"start": 998.84, "end": 1003.56, "text": " So the hammer throw starts out slow and gets faster and faster and faster."}, {"start": 1003.56, "end": 1008.8, "text": " And you can see this pretty clearly at the lines right here, namely, if you go through"}, {"start": 1008.8, "end": 1009.8, "text": " time."}, {"start": 1009.8, "end": 1011.64, "text": " So you start off here."}, {"start": 1011.64, "end": 1013.48, "text": " And you go through time."}, {"start": 1013.48, "end": 1019.6999999999999, "text": " You can see that the distance to the next line here is fairly large, but you go through"}, {"start": 1019.6999999999999, "end": 1022.72, "text": " time further, the distance gets shorter."}, {"start": 1022.72, "end": 1025.8799999999999, "text": " You go through time further, the distance gets even shorter."}, {"start": 1025.8799999999999, "end": 1032.32, "text": " So these pattern of lines here that's kind of converging towards that, it indicates that"}, {"start": 1032.32, "end": 1036.28, "text": " this repeating action gets faster and faster and faster."}, {"start": 1036.28, "end": 1042.52, "text": " This is nice to see here at the bouncy ball example where you can see it starts out pretty"}, {"start": 1042.52, "end": 1048.0, "text": " slow, but it gets faster and faster and here."}, {"start": 1048.0, "end": 1053.68, "text": " If you have this full thing right here, that basically means all the frames are self-similar"}, {"start": 1053.68, "end": 1059.36, "text": " to each other, which basically means if you stop the video, right, that's if you have"}, {"start": 1059.36, "end": 1062.96, "text": " 10 frames in a row, the same thing, the ball is just lying on the ground."}, {"start": 1062.96, "end": 1065.8, "text": " All of these frames will be self-similar."}, {"start": 1065.8, "end": 1069.36, "text": " So there's probably no bouncing happening down here."}, {"start": 1069.36, "end": 1073.28, "text": " You can see pretty well from the pattern what happens."}, {"start": 1073.28, "end": 1078.76, "text": " And here in this mixing concrete example that we saw at the beginning, you can see that"}, {"start": 1078.76, "end": 1083.28, "text": " at the beginning, at the end, there's this intro and outro sequence."}, {"start": 1083.28, "end": 1086.32, "text": " And only in the middle is there a repeating action."}, {"start": 1086.32, "end": 1092.72, "text": " And that's indicated by this line pattern is only in the middle of the videos, only between"}, {"start": 1092.72, "end": 1094.76, "text": " here and here."}, {"start": 1094.76, "end": 1102.12, "text": " So it's going to be pretty difficult to just have a heuristic that reads out these periodic"}, {"start": 1102.12, "end": 1104.0, "text": " action, periodicity."}, {"start": 1104.0, "end": 1109.56, "text": " And in a truly learning fashion, the authors here, oh sorry, maybe you can see that."}, {"start": 1109.56, "end": 1114.8799999999999, "text": " I've shifted my recording window, so maybe sometimes something's out of frame and you"}, {"start": 1114.8799999999999, "end": 1118.56, "text": " have to yell at me if I do that, please."}, {"start": 1118.56, "end": 1125.32, "text": " So I hope you saw this that you have the ever-deaf speeding up here and here, where visible"}, {"start": 1125.32, "end": 1126.3999999999999, "text": " in the pattern."}, {"start": 1126.3999999999999, "end": 1131.56, "text": " And then here you have the beginning sequence, the end sequence that have no repeating pattern"}, {"start": 1131.56, "end": 1134.04, "text": " and the repeating pattern only mirrors in the middle."}, {"start": 1134.04, "end": 1139.3999999999999, "text": " So the authors want to do this through, of course, a deep learning network."}, {"start": 1139.3999999999999, "end": 1145.84, "text": " They want to read out the periodicities, not through a heuristic, but using a deep network."}, {"start": 1145.84, "end": 1147.24, "text": " You know, respectable."}, {"start": 1147.24, "end": 1149.24, "text": " That's at the times we live in."}, {"start": 1149.24, "end": 1151.44, "text": " So what do they do?"}, {"start": 1151.44, "end": 1158.96, "text": " First of all, you have to see right here, everything that happens from here, as I understand"}, {"start": 1158.96, "end": 1161.56, "text": " it, is per frame."}, {"start": 1161.56, "end": 1169.52, "text": " So they simply take a row of this matrix right here, like this red line, and that is independently"}, {"start": 1169.52, "end": 1171.72, "text": " pulled through to the end."}, {"start": 1171.72, "end": 1177.84, "text": " So there is no interaction happening anymore between the individual frame data."}, {"start": 1177.84, "end": 1183.2, "text": " The only interaction that happens is a little bit here at the temporal convolutions, but"}, {"start": 1183.2, "end": 1187.6000000000001, "text": " the only real interaction between the frames is happening through the self-similarity"}, {"start": 1187.6000000000001, "end": 1188.6000000000001, "text": " matrix."}, {"start": 1188.6000000000001, "end": 1192.96, "text": " And again, this is the information bottleneck that the authors forced the information"}, {"start": 1192.96, "end": 1193.96, "text": " through."}, {"start": 1193.96, "end": 1198.96, "text": " Everything happening from here, no, that's actually not right."}, {"start": 1198.96, "end": 1201.24, "text": " There is this convolution right here."}, {"start": 1201.24, "end": 1205.4, "text": " But still, this is the information bottleneck you have to go through."}, {"start": 1205.4, "end": 1210.36, "text": " So right here, we process this image using a convolution."}, {"start": 1210.36, "end": 1213.72, "text": " So this is an image, right?"}, {"start": 1213.72, "end": 1218.64, "text": " And we can process it using a convolutional neural network."}, {"start": 1218.64, "end": 1223.52, "text": " So what we do is we have a 64 by 64 image in one channel."}, {"start": 1223.52, "end": 1229.76, "text": " We simply upsample that, not upsample, but we expand the channels to 32 channels."}, {"start": 1229.76, "end": 1235.84, "text": " Now, as I said, it's pretty easy to think we can just go to the end here, use a convent"}, {"start": 1235.84, "end": 1243.8799999999999, "text": " to produce our final 512 by, so 512 embeddings we have here, again, 64 by 64, that we then"}, {"start": 1243.8799999999999, "end": 1248.16, "text": " use to predict the final result."}, {"start": 1248.16, "end": 1251.12, "text": " But the authors here do something different."}, {"start": 1251.12, "end": 1255.92, "text": " They do transformer layers in the middle, but only per frame."}, {"start": 1255.92, "end": 1258.04, "text": " So what does it mean?"}, {"start": 1258.04, "end": 1265.1599999999999, "text": " So here, you upsample to 32 channels."}, {"start": 1265.1599999999999, "end": 1271.84, "text": " And then that means that one of these blocks right here, one of these blocks corresponds"}, {"start": 1271.84, "end": 1277.1599999999999, "text": " to one row in the self-similar t matrix, which corresponds to one frame."}, {"start": 1277.1599999999999, "end": 1282.72, "text": " And from now on, so from now on, I want to say what I said before, from now on, it's"}, {"start": 1282.72, "end": 1288.52, "text": " all just this one block, they are independent of each other."}, {"start": 1288.52, "end": 1295.72, "text": " Okay, so you take this one block and you feed it through a transformer to achieve at your"}, {"start": 1295.72, "end": 1299.32, "text": " final embedding of 512."}, {"start": 1299.32, "end": 1303.96, "text": " And it's probably best if we read what they say about it."}, {"start": 1303.96, "end": 1306.96, "text": " Okay."}, {"start": 1306.96, "end": 1314.96, "text": " So if we're given this self-similarity matrices, matrix, it consists of row, each row is the"}, {"start": 1314.96, "end": 1320.52, "text": " per frame self-similarity representation and generates two outputs, the per frame period"}, {"start": 1320.52, "end": 1325.04, "text": " length estimation and the per frame binary periodicity classification."}, {"start": 1325.04, "end": 1332.32, "text": " Note that both L and P are vectors and their elements are per frame predictions."}, {"start": 1332.32, "end": 1334.32, "text": " Okay."}, {"start": 1334.32, "end": 1337.8799999999999, "text": " The architecture of the period predictor module can be viewed in figure two."}, {"start": 1337.8799999999999, "end": 1343.24, "text": " Note that the predictors share a common architecture and weights until the last classification"}, {"start": 1343.24, "end": 1344.84, "text": " phase."}, {"start": 1344.84, "end": 1351.0, "text": " The share processing pipeline starts with starts with 32 2D convolutional filters of"}, {"start": 1351.0, "end": 1358.52, "text": " size 3 by 3, followed by a transformer layer, which uses a multi-headed attention with"}, {"start": 1358.52, "end": 1363.24, "text": " trainable positional embeddings in the form of a 64 length variable."}, {"start": 1363.24, "end": 1365.4, "text": " That is learned by training."}, {"start": 1365.4, "end": 1366.4, "text": " Okay."}, {"start": 1366.4, "end": 1371.52, "text": " It's I guess the transformers learn by training and the positional embeddings are also learned"}, {"start": 1371.52, "end": 1373.24, "text": " by training."}, {"start": 1373.24, "end": 1375.2, "text": " That's fairly common."}, {"start": 1375.2, "end": 1379.2, "text": " We use four heads with 512 dimension in the transformer."}, {"start": 1379.2, "end": 1383.56, "text": " By the way, if you don't know what a transformer is, watch the video on attention is all you"}, {"start": 1383.56, "end": 1384.56, "text": " need."}, {"start": 1384.56, "end": 1385.56, "text": " I made one."}, {"start": 1385.56, "end": 1386.56, "text": " It's very popular."}, {"start": 1386.56, "end": 1387.56, "text": " Yeah."}, {"start": 1387.56, "end": 1391.68, "text": " So with each head being 128 dimensions in size."}, {"start": 1391.68, "end": 1397.8, "text": " After the shared pipeline, we have two classifiers, period length classifier and periodicity classifier"}, {"start": 1397.8, "end": 1398.8, "text": " tau."}, {"start": 1398.8, "end": 1399.8, "text": " Sorry."}, {"start": 1399.8, "end": 1400.8, "text": " This is fine."}, {"start": 1400.8, "end": 1401.8, "text": " This is tau."}, {"start": 1401.8, "end": 1404.92, "text": " Each of them consists of two fully connected layers of size 512."}, {"start": 1404.92, "end": 1408.8, "text": " So I guess the pipeline here is pretty simple."}, {"start": 1408.8, "end": 1415.5600000000002, "text": " The question could be, why do they use a transformer and not simply another convolutional network?"}, {"start": 1415.5600000000002, "end": 1421.0800000000002, "text": " So here they upsample the image as we saw into 32 channels."}, {"start": 1421.08, "end": 1427.0, "text": " And then they simply want to take one of these blocks here."}, {"start": 1427.0, "end": 1429.32, "text": " And that corresponds a little bit."}, {"start": 1429.32, "end": 1432.6799999999998, "text": " So we have four one frame."}, {"start": 1432.6799999999998, "end": 1433.6799999999998, "text": " What does it mean?"}, {"start": 1433.6799999999998, "end": 1441.1599999999999, "text": " We have basically 64 by 32 things."}, {"start": 1441.1599999999999, "end": 1448.24, "text": " So the 64 things, it's this one frame's temporal connection to each other frame."}, {"start": 1448.24, "end": 1451.4, "text": " Then comes from this self similarity matrix."}, {"start": 1451.4, "end": 1457.28, "text": " So it kind of relates this frame that we're considering to each of the other frames."}, {"start": 1457.28, "end": 1462.04, "text": " And each of these entries is a 32 size vector."}, {"start": 1462.04, "end": 1470.48, "text": " This is sort of a, this is you can consider like a sequence of 64 things, 64 embeddings."}, {"start": 1470.48, "end": 1476.28, "text": " So to use a transformer here, it's pretty natural if you think of this as like a sequence"}, {"start": 1476.28, "end": 1478.96, "text": " transformation task."}, {"start": 1478.96, "end": 1481.72, "text": " I would guess."}, {"start": 1481.72, "end": 1488.8, "text": " So the transformer can, if there are these peaks right here, like we saw right here, the"}, {"start": 1488.8, "end": 1495.0, "text": " transformer can make very good sense of that because of course the attention mechanism from"}, {"start": 1495.0, "end": 1503.12, "text": " a one peak, it can attend to all the other peaks and can sort of relate the different peaks"}, {"start": 1503.12, "end": 1506.24, "text": " to each other and then determine the periodicity length."}, {"start": 1506.24, "end": 1512.84, "text": " Whereas with a convolutional network, I guess that's going to be a lot harder because of"}, {"start": 1512.84, "end": 1515.6, "text": " the sort of invariance built into the convolution."}, {"start": 1515.6, "end": 1516.6, "text": " I'm not sure."}, {"start": 1516.6, "end": 1518.88, "text": " Maybe they also, it just worked better."}, {"start": 1518.88, "end": 1521.0, "text": " But that's how I think about it."}, {"start": 1521.0, "end": 1527.32, "text": " It's that for a given frame, you basically have a sequence classification or a set classification"}, {"start": 1527.32, "end": 1528.32, "text": " task."}, {"start": 1528.32, "end": 1535.0, "text": " And the attention mechanism allows you to in one single step connect each peak with"}, {"start": 1535.0, "end": 1541.44, "text": " each other peak or each information with each other information in this sequence."}, {"start": 1541.44, "end": 1542.44, "text": " All right."}, {"start": 1542.44, "end": 1547.68, "text": " So at the end, you have just fully connected layers again, only on a per frame basis and"}, {"start": 1547.68, "end": 1550.6, "text": " that will give you the output."}, {"start": 1550.6, "end": 1554.72, "text": " And again, you compare this to the label and you backprop through everything."}, {"start": 1554.72, "end": 1556.12, "text": " Everything here is differentiable."}, {"start": 1556.12, "end": 1561.4, "text": " So all of this is trained to achieve minimum possible loss."}, {"start": 1561.4, "end": 1566.96, "text": " And because you train everything to achieve minimum possible loss, you make this encoder"}, {"start": 1566.96, "end": 1572.1200000000001, "text": " right here, which is the crucial part because the encoder is must give you good embeddings"}, {"start": 1572.1200000000001, "end": 1576.3200000000002, "text": " which must give you a sensible self-similarity matrix, right?"}, {"start": 1576.3200000000002, "end": 1583.1200000000001, "text": " You train the encoder to encode things that are relevant for the task."}, {"start": 1583.1200000000001, "end": 1587.6000000000001, "text": " And that's what makes the whole thing work."}, {"start": 1587.6000000000001, "end": 1589.6000000000001, "text": " Okay."}, {"start": 1589.6, "end": 1592.28, "text": " So we've gone through the architecture."}, {"start": 1592.28, "end": 1599.56, "text": " Now the problem right here is the dataset."}, {"start": 1599.56, "end": 1602.8, "text": " So they also go into how they do inference."}, {"start": 1602.8, "end": 1606.8799999999999, "text": " They can actually do a bunch of things like play the video at different speeds and then"}, {"start": 1606.8799999999999, "end": 1609.1599999999999, "text": " look at each of the predictions."}, {"start": 1609.1599999999999, "end": 1614.08, "text": " So if a double speed, it predicts half the period length, then you can be more sure and"}, {"start": 1614.08, "end": 1615.08, "text": " so on."}, {"start": 1615.08, "end": 1616.8799999999999, "text": " So that's pretty cool."}, {"start": 1616.88, "end": 1622.88, "text": " But they go into another point right here and that's the dataset."}, {"start": 1622.88, "end": 1629.3200000000002, "text": " So they produce this countics dataset, but also on the other hand, which is something I"}, {"start": 1629.3200000000002, "end": 1634.2800000000002, "text": " also find very cool is they produce a synthetic dataset."}, {"start": 1634.2800000000002, "end": 1638.64, "text": " So here they say we train with synthetic repetitions."}, {"start": 1638.64, "end": 1645.16, "text": " And that can be sort of I didn't know what to think of it at first."}, {"start": 1645.16, "end": 1648.5600000000002, "text": " I was just like, huh, but then it's pretty cool."}, {"start": 1648.5600000000002, "end": 1653.0800000000002, "text": " So if you have a video with these, these are the frames of the video, right?"}, {"start": 1653.0800000000002, "end": 1656.3200000000002, "text": " So the video goes in this temporal direction."}, {"start": 1656.3200000000002, "end": 1663.44, "text": " What you can do is simply go here, go through these frames and just repeat these frames and"}, {"start": 1663.44, "end": 1664.96, "text": " repeat them and repeat them."}, {"start": 1664.96, "end": 1667.5600000000002, "text": " And at the end, you have these frames, right?"}, {"start": 1667.5600000000002, "end": 1668.8400000000001, "text": " And then you have a dataset."}, {"start": 1668.84, "end": 1675.9599999999998, "text": " And if you assume that most videos do not naturally contain repeating actions, right?"}, {"start": 1675.9599999999998, "end": 1677.1999999999998, "text": " Most videos are just videos."}, {"start": 1677.1999999999998, "end": 1679.48, "text": " They're not videos of something repeating."}, {"start": 1679.48, "end": 1685.36, "text": " Then you can safely assume that these parts here are non-repeating."}, {"start": 1685.36, "end": 1687.32, "text": " So and these parts here are repeating."}, {"start": 1687.32, "end": 1689.6399999999999, "text": " This is one of the labels that you need, right?"}, {"start": 1689.6399999999999, "end": 1694.1999999999998, "text": " The problem with synthetic dataset is always to have the labels."}, {"start": 1694.2, "end": 1700.92, "text": " And also, you know how many there are because you can simply count the number of times that"}, {"start": 1700.92, "end": 1702.1200000000001, "text": " you go through it."}, {"start": 1702.1200000000001, "end": 1704.44, "text": " You can even make it faster, slower and so on."}, {"start": 1704.44, "end": 1707.2, "text": " So this synthetic approach is pretty cool."}, {"start": 1707.2, "end": 1711.28, "text": " And especially the bottom right here, because this might be kind of hacky."}, {"start": 1711.28, "end": 1717.28, "text": " Because each time you jump from the end of one of those arrows to the beginning, right?"}, {"start": 1717.28, "end": 1723.48, "text": " You have kind of a hack in the individual because you know, it's not continuous."}, {"start": 1723.48, "end": 1728.52, "text": " So what you can do, and this is the bottom here, you can do this reversal technique where"}, {"start": 1728.52, "end": 1729.8, "text": " you go to the end."}, {"start": 1729.8, "end": 1732.44, "text": " And then you play the frames backwards."}, {"start": 1732.44, "end": 1736.64, "text": " And then you play the frames forwards again, backwards again, forwards again, and then"}, {"start": 1736.64, "end": 1737.92, "text": " you go out here."}, {"start": 1737.92, "end": 1740.3600000000001, "text": " And that gives you one continuous motion, right?"}, {"start": 1740.3600000000001, "end": 1745.72, "text": " If someone, if it's simply a video of someone lifting their hand, like it starts out down"}, {"start": 1745.72, "end": 1748.96, "text": " here and it goes here and it goes here."}, {"start": 1748.96, "end": 1755.6000000000001, "text": " And then if you do this technique, it would go down again, down again, up again, up again,"}, {"start": 1755.6000000000001, "end": 1757.4, "text": " and so on."}, {"start": 1757.4, "end": 1763.24, "text": " So, that's, you know, I think it's a fairly smart technique, honestly."}, {"start": 1763.24, "end": 1766.92, "text": " Now they try this and it doesn't work super well."}, {"start": 1766.92, "end": 1773.88, "text": " So what they also have to do is they have to do manual camera motion augmentation."}, {"start": 1773.88, "end": 1776.44, "text": " So that's, so camera motion augmentation."}, {"start": 1776.44, "end": 1781.8400000000001, "text": " It basically means that if you just do a repeating action like this, it's sort of, I guess it's"}, {"start": 1781.8400000000001, "end": 1782.8400000000001, "text": " too monotonic."}, {"start": 1782.8400000000001, "end": 1786.8, "text": " It doesn't really cover real videos with repeating actions."}, {"start": 1786.8, "end": 1793.52, "text": " So what they do is they kind of simulate a moving camera."}, {"start": 1793.52, "end": 1797.88, "text": " And you simulate that much like you would do image augmentation."}, {"start": 1797.88, "end": 1800.24, "text": " So you can rotate the camera over time."}, {"start": 1800.24, "end": 1801.76, "text": " You can translate it."}, {"start": 1801.76, "end": 1803.96, "text": " You can scale it differently."}, {"start": 1803.96, "end": 1807.92, "text": " And through, if you do that throughout the video and you change it around how the camera"}, {"start": 1807.92, "end": 1812.56, "text": " moves, then that appears to work fairly well."}, {"start": 1812.56, "end": 1820.16, "text": " So if they now compare this and their data set, they perform pretty well."}, {"start": 1820.16, "end": 1825.8, "text": " So in their data set, they take this kinetics data set and they crowdsource the label."}, {"start": 1825.8, "end": 1831.24, "text": " And the tasks in the data set, they're pretty diverse as you can see right here."}, {"start": 1831.24, "end": 1836.52, "text": " So you have sports like a rope training mount and a climb, but you have also things like"}, {"start": 1836.52, "end": 1842.08, "text": " playing ukulele exercising arms slicing and onion and so on."}, {"start": 1842.08, "end": 1845.88, "text": " And you can see that the repetition count is fairly diverse as well."}, {"start": 1845.88, "end": 1850.1200000000001, "text": " So from one or two repetitions per video, it goes to 50 or so."}, {"start": 1850.1200000000001, "end": 1853.64, "text": " And the period length is also between one and five seconds."}, {"start": 1853.64, "end": 1860.72, "text": " Though as you, as I already said, you don't have to, you don't have to count on that because"}, {"start": 1860.72, "end": 1867.88, "text": " you can always play the video slower or faster and then determine other periodicities."}, {"start": 1867.88, "end": 1873.84, "text": " So in their experiment, first of all, they perform pretty well and they show that if they"}, {"start": 1873.84, "end": 1882.76, "text": " train on their data set and on the synthetic data set, they perform better than if they"}, {"start": 1882.76, "end": 1887.56, "text": " just train on the synthetic or they just train on their data set."}, {"start": 1887.56, "end": 1893.76, "text": " They also show pretty clearly that the addition of this temporal self-similarity matrix helps"}, {"start": 1893.76, "end": 1894.76, "text": " tremendously."}, {"start": 1894.76, "end": 1900.32, "text": " You can see right here in each of these boxes is the comparison and this OBO, I think"}, {"start": 1900.32, "end": 1902.32, "text": " is the off by one error."}, {"start": 1902.32, "end": 1907.32, "text": " So it kind of forgives you if you're off by one count, but otherwise you get a zero if"}, {"start": 1907.32, "end": 1908.72, "text": " you're wrong."}, {"start": 1908.72, "end": 1912.9199999999998, "text": " And you can see that the self-similarity matrix helps tremendously."}, {"start": 1912.92, "end": 1918.04, "text": " They also compare with some other architectural choices instead of the transformer."}, {"start": 1918.04, "end": 1925.1200000000001, "text": " I guess, yeah, so I guess they just take it because it performs pretty well."}, {"start": 1925.1200000000001, "end": 1931.4, "text": " And they do a lot of, a lot of ablations, but what I particularly appreciate is that they"}, {"start": 1931.4, "end": 1933.24, "text": " do something like this."}, {"start": 1933.24, "end": 1939.96, "text": " So what they do at the end, once they've trained the architectures, they do a 1DPCA protection"}, {"start": 1939.96, "end": 1942.52, "text": " of the encoder features over time."}, {"start": 1942.52, "end": 1946.84, "text": " Now the encoder features, they were 512 dimensional, right?"}, {"start": 1946.84, "end": 1951.68, "text": " This is the thing before it goes into the self-similarity matrix."}, {"start": 1951.68, "end": 1958.6, "text": " So those, we said, the encoder is the crucial part here because it needs to take the video"}, {"start": 1958.6, "end": 1965.12, "text": " and encode things that make them accessible to calculating the self-similarity."}, {"start": 1965.12, "end": 1971.32, "text": " Now they do a 1DPCA, so a projection into one dimension of these features."}, {"start": 1971.32, "end": 1980.32, "text": " And you can already see at this one dimensional projection that the periodicity here is clearly,"}, {"start": 1980.32, "end": 1984.84, "text": " clearly visible, namely, for example, right here."}, {"start": 1984.84, "end": 1989.8799999999999, "text": " Every time up here is when the legs are up and every time down here is when the legs"}, {"start": 1989.8799999999999, "end": 1991.84, "text": " are down right here."}, {"start": 1991.84, "end": 1995.8799999999999, "text": " So that is very, very impressive."}, {"start": 1995.88, "end": 2002.6000000000001, "text": " And that really shows that the model is doing what you claim that it's doing."}, {"start": 2002.6000000000001, "end": 2007.68, "text": " Like I'm almost more interested in experiments like this than in these numbers right here,"}, {"start": 2007.68, "end": 2014.8400000000001, "text": " because the numbers could always be because you've just thrown more stuff at it, right?"}, {"start": 2014.8400000000001, "end": 2020.3600000000001, "text": " So they go over a bunch of possible applications of their model."}, {"start": 2020.36, "end": 2027.7199999999998, "text": " So first of all, you can do something like, as we can see, repetition counting from videos."}, {"start": 2027.7199999999998, "end": 2030.1999999999998, "text": " You can do periodicity detection."}, {"start": 2030.1999999999998, "end": 2033.0, "text": " Those were the things that the model is trained to do."}, {"start": 2033.0, "end": 2037.9199999999998, "text": " But there's also a bunch of things that the model can now implicitly do, namely something"}, {"start": 2037.9199999999998, "end": 2042.9199999999998, "text": " like change inspection where they say, look, if someone's chopping this pineapple right"}, {"start": 2042.9199999999998, "end": 2048.7999999999997, "text": " here, then at the end of each of the repetitions, there is something that changed, namely the"}, {"start": 2048.8, "end": 2051.1200000000003, "text": " number of slices of pineapple."}, {"start": 2051.1200000000003, "end": 2052.1200000000003, "text": " Is it bread?"}, {"start": 2052.1200000000003, "end": 2053.1200000000003, "text": " Is it?"}, {"start": 2053.1200000000003, "end": 2054.1200000000003, "text": " I can't."}, {"start": 2054.1200000000003, "end": 2055.1200000000003, "text": " I think it's pineapple."}, {"start": 2055.1200000000003, "end": 2056.1200000000003, "text": " Okay."}, {"start": 2056.1200000000003, "end": 2060.04, "text": " So the number of slices or pieces right here changes."}, {"start": 2060.04, "end": 2067.8, "text": " So in essence, this could be the base for another model estimating whatever changed or"}, {"start": 2067.8, "end": 2072.48, "text": " training to recognize numbers of pieces and so on."}, {"start": 2072.48, "end": 2075.32, "text": " Also you can detect the speed."}, {"start": 2075.32, "end": 2080.6800000000003, "text": " So the speed of a repeating action, if you perform something slow or fast, this model"}, {"start": 2080.6800000000003, "end": 2083.76, "text": " can implicitly do it."}, {"start": 2083.76, "end": 2087.2000000000003, "text": " And this they call cross period retrieval."}, {"start": 2087.2000000000003, "end": 2094.36, "text": " So if you know when the repetitions are, you know that, okay, maybe the first frame,"}, {"start": 2094.36, "end": 2101.92, "text": " so always on the upswing right here, these should all be fairly similar visually, right?"}, {"start": 2101.92, "end": 2105.2400000000002, "text": " As with respect to the repeating action."}, {"start": 2105.24, "end": 2112.0, "text": " So you can see that even though this, whenever the kid in the swing here is close, it looks"}, {"start": 2112.0, "end": 2118.08, "text": " fairly different in a purely visual sense, in a pixel sense, but it is at the same point"}, {"start": 2118.08, "end": 2120.08, "text": " in the repeating action."}, {"start": 2120.08, "end": 2122.64, "text": " And that's, you know, that's pretty cool."}, {"start": 2122.64, "end": 2128.0, "text": " So you can technically retrieve related things even though they visually, they don't look"}, {"start": 2128.0, "end": 2131.3199999999997, "text": " similar that much."}, {"start": 2131.3199999999997, "end": 2132.3199999999997, "text": " Yeah."}, {"start": 2132.32, "end": 2137.28, "text": " That's the kind of applications here are probably many, many fold."}, {"start": 2137.28, "end": 2143.0, "text": " And I also think that, so in this measure of intelligence paper by Hauss-Wa Shouley,"}, {"start": 2143.0, "end": 2147.84, "text": " he basically claims that this is one of the innate abilities of humans."}, {"start": 2147.84, "end": 2150.48, "text": " They can count, you know, they can count things."}, {"start": 2150.48, "end": 2153.56, "text": " This is something you're basically born with."}, {"start": 2153.56, "end": 2161.04, "text": " And maybe this thing right here will become sort of a staple, staple component for many"}, {"start": 2161.04, "end": 2163.48, "text": " other things that we build AI on."}, {"start": 2163.48, "end": 2168.32, "text": " I would not be surprised, but maybe we'll just fade into history."}, {"start": 2168.32, "end": 2173.96, "text": " I think it's a pretty cool project, especially, you know, the architectural choice here to"}, {"start": 2173.96, "end": 2177.8, "text": " pull everything through this self-similarity matrix."}, {"start": 2177.8, "end": 2184.56, "text": " And you know, just looking at this matrix already makes you kind of know that this thing"}, {"start": 2184.56, "end": 2185.56, "text": " works."}, {"start": 2185.56, "end": 2186.8, "text": " All right."}, {"start": 2186.8, "end": 2191.04, "text": " This was it from me. Let me know in the comments what you think about the paper."}, {"start": 2191.04, "end": 2192.6400000000003, "text": " Check out the website."}, {"start": 2192.6400000000003, "end": 2197.2400000000002, "text": " The website has a lot of video demo examples of what they're doing."}, {"start": 2197.2400000000002, "end": 2199.7200000000003, "text": " I think the dataset as well."}, {"start": 2199.7200000000003, "end": 2201.2400000000002, "text": " And yeah, I'll see you next time."}, {"start": 2201.24, "end": 2216.68, "text": " Bye."}] |
Yannic Kilcher | 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, BOMZ, 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. These 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 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 young look on ways 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 picks trained 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. I mean, 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 is 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 Lomburginis 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. Now I train my logistic regression and it tells me okay, 6040. Cool. But now I train my logistic regression with an L1 penalty and I say I want my model to be 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 add 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 Yandlacompt points out here, if you change the data set, you'll change these biases. Notably these societal biases can only be in the data set. Otherwise you 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 Yandlacompt 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 societal bias. But Yandlacompt, 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, right? 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 Lacompt 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, Sumith here makes an 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 bird or resonant 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, ooh, this is a face-up sampler. Cool. I can use that without noting that this is simply an example, an 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 Yonlakan not correct. But I'd 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 L2 loss and almost everyone will look white, or train it on the whole American population with an L1 loss and more people might look black. Stop pretending that bias does not also come from algorithmic choices. Yonlakan never says it doesn't, right? The con response 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 L1 instead of an L2 will not even begin to solve the problem. I would pretty much argue training with an L1 loss here would exacerbate the problem, because the L2 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 cycle again? And L2 says, because people should be aware of this problem and know it's cause so they can fix it. How terrible, Yonlakan 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 Nigivara says, Yonl 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 Yonlakan does not ever deny. He simply says this particular problem can be solved by switching the data set. Nikolau Leroux says, Yonl was in my PhD jury. I am 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, Leroux says cause of the biases or 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-concazion people. Which was never the intent of this. The intent of this was to showcase the method. I mean, image that is like 60% dog species. And still people train on it to showcase their image recognition techniques. No one training on image that makes a claim that they have solved computer vision for all the classes in the world in a fair manner. Timnigibru goes on saying, I'm sick of this framing tired of it. Many people have tried to explain many scholars listen to as 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 Jan LeCas 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 most the 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 Marou says I respectfully disagree with Jan here. As long as progress is benchmarked on bias 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 laws 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 LeConn 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 LeConn 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 trainings that 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 downpixled. This is simply going to give you the most likely face associated with that downpixled 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't 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 sample 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. Younglucka 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 this is 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 rabbled down all the different things that are and might be wrong according to the canon. And big props to Younglucka here for holding his own. 90% of people by now would probably be like, oh yes, I'm so sorry, I did a not thoughtful comment blah blah blah. Props to you, Jan. 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": 7.84, "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"}, {"start": 8.2, "end": 9.32, "text": " up sample a"}, {"start": 9.32, "end": 15.32, "text": " pixelated image in a way that makes it look realistic but also that the again"}, {"start": 15.88, "end": 22.28, "text": " down sampled variant matches the original down sampled image. So it's kind of a cycle consistency loss"}, {"start": 22.8, "end": 24.8, "text": " together with a GAN and"}, {"start": 24.8, "end": 31.68, "text": " all in all, it's a method to demonstrate how you could do this. Now this has been trained on this face data set"}, {"start": 31.68, "end": 33.68, "text": " among others. There was a user,"}, {"start": 34.04, "end": 38.64, "text": " BOMZ, that made this into a colab so people could try it out and"}, {"start": 39.32, "end": 40.84, "text": " tweeted this out."}, {"start": 40.84, "end": 47.68, "text": " And as you can see, it works pretty nicely, gives pretty nice results on this particular data set."}, {"start": 47.68, "end": 48.68, "text": " But of course,"}, {"start": 48.68, "end": 53.72, "text": " people started playing around with it and gave fairly funny results like"}, {"start": 53.72, "end": 58.4, "text": " this or that that gets more into the horrible category."}, {"start": 58.72, "end": 61.32, "text": " These so you can see"}, {"start": 62.28, "end": 68.08, "text": " these ones I particularly like Trump being made into the little child."}, {"start": 69.32, "end": 75.92, "text": " So you can see as soon as you get away from the original kind of data set modality, you are going to get"}, {"start": 76.32, "end": 78.32, "text": " these results that are off and"}, {"start": 78.32, "end": 83.72, "text": " and people started to notice that so here you input Barack Obama and"}, {"start": 84.27999999999999, "end": 93.6, "text": " 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": 93.6, "end": 97.47999999999999, "text": " I guess here is where the entire story starts."}, {"start": 97.47999999999999, "end": 103.24, "text": " So young look on ways in and says ML systems are biased when data is biased."}, {"start": 103.24, "end": 109.88, "text": " This face up sampling system makes everyone look white because the network was pre trained on flick face HQ"}, {"start": 110.0, "end": 118.39999999999999, "text": " which mainly contains white people picks trained the exact same system on a date set from Senegal and everyone will look African."}, {"start": 118.39999999999999, "end": 123.96, "text": " So this is pointing out why this happens namely because the data set is mainly Caucasian people."}, {"start": 123.96, "end": 128.2, "text": " So the results of up sampling are going to be mainly Caucasian people."}, {"start": 128.2, "end": 133.51999999999998, "text": " I mean, this is like a straightforward explanation of why we're seeing what we're seeing."}, {"start": 134.0, "end": 139.07999999999998, "text": " But of course this was not okay and here is where the piling starts."}, {"start": 139.07999999999998, "end": 142.48, "text": " As an interjection, we have to talk about bias in machine learning."}, {"start": 142.48, "end": 148.67999999999998, "text": " Technically, there is a statistical notion of bias which has a very rigorous definition and there is the societal"}, {"start": 149.04, "end": 154.12, "text": " definition of bias and these two things even though they're the same word, they're totally different."}, {"start": 154.12, "end": 162.4, "text": " A machine learning system mainly consists of four different parts. There is the data set, the model, the loss function and the optimization procedure."}, {"start": 162.4, "end": 171.36, "text": " Statistical bias means whenever the model, the loss or the optimization procedure lead to a situation where the outcome"}, {"start": 171.36, "end": 175.48000000000002, "text": " doesn't reflect the distribution of the data that you input."}, {"start": 175.48000000000002, "end": 182.16, "text": " This for example is achieved when you regularize your model which means that you put some prior knowledge onto the model,"}, {"start": 182.16, "end": 187.79999999999998, "text": " you introduce bias and therefore you choose to not accurately represent your data distribution,"}, {"start": 187.79999999999998, "end": 192.96, "text": " regularize it to a more biased distribution that in turn has lower variance."}, {"start": 192.96, "end": 196.72, "text": " We know this as the bias variance trade off. It's actually very simple, right?"}, {"start": 196.72, "end": 202.24, "text": " You have the Ferraris and the Lomburginis and you want to make a model that predicts the accident probability."}, {"start": 202.24, "end": 208.96, "text": " Now it just so happens that the Ferrari drivers are a bit more reckless and they do slightly higher accidents."}, {"start": 208.96, "end": 213.68, "text": " Now I train my logistic regression and it tells me okay, 6040. Cool."}, {"start": 213.68, "end": 219.60000000000002, "text": " But now I train my logistic regression with an L1 penalty and I say I want my model to be explainable."}, {"start": 219.60000000000002, "end": 224.08, "text": " So I want it to be sparse. I want the least amount of variables to be contributing to it."}, {"start": 224.08, "end": 229.04000000000002, "text": " What's the model going to say? The model is going to say Ferrari drivers add Lamborghini drivers good."}, {"start": 229.04000000000002, "end": 231.76000000000002, "text": " Societal bias in machine learning is way different."}, {"start": 231.76000000000002, "end": 236.56, "text": " An example for this is when face detection systems work well on Caucasian people,"}, {"start": 236.56, "end": 240.72, "text": " but don't work so well faced with people from other heritages."}, {"start": 240.72, "end": 244.16, "text": " And these societal biases are in the data set."}, {"start": 244.16, "end": 249.36, "text": " As Yandlacompt points out here, if you change the data set, you'll change these biases."}, {"start": 249.36, "end": 253.52, "text": " Notably these societal biases can only be in the data set."}, {"start": 253.52, "end": 260.4, "text": " Otherwise you have to argue something like logistic regression itself has a preference for white people or something like this."}, {"start": 260.4, "end": 263.36, "text": " Now there is a considerable interaction effect between the two,"}, {"start": 263.36, "end": 272.8, "text": " but as Yandlacompt points out, the actual societal bias of the final system is a direct result of the bias in the data set."}, {"start": 272.8, "end": 276.64, "text": " And he is very correct. If you train that system on a different data set,"}, {"start": 276.64, "end": 279.2, "text": " it will exhibit different biases."}, {"start": 279.2, "end": 283.44, "text": " Societal bias cannot be in the other parts of the machine learning pipeline."}, {"start": 283.44, "end": 288.32, "text": " They can serve to exaggerate or mitigate that bias in the data set,"}, {"start": 288.32, "end": 293.2, "text": " but they themselves can only be statistically biased and not societal bias."}, {"start": 293.2, "end": 299.12, "text": " But Yandlacompt, the terrible mistake of pinpointing the exact root cause of this problem"}, {"start": 299.12, "end": 305.84, "text": " and not addressing the, I guess, wider ranging problems in the field as some people perceive it."}, {"start": 305.84, "end": 307.44, "text": " And he shouldn't have to, right?"}, {"start": 307.44, "end": 311.03999999999996, "text": " He pretty clearly says, this is why it happens."}, {"start": 311.03999999999996, "end": 313.2, "text": " We can solve it by swapping the data set."}, {"start": 313.2, "end": 315.68, "text": " He doesn't say anything about anything else."}, {"start": 315.68, "end": 319.6, "text": " Namely, he doesn't say that general bias in the field is not a problem."}, {"start": 319.6, "end": 323.04, "text": " He doesn't say that this doesn't harm anyone."}, {"start": 323.04, "end": 326.64, "text": " None of that. He simply suggests a solution."}, {"start": 326.64, "end": 329.36, "text": " Jonathan Peck says, well, yes, that's the point."}, {"start": 329.36, "end": 335.52, "text": " ML researchers need to be more careful selecting their data so that they don't encode biases like this."}, {"start": 335.52, "end": 339.92, "text": " And Lacompt responds with not so much ML researchers, but ML engineers."}, {"start": 339.92, "end": 345.44, "text": " The consequences of bias are considerably more dire in a deployed product than in an academic paper."}, {"start": 345.44, "end": 347.2, "text": " Which is also correct."}, {"start": 347.2, "end": 353.04, "text": " This paper was about the method showing that this method works on this data set."}, {"start": 353.04, "end": 357.2, "text": " Now, Sumith here makes an interesting point, which I agree with,"}, {"start": 357.2, "end": 362.56, "text": " saying that today, ML researchers are inadvertently powering product of a lot of non-AI companies"}, {"start": 362.56, "end": 367.12, "text": " who ignorantly start with a pre-trained bird or resonant or yolo from the internet,"}, {"start": 367.12, "end": 369.68, "text": " probably ignoring the license, read me, and so on."}, {"start": 369.68, "end": 371.68, "text": " Which is a valid point, right?"}, {"start": 371.68, "end": 376.08, "text": " There are going to be people that take this and think, ooh, this is a face-up sampler."}, {"start": 376.08, "end": 382.96, "text": " Cool. I can use that without noting that this is simply an example, an implementation, on an example, data set."}, {"start": 382.96, "end": 387.92, "text": " So you can argue that there might be some responsibility of the researchers right here"}, {"start": 387.92, "end": 389.92, "text": " that doesn't make Yonlakan not correct."}, {"start": 389.92, "end": 395.52, "text": " But I'd still consider this to be like a fruitful discussion between individuals right here."}, {"start": 395.52, "end": 396.64, "text": " But now we go on."}, {"start": 396.64, "end": 402.15999999999997, "text": " This person saying, train it on the whole American population with an L2 loss and almost everyone"}, {"start": 402.15999999999997, "end": 407.76, "text": " will look white, or train it on the whole American population with an L1 loss and more people"}, {"start": 407.76, "end": 412.56, "text": " might look black. Stop pretending that bias does not also come from algorithmic choices."}, {"start": 412.56, "end": 415.03999999999996, "text": " Yonlakan never says it doesn't, right?"}, {"start": 415.03999999999996, "end": 420.24, "text": " The con response now saying, the most efficient way to do it, though, is to equalize the frequencies"}, {"start": 420.24, "end": 422.64, "text": " of the categories of samples during training."}, {"start": 422.64, "end": 428.0, "text": " This forces the network to pay attention to all the relevant features for all the sample categories."}, {"start": 428.0, "end": 432.4, "text": " And training with an L1 instead of an L2 will not even begin to solve the problem."}, {"start": 432.4, "end": 437.12, "text": " I would pretty much argue training with an L1 loss here would exacerbate the problem,"}, {"start": 437.12, "end": 440.64, "text": " because the L2 loss is much more sensitive to outliers."}, {"start": 440.64, "end": 444.88, "text": " Charles Sutton says, serious question, why do you feel that it's important to make this point?"}, {"start": 444.88, "end": 448.64, "text": " Are you worried that people are going to start suing cycle again?"}, {"start": 448.64, "end": 455.12, "text": " And L2 says, because people should be aware of this problem and know it's cause so they can fix it."}, {"start": 455.12, "end": 461.68, "text": " How terrible, Yonlakan how terrible you dare pinpoint the exact cause of the problem so that people"}, {"start": 461.68, "end": 466.96, "text": " can fix it. The correct thing to do is to point out that everything is problematic."}, {"start": 466.96, "end": 472.64, "text": " So Tim Nigivara says, Yonl I suggest you watch me and Emily's tutorial or a number of scholars"}, {"start": 472.64, "end": 478.08, "text": " who are expert in this area. You can't just reduce harms to data set bias."}, {"start": 478.08, "end": 482.15999999999997, "text": " For once, listen to us people from marginalized communities and what we tell you."}, {"start": 482.15999999999997, "end": 485.12, "text": " If not now during worldwide protests, not sure when."}, {"start": 485.12, "end": 491.44, "text": " So again, I feel the argument here is that you can't simply point out that it's the data set bias."}, {"start": 491.44, "end": 496.79999999999995, "text": " You must point out the bigger problems which Yonlakan does not ever deny."}, {"start": 496.79999999999995, "end": 501.59999999999997, "text": " He simply says this particular problem can be solved by switching the data set."}, {"start": 501.59999999999997, "end": 504.79999999999995, "text": " Nikolau Leroux says, Yonl was in my PhD jury."}, {"start": 504.8, "end": 510.08, "text": " I am indebted for him for everything he taught me but this constant dismissal of the harms caused"}, {"start": 510.08, "end": 513.92, "text": " directly or indirectly by the ML community is highly problematic."}, {"start": 513.92, "end": 518.16, "text": " Where or when have I dismissed the harm caused by the ML community?"}, {"start": 518.16, "end": 522.08, "text": " I'm pointing out the cause of the harm so it can be fixed."}, {"start": 522.08, "end": 524.8, "text": " You can't fix the harm unless you know what causes it."}, {"start": 524.8, "end": 529.52, "text": " No, Leroux says cause of the biases or numerous only pointing out data set bias deflects"}, {"start": 529.52, "end": 534.24, "text": " the attention away from the other more pervasive ones that make the whole field of bias in ML."}, {"start": 534.24, "end": 538.48, "text": " Many people try to get your attention about these issues but you kept focus on the data set."}, {"start": 538.48, "end": 542.64, "text": " Because the data set is the problem right here."}, {"start": 542.64, "end": 548.5600000000001, "text": " He doesn't dismiss any of the other things he simply says here the data set is the problem."}, {"start": 548.5600000000001, "end": 553.2, "text": " If your problem is that it doesn't work as well for non-concazion people."}, {"start": 553.2, "end": 554.64, "text": " Which was never the intent of this."}, {"start": 554.64, "end": 556.96, "text": " The intent of this was to showcase the method."}, {"start": 556.96, "end": 560.48, "text": " I mean, image that is like 60% dog species."}, {"start": 560.48, "end": 565.6800000000001, "text": " And still people train on it to showcase their image recognition techniques."}, {"start": 565.6800000000001, "end": 569.36, "text": " No one training on image that makes a claim that they have solved computer vision"}, {"start": 569.36, "end": 572.24, "text": " for all the classes in the world in a fair manner."}, {"start": 572.24, "end": 573.6, "text": " Timnigibru goes on saying,"}, {"start": 573.6, "end": 575.9200000000001, "text": " I'm sick of this framing tired of it."}, {"start": 575.9200000000001, "end": 580.32, "text": " Many people have tried to explain many scholars listen to as you can't just reduce the harms"}, {"start": 580.32, "end": 582.72, "text": " caused by ML to data set bias."}, {"start": 582.72, "end": 584.32, "text": " Doesn't do that. Doesn't do it."}, {"start": 585.36, "end": 586.88, "text": " So someone asks her,"}, {"start": 586.88, "end": 589.36, "text": " is he engaging in any ways with you?"}, {"start": 589.36, "end": 592.8000000000001, "text": " It's appalling to see that he answers to everybody, but you."}, {"start": 592.8000000000001, "end": 597.6800000000001, "text": " Yet maybe there is a conversation going on in private and I don't want to jeopardize it."}, {"start": 597.6800000000001, "end": 602.88, "text": " Note that Jan LeCas tweet has 500 retweets,"}, {"start": 602.88, "end": 608.24, "text": " 1.9k likes and comments as far as you can scroll."}, {"start": 609.04, "end": 610.8000000000001, "text": " To what she responds to with,"}, {"start": 610.8000000000001, "end": 615.52, "text": " yep, but I'm used to white men refusing to engage with black and brown women"}, {"start": 615.52, "end": 618.32, "text": " even on issues of bias that most the affect us."}, {"start": 618.32, "end": 623.2, "text": " I mean, he literally has ignored a whole body of work by people from that demographic,"}, {"start": 623.2, "end": 625.6800000000001, "text": " hence the statement, so not surprised."}, {"start": 625.6800000000001, "end": 632.6400000000001, "text": " I mean, in absence of the fact that an argument should be independent of the person making the argument,"}, {"start": 634.5600000000001, "end": 635.6, "text": " that is a low blow."}, {"start": 636.88, "end": 639.84, "text": " Hard Marou says I respectfully disagree with Jan here."}, {"start": 639.84, "end": 642.5600000000001, "text": " As long as progress is benchmarked on bias data,"}, {"start": 642.5600000000001, "end": 646.8000000000001, "text": " such biases will also be reflected in the inductive biases of ML systems."}, {"start": 646.8, "end": 653.68, "text": " Advancing ML with bias benchmarks and asking engineers to simply retrain models with unbiased data"}, {"start": 653.68, "end": 654.64, "text": " is not helpful."}, {"start": 654.64, "end": 656.4, "text": " I don't disagree with you here."}, {"start": 656.4, "end": 658.4, "text": " I don't think my tweet contradicts your statement,"}, {"start": 658.4, "end": 659.52, "text": " which it doesn't."}, {"start": 659.52, "end": 665.5999999999999, "text": " People are reading into this because he doesn't conform to the orthodoxy of pointing out that everything"}, {"start": 665.5999999999999, "end": 670.8, "text": " and everything is problematic and simply pinpoints a particular problem."}, {"start": 670.8, "end": 673.92, "text": " He must be thinking all the wrong things."}, {"start": 673.92, "end": 679.12, "text": " Jeff Dean says this is a clear example here is an illustration that seemingly minor choices in"}, {"start": 679.12, "end": 684.4, "text": " learning algorithms or laws can have significant effects, so bias in ML systems is about much more"}, {"start": 684.4, "end": 686.4799999999999, "text": " than just avoid data bias."}, {"start": 686.4799999999999, "end": 690.0799999999999, "text": " ML researchers and practitioners must pay attention to these issues."}, {"start": 690.64, "end": 692.0799999999999, "text": " And I think they are."}, {"start": 692.0799999999999, "end": 694.16, "text": " And LeConn doesn't say anything against that."}, {"start": 694.16, "end": 696.4, "text": " He says as I point out in my comment to this tweet,"}, {"start": 696.4, "end": 699.92, "text": " is much more efficient to correct this kind of bias."}, {"start": 699.92, "end": 704.4, "text": " Note that LeConn actually differentiates between the different kinds of biases."}, {"start": 704.4, "end": 708.9599999999999, "text": " By equalizing the frequencies of categories of samples during training,"}, {"start": 708.9599999999999, "end": 711.5999999999999, "text": " then be hacking the loss function."}, {"start": 711.5999999999999, "end": 712.24, "text": " Correct."}, {"start": 712.24, "end": 716.3199999999999, "text": " Because if you hack the loss function, you're trying to counter one kind of bias"}, {"start": 716.3199999999999, "end": 718.4799999999999, "text": " by another kind of bias."}, {"start": 718.4799999999999, "end": 724.48, "text": " Meredith Whitaker says this is very racist and even if it recognized non-white people,"}, {"start": 724.48, "end": 726.7199999999999, "text": " it would be very racist."}, {"start": 726.72, "end": 731.44, "text": " This is cop tech, it's designed to allow those with power to surveil and control those with"}, {"start": 731.44, "end": 732.24, "text": " less power."}, {"start": 732.24, "end": 736.88, "text": " Diverse trainings that aren't going to fix it, advocating that we should never build these systems."}, {"start": 736.88, "end": 738.8000000000001, "text": " And that's a discussion to be had."}, {"start": 738.8000000000001, "end": 741.28, "text": " But let me break this to you."}, {"start": 741.28, "end": 743.0400000000001, "text": " This isn't going to help the cops."}, {"start": 743.0400000000001, "end": 747.36, "text": " This isn't actually giving you the face of the person that was downpixled."}, {"start": 747.36, "end": 753.44, "text": " This is simply going to give you the most likely face associated with that downpixled picture,"}, {"start": 753.44, "end": 756.24, "text": " given the data set the algorithm was trained on."}, {"start": 756.24, "end": 761.84, "text": " I don't see this whenever any machine learning algorithm does anything with faces at all."}, {"start": 761.84, "end": 764.64, "text": " People jumping up going like this is cop technology."}, {"start": 764.64, "end": 767.44, "text": " Well, in line with all the broader impact statement advice,"}, {"start": 767.44, "end": 773.44, "text": " can't it also be used to find lost children from very, very bad security camera footage?"}, {"start": 773.44, "end": 779.12, "text": " And if I already mentioned that this doesn't actually give you back the person on the down"}, {"start": 779.12, "end": 785.6800000000001, "text": " sample image, it will give you back the most likely person given the data set."}, {"start": 785.68, "end": 787.8399999999999, "text": " So with that, I want to conclude this section."}, {"start": 787.8399999999999, "end": 789.8399999999999, "text": " Please stop the witch hunting."}, {"start": 789.8399999999999, "end": 792.9599999999999, "text": " Younglucka made a completely fine tweet here."}, {"start": 792.9599999999999, "end": 796.4799999999999, "text": " And there's no reason why people should pile on him this hard."}, {"start": 796.4799999999999, "end": 800.3199999999999, "text": " He doesn't dismiss any of the other problems just because he doesn't mention them."}, {"start": 800.3199999999999, "end": 804.3199999999999, "text": " And while we all enjoy a good discussion where people disagree genuinely,"}, {"start": 804.3199999999999, "end": 807.52, "text": " it's not helpful to accuse him of things he never said or meant."}, {"start": 807.52, "end": 808.9599999999999, "text": " I mean, where this is all lead."}, {"start": 808.9599999999999, "end": 813.52, "text": " The result of this is going to be that small labs that don't have the resources to collect"}, {"start": 813.52, "end": 818.56, "text": " their own data sets or check for all the possible biases in their models that are"}, {"start": 818.56, "end": 823.76, "text": " reliant on the data sets that we do have even if they are biased and flawed will just be"}, {"start": 823.76, "end": 828.56, "text": " disincentivized from publishing their code or actually doing research at all."}, {"start": 828.56, "end": 834.96, "text": " So this as every other additional constraint on research is going to help the large corporations"}, {"start": 834.96, "end": 835.92, "text": " with lots of money."}, {"start": 835.92, "end": 841.1999999999999, "text": " And maybe that's just my opinion, but we should be able to just talk about a problem"}, {"start": 841.2, "end": 845.76, "text": " and the solution to it without always having to make sure that we"}, {"start": 845.76, "end": 850.72, "text": " rabbled down all the different things that are and might be wrong according to the canon."}, {"start": 850.72, "end": 853.76, "text": " And big props to Younglucka here for holding his own."}, {"start": 853.76, "end": 856.32, "text": " 90% of people by now would probably be like,"}, {"start": 856.32, "end": 860.48, "text": " oh yes, I'm so sorry, I did a not thoughtful comment blah blah blah."}, {"start": 860.48, "end": 861.76, "text": " Props to you, Jan."}, {"start": 861.76, "end": 862.5600000000001, "text": " Keep going."}, {"start": 862.5600000000001, "end": 864.72, "text": " And with that, I conclude this section."}, {"start": 864.72, "end": 868.24, "text": " Let me know what you think in the comments and I'll see you next time."}, {"start": 868.24, "end": 878.24, "text": " Bye bye."}] |
Yannic Kilcher | 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 Sitzmann, Julian N. P. Martell, Alexander W. Bergman, David Bielandell, and Gordon Weststein. 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 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 they're not the first ones to do this, but they manage to do this very well using these new models called sirens, which are basically neural networks that so sirens spelled like this, neural networks that have sine waves as their non-linearities instead of like relus 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 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 that we are interested in a class of functions phi. That's 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 again, the 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 again, I guess this here would count as the representation. The continuous representation of this picture. However, in this case right here the function itself is the representation. So in again, 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. Okay. 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. Okay. So if if an 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 0.5, 0.7 and 0.1. Those are the rgb values at that. Okay. So now the goal is to have this right here be a neural network where I have like a multi-layer 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 0.5, 0.7, 0.1. Okay. Now again, this network here is they now train this network to map input to output. Okay. 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. Now you might reasonably ask why, why do we do it like this? 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 can not, 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 3.2 and 4.1? 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 sense, 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's 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, 2, r, g, b. Okay. And the way they train these networks, now 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, 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. 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, you're 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, you take your network and you can simply output each pixel location. So you say, okay, now I'm going to reproduce this image using my network because if it's trained well, it certainly give me back the positions at the pixels. So you ask it, what's 0, 0, what's 0, 1, what's 0, 2, what's 0, at 0, 3. 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 know about machine learning in the classic sense because like I'd still see people who go like, we've just used a GAN or something like this. So yes, valid point, but we're 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 10-H 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 it's 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 this, 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 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 gradient. And 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, this architecture manages to also capture the derivatives of the signal and therefore have a more faithful representation. Okay, so that was positional. RBF relus 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 don't want to uh, don't con anyone. It's basically you, 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 do they do in order to be able to capture a signal very well? What do, how does it have a sign 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 networks. So the end is networks. 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 concatenate, 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 from an MLP otherwise. So usually here, you have something like a sigmoid or a relu function. Now you have a sine wave. And the, 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? Where 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, these networks have particularly, have, have some good properties if you want to capture natural signals. And they have some bad properties, namely that 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 an onlinearity with like my sine function? Could I do something? It isn't then tried it out and it didn't really work. So I scrapped that. Now this here, of course, isn't simply replacing the 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 very careful consideration. And we'll go on onto that right now. So actually they just describe it. It's 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. Okay. 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 proposed 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 equal 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 too, they're 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 and 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% 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, okay. So 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 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 relus, it's the derivative of a relu network is like a cond. 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 signals derivatives, these property of this siren become very, very, very handy. So how do you train a siren? We've already alluded to how you would do that in the, 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, 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. Can I find it? Can I find it? That's what they do right here? Okay. So here you see the, the ground truth image. And this is its gradients. And this is its Laplacian. Okay. 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, 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. Okay. 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. Right. Now again you can say why is this? Why can't we just match the image itself? And I think it 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 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 it's 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 it's 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 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 regular networks they don't even have a Laplacian is a constant. So this is something you could never do. And you can see that the outcoming image is still pretty good right this or this is now missing the constant luminosity in the first and second derivative sorry in the in the zero earth and first derivative and still the information is the reconstruction is pretty good. All right so these 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 is that by 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'd 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 does 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 right. 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 bare 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. It would 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 as 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 a pixel of aloe 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 our these cm which are constraints. So this loss function operates on these constraints and the constraints are across a of x which basically it's 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're 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 all right so the 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 as the F's we fit S the F's directly on oriented point clouds using both Rayloo based implicit neural representations and sirens okay so what is an S the F a signed distance function that's pretty easy a signed distance function simply a distance function with a sign like wow so a a 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 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 you 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 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 I have no cloud laser scanner looks and the laser scanner kind of shoots lasers at random locations and always measures the distance right and that's 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 like 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 and implicit representation so we're going to train a neural network that represents this shape right here basically by mapping coordinates to to but signed distance values so whenever we ask the neural network what at this location here what's the signed distance and it's going to tell us oh it's plus five or at at this location here what's the signed distance it's going to tell us eyes zero right so we're going to we're going to train a neural network to do that and hello yes no okay so this is a bit more complicated and since we have these awesome power of these sirens we can also do more constraints so we know and this goes on this amounts to solving a particular iconoboundary value problem that constrains the norm of spatial gradients to be one almost everywhere so this iconoboundary 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 so I could be wrong note that rail networks are seemingly 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 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 I need to maybe I'll start monetizing just so I can get in your tablet okay so no okay this 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 right 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 stable 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 1 it penalizes off surface points for creating sdf values close to 0 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 sign distance function like it should not be close to 0 because it's away from a boundary okay and in practice how you're 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 require first of all we require their value to be 0 or close to 0 right this is the loss function so we want to minimize this and this is simply the output value so the sign distance function of points on the surface you know the things we actually measure they should be 0 right because the sign 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 sign 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 sign the 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 sign distance function should be 0 because it's on the boundary second of all the norm of the gradient of the sign distance function at that point should be 1 because that's a property of sign distance function and third and that's the thing right now the gradient of the sign distance function should align with this normal vector right and that's you know pretty intuitive because you want you want the sign distance function to increase in value the gradient basically tells you where the highest increase in value of the function is you wanted to increase along the normal direction and not along any other direction right 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 sign 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 you additionally say hey you should have a pretty high value and actually not a zero value but a pretty high value right 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 relo what you'll get is super super wobbly because if even if you train the relo with the same loss function these constraints on the gradients they're just not going to work out with the relo 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 the details are preserved way better where the reloos 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 but 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 in 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 that 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 reloow representations then here solving the possible 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 reloow representation of the same thing so this is the same network with the same objective it just has reloows 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 really with the positional encodings still not good right 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 xy coordinate so technically you 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 I relate a project 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 what we want to you want to get you want to figure out which is unknown and then this hmm 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 a 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 so I I have a network right here that I have a network that gives me the parameters of the siren so this right here is um um 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 this the 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 c for 10 and you construct a whole bunch of images with only kind of a hundred 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 even if you only have 10 pixels you already get something out of it right and if you have a hundred pixels you already get fairly close to the to the ground truth right here now this is not gam 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 it's better than it's it's kind of more back to the machine learning framework that you're used to because there's a train and a test dataset 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 actually 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 refer the reader to a recent re-article 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 author's think of the consequences of their research 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 a way 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": 7.04, "text": " Hi there. Today we're looking at implicit neural representations with periodic activation functions"}, {"start": 7.04, "end": 13.52, "text": " by Vincent Sitzmann, Julian N. P. Martell, Alexander W. Bergman, David Bielandell, and Gordon"}, {"start": 13.52, "end": 20.8, "text": " Weststein. So this paper is a bit of a special paper. If you're like me coming from like classic"}, {"start": 20.8, "end": 27.84, "text": " machine learning or deep learning, things like this, this paper requires you to think around your"}, {"start": 27.84, "end": 35.519999999999996, "text": " 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.519999999999996, "end": 43.519999999999996, "text": " Essentially what they're doing is they are representing signals such as images or sound or generally waves"}, {"start": 43.519999999999996, "end": 51.44, "text": " or point clouds. They're representing these signals as functions mapping, for example, from their"}, {"start": 51.44, "end": 60.48, "text": " coordinates to their values and we'll see what that entails. And they they're not the first ones to"}, {"start": 60.48, "end": 66.96, "text": " do this, but they manage to do this very well using these new models called sirens, which are"}, {"start": 66.96, "end": 74.56, "text": " basically neural networks that so sirens spelled like this, neural networks that have"}, {"start": 74.56, "end": 82.48, "text": " sine waves as their non-linearities instead of like relus or hyperbolic tangents and so on. So"}, {"start": 82.48, "end": 89.12, "text": " it turns out that if you initialize these very carefully, those can be made to capture these"}, {"start": 89.12, "end": 98.72, "text": " signals very very well. So that's the kind of high level overview and we'll go through the paper"}, {"start": 98.72, "end": 104.16, "text": " in a bit of a fashion of someone that is not in this particular literature. So this is not going to"}, {"start": 104.16, "end": 114.0, "text": " be like as in depth or technical as usually because I myself am not super familiar with with this"}, {"start": 114.0, "end": 121.44, "text": " kind of literature with the neural representations and so on. So if you go at this paper from a machine"}, {"start": 121.44, "end": 126.96, "text": " learning perspective, the first like you're going to be ultimately like super confused at the"}, {"start": 126.96, "end": 136.48, "text": " beginning. So I'm going to try to kind of clear up retrace my steps of my confusion. Okay, so"}, {"start": 136.48, "end": 142.4, "text": " I love that this paper starts out that we are interested in a class of functions phi. That's"}, {"start": 142.4, "end": 150.24, "text": " satisfy equations of the form this right here. Like aren't we all like we are interested in a class"}, {"start": 150.24, "end": 158.8, "text": " of functions. Okay, I've never you know particularly had many dreams about functions like this but"}, {"start": 158.8, "end": 167.12, "text": " so how can you how can you look at this? So we're interested in the relation between inputs"}, {"start": 168.24, "end": 174.0, "text": " and outputs. This here is the function as you can see. This maps input to output. Okay,"}, {"start": 174.0, "end": 181.84, "text": " and we're also interested in its derivatives. So here you go first, second, third, derivative"}, {"start": 181.84, "end": 188.72, "text": " and so on. So this function right here is what we're going to call a neural representation or an"}, {"start": 188.72, "end": 195.76, "text": " implicit representation. It's called a neural representation. I guess if it's a neural network"}, {"start": 195.76, "end": 202.08, "text": " that this function is so so far so good. You've seen this right. You've seen this could be a data"}, {"start": 202.08, "end": 209.44000000000003, "text": " point and then could map it to a label or something like this. Since we're going to represent images"}, {"start": 210.24, "end": 216.16000000000003, "text": " you already know maybe again, the generative adversarial network where this here is the latent"}, {"start": 216.16000000000003, "end": 223.52, "text": " vector and then you have a neural network mapping this latent vector to an image. Right, so this"}, {"start": 223.52, "end": 233.76000000000002, "text": " is going to produce an image. This here is quite similar but not quite. So in again, I guess this"}, {"start": 233.76000000000002, "end": 240.56, "text": " here would count as the representation. The continuous representation of this picture. However, in this"}, {"start": 240.56, "end": 249.92000000000002, "text": " case right here the function itself is the representation. So in again, what we do, we learn this right"}, {"start": 249.92, "end": 255.76, "text": " here, this function phi. We learn this from data such that if I plug in one particular vector,"}, {"start": 255.76, "end": 260.56, "text": " I get one particular image and if I plug in another vector, I get another image and the function"}, {"start": 260.56, "end": 268.56, "text": " always stays the same. Here it's going to be one function per image. So each image, the function"}, {"start": 268.56, "end": 275.44, "text": " is the image. So how is a function an image? You can simply, if I have an image and it's made of"}, {"start": 275.44, "end": 283.52, "text": " pixels. Right. So it's made of pixels. Each pixel has an x and a y coordinate. Okay. Let's call"}, {"start": 283.52, "end": 293.04, "text": " that x1 and x2 the coordinate of that and each pixel also has a color value, right, which is"}, {"start": 293.04, "end": 301.44, "text": " three dimensional. So each pixel has a three dimensional rgb color value. So technically, an image"}, {"start": 301.44, "end": 310.71999999999997, "text": " is a function from coordinates to pixel values. Okay. So if if an if this is my image is represented"}, {"start": 310.71999999999997, "end": 319.68, "text": " by a function, then if I input any coordinates like three, four, that function should return what"}, {"start": 319.68, "end": 328.72, "text": " are the rgb values at that? Maybe it's like 0.5, 0.7 and 0.1. Those are the rgb values at that."}, {"start": 328.72, "end": 338.32000000000005, "text": " Okay. So now the goal is to have this right here be a neural network where I have like a multi-layer"}, {"start": 338.32000000000005, "end": 344.16, "text": " perceptron. And they, I think they always use like a five layer MLPs. So really simple neural networks."}, {"start": 344.72, "end": 352.56, "text": " And you simply input. So here you have two input neurons where this here goes. So one gets the"}, {"start": 352.56, "end": 358.8, "text": " three one gets the four. Then this travels through the network. And at the end, the network should"}, {"start": 358.8, "end": 370.0, "text": " output three output nodes. And this should be like the 0.5, 0.7, 0.1. Okay. Now again, this network"}, {"start": 370.0, "end": 380.88, "text": " here is they now train this network to map input to output. Okay. To map coordinates to values. And"}, {"start": 380.88, "end": 387.12, "text": " this of course, it is one particular image. So you're going to have one neural network per image."}, {"start": 387.76, "end": 393.6, "text": " Now you might reasonably ask why, why do we do it like this? Why don't we just save the image"}, {"start": 393.6, "end": 399.52, "text": " as the pixel values? Why do we need like a function mapping the coordinates to the pixels?"}, {"start": 400.24, "end": 407.04, "text": " And that's a valid question, I guess. And the image is just one example of this. But one advantage"}, {"start": 407.04, "end": 413.12, "text": " that you immediately get is that now you have a continuous representation. So now you can not,"}, {"start": 413.12, "end": 420.08000000000004, "text": " not only do you know, because if you store an image like this, you only know its value at each"}, {"start": 420.08000000000004, "end": 426.32000000000005, "text": " of the pixel locations. However, if you store an image like this, you know its value at any"}, {"start": 426.32000000000005, "end": 433.12, "text": " continuous in between location. Right. So you can ask the network, what's the pixel value at 3.2"}, {"start": 433.12, "end": 439.36, "text": " and 4.1? Right. It will give you an answer. And if the network is trained well, it will give you"}, {"start": 439.36, "end": 447.44, "text": " sort of an answer that makes sense. That is what's the exact color at this sub pixel location"}, {"start": 447.44, "end": 456.56, "text": " right here. Now so far so good. Right. So essentially this boils down to not really a machine"}, {"start": 456.56, "end": 463.6, "text": " learning problem in the classic sense, but an optimization problem. Because all you have to do"}, {"start": 463.6, "end": 469.6, "text": " is you have to make the neural network match all input to all output. There's not really a training"}, {"start": 469.6, "end": 475.28, "text": " and a test set right here. Namely, your data set is going to be all the pixels in the image. So each"}, {"start": 475.28, "end": 483.2, "text": " pixel in the image is going to be one data point because it's one. So each pixel is x, y,"}, {"start": 483.2, "end": 489.76, "text": " 2, r, g, b. Okay. And the way they train these networks, now at the examples of pixels, the way"}, {"start": 489.76, "end": 496.48, "text": " they train it, they simply sample a mini batch of pixels like this one, this one, this one, this one,"}, {"start": 496.48, "end": 504.96, "text": " this one, this one, they use that mini batch to train the network to do one step to train the"}, {"start": 504.96, "end": 509.59999999999997, "text": " network. And then they sample another mini batch and so on. You might sample the same pixels multiple"}, {"start": 509.6, "end": 515.0400000000001, "text": " times, but ultimately what you want is sort of a continuous representation of the image."}, {"start": 515.6800000000001, "end": 521.6, "text": " That there, this is not a new idea. This has been around and they cite a lot of literature"}, {"start": 521.6, "end": 530.4, "text": " where this has been around before. So what their new thing is is that they say these other"}, {"start": 530.4, "end": 536.32, "text": " representations. So if you use a neural network in a classic sense like this and you do,"}, {"start": 536.32, "end": 543.5200000000001, "text": " you're training with the mini batches like this. What you'll end up with is a bad image. So if you"}, {"start": 543.5200000000001, "end": 548.72, "text": " then, if you then simply go, right, once you've trained the network, you can take it, you take"}, {"start": 548.72, "end": 556.4000000000001, "text": " your network and you can simply output each pixel location. So you say, okay, now I'm going to"}, {"start": 556.4000000000001, "end": 562.32, "text": " reproduce this image using my network because if it's trained well, it certainly give me back"}, {"start": 562.32, "end": 571.0400000000001, "text": " the positions at the pixels. So you ask it, what's 0, 0, what's 0, 1, what's 0, 2, what's 0,"}, {"start": 571.0400000000001, "end": 577.9200000000001, "text": " at 0, 3. And you can fill in the picture and that usually gives you very bad outcomes or so they"}, {"start": 577.9200000000001, "end": 583.44, "text": " claim. I mean, I haven't checked it particularly, but you can see right here, this is the ground truth"}, {"start": 583.44, "end": 592.4000000000001, "text": " and the here you have a network that is parameterized with relu functions like with relu nonlinearities."}, {"start": 592.96, "end": 601.9200000000001, "text": " And as you can see, the relu network misses a lot of the sort of higher definition things in the"}, {"start": 601.9200000000001, "end": 610.1600000000001, "text": " image. And so it depends on the architecture that you use how well you can make a neural network"}, {"start": 610.16, "end": 617.4399999999999, "text": " represent those things. Again, you kind of need to forget what you know about machine learning"}, {"start": 617.4399999999999, "end": 623.1999999999999, "text": " in the classic sense because like I'd still see people who go like, we've just used a GAN or"}, {"start": 623.1999999999999, "end": 630.24, "text": " something like this. So yes, valid point, but we're in the business right now of of solving this"}, {"start": 630.24, "end": 637.4399999999999, "text": " particular problem. And as we'll go on to see, it's not just about images, but images are a nice"}, {"start": 637.44, "end": 643.2800000000001, "text": " example of a natural signal. So the 10-H networks, you also see they, I think they fail even harder,"}, {"start": 643.2800000000001, "end": 653.84, "text": " they have these artifacts back here even. And this here, it gets better when you do relu networks"}, {"start": 653.84, "end": 660.08, "text": " with what it's called a positional encoding. So not only do you have your X and your Y coordinates"}, {"start": 660.08, "end": 665.6800000000001, "text": " go through a relu network, but you also have them go through a positional encoding. And that's very"}, {"start": 665.68, "end": 671.1999999999999, "text": " much like in like you would have in a transformer. So if you watch my video about attention is all"}, {"start": 671.1999999999999, "end": 677.4399999999999, "text": " you need, I explain how the positional encodings work there. But basically what you do is you map"}, {"start": 677.4399999999999, "end": 687.3599999999999, "text": " these things to cosine and sine waves. So you're going to be like this, the sine of X times 10."}, {"start": 687.36, "end": 696.8000000000001, "text": " 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."}, {"start": 696.8000000000001, "end": 704.48, "text": " And that ends you up with more features that sort of, then the function can use to represent"}, {"start": 704.48, "end": 710.64, "text": " positions way better than just given the X and Y coordinates. If you do that, you kind of recover"}, {"start": 710.64, "end": 717.76, "text": " some of the image, but you see here they also analyze how, so this is the ground truth. And this"}, {"start": 717.76, "end": 723.4399999999999, "text": " is the gradient of the ground truth, which is basically a a sobel filter if you know that it's"}, {"start": 723.4399999999999, "end": 729.84, "text": " basically an edge detector color gradient thing. And then this here is the second derivative,"}, {"start": 729.84, "end": 740.24, "text": " the Laplacian of the image. And ideally if your implicit representation models the signal"}, {"start": 740.24, "end": 747.44, "text": " very well, it should also model the derivatives of the signal very well. So now we're kind of"}, {"start": 747.44, "end": 754.88, "text": " connecting it to what we saw at the beginning, right. These siren networks are specifically"}, {"start": 754.88, "end": 764.5600000000001, "text": " designed to not only match the signal right here, but also match its derivatives. And if you match,"}, {"start": 764.56, "end": 770.56, "text": " maybe in an image it's not so, it's not that important to match the derivatives even though it"}, {"start": 772.3199999999999, "end": 781.5999999999999, "text": " is because there are small things like you can see right here the grass isn't as well represented."}, {"start": 782.4799999999999, "end": 788.4799999999999, "text": " And here you mostly, you get some artifacts that you see here in the gradient."}, {"start": 788.48, "end": 794.0, "text": " And might not be as important for images in terms of human vision, but for many signals it's"}, {"start": 794.0, "end": 798.96, "text": " also important to match the derivatives. And here the siren, even though it's trained on the"}, {"start": 798.96, "end": 806.4, "text": " image itself, you can see that its derivatives are very much in line with the original signal."}, {"start": 806.4, "end": 817.6, "text": " So simply by matching the signal, this architecture manages to also capture the derivatives of the"}, {"start": 817.6, "end": 824.24, "text": " signal and therefore have a more faithful representation. Okay, so that was positional. RBF"}, {"start": 824.24, "end": 830.32, "text": " relus are simply the relu network and I think somewhere in here there is an RBF kernel."}, {"start": 831.6800000000001, "end": 840.8000000000001, "text": " If you young kids don't know what an RBF kernel is, then yeah, no, I guess I don't want to"}, {"start": 840.8, "end": 850.64, "text": " uh, don't con anyone. It's basically you, how do I explain it? You map it to an infinite"}, {"start": 850.64, "end": 861.3599999999999, "text": " dimensional space using Gaussian kernels. Yeah, maybe Wikipedia is better at that than I am."}, {"start": 862.0, "end": 870.16, "text": " So sirens, what do they do in order to be able to capture a signal very well? What do,"}, {"start": 870.16, "end": 875.36, "text": " how does it have a sign siren different from like an RBF network? And the answer is pretty,"}, {"start": 875.36, "end": 881.8399999999999, "text": " pretty, pretty simple. So the architecture of a siren network is the end. Does it already stand"}, {"start": 881.8399999999999, "end": 894.16, "text": " for network? I'm not sure, honestly, maybe we'll find out. Yes, it's the sinusoidal representation"}, {"start": 894.16, "end": 902.4, "text": " networks. So the end is networks. So we don't say siren network. We say siren. And a siren"}, {"start": 902.4, "end": 911.1999999999999, "text": " is simply made of what is that here? It's a multi layer perceptron basically, right? So it is a"}, {"start": 912.24, "end": 918.3199999999999, "text": " this here is the network. The network, this is the final layer of the network, which is a linear"}, {"start": 918.32, "end": 928.1600000000001, "text": " layer before that you have all these layers just not concatenate, but following each other."}, {"start": 928.1600000000001, "end": 934.6400000000001, "text": " So it's a multi layer perceptron, pretty regular. And each of the layers in the multi layer perceptron"}, {"start": 934.6400000000001, "end": 940.72, "text": " is made up like this. You have an input, you multiply it by a weight matrix, you add a bias,"}, {"start": 940.72, "end": 948.1600000000001, "text": " and then you put it through a sine wave. So the sine wave here is really, that's, that's the only"}, {"start": 948.16, "end": 956.7199999999999, "text": " change from a from an MLP otherwise. So usually here, you have something like a sigmoid or a"}, {"start": 956.7199999999999, "end": 964.9599999999999, "text": " relu function. Now you have a sine wave. And the, I mean, it's a bit weird, right? Because a relu"}, {"start": 965.4399999999999, "end": 972.4, "text": " function is like this. So it has this center thing where it kind of switches, but here it's linear"}, {"start": 972.4, "end": 982.0, "text": " and monotonic and here it's kind of constant. And even a, even a sigmoid. So the sigmoid is,"}, {"start": 982.0, "end": 988.88, "text": " I don't even remember like this. Yes, I guess. So the sigmoid is like this. So it's kind of"}, {"start": 988.88, "end": 994.0, "text": " constant here, constant here monotonic. And so on, we're used to monotonic activation functions,"}, {"start": 994.0, "end": 1000.96, "text": " whereas a sine wave is really different. The sine wave, of course, is something like this,"}, {"start": 1000.96, "end": 1009.12, "text": " right? Where it's not monotonic at all. Like if you, if you want to increase your function value"}, {"start": 1009.12, "end": 1014.4000000000001, "text": " at any point and you're here and you go up the hill and you do a step that's too large,"}, {"start": 1014.4000000000001, "end": 1021.2800000000001, "text": " you end up down the hill again. But it turns out that these, these networks have particularly,"}, {"start": 1023.2, "end": 1030.56, "text": " have, have some good properties if you want to capture natural signals. And they have some bad"}, {"start": 1030.56, "end": 1036.96, "text": " properties, namely that fact that they are periodic and go down again. And the reason why they get"}, {"start": 1036.96, "end": 1043.76, "text": " around the bad properties is because or so they claim they initialize the network in a very"}, {"start": 1043.76, "end": 1049.9199999999998, "text": " particular fashion. Because I think at least I, when I, when I started in deep learning, I had"}, {"start": 1049.9199999999998, "end": 1054.8, "text": " this idea. So a lot of other people must have had this idea too of like, hey, what if I just"}, {"start": 1054.8, "end": 1061.52, "text": " replaced an onlinearity with like my sine function? Could I do something? It isn't then tried it out"}, {"start": 1061.52, "end": 1067.84, "text": " and it didn't really work. So I scrapped that. Now this here, of course, isn't simply replacing the"}, {"start": 1068.8799999999999, "end": 1074.32, "text": " the neural network. It's also using the neural network for something completely different than I would,"}, {"start": 1074.32, "end": 1079.84, "text": " namely, it's using the neural network to learn these implicit representations and not like I would"}, {"start": 1079.84, "end": 1087.6, "text": " to do simply for learning a data set. But still it seems like you need to initialize them fairly"}, {"start": 1089.36, "end": 1099.6799999999998, "text": " with very careful consideration. And we'll go on onto that right now. So actually they just"}, {"start": 1099.68, "end": 1108.96, "text": " describe it. It's it's not like a, it's not very interesting, but you need to sample the weights"}, {"start": 1108.96, "end": 1118.48, "text": " uniformly from this uniform distribution where I think, yeah, and they have a proof in the"}, {"start": 1118.48, "end": 1125.92, "text": " supplementary material where they sort of show why that is. So or not here we propose to draw"}, {"start": 1125.92, "end": 1132.24, "text": " weights with C equals six such that W is in this uniform distribution right here. Oh no, it's"}, {"start": 1132.24, "end": 1141.04, "text": " different. Okay. This ensures that the input to each of the sine activation is normal distributed"}, {"start": 1141.04, "end": 1145.92, "text": " with a standard deviation of one. Since only a few weights have magnitude larger than pi,"}, {"start": 1145.92, "end": 1152.96, "text": " the frequency throughout the sine network grows only slowly. Finally, we proposed to initialize"}, {"start": 1152.96, "end": 1160.16, "text": " the first layer of the sine network with weights so that the sine function spans multiple periods"}, {"start": 1160.16, "end": 1166.56, "text": " over negative one to one. We found W zero to equal 30 to work well for all the applications in"}, {"start": 1166.56, "end": 1171.6000000000001, "text": " this work. The proposed initialization scheme yielded fast and robust convergence using the"}, {"start": 1171.6000000000001, "end": 1176.64, "text": " atom optimizer for all experiments in this work. So the initialization here takes a fairly"}, {"start": 1176.64, "end": 1181.76, "text": " prominent piece in that paper which tells me maybe that they have spent a lot of time working on"}, {"start": 1181.76, "end": 1187.68, "text": " this. And this is, I mean, if this is the case, this is too, they're credit because I guess most"}, {"start": 1187.68, "end": 1192.8, "text": " people like me would try out something like this and then after a while realize it doesn't work."}, {"start": 1192.8, "end": 1199.36, "text": " And to, you know, be so convinced and to go and really figure out how do we need to initialize these"}, {"start": 1200.32, "end": 1206.64, "text": " to make it work. And of course, as you're doing this, there's still like a 99% chance that it's not"}, {"start": 1206.64, "end": 1212.8000000000002, "text": " going to work once you've done that is quite respectable. I find it might have been really"}, {"start": 1212.8000000000002, "end": 1217.68, "text": " different. This might have been the first thing they thought about and just worked it out. But yeah,"}, {"start": 1217.68, "end": 1226.0, "text": " okay. So what is the deal with all these derivatives? Now, since this network right here has these"}, {"start": 1226.0, "end": 1232.4, "text": " sine waves in it, right? So it's a neural network with sine waves as derivatives as nonlinearities."}, {"start": 1232.4, "end": 1241.0400000000002, "text": " What now, so we have a neural network, what now is the first derivative of that neural network,"}, {"start": 1241.0400000000002, "end": 1247.1200000000001, "text": " right? With respect to its input. So we have an input. Now, what's the first derivative with"}, {"start": 1247.1200000000001, "end": 1253.68, "text": " respect to its input? And the cool thing about this is what's the first derivative of sine wave?"}, {"start": 1253.68, "end": 1260.4, "text": " It's of course, a sine wave that's shifted. So it's a cosine, which is a sine wave that's"}, {"start": 1260.4, "end": 1267.76, "text": " simply phase shifted. And then the next derivative, again, is a shifted sine wave and so on. So"}, {"start": 1269.2800000000002, "end": 1280.3200000000002, "text": " the derivative of a siren is a siren. And that does not hold for any of these other nonlinearities."}, {"start": 1281.1200000000001, "end": 1288.88, "text": " So in relus, it's the derivative of a relu network is like a cond. So if I take the derivative of"}, {"start": 1288.88, "end": 1296.0, "text": " this, it's like a constant zero right here and then a constant one right here. And if I then"}, {"start": 1296.0, "end": 1302.4, "text": " take the derivative again, it's simply a constant zero function, right? And all these other nonlinearities,"}, {"start": 1302.4, "end": 1311.2, "text": " their derivatives are different from themselves. And here, since we want to not only match a signal,"}, {"start": 1311.2, "end": 1319.44, "text": " but also the signals derivatives, these property of this siren become very, very, very handy. So how"}, {"start": 1319.44, "end": 1325.8400000000001, "text": " do you train a siren? We've already alluded to how you would do that in the, in the kind of idea"}, {"start": 1325.8400000000001, "end": 1332.16, "text": " of matching an image where you simply train the pixel values to the RGB values. But there's more"}, {"start": 1332.16, "end": 1340.96, "text": " that you can do with the sirens given that they basically given that their derivatives are also"}, {"start": 1340.96, "end": 1348.24, "text": " sirens. What you can do. So with the image part, we've basically neglected all of this. We simply"}, {"start": 1348.24, "end": 1357.92, "text": " said, we want to find a relationship between the input x and the output like this. What we can also do"}, {"start": 1357.92, "end": 1364.48, "text": " is we can say, no, no, no, no, no, we want to find a relationship between the input and its first"}, {"start": 1364.48, "end": 1371.84, "text": " derivative and not even have this as part of the, let's say, of the loss function. And then we can"}, {"start": 1371.84, "end": 1384.48, "text": " see what comes out. So that's what they do. Can I find it? Can I find it? That's what they do"}, {"start": 1384.48, "end": 1395.52, "text": " right here? Okay. So here you see the, the ground truth image. And this is its gradients. And this is"}, {"start": 1395.52, "end": 1403.76, "text": " its Laplacian. Okay. Now we've already seen that we can fit the image itself. But what if we just"}, {"start": 1403.76, "end": 1412.64, "text": " fit the first derivative? So we simply input this thing right here. We input this into the siren. We"}, {"start": 1412.64, "end": 1422.88, "text": " do the same thing, right? The siren is now it maps x and y to RGB. But our loss function isn't going"}, {"start": 1422.88, "end": 1431.44, "text": " to be mapping x and y to RGB. Our loss function is going to, to depend on the gradient of that."}, {"start": 1432.0800000000002, "end": 1441.44, "text": " So our loss function is going to be something like the gradient of the image. Let's call the"}, {"start": 1441.44, "end": 1452.24, "text": " image i minus the gradient of that function that maps x of this function right here. Okay. Because"}, {"start": 1452.24, "end": 1458.0, "text": " we have these auto differentiation tools right now we can easily make this into a loss function."}, {"start": 1458.0, "end": 1466.48, "text": " So here we are looking for the function whose gradient matches the gradient of the image."}, {"start": 1466.48, "end": 1472.4, "text": " Right. Now again you can say why is this? Why can't we just match the image itself? And I"}, {"start": 1472.4, "end": 1478.96, "text": " think it valid point. But it's not about why can't we just, it's about demonstrating the power of"}, {"start": 1478.96, "end": 1487.04, "text": " these networks. So if you only match the gradients right what you'll find is if you then look at the"}, {"start": 1487.04, "end": 1493.44, "text": " function right you still find the function. You don't, you don't find the gradient. You still"}, {"start": 1493.44, "end": 1499.92, "text": " train the function. You still train the weights of the function itself. But the loss function depends"}, {"start": 1499.92, "end": 1506.48, "text": " on the gradient of that function. If you do that you'll find that if you then look at the function."}, {"start": 1506.48, "end": 1511.68, "text": " Again you can ask the function to produce the image by simply cycling over each of the coordinates."}, {"start": 1513.04, "end": 1520.3200000000002, "text": " You'll find that look at that just by matching the gradient. You'll match the image itself pretty"}, {"start": 1520.32, "end": 1527.76, "text": " pretty well. Right. And that's pretty cool. Now of course you're not going to match the"}, {"start": 1527.76, "end": 1534.8799999999999, "text": " RGB values. This is a grayscale image. And you know there's a, there's kind of a reason for that"}, {"start": 1534.8799999999999, "end": 1544.56, "text": " because since the gradient loses like constant bias information. So what if you match an RGB image"}, {"start": 1544.56, "end": 1551.44, "text": " I'm going to guess you're going to have like color very much color distortions. But and here what"}, {"start": 1551.44, "end": 1559.76, "text": " you're going to have in this case is just distortions in luminosity. Like if you know that if you have a"}, {"start": 1559.76, "end": 1567.9199999999998, "text": " function. If you have the derivative of a function and you will want to find the function itself"}, {"start": 1567.92, "end": 1576.72, "text": " and you integrate then the solution is always an entire space of functions because you will"}, {"start": 1576.72, "end": 1583.68, "text": " integrate the function this thing right here. And so with the whatever it's input is and"}, {"start": 1585.28, "end": 1589.92, "text": " you have to add a constant and you don't know what the constant was in the original function"}, {"start": 1589.92, "end": 1596.48, "text": " because when you derive the function the constant drops away. So similarly here what we'd expect is"}, {"start": 1596.48, "end": 1602.96, "text": " that the image that we're getting back will be faithful with respect to like it's borders right"}, {"start": 1602.96, "end": 1608.56, "text": " since we're matching the gradient. And the gradient is basically an edge detector will match the"}, {"start": 1608.56, "end": 1613.6, "text": " sort of edge information of the picture which you can clearly see. But what we would expect is"}, {"start": 1613.6, "end": 1620.48, "text": " some difference in overall luminosity. And I don't even know how they exactly did this because"}, {"start": 1620.48, "end": 1626.4, "text": " they now have to choose a constant to add. Maybe they just chose it in some way or maybe they just"}, {"start": 1626.4, "end": 1631.1200000000001, "text": " let the network do. But this is you know still pretty pretty impressive. You can see there's some"}, {"start": 1631.1200000000001, "end": 1637.52, "text": " detail missing but not much. And the same exact same thing you can do for matching the second"}, {"start": 1637.52, "end": 1644.24, "text": " derivative. So now you match the Laplacian of the image and remember in the regular networks they"}, {"start": 1644.24, "end": 1651.0400000000002, "text": " don't even have a Laplacian is a constant. So this is something you could never do. And you can see"}, {"start": 1651.04, "end": 1656.56, "text": " that the outcoming image is still pretty good right this or this is now missing the constant"}, {"start": 1656.56, "end": 1663.44, "text": " luminosity in the first and second derivative sorry in the in the zero earth and first derivative"}, {"start": 1663.44, "end": 1672.0, "text": " and still the information is the reconstruction is pretty good. All right so these demonstrates"}, {"start": 1672.0, "end": 1678.24, "text": " kind of the power of these networks. Again we're not having our data set our entire data set is"}, {"start": 1678.24, "end": 1685.28, "text": " just this image. So if we fit something then this thing right here is our entire data set. There's"}, {"start": 1685.28, "end": 1691.76, "text": " no there's no big data set and this is a test sample like this is the data set and the test sample"}, {"start": 1691.76, "end": 1697.52, "text": " at the same. I guess you can consider the Laplacian here the data set and then the actual image is"}, {"start": 1697.52, "end": 1705.44, "text": " the test sample like the label or something like this. So what is that by you here is a thing you"}, {"start": 1705.44, "end": 1712.96, "text": " can do if you want to mix two images what do you do. So if you want to mix this and this what you"}, {"start": 1712.96, "end": 1720.48, "text": " could do is linearly interpolate but that would be not very cool because right here you have a lot"}, {"start": 1720.48, "end": 1727.2, "text": " of like very bright pixels which probably have like values of one and here you'd have the dark"}, {"start": 1727.2, "end": 1734.8, "text": " pixels which probably have values like more close to zero and the if you simply mix them if you simply"}, {"start": 1734.8, "end": 1741.68, "text": " add them together and divide by two then you'd get kind of get a wash of the two and similarly here"}, {"start": 1741.68, "end": 1747.52, "text": " you kind of wash out the bear because you'd have some pixel values here that would come over and"}, {"start": 1747.52, "end": 1754.0, "text": " generally not not a good idea to mix images like this. Now you know with Gans we can do this"}, {"start": 1754.72, "end": 1761.68, "text": " but we have to have like a training data set and so on. Here what we'll say is we'll simply say"}, {"start": 1761.68, "end": 1768.3200000000002, "text": " we'll take the gradient of this and we'll take the gradient of this and then we'll add the two"}, {"start": 1768.3200000000002, "end": 1774.64, "text": " gradient maps. Now what does does is that as you can see right here on the left is the composite"}, {"start": 1774.64, "end": 1783.44, "text": " gradients and what this does is right here in the sky there is no gradient information in this image"}, {"start": 1783.44, "end": 1791.68, "text": " because it's just a flat patch of sky right. So and down maybe down here there's not that much"}, {"start": 1791.68, "end": 1797.3600000000001, "text": " gradient information there is a bit right but not here so that's where this bare head is and"}, {"start": 1798.0, "end": 1805.44, "text": " if you want to mix images like it can be a good idea to mix their gradients because generally the"}, {"start": 1805.44, "end": 1812.88, "text": " information in an image is where the gradients are. So what we would expect the gradient to represent"}, {"start": 1812.88, "end": 1820.24, "text": " the gradient would carry over this portion. It would maybe carry over a bit of this portion."}, {"start": 1820.24, "end": 1825.2, "text": " It would carry over this portion and this portion. So everything where the signal is not flat."}, {"start": 1825.2, "end": 1834.8000000000002, "text": " So here you can see the composite gradient and if we fit again we fit our function such that the"}, {"start": 1834.8000000000002, "end": 1842.4, "text": " gradient of the function that we fit matches this mixed gradient right here. Then this is the"}, {"start": 1842.4, "end": 1849.92, "text": " gradient of the function that we match and this is the actual function and you can see pretty pretty"}, {"start": 1849.92, "end": 1857.76, "text": " good right. It basically mixed everywhere where there was gradient and this is now just reconstructed"}, {"start": 1857.76, "end": 1863.1200000000001, "text": " from this gradient. There is no I think there is no as least as I understand it. There is no"}, {"start": 1863.68, "end": 1869.1200000000001, "text": " pixel information carried over from either of those images. They're simply added to this"}, {"start": 1869.12, "end": 1876.56, "text": " gradient. The gradient is fit and then the function is asked to output a pixel of aloe"}, {"start": 1876.56, "end": 1885.76, "text": " at each location and that's that. Okay so this is just a simple you know thing that you can play"}, {"start": 1885.76, "end": 1894.0, "text": " around with but they do they do other more interesting things right here. For example"}, {"start": 1894.0, "end": 1904.0, "text": " this representing shapes with signed distance functions. So if you go over the formulation the"}, {"start": 1904.0, "end": 1908.48, "text": " actual formulation of their loss function we haven't actually done this right quite yet."}, {"start": 1909.2, "end": 1919.76, "text": " It's here it's very complicatedly stated but ultimately what this means is so a component right"}, {"start": 1919.76, "end": 1928.16, "text": " here is our these cm which are constraints. So this loss function operates on these constraints"}, {"start": 1928.16, "end": 1934.48, "text": " and the constraints are across a of x which basically it's just x it's kind of a the anything"}, {"start": 1934.48, "end": 1941.44, "text": " depending on the input itself then the output of the function the gradient of the output of the"}, {"start": 1941.44, "end": 1949.28, "text": " function the second derivative third derivative and so on. So this these sirens can fit anything"}, {"start": 1949.28, "end": 1957.12, "text": " that you can formulate as a set of constraints that relate the input of the function right here"}, {"start": 1957.68, "end": 1964.24, "text": " to its output or any of its derivatives and we've already seen that at once we if we fit an"}, {"start": 1964.24, "end": 1971.68, "text": " image our only constraint is that these things match right here with the original image that the"}, {"start": 1971.68, "end": 1978.8, "text": " coordinates are mapped to the RGB values then when we match the gradients we don't care about this"}, {"start": 1978.8, "end": 1985.2, "text": " we only care about the relation between this and so on. So the loss function is literally just"}, {"start": 1985.76, "end": 1992.48, "text": " over the entire signal space which in our case was was over the entire image we want these"}, {"start": 1992.48, "end": 1998.8, "text": " constraints to hold or to be as small as possible or the constraints are always formulate such that"}, {"start": 1998.8, "end": 2008.0, "text": " if they're fulfilled they equal zero and so the for example the L2 loss between the RGB values"}, {"start": 2008.0, "end": 2014.0, "text": " of the true image and the RGB values that you fit the RGB loss sorry the L2 loss would be a"}, {"start": 2014.0, "end": 2020.24, "text": " constraint like this and of course the more differentiable you make it the more the easier this"}, {"start": 2020.24, "end": 2027.28, "text": " network has at fitting it right so that's why there's this norm right here but it's not that"}, {"start": 2027.28, "end": 2036.0, "text": " complicated it simply says whatever you can formulate as a constraint on relating the inputs to"}, {"start": 2036.0, "end": 2042.4, "text": " the outputs or any of the derivatives of this implicit representation that is the loss function"}, {"start": 2043.84, "end": 2048.96, "text": " all right so the the next interesting thing we can do as I said is representing shapes"}, {"start": 2048.96, "end": 2058.16, "text": " with signed distance functions so we're going to go slowly and this is yeah it's not that hard"}, {"start": 2059.52, "end": 2064.8, "text": " inspired by recent work on shape representation with differentiable signed distance functions"}, {"start": 2064.8, "end": 2073.6800000000003, "text": " as the F's we fit S the F's directly on oriented point clouds using both Rayloo based implicit"}, {"start": 2073.6800000000003, "end": 2081.04, "text": " neural representations and sirens okay so what is an S the F a signed distance function that's"}, {"start": 2081.04, "end": 2090.4, "text": " pretty easy a signed distance function simply a distance function with a sign like wow so a"}, {"start": 2090.4, "end": 2098.8, "text": " a if you have a and it's usually done if you have like a boundary somewhere between things then of"}, {"start": 2098.8, "end": 2105.52, "text": " course any point here has a distance to the boundary but you if you have a signed distance function"}, {"start": 2105.52, "end": 2111.52, "text": " simply means that each point also has a sign in front of it and that means all the things on one"}, {"start": 2111.52, "end": 2117.84, "text": " side of the boundary maybe have a plus and all the things on the other side maybe have a minus so"}, {"start": 2117.84, "end": 2124.08, "text": " even though two points could be the same distance from the boundary one is like plus five away and"}, {"start": 2124.08, "end": 2133.52, "text": " one is negative five away and you can do this this is useful for example when you fit point clouds"}, {"start": 2133.52, "end": 2140.1600000000003, "text": " as they do in this example so when they have point clouds and you that's usually in 3D space but"}, {"start": 2140.16, "end": 2147.2799999999997, "text": " if you have point clouds you basically have points right here and you know that the points should"}, {"start": 2148.24, "end": 2155.3599999999997, "text": " represent some kind of shape maybe a wall or so they have these room interiors as you can see"}, {"start": 2155.8399999999997, "end": 2163.04, "text": " right here so this is a 3D scene but you only have a point cloud of the 3D scene and what that"}, {"start": 2163.04, "end": 2169.52, "text": " means is that maybe you were in this room and you put up a laser scanner right here laser scanner"}, {"start": 2169.52, "end": 2175.84, "text": " I don't I have no cloud laser scanner looks and the laser scanner kind of shoots lasers at random"}, {"start": 2175.84, "end": 2182.08, "text": " locations and always measures the distance right and that's that's how you end up with a point cloud"}, {"start": 2182.08, "end": 2188.32, "text": " so you'll end up with like a point cloud where in 3D space you know where the laser hit something"}, {"start": 2188.88, "end": 2194.72, "text": " and the reasonable assumption to make if you have like a dense sampling of this is that you should"}, {"start": 2194.72, "end": 2203.12, "text": " be able to like connect those point clouds in some way to obtain the actual continuous shape of"}, {"start": 2203.12, "end": 2211.4399999999996, "text": " the thing that you measured and this is what we're going to try to do with these sirens right to go"}, {"start": 2212.0, "end": 2218.08, "text": " from point clouds to shape by training and implicit representation so we're going to train a neural"}, {"start": 2218.08, "end": 2224.96, "text": " network that represents this shape right here basically by mapping coordinates to"}, {"start": 2226.56, "end": 2234.48, "text": " to but signed distance values so whenever we ask the neural network what at this location here"}, {"start": 2236.72, "end": 2242.7999999999997, "text": " what's the signed distance and it's going to tell us oh it's plus five or at at this location"}, {"start": 2242.8, "end": 2248.48, "text": " here what's the signed distance it's going to tell us eyes zero right so we're going to we're going"}, {"start": 2248.48, "end": 2260.48, "text": " to train a neural network to do that and hello yes no okay so this is a bit more complicated"}, {"start": 2260.48, "end": 2266.48, "text": " and since we have these awesome power of these sirens we can also do more"}, {"start": 2266.48, "end": 2278.96, "text": " constraints so we know and this goes on this amounts to solving a particular iconoboundary value"}, {"start": 2278.96, "end": 2286.32, "text": " problem that constrains the norm of spatial gradients to be one almost everywhere so this iconoboundary"}, {"start": 2286.32, "end": 2294.16, "text": " value problem this is a property of signed distance function that the norm of the gradients with"}, {"start": 2294.16, "end": 2300.08, "text": " respect to the input is one almost everywhere almost everywhere means everywhere I guess except at"}, {"start": 2300.08, "end": 2310.0, "text": " the boundary itself where the distance is zero so I could be wrong note that rail networks are"}, {"start": 2310.0, "end": 2316.8799999999997, "text": " seemingly seemingly ideal for representing sdfs as their gradients are locally constant and their"}, {"start": 2316.8799999999997, "end": 2322.24, "text": " second derivatives are zero adequate training procedure for working directly with point clouds"}, {"start": 2322.24, "end": 2329.2, "text": " were described in prior work we fit a siren to an oriented point cloud using a loss of the form"}, {"start": 2329.2, "end": 2335.2, "text": " and now we'll look at the loss so the first thing you observe in the loss is that it is made of"}, {"start": 2335.2, "end": 2341.12, "text": " three different integrals and that simply means they now partition the space right here they"}, {"start": 2341.12, "end": 2349.7599999999998, "text": " partition it into two different they partition it into two different regions so to say so"}, {"start": 2349.76, "end": 2358.6400000000003, "text": " maybe go here no can I zoom here so the first region is going to be whatever is on the boundary"}, {"start": 2358.6400000000003, "end": 2364.2400000000002, "text": " itself right and that's basically wherever a point wherever a point hit right whenever you have"}, {"start": 2364.2400000000002, "end": 2371.76, "text": " a point or on the boundary itself that's going to be your omega zero is going to be that and then"}, {"start": 2371.76, "end": 2380.0, "text": " all the other points right here are going to be part of your omega without the omega zero so you're"}, {"start": 2380.0, "end": 2385.0400000000004, "text": " going to have different constraints for all of these things right here for example and I have to"}, {"start": 2385.0400000000004, "end": 2391.6800000000003, "text": " pay attention that I don't say anything wrong you will have this this constraint of this gradient"}, {"start": 2391.68, "end": 2403.6, "text": " my tablet I need to maybe I'll start monetizing just so I can get in your tablet okay so"}, {"start": 2405.12, "end": 2411.68, "text": " no okay this this condition right here says that the gradient should be one and that's actually"}, {"start": 2411.68, "end": 2421.44, "text": " everywhere right so I was wrong that the gradient is only one outside the boundary then you can see"}, {"start": 2421.44, "end": 2430.0, "text": " right here the last part is all the points that are not on the boundary since"}, {"start": 2430.8, "end": 2437.36, "text": " right our network maps any point in 3d space to assign distance function so most of these points"}, {"start": 2437.36, "end": 2442.88, "text": " aren't going to be on the boundary itself even though in the mini batch where we train where they"}, {"start": 2442.88, "end": 2452.0, "text": " train they sample points on and off the on and off the boundary at the at equal rates just to"}, {"start": 2452.0, "end": 2460.32, "text": " to have the network train more stable so this is a condition on all the points off of the boundary"}, {"start": 2460.32, "end": 2470.0, "text": " and they say here this function is this exponential function with alpha larger than 1 it penalizes off"}, {"start": 2470.0, "end": 2478.64, "text": " surface points for creating sdf values close to 0 so this is simply a regularizer that says whenever"}, {"start": 2479.76, "end": 2486.96, "text": " I input coordinates that are far away from the boundary from the surface then there should be a"}, {"start": 2486.96, "end": 2493.6, "text": " large sign distance function like it should not be close to 0 because it's away from a boundary"}, {"start": 2493.6, "end": 2499.76, "text": " okay and in practice how you're going to train this is if you have a point cloud if your coordinates"}, {"start": 2499.76, "end": 2507.76, "text": " are far away from the next point then this this is going to be a high this should be a high value"}, {"start": 2507.76, "end": 2514.5600000000004, "text": " otherwise the network is penalized so we have this condition right here on the gradients which we"}, {"start": 2514.5600000000004, "end": 2520.0800000000004, "text": " know sign distance function should fulfill we have this thing right here which is a regularizer"}, {"start": 2520.0800000000004, "end": 2525.28, "text": " basically telling points far away from our data that they should have a high distance function"}, {"start": 2525.28, "end": 2532.32, "text": " and then we have this last thing right here which is for all the points on the surface itself"}, {"start": 2533.2000000000003, "end": 2542.5600000000004, "text": " here's what we require first of all we require their value to be 0 or close to 0 right this is"}, {"start": 2542.5600000000004, "end": 2547.52, "text": " the loss function so we want to minimize this and this is simply the output value so the sign"}, {"start": 2547.52, "end": 2552.2400000000002, "text": " distance function of points on the surface you know the things we actually measure they should be"}, {"start": 2552.24, "end": 2558.16, "text": " 0 right because the sign distance function measures how far away from the surface you are so this"}, {"start": 2558.16, "end": 2569.7599999999998, "text": " is pretty intuitive but then also this right here it says that the gradient of the sign distance"}, {"start": 2569.7599999999998, "end": 2579.04, "text": " function and the normal vector of that point should align and that basically means and this is"}, {"start": 2579.04, "end": 2586.88, "text": " now I think this is because we have an oriented point cloud or no yes so what we can do is we can"}, {"start": 2587.44, "end": 2595.2799999999997, "text": " kind of connect points next to each other and then calculate the normal vectors of that right and"}, {"start": 2596.16, "end": 2602.88, "text": " the sign the the network if we ask the network hey what do you think about this position right here"}, {"start": 2602.88, "end": 2609.04, "text": " the network should tell us first of all the sign distance function should be 0 because it's on the"}, {"start": 2609.04, "end": 2617.52, "text": " boundary second of all the norm of the gradient of the sign distance function at that point should be"}, {"start": 2617.52, "end": 2623.6800000000003, "text": " 1 because that's a property of sign distance function and third and that's the thing right now the"}, {"start": 2623.6800000000003, "end": 2630.0, "text": " gradient of the sign distance function should align with this normal vector"}, {"start": 2630.0, "end": 2637.92, "text": " right and that's you know pretty intuitive because you want you want the sign distance function to"}, {"start": 2637.92, "end": 2643.76, "text": " increase in value the gradient basically tells you where the highest increase in value of the"}, {"start": 2643.76, "end": 2649.6, "text": " function is you wanted to increase along the normal direction and not along any other direction"}, {"start": 2649.6, "end": 2655.28, "text": " right so that's a pretty good pretty good constraint to have so you can see right here I mean"}, {"start": 2655.28, "end": 2660.0800000000004, "text": " you don't really have to understand exactly about sign distance functions and so on but these"}, {"start": 2660.0800000000004, "end": 2665.2000000000003, "text": " sirens are pretty good at capturing all of these different constraints and this was a point you"}, {"start": 2665.2000000000003, "end": 2671.28, "text": " know on the surface points off the surface you you additionally say hey you should have a pretty"}, {"start": 2671.28, "end": 2680.7200000000003, "text": " high value and actually not a zero value but a pretty high value right so and again we only fit one"}, {"start": 2680.72, "end": 2686.9599999999996, "text": " particular scene we only ever fit one scene with an entire network so the entire neural network"}, {"start": 2686.9599999999996, "end": 2693.4399999999996, "text": " this this this whole structure right here everything is captured by this neural network that we"}, {"start": 2693.4399999999996, "end": 2701.6, "text": " train on the point cloud and you can see that if you use a relo what you'll get is super super"}, {"start": 2701.6, "end": 2709.7599999999998, "text": " wobbly because if even if you train the relo with the same loss function these constraints on"}, {"start": 2709.76, "end": 2714.1600000000003, "text": " the gradients they're just not going to work out with the relo because the gradients are like"}, {"start": 2714.1600000000003, "end": 2721.76, "text": " constant and discontinuous right whereas the siren can basically fulfill all of these constraints"}, {"start": 2721.76, "end": 2728.0800000000004, "text": " on the different parts like on the values and on the gradients of the of the loss function"}, {"start": 2729.5200000000004, "end": 2736.96, "text": " and they have another example right here where they fit this shape yeah so you see all the the details"}, {"start": 2736.96, "end": 2744.32, "text": " are preserved way better where the reloos they'll simply kind of flatten over everything and make it"}, {"start": 2744.32, "end": 2753.92, "text": " wobbly all right so I hope this sort of made sense and we'll go to the last thing right now"}, {"start": 2755.76, "end": 2760.2400000000002, "text": " but it is restarting I wanted to show you the website right here they have for this it's a pretty"}, {"start": 2760.24, "end": 2768.16, "text": " cool website to go along with it and as you can see right here they have all these samples that"}, {"start": 2768.16, "end": 2773.9199999999996, "text": " they have in the paper but also in animated format in as you can see right here this is the fitting"}, {"start": 2773.9199999999996, "end": 2781.6, "text": " process the learning process of how you represent these images so as I said there you want to fit"}, {"start": 2781.6, "end": 2786.7999999999997, "text": " these functions to the ground truth and that happens in steps so this is very much like you would"}, {"start": 2786.8, "end": 2792.0, "text": " learn a deep learning functions that I think they use the atom optimizer it's just that the data set"}, {"start": 2792.0, "end": 2797.84, "text": " now comes all comes from this one ground truth image and you can see that the siren network on"}, {"start": 2797.84, "end": 2805.04, "text": " the right pretty quickly zeros in on the on the image and then gets the details subsequently right"}, {"start": 2806.4, "end": 2812.2400000000002, "text": " they also represent audio with this and you can watch that they represent video"}, {"start": 2812.24, "end": 2821.52, "text": " compare that to reloow representations then here solving the possible equation is where you only fit"}, {"start": 2821.52, "end": 2829.2799999999997, "text": " the gradients or the Laplacian of an image and still get out the good image that's pretty cool"}, {"start": 2830.0, "end": 2839.12, "text": " and here you can see that you can actually play around with these things so you can click on them"}, {"start": 2839.12, "end": 2847.52, "text": " and look at this look at this learned thing so on the left you can see what the siren network"}, {"start": 2847.52, "end": 2854.24, "text": " learned and scroll down here a bit and on the right is a reloow representation of the same thing"}, {"start": 2854.24, "end": 2859.6, "text": " so this is the same network with the same objective it just has reloows instead of"}, {"start": 2859.6, "end": 2865.3599999999997, "text": " sine waves as activation functions so you can see how much of a difference that makes right here"}, {"start": 2865.36, "end": 2871.84, "text": " and the middle is a really with the positional encodings still not good right the only the only"}, {"start": 2871.84, "end": 2877.52, "text": " thing right here that you have to think of if you look at how big these sirens are how many"}, {"start": 2877.52, "end": 2884.32, "text": " parameters they have they're about at the order of magnitude of how many pixels there are in the"}, {"start": 2884.32, "end": 2895.84, "text": " image so I'm yeah it's certainly a cool method but to like this it's not like you're the implicit"}, {"start": 2895.84, "end": 2900.48, "text": " representation here is very very well at generalizing though it would be very cool to see what happens"}, {"start": 2900.48, "end": 2906.56, "text": " outside right if you because now you have you can input any xy coordinate so technically you"}, {"start": 2906.56, "end": 2913.2000000000003, "text": " you could continue the picture to the bottom and just see what the siren thinks should be here at"}, {"start": 2913.2, "end": 2918.72, "text": " the bottom so all of these things would be pretty pretty cool to actually experiment with and they"}, {"start": 2918.72, "end": 2925.7599999999998, "text": " have the code available to do that and you can see the fitting process of the Helmholtz equation"}, {"start": 2925.7599999999998, "end": 2931.12, "text": " right here and I relate a project pretty cool website I definitely invite you to check it out"}, {"start": 2931.12, "end": 2938.3199999999997, "text": " and let's go back to the paper and we're back and my tablet crashed and let's continue so they're"}, {"start": 2938.32, "end": 2947.36, "text": " now going on to use sirens in order to solve PDEs and so in physics often you have these problems"}, {"start": 2947.36, "end": 2952.8, "text": " where you are given an equation but the equation doesn't necessarily involve a function itself"}, {"start": 2952.8, "end": 2959.36, "text": " but only involves derivatives of that function like or relates derivatives to the function and so on"}, {"start": 2959.36, "end": 2968.48, "text": " so one example here is this Helmholtz equation that's given as this where the I think the the f is"}, {"start": 2968.48, "end": 2975.28, "text": " a known function but this is the wave field what we want to you want to get you want to figure out"}, {"start": 2975.28, "end": 2983.84, "text": " which is unknown and then this hmm is including for example this right here which is the Laplace"}, {"start": 2983.84, "end": 2992.88, "text": " operator so you're given the relation between the function and a Laplace operator of the wave"}, {"start": 2992.88, "end": 3000.08, "text": " that you want to find out and your task is to recover the wave now I don't want to go very much"}, {"start": 3000.08, "end": 3007.84, "text": " into this right here but what you can do is basically you can measure you can have a room and you"}, {"start": 3007.84, "end": 3015.28, "text": " can have measurements of the wave or of its derivatives and so on and then you kind of calculate"}, {"start": 3015.28, "end": 3023.92, "text": " backwards from the measurements to what the actual wave was and these sirens turn out to be very"}, {"start": 3023.92, "end": 3031.6800000000003, "text": " very good at things like this and I guess that's in this solving for the wave field things but"}, {"start": 3031.68, "end": 3040.96, "text": " essentially what this amounts to is a numerical solution of these partial differential equations"}, {"start": 3040.96, "end": 3049.8399999999997, "text": " in physics using these sirens and that's pretty cool and the last thing they do is and this gets"}, {"start": 3049.8399999999997, "end": 3057.2799999999997, "text": " back to a more of the machine learning context where they say learning a space of implicit functions"}, {"start": 3057.28, "end": 3065.28, "text": " so now they go ahead and say yeah so we can represent images in terms of these of these functions"}, {"start": 3065.28, "end": 3070.2400000000002, "text": " right but each image is basically its own function so each image is basically an optimization"}, {"start": 3070.2400000000002, "end": 3078.1600000000003, "text": " a fitting problem can we somehow learn functions of functions so this goes this comes now back to"}, {"start": 3078.16, "end": 3091.2799999999997, "text": " more of a machine learning context where you say so I I have a network right here that"}, {"start": 3094.56, "end": 3101.3599999999997, "text": " I have a network that gives me the parameters of the siren so this right here is um"}, {"start": 3101.36, "end": 3110.1600000000003, "text": " um okay let's let's go to an example in this example what you'll have is you'll have an image"}, {"start": 3111.84, "end": 3120.08, "text": " like this one where a few pixels are masked actually most of the pixels are masked and you"}, {"start": 3120.08, "end": 3131.2799999999997, "text": " want to put this into a CNN and the CNN should output the parameters of the siren network so"}, {"start": 3131.2799999999997, "end": 3139.44, "text": " the parameters because this the the siren network given its parameters is the image itself so"}, {"start": 3139.44, "end": 3149.2, "text": " that's the siren I said siren network the siren is the image if you know its parameters right"}, {"start": 3149.2, "end": 3157.8399999999997, "text": " so here you train a CNN to give you the parameters of the siren that's almost the same as training a"}, {"start": 3157.8399999999997, "end": 3166.3199999999997, "text": " CNN to give you the image directly but again we don't want to have the explicit representation of"}, {"start": 3166.3199999999997, "end": 3171.68, "text": " an image we want to have the implicit representation such that it's continuous and we can manipulate it"}, {"start": 3171.68, "end": 3180.3999999999996, "text": " and so on so the CNN is now trained on a data set so you take c for 10 and you construct a whole"}, {"start": 3180.3999999999996, "end": 3189.3599999999997, "text": " bunch of images with only kind of a hundred pixels remaining and then you train a CNN to give you"}, {"start": 3189.3599999999997, "end": 3196.3999999999996, "text": " the parameters of the siren that would reconstruct the ground truth right and then you can test that"}, {"start": 3196.4, "end": 3202.7200000000003, "text": " on the test image and you can see right here the results are pretty good so these are test samples"}, {"start": 3202.7200000000003, "end": 3210.64, "text": " these are now these are now images that were not seen during training of this CNN and therefore"}, {"start": 3210.64, "end": 3217.52, "text": " the outcoming siren also hasn't seen that image it's the siren is simply parameterized by the"}, {"start": 3217.52, "end": 3224.7200000000003, "text": " CNN you can see this works pretty well so even if you only have 10 pixels you already get something"}, {"start": 3224.72, "end": 3231.9199999999996, "text": " out of it right and if you have a hundred pixels you already get fairly close to the to the ground"}, {"start": 3231.9199999999996, "end": 3238.3199999999997, "text": " truth right here now this is not gam quality images of course but it's pretty impressive to see"}, {"start": 3238.3199999999997, "end": 3246.56, "text": " that an implicit parameterization an implicit representation of the images can be so powerful"}, {"start": 3246.56, "end": 3252.72, "text": " right yeah so this this is a pretty cool thing and again it's it's better than"}, {"start": 3252.72, "end": 3260.0, "text": " it's it's kind of more back to the machine learning framework that you're used to because there's"}, {"start": 3260.0, "end": 3266.3999999999996, "text": " a train and a test dataset and now the only thing is that the output is a function given by its"}, {"start": 3266.3999999999996, "end": 3274.56, "text": " parameters and not the actual pixel values okay so let's actually let's look at the broader"}, {"start": 3274.56, "end": 3282.3199999999997, "text": " impact statement the proposed siren representation enables accurate representations of natural signals"}, {"start": 3282.32, "end": 3289.28, "text": " such as images audio and video in a deep learning framework this may be an enabler for downstream"}, {"start": 3289.28, "end": 3295.52, "text": " tasks involving such signals such as classification for images or speech to text systems for audio"}, {"start": 3296.32, "end": 3301.76, "text": " such applications may be leveraged for both positive and negative ends siren may in the future"}, {"start": 3301.76, "end": 3308.0, "text": " further enable novel approaches to the generation of such signals this has potential for misuse"}, {"start": 3308.0, "end": 3312.8, "text": " in impersonating actors without their consent for an in-depth discussion of so-called deep"}, {"start": 3312.8, "end": 3320.48, "text": " fakes refer the reader to a recent re-article neural rendering this has this has like no perplexity"}, {"start": 3320.48, "end": 3331.6, "text": " like no perplexity at all like is anyone benefited by this seriously okay but at least we made"}, {"start": 3331.6, "end": 3340.4, "text": " the author's think of the consequences of their research so i invite you to check out this paper"}, {"start": 3340.4, "end": 3346.7999999999997, "text": " maybe with this right now you can follow a bit better what happens here this is a different"}, {"start": 3346.7999999999997, "end": 3353.2799999999997, "text": " paradigm of research it's a cool paradigm it's a way from your usual machine learning framework"}, {"start": 3353.8399999999997, "end": 3359.7599999999998, "text": " and yeah so i'm excited what happens next in this i also invite you to check out the websites"}, {"start": 3359.76, "end": 3364.4, "text": " they have lots of videos and goodies and so on and with that bye bye"}] |
Yannic Kilcher | 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, our strong semi-supervised learners by Ting Chen, Simon Cornblath, Kevin Swarski, Moamut 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 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 things. So they present this new method like 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 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 basic claims 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 image net data set and this right here is going to be our labeled portion like we have labels. Now usually one has labels for image net 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're 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 I've recently made a video about open AI'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 pre conditioner 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 device 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 a 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 near near neighbors to these in the feature space they should have similar labels or things like this. So these semi supervised method 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 a 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 you random crop somewhere so version one could be random crop tier version two could be random crop tier 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 too 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 you 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 z1 z2 these are the the outputs 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 z3 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 want to see the similarity of zi and zj which are the outputs of the same image to be close together and then this down here they want to be far apart zi with zk 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 rappers for some reason we still don't exactly know why combining augmentation with these self supervised losses 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 their 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 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 or let's cancel 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 what's got task agnostic big CNN the arrow is actually coming out of those grid 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-turning 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 exactly 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 head three layers but we leave one layer and we train from the middle layer in 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 dataset that has labels so the part of the dataset 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 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 1 10% class 2 0% class 3 something like this and now you take this as a 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 1 but I'm not 100 percent 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 percent 10 percent 0 percent 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 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 this deletion 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 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 same clear v2 in its in all of its form all right so they go into fine tuning right here and yeah so they say again we elaborate with a three-layer projection head so that's the three-layer projection head this here is the output of resin at 50 where sigma is a relu non-linearity and we ignore the bias term for gravity blah blah blah blah so they contrast this here for fine-tuning sim clear uses this right here which is just it's basically just a classifier on top of the output of the resin at 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 resin that followed by fully connected layers and you see they take the resin at 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 del out of it especially especially since the last layer of the resin at 50 I'm not okay here is I'm not entirely sure but are they taking the look no they're 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 gonna guess there's a big chance that that's the case that the last layer of this encoder is actually not even followed by a 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 you have the teacher what the teacher model thinks why 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 one percent of the labels only one percent of image net labels which they say is smaller or equal than 13 images per class so there's a thousand classes and you only have 13 labels per class or less if you and they differentiate if your encoder that you train is a resonant 50 then you get and you can see the dash line here is a supervised baseline you almost get to the supervised baseline with 1 percent of the labels and if you actually have a larger resonant then you get to the supervised performance without 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 oh 100% what if we you know what if we do the whole procedure with 100% of the labels so first we don't label the data we do supervised self supervision then we fine tune on a 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 and this now relates to the title they say bigger models a yield larger gains when fine tuning with fewer labeled examples so 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 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 image net one top accuracy so if you do this whole thing with 100% of the labels right I'm gonna 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 smaller less and less labels okay so if you only have 10% of the labels your relative gains are a larger does 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 the relative improvement is higher the 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 gonna learn more kinds of features and then you're going to outperform because you have more chance that these features are gonna 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 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 image net and like that there's this we are tasked to recognize a three and we get lots and lots and lots of examples of three's right we can we can decide on a feature we can say oh I all the three's that I see they have this bow down here or all the three's 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 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 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 make you better and here they drop 0.1% and here they drop less than 1% by leaving away the label but their point basically is that it is more important to distill using also unlabeled data than 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 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 care for 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 that approach can become a potent component of harmful surveillance systems more over 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 sim clear 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'm not want to get too upset about this 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 deepfakes and if it's a NLP it's like oh my fake news and yeah 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 statement is going to be in any case rent too long check out paper share it out leave a like comment if you disagree or agree yeah bye bye | [{"start": 0.0, "end": 6.84, "text": " Hi there. Today we'll look at big self-supervised models, our strong semi-supervised learners"}, {"start": 6.84, "end": 13.16, "text": " by Ting Chen, Simon Cornblath, Kevin Swarski, Moamut Nerozzi and Jeffrey Hinton of Google"}, {"start": 13.16, "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.88, "text": " if you want to do semi-supervised learning, that you're very well served by starting out"}, {"start": 26.88, "end": 33.68, "text": " with self-supervised learning and then doing fine-tuning much like NLP models do, rather"}, {"start": 33.68, "end": 41.0, "text": " than the kind of semi-supervised approach that image tasks had so far. And they present"}, {"start": 41.0, "end": 46.92, "text": " this Sinclair V2, which is an improvement over the Sinclair approach to self-supervised"}, {"start": 46.92, "end": 52.44, "text": " pre-training, and they demonstrate it outperforms a lot of the baselines."}, {"start": 52.44, "end": 58.8, "text": " Alright, so if you like content like this, don't forget to share it out and leave a like"}, {"start": 58.8, "end": 66.6, "text": " and tell me what you think in the comments. So this paper, it sort of is kind of a club"}, {"start": 66.6, "end": 74.8, "text": " together thing of different things. So they present this new method like Sinclair V2,"}, {"start": 74.8, "end": 80.56, "text": " which is a modification of Sinclair and we'll go over that, but they also try to make"}, {"start": 80.56, "end": 90.64, "text": " like a scientific claim, namely that somehow bigger models are better for this pathway"}, {"start": 90.64, "end": 97.52000000000001, "text": " of learning and we'll try to untangle all of these things. So first of all, we're in the"}, {"start": 97.52000000000001, "end": 102.76, "text": " semi-supervised learning regime right here. Semi-supervised basic claims that you have"}, {"start": 102.76, "end": 110.48, "text": " a data set and you only have labels for a part of that data set. So this could be"}, {"start": 110.48, "end": 117.12, "text": " like here the bottom 10% or so because labels might be expensive to get and so you only"}, {"start": 117.12, "end": 123.16, "text": " have a few of them, but you have much more data that's unlabeled. Now sometimes this problem"}, {"start": 123.16, "end": 129.52, "text": " is formulated as this here is your data set and then this here is like a different data"}, {"start": 129.52, "end": 134.08, "text": " set, but one that's close enough such that you can learn from it and that's usually in"}, {"start": 134.08, "end": 140.72000000000003, "text": " NLP, you'll have your data set is like a sentiment classification task, but you have all"}, {"start": 140.72000000000003, "end": 146.56, "text": " of Wikipedia that is not labeled, but it's just text so you can sort of pre-train on it."}, {"start": 146.56, "end": 152.60000000000002, "text": " In this case, we'll be in a situation where we'll artificially construct a small data"}, {"start": 152.60000000000002, "end": 159.8, "text": " set. So this entire thing here is going to be the image net data set and this right here"}, {"start": 159.8, "end": 166.16000000000003, "text": " is going to be our labeled portion like we have labels. Now usually one has labels for"}, {"start": 166.16000000000003, "end": 172.56, "text": " image net as well, but we artificially restrict ourselves to simulate a situation where we"}, {"start": 172.56, "end": 179.56, "text": " have lots of data and we only have a fixed budget. So we can only because to obtain labels"}, {"start": 179.56, "end": 184.76000000000002, "text": " oftentimes you have to ask humans right to label images and let's say we're a company"}, {"start": 184.76, "end": 191.79999999999998, "text": " and we've collected this big data set, but we only have like maybe 500 bucks on Amazon"}, {"start": 191.79999999999998, "end": 198.79999999999998, "text": " mechanical Turk and we only managed to get a very like 1% of our data set labeled. Now"}, {"start": 198.79999999999998, "end": 206.79999999999998, "text": " we're in the in the regime of semi supervised learning. Okay, this is slightly different"}, {"start": 206.79999999999998, "end": 211.68, "text": " from what NLP does and as I said in NLP usually assume you have different data sets, the large"}, {"start": 211.68, "end": 216.92000000000002, "text": " one being the different distribution and in the semi supervised regime you often assume"}, {"start": 216.92000000000002, "end": 221.96, "text": " that it is actually the same data distribution, but you only have labels for some of them,"}, {"start": 221.96, "end": 228.8, "text": " but there should be a fair bit of overlap between the two things. So I've recently made"}, {"start": 228.8, "end": 235.64000000000001, "text": " a video about open AI's image GPT that kind of goes into the into the same direction as"}, {"start": 235.64, "end": 241.51999999999998, "text": " this work right here that basically says pre training on unlabeled data like this whole"}, {"start": 241.51999999999998, "end": 249.35999999999999, "text": " data set without the labels can be a very good pre conditioner for fine tuning later and"}, {"start": 249.35999999999999, "end": 256.76, "text": " this paper says the same thing. So basically in in the good old days what you would do is"}, {"start": 256.76, "end": 264.2, "text": " you would devise a method that somehow takes you know takes in a device method that takes"}, {"start": 264.2, "end": 270.59999999999997, "text": " in a mini batch and in the mini batch you'd have your data samples and then some of them"}, {"start": 270.59999999999997, "end": 274.92, "text": " would be labeled right here you'd have a Y and here you'd have a Y, but most of them"}, {"start": 274.92, "end": 280.88, "text": " would be not labeled and you'd have like some sort of loss function that would put special"}, {"start": 280.88, "end": 287.08, "text": " weight on the ones that are labeled or somehow handle these ones that are unlabeled in a way"}, {"start": 287.08, "end": 292.8, "text": " you might be doing like a some sort of a consistency loss such that if they are very near"}, {"start": 292.8, "end": 298.12, "text": " near neighbors to these in the feature space they should have similar labels or things like"}, {"start": 298.12, "end": 305.16, "text": " this. So these semi supervised method they basically try to solve the problem at once"}, {"start": 305.16, "end": 309.96000000000004, "text": " but while taking data that is labeled and not labeled this paper goes into a different"}, {"start": 309.96000000000004, "end": 316.28000000000003, "text": " direction this paper says first we should it's actually three stages right here and they"}, {"start": 316.28, "end": 323.23999999999995, "text": " have a diagram so I don't need to draw they have a three stage approach three stages the"}, {"start": 323.23999999999995, "end": 329.67999999999995, "text": " one on the left is unsupervised pre-training so they say let's forget about the labels"}, {"start": 329.67999999999995, "end": 335.84, "text": " right now even like your unlabeled data so even the data where we have the labels let's"}, {"start": 335.84, "end": 342.35999999999996, "text": " forget about the labels and let's just do unsupervised pre-training now unsupervised pre-training"}, {"start": 342.36, "end": 348.32, "text": " in this kind of setting is also known as self supervised pre-training and this first"}, {"start": 348.32, "end": 356.76, "text": " stage is done using a contrastive loss and that's very similar to a sim clear to this contrastive"}, {"start": 356.76, "end": 362.84000000000003, "text": " loss so what you'll do and they describe it very very well here so what you'll do is given"}, {"start": 362.84000000000003, "end": 368.92, "text": " a randomly sampled mini batch of images each image is augmented twice using random crop"}, {"start": 368.92, "end": 375.24, "text": " color distortion and Gaussian blur creating two views of the same example okay so you have"}, {"start": 375.24, "end": 380.96000000000004, "text": " an image in your mini batch each image you take and you make two versions of it and each"}, {"start": 380.96000000000004, "end": 386.0, "text": " version you crop you random crop somewhere so version one could be random crop tier version"}, {"start": 386.0, "end": 392.92, "text": " two could be random crop tier and then you put some Gaussian blur on it and so on so a"}, {"start": 392.92, "end": 398.76, "text": " little bit of as you can see random crop color distortion Gaussian blur so what you'll"}, {"start": 398.76, "end": 406.03999999999996, "text": " want is two different versions of the same image each of these versions has been augmented in a"}, {"start": 406.03999999999996, "end": 411.8, "text": " different way cropped in a different way blurred in a different way such it's it's too slightly"}, {"start": 411.8, "end": 418.84, "text": " different versions of the same image and now you want to enforce you want to put this through"}, {"start": 419.96, "end": 426.2, "text": " your network so ultimately as you can see on the right side here what you want to end up is a"}, {"start": 426.2, "end": 435.15999999999997, "text": " a network and then okay we'll forget about this right now what you want to train is this network"}, {"start": 435.15999999999997, "end": 440.03999999999996, "text": " right here actually including these projection layers we'll get to them later this is the network"}, {"start": 440.03999999999996, "end": 445.48, "text": " that you want to train so you want to put you take your unlabeled data you take an image you'd"}, {"start": 445.48, "end": 454.28, "text": " make two versions of it and you put those through the network right until the end right here so you'll"}, {"start": 454.28, "end": 462.84, "text": " get z1 z2 these are the the outputs of the network for the two images and then what you want to do is"}, {"start": 462.84, "end": 469.55999999999995, "text": " you want to take another image that's not this image and also put it through the network maybe also"}, {"start": 469.55999999999995, "end": 477.23999999999995, "text": " augmented first and then you have z3 so now you have the outputs of two things that are supposed to"}, {"start": 477.23999999999995, "end": 481.96, "text": " come from the same image and one thing that's supposed to come from a different image and now your"}, {"start": 481.96, "end": 490.68, "text": " loss is simply going to be make those two things close together and push those two things apart"}, {"start": 490.68, "end": 498.67999999999995, "text": " or those three actually so the loss and this is this is the contrastive loss of self supervised"}, {"start": 498.67999999999995, "end": 504.35999999999996, "text": " learning as you know you don't need any labels right here you simply say the things that come from"}, {"start": 504.35999999999996, "end": 508.91999999999996, "text": " the same image should be close together and the things that come from different images should be"}, {"start": 508.92, "end": 515.32, "text": " far apart and this relies heavily on these data augmentations that you do right here"}, {"start": 516.28, "end": 522.12, "text": " they also employ some other tricks like the momentum encoder from moco from momentum contrast"}, {"start": 522.12, "end": 529.5600000000001, "text": " and so on but this is the main the main part so you can pull a lot of strings here to get like"}, {"start": 529.5600000000001, "end": 538.6, "text": " another percent of performance but ultimately they want to see the similarity of zi and zj"}, {"start": 538.6, "end": 546.76, "text": " which are the outputs of the same image to be close together and then this down here they want to"}, {"start": 546.76, "end": 556.52, "text": " be far apart zi with zk where k is all the other images okay you can do this in a mini batch fashion"}, {"start": 556.52, "end": 561.72, "text": " so this is self supervised learning and the reason why you do this is you don't need labels"}, {"start": 561.72, "end": 568.9200000000001, "text": " and it tends we know it tends to give very very good representations so I'm past that"}, {"start": 570.12, "end": 577.0, "text": " so what this network here will learn will be very good rappers for some reason we still don't"}, {"start": 577.0, "end": 582.9200000000001, "text": " exactly know why combining augmentation with these self supervised losses with contrastive loss"}, {"start": 582.92, "end": 592.92, "text": " for example gives such good performance there have been papers recently that modify the loss and so on"}, {"start": 592.92, "end": 599.0, "text": " but it's not super well understood yet but if you do it like this their the network here will give"}, {"start": 599.0, "end": 604.12, "text": " you already very very good representation and we know this because we can take a network like this"}, {"start": 604.12, "end": 612.5999999999999, "text": " and then simply train a linear classifier on top of that on a data set and achieve very very"}, {"start": 612.6, "end": 619.4, "text": " good performance and mind you you have trained it with unlabeled data right so the the network has"}, {"start": 619.4, "end": 624.28, "text": " never been trained to solve like image net classification it has simply been trained to look at the"}, {"start": 624.28, "end": 629.72, "text": " pictures and determine if you know two versions of a picture come from the same picture or from"}, {"start": 629.72, "end": 635.32, "text": " different pictures and now if you simply train a linear classifier on top of these representations"}, {"start": 635.32, "end": 640.76, "text": " you're doing extremely well already so we know these representations they actually learn something"}, {"start": 640.76, "end": 649.8, "text": " about these images so that's the first part then stage two or let's cancel of that stage two"}, {"start": 649.8, "end": 657.64, "text": " is you want to do supervised fine tuning now you already see that the arrow here coming out is not"}, {"start": 657.64, "end": 664.4399999999999, "text": " this what's got task agnostic big CNN the arrow is actually coming out of those grid those yellow"}, {"start": 664.44, "end": 670.84, "text": " boxes and the yellow boxes are these projection heads so in the original sim clear paper what they"}, {"start": 670.84, "end": 678.84, "text": " did was they they wanted originally they wanted to train this network right here this is like a"}, {"start": 678.84, "end": 684.44, "text": " resonant 50 is pretty standard in these kind of self supervised approaches and so on to train"}, {"start": 684.44, "end": 692.2, "text": " or these few label approaches to train a a standardized network and this is like a resonant 50"}, {"start": 692.2, "end": 697.5600000000001, "text": " so in the original sim clear paper they said we want to make resonant 50 as strong as possible"}, {"start": 698.2800000000001, "end": 705.72, "text": " but in order to do this loss right here we are going to attach this projection head just to"}, {"start": 705.72, "end": 712.2800000000001, "text": " because the dimensionality here I think is like 2048 and we want to do this inner product in a"}, {"start": 712.2800000000001, "end": 719.96, "text": " lower dimension of like maybe 256 or so so this these are just multi layer perceptrons these are"}, {"start": 719.96, "end": 727.72, "text": " just fully connected layers that compress the representation down to that and once we're done with"}, {"start": 727.72, "end": 731.96, "text": " the unsupervised pre-turning we're going to throw those away right and this resonant is the thing"}, {"start": 731.96, "end": 739.32, "text": " that we really care about now here they claim okay it actually works better and they have experiments"}, {"start": 739.32, "end": 747.88, "text": " to prove this or to show this if you use one if you actually leave one of these layers here so"}, {"start": 747.88, "end": 754.4399999999999, "text": " in the end they I guess they converge on three projection head layers and then they only throw away"}, {"start": 754.4399999999999, "end": 761.16, "text": " the top two and like they make this big deal out of the fact where you know I can just call I can"}, {"start": 761.16, "end": 770.4399999999999, "text": " just call this part right here now the encoder and I don't so I don't know exactly like I don't see"}, {"start": 770.4399999999999, "end": 776.2, "text": " the giant deal here like you just made your network one layer bigger and now you consider that"}, {"start": 776.2, "end": 782.36, "text": " to be your 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 head three layers but we leave one layer and we train from the middle"}, {"start": 786.76, "end": 792.2800000000001, "text": " layer in in any case they have this layer additional layer right here compared to the old"}, {"start": 792.2800000000001, "end": 798.36, "text": " sim clear and then the representation of that goes into supervised fine tuning now this is pretty easy"}, {"start": 798.36, "end": 805.6400000000001, "text": " this is exactly what it sounds like so now you use only only the dataset that has labels so the part"}, {"start": 805.64, "end": 811.4, "text": " of the dataset that has labels and you do the fine tuning and fine tuning is simply supervised"}, {"start": 811.4, "end": 817.48, "text": " learning you train this network in a supervised fashion on that small fraction of data that has"}, {"start": 817.48, "end": 824.6, "text": " class labels and that already performs pretty well and they show this in experiments but then you"}, {"start": 824.6, "end": 834.68, "text": " can go a step further and do what's known as distillation or self training and what's distillation"}, {"start": 834.68, "end": 841.8, "text": " or self training it's so distillation is when you have a network that you call the teacher network"}, {"start": 841.8, "end": 849.16, "text": " and that network has been trained to do some classification maybe into three classes pretty"}, {"start": 849.16, "end": 856.76, "text": " pretty well okay but now this is very large and you want maybe a smaller model so you just want"}, {"start": 856.76, "end": 861.24, "text": " like this tiny model because you want to ship it on a mobile device right but it's also supposed"}, {"start": 861.24, "end": 868.6800000000001, "text": " to do this and you know that if you just directly train this which is called the student model it"}, {"start": 868.6800000000001, "end": 874.2, "text": " doesn't perform as well as the teacher model there is a better way if you have the teacher model"}, {"start": 874.2, "end": 879.16, "text": " you can sort of transfer the knowledge to the student model you can distill the knowledge and how"}, {"start": 879.16, "end": 885.48, "text": " do you do that you do that by so what would you do in supervised training in supervised training"}, {"start": 885.48, "end": 891.96, "text": " you would take an image put it in and then put the label that comes along with the image you put"}, {"start": 891.96, "end": 898.12, "text": " it up here and you compare the output to the label and that gives you the loss function right now"}, {"start": 898.12, "end": 906.44, "text": " you do that right here if you distill you put the image into both now the teacher is already trained"}, {"start": 907.08, "end": 913.32, "text": " so its output will be a distribution over classes it won't be a single label it will be like okay"}, {"start": 913.32, "end": 922.6800000000001, "text": " 90% class 1 10% class 2 0% class 3 something like this and now you take this as a like a pseudo label"}, {"start": 922.6800000000001, "end": 928.7600000000001, "text": " this entire distribution and you put it here and you compare the output of the student to that of"}, {"start": 928.7600000000001, "end": 934.6800000000001, "text": " the teacher and that's your loss function so this kind of the teacher might have learned to put"}, {"start": 934.6800000000001, "end": 940.6800000000001, "text": " some nuance into the classification to say well I'm pretty sure this is class 1 but I'm not 100"}, {"start": 940.68, "end": 946.68, "text": " percent sure and it can transfer that knowledge to the student and that makes the student better"}, {"start": 946.68, "end": 954.4399999999999, "text": " than had you just trained it from the beginning from from with just the labels right so this is"}, {"start": 954.4399999999999, "end": 961.8, "text": " distillation and you can do this even what they call self distillation here or self training so"}, {"start": 961.8, "end": 969.9599999999999, "text": " apparently this even helps if the teacher is if the student model is the same as the teacher model"}, {"start": 969.96, "end": 975.48, "text": " now why does it help in this case and I think it is not exactly the case in this case because"}, {"start": 975.48, "end": 980.6800000000001, "text": " they always say their teacher model has this extra projection layer right and then the student model"}, {"start": 980.6800000000001, "end": 986.6, "text": " doesn't have that even if they do self training but why does it help in this case I mean it's"}, {"start": 986.6, "end": 992.2, "text": " it's kind of shocking and I'm pretty sure it helps in any case but in this particular case it helps"}, {"start": 992.2, "end": 1000.76, "text": " because now you're using the unlabeled data again so you have a teacher model and the teacher"}, {"start": 1000.76, "end": 1008.2800000000001, "text": " model is trained first using unsupervised like this is the teacher model right here using unsupervised"}, {"start": 1008.2800000000001, "end": 1015.48, "text": " training then the teacher model is further fine tuned on the small data right so it is now already"}, {"start": 1015.48, "end": 1022.6800000000001, "text": " pretty good at the task but how can you get a student model that's even better than the teacher model"}, {"start": 1022.6800000000001, "end": 1028.1200000000001, "text": " it's by using again this unlabeled data you have this giant amount of data so what you'll do is you"}, {"start": 1028.1200000000001, "end": 1033.64, "text": " take an image from the unlabeled data and you ask the teacher model teacher model what do you think"}, {"start": 1033.64, "end": 1041.0, "text": " about that image right and the teacher model will give you a prediction like let's say again this 90"}, {"start": 1041.0, "end": 1047.72, "text": " percent 10 percent 0 percent and then you take the student model you input that image and you compare"}, {"start": 1047.72, "end": 1055.48, "text": " its output to what the teacher said so this combines the teacher model you freeze the teacher model"}, {"start": 1055.48, "end": 1061.96, "text": " right the teacher model is only trained until here you take it from here the student model is now"}, {"start": 1061.96, "end": 1071.96, "text": " able to take basically the teacher it takes everything that the teacher model knows not only about"}, {"start": 1071.96, "end": 1077.4, "text": " this data but about all the data so it kind of gets to ask the teacher model what do you think about"}, {"start": 1077.4, "end": 1081.96, "text": " this what do you think about this what do you think about this and it can incorporate all that"}, {"start": 1081.96, "end": 1088.68, "text": " knowledge about all of this unlabeled data and that's why the student model here in the end if"}, {"start": 1088.68, "end": 1095.24, "text": " it's the same size will probably end up even better than the teacher model right so this"}, {"start": 1095.24, "end": 1102.28, "text": " deletion I think also is still kind of a mystery of why you get a better model or I mean to to make"}, {"start": 1102.28, "end": 1107.72, "text": " it smaller if you make it a lot smaller usually you don't end up with a better model but you end up"}, {"start": 1107.72, "end": 1112.28, "text": " with a pretty good model that you couldn't have gotten by just training the small small model"}, {"start": 1112.28, "end": 1120.6, "text": " but so that's already pretty cool but why you get a better model with when they're the same size"}, {"start": 1120.6, "end": 1128.68, "text": " that's I don't think that's well understood yet so that's the three-stage approach so recap first"}, {"start": 1129.24, "end": 1135.48, "text": " use all of the data without labels to do unsupervised or self-supervised contrastive pre-training"}, {"start": 1135.48, "end": 1145.32, "text": " second use only the data that has labels to do fine tuning third either distill the learned"}, {"start": 1145.32, "end": 1154.04, "text": " classifier to a smaller model or distill it to a model of the same size again with in both cases"}, {"start": 1154.04, "end": 1162.04, "text": " you would again use the unlabeled all of the unlabeled data okay and that's the three-step approach"}, {"start": 1162.04, "end": 1170.92, "text": " that's same clear v2 in its in all of its form all right so they go into fine tuning right here"}, {"start": 1172.44, "end": 1181.48, "text": " and yeah so they say again we elaborate with a three-layer projection head so that's the three-layer"}, {"start": 1181.48, "end": 1189.72, "text": " projection head this here is the output of resin at 50 where sigma is a relu non-linearity and we"}, {"start": 1189.72, "end": 1195.4, "text": " ignore the bias term for gravity blah blah blah blah so they contrast this here for fine-tuning"}, {"start": 1195.4, "end": 1204.2, "text": " sim clear uses this right here which is just it's basically just a classifier on top of the output"}, {"start": 1204.2, "end": 1213.64, "text": " of the resin at 50 okay yada yada yada yada this is fine-tuning from the input layer of the projection"}, {"start": 1213.64, "end": 1219.16, "text": " head to fine-tune from the first layer of the projection head we have a new encoder function"}, {"start": 1219.16, "end": 1225.96, "text": " as this which is resin that followed by fully connected layers and you see they take the resin at 50"}, {"start": 1225.96, "end": 1232.44, "text": " output and they ship it through the first projection layer and then there is a task-specific"}, {"start": 1232.44, "end": 1238.68, "text": " classifier now again why I don't even see why they make like this ginormous del out of it"}, {"start": 1238.68, "end": 1245.8000000000002, "text": " especially especially since the last layer of the resin at 50 I'm not okay here is I'm not entirely"}, {"start": 1245.8, "end": 1251.96, "text": " sure but are they taking the look no they're probably not taking the log it's okay but it's"}, {"start": 1253.3999999999999, "end": 1260.36, "text": " yeah I'm it's just weird like is there even a non-linearity at the end right here or is this really"}, {"start": 1260.36, "end": 1265.96, "text": " just like two matrix multiplications in a row which I'm gonna guess there's a big chance that"}, {"start": 1265.96, "end": 1271.32, "text": " that's the case that the last layer of this encoder is actually not even followed by a non-linearity"}, {"start": 1271.32, "end": 1276.4399999999998, "text": " and therefore you'll just kind of make the dimension different and I don't see why you can't just"}, {"start": 1276.4399999999998, "end": 1281.96, "text": " just incorporate this into the model and have to like say it over and over again that this is a"}, {"start": 1281.96, "end": 1287.0, "text": " new special thing right again this is equivalent of tuning from a middle layer of the projection head"}, {"start": 1287.0, "end": 1293.8799999999999, "text": " instead of the output layer okay you just make your model a bit bigger yeah so the third step"}, {"start": 1293.8799999999999, "end": 1299.72, "text": " is self-training or knowledge distillation and they give two variants right here this variant as"}, {"start": 1299.72, "end": 1306.6000000000001, "text": " you can see here this is this is just the cross entropy but instead of having labels right here why"}, {"start": 1308.52, "end": 1316.44, "text": " you have the teacher what the teacher model thinks why is given x okay that's that's"}, {"start": 1317.4, "end": 1322.44, "text": " cross entropy but not with the true labels but with the output of the teacher model and you can"}, {"start": 1322.44, "end": 1330.6000000000001, "text": " even mix that so you can as you can see right here you can mix this with an actual supervised"}, {"start": 1330.6000000000001, "end": 1335.48, "text": " loss so this would be the supervised loss whatever yeah I guess that I was wrong that wasn't"}, {"start": 1336.2, "end": 1344.04, "text": " I guess p of y is always one in that case but they don't use this particular kind I think"}, {"start": 1344.04, "end": 1353.56, "text": " except in one of the ablations so how does this work it works pretty well and so one of their"}, {"start": 1353.56, "end": 1362.12, "text": " experiments as you see up here it works pretty well in that if you have one percent of the labels"}, {"start": 1362.12, "end": 1370.92, "text": " only one percent of image net labels which they say is smaller or equal than 13 images per class so"}, {"start": 1370.92, "end": 1379.96, "text": " there's a thousand classes and you only have 13 labels per class or less if you and they differentiate"}, {"start": 1379.96, "end": 1390.1200000000001, "text": " if your encoder that you train is a resonant 50 then you get and you can see the dash line here is"}, {"start": 1390.1200000000001, "end": 1395.8000000000002, "text": " a supervised baseline you almost get to the supervised baseline with 1 percent of the labels"}, {"start": 1395.8, "end": 1402.04, "text": " and if you actually have a larger resonant then you get to the supervised performance without"}, {"start": 1402.84, "end": 1411.96, "text": " without 99% of the labels and if you have excuse me 10% of the labels you pass the supervised"}, {"start": 1411.96, "end": 1419.96, "text": " baseline so the supervised baseline is on 100% of the labels mind you and you only have 10% and this"}, {"start": 1419.96, "end": 1425.56, "text": " outperforms the supervised baseline now of course you could here you could have another graphic where"}, {"start": 1425.56, "end": 1431.64, "text": " you show oh 100% what if we you know what if we do the whole procedure with 100% of the labels so"}, {"start": 1431.64, "end": 1438.68, "text": " first we don't label the data we do supervised self supervision then we fine tune on a 100% of the"}, {"start": 1438.68, "end": 1443.88, "text": " data and then we do this distillation again you would of course be even better and I think they"}, {"start": 1443.88, "end": 1452.6000000000001, "text": " have this somewhere in a table but this is already pretty pretty impressive and another claim they"}, {"start": 1452.6000000000001, "end": 1462.0400000000002, "text": " make right here is about the model sizes so and this figure is description and this now relates"}, {"start": 1462.0400000000002, "end": 1470.2800000000002, "text": " to the title they say bigger models a yield larger gains when fine tuning with fewer labeled examples"}, {"start": 1470.28, "end": 1477.0, "text": " so there are three comparative statement words in one sentence let's unpack this"}, {"start": 1478.68, "end": 1489.0, "text": " bigger models yield larger gains so the bigger the bigger the model the better the good let's say"}, {"start": 1489.8, "end": 1493.96, "text": " when fine tuning with fewer labeled examples let's just look at the graph it's pretty it's"}, {"start": 1493.96, "end": 1500.2, "text": " really clear so here we have number of parameters going over so these are the different models they look at"}, {"start": 1500.2, "end": 1506.52, "text": " how many parameters they have to do this whole procedure and here is the relative improvement"}, {"start": 1506.52, "end": 1515.8, "text": " in percent over the top image net one top accuracy so if you do this whole thing with 100% of the"}, {"start": 1515.8, "end": 1522.92, "text": " labels right I'm gonna guess this here this here is where they start out and you can see as you"}, {"start": 1522.92, "end": 1531.8000000000002, "text": " grow your models you grow the performance and this this is just by increasing the model size right"}, {"start": 1531.8000000000002, "end": 1537.64, "text": " you have the same data set you have the same amount of labels you have the same number of steps"}, {"start": 1537.64, "end": 1545.88, "text": " that you train for and so on just by the fact that you make your model bigger you gain in performance"}, {"start": 1545.88, "end": 1555.4, "text": " okay now you can see that these curves here are above one another and these curves refer to"}, {"start": 1555.4, "end": 1563.3200000000002, "text": " getting smaller less and less labels okay so if you only have 10% of the labels your relative gains"}, {"start": 1563.3200000000002, "end": 1569.48, "text": " are a larger does doesn't mean that you perform better with 10% of the labels than with 100% of the"}, {"start": 1569.48, "end": 1575.72, "text": " labels that would be that would be like ridiculous well I guess in this day and age nothing is ridiculous"}, {"start": 1575.72, "end": 1582.76, "text": " but for now we're still performing better by having more labels if we do the same procedure right"}, {"start": 1584.52, "end": 1590.3600000000001, "text": " it's not like here so here this baseline the supervised baseline only does supervised training"}, {"start": 1590.3600000000001, "end": 1596.84, "text": " right so that's why we can outperform it with less of labels but here we do the same procedure"}, {"start": 1596.84, "end": 1605.32, "text": " this is relative improvement right so this right here the starting point would be if you had 10%"}, {"start": 1605.32, "end": 1614.04, "text": " of labels and a 25 million model parameter model and this right here for example is if you have"}, {"start": 1614.04, "end": 1621.48, "text": " the same amount of labels but a 200 million parameter model and this is relative improvement okay"}, {"start": 1621.48, "end": 1627.88, "text": " but what the graph says is that the relative improvement is larger the"}, {"start": 1629.4, "end": 1637.8, "text": " the relative improvement is higher the the more parameters you have which is the more you go to the right"}, {"start": 1637.8, "end": 1646.04, "text": " and that effect in itself is higher the fewer labels you have which is the different graphs and you"}, {"start": 1646.04, "end": 1652.36, "text": " can see that right here so if you have fewer and fewer labels it becomes more and more important"}, {"start": 1652.36, "end": 1658.12, "text": " that you have bigger models and that's really counterintuitive right because you would expect that"}, {"start": 1658.12, "end": 1665.24, "text": " the bigger models they can overfit much more easily to the fewer labels but that doesn't seem the"}, {"start": 1665.24, "end": 1672.68, "text": " case so this self supervision it really seems to be sort of a counter to this notion of overfitting"}, {"start": 1672.68, "end": 1678.44, "text": " and if you have larger and larger models that's what they argue in the paper you might be able to"}, {"start": 1678.44, "end": 1684.92, "text": " learn more and more features that might be useful for classification so if you have a larger model"}, {"start": 1684.92, "end": 1691.3200000000002, "text": " you might you're gonna learn more kinds of features and then you're going to outperform because"}, {"start": 1691.3200000000002, "end": 1696.28, "text": " you have more chance that these features are gonna be useful for classification and I don't"}, {"start": 1696.28, "end": 1703.6399999999999, "text": " think they really make a statement as to why that happens more with the if you have less labels so"}, {"start": 1703.6399999999999, "end": 1711.72, "text": " let's think about this if I have very few labels very very few labels why does it help me even more"}, {"start": 1711.72, "end": 1716.36, "text": " if I have a big model well with the same argumentation we could say and maybe they actually say this"}, {"start": 1716.36, "end": 1727.3999999999999, "text": " already so I might be copying them involuntarily maybe with fewer and fewer labels like let's say we"}, {"start": 1727.3999999999999, "end": 1733.9599999999998, "text": " have all the labels that's probably too many right if if we can learn a task with some accuracy we"}, {"start": 1733.9599999999998, "end": 1740.52, "text": " probably had too many labels okay it's like we like if we can't learn a task we know we have too few"}, {"start": 1740.52, "end": 1746.28, "text": " somewhere there is a border where we have enough but that's like kind of one number and everything"}, {"start": 1746.28, "end": 1751.6399999999999, "text": " else is too too many technically speaking like learning theoretically speaking so"}, {"start": 1754.04, "end": 1757.96, "text": " usually we have too many labels and what does that mean that probably means that there are"}, {"start": 1757.96, "end": 1763.8, "text": " multiple ways like if we have too many labels there are multiple different features we can pick up"}, {"start": 1763.8, "end": 1770.12, "text": " to learn there are multiple different paths to learn our goals so if we have image net and like"}, {"start": 1770.12, "end": 1775.8, "text": " that there's this we are tasked to recognize a three and we get lots and lots and lots of examples"}, {"start": 1775.8, "end": 1782.36, "text": " of three's right we can we can decide on a feature we can say oh I all the three's that I see they"}, {"start": 1782.36, "end": 1787.8, "text": " have this bow down here or all the three's that I see they have this bend here and so on but if"}, {"start": 1787.8, "end": 1794.84, "text": " I only have very few labels there might only be like a single feature that is even theoretically"}, {"start": 1794.84, "end": 1801.9599999999998, "text": " possible to learn from the labels I'm given and therefore if I have a bigger model in cell in pre-training"}, {"start": 1801.9599999999998, "end": 1807.8, "text": " because the pre-training happens with the same amount of data right if I have a if I have a bigger"}, {"start": 1807.8, "end": 1814.04, "text": " model that does the self supervised pre-training is going to learn more features and then there's a"}, {"start": 1814.04, "end": 1822.6799999999998, "text": " higher chance that that one feature that I'm that these very few labels that I am able to learn"}, {"start": 1822.68, "end": 1828.6000000000001, "text": " something from is going to be in these features so that's kind of how I make sense of it in combination"}, {"start": 1828.6000000000001, "end": 1838.44, "text": " what with what they're saying right here okay so this was the main points they do a lot of empirical"}, {"start": 1838.44, "end": 1845.16, "text": " studies showing the effects of these sizes they stress that it's important to have both deep and"}, {"start": 1845.16, "end": 1853.0800000000002, "text": " wide networks and they also do this additional attention mechanism over the convolution filters"}, {"start": 1853.0800000000002, "end": 1861.88, "text": " I don't want to go into that particularly but they they also do linear evaluation compared to"}, {"start": 1861.88, "end": 1868.76, "text": " supervised compared to to fine tuning on with 100% of the labels so they do a very thorough empirical"}, {"start": 1868.76, "end": 1881.16, "text": " investigation and yeah I do appreciate that and they kind of show the same things and here they show"}, {"start": 1881.16, "end": 1887.4, "text": " the number of layers in the projection head so as you increase the number of layers in the projection"}, {"start": 1887.4, "end": 1894.04, "text": " head and train from the optimal layer in the middle your performance goes up as you can see but"}, {"start": 1894.04, "end": 1901.48, "text": " it also this effect is stronger when you have fewer labels right you can see the differences here"}, {"start": 1901.48, "end": 1907.96, "text": " are greater than the differences here or even here when you have 100% of the labels so the fewer"}, {"start": 1907.96, "end": 1914.6, "text": " labels the fewer the labels the more benefit you have from the architecture right here and here they"}, {"start": 1914.6, "end": 1920.36, "text": " show that it's not always optimal to train from the last projection layer but here the first one so"}, {"start": 1920.36, "end": 1925.9599999999998, "text": " I guess they converge on three projection layers and you always want to keep the first one around"}, {"start": 1925.9599999999998, "end": 1934.12, "text": " after self supervised training as we mentioned before okay they investigate different different"}, {"start": 1934.12, "end": 1940.12, "text": " distillation losses and show that it is actually important that you do the distillation loss"}, {"start": 1942.12, "end": 1947.8799999999999, "text": " on labeled and unlabeled sets you can see here if you only do it if you only train with the labels"}, {"start": 1947.88, "end": 1957.48, "text": " after fine tuning you get poor performance if you do the label and distillation loss but only do"}, {"start": 1957.48, "end": 1964.2800000000002, "text": " it on the data set where you have labels then you get more performance if you do label and distillation"}, {"start": 1964.2800000000002, "end": 1971.88, "text": " loss but also include your unlabeled data you get even more performance and then if you do that"}, {"start": 1971.88, "end": 1979.3200000000002, "text": " but you don't do the label loss so before we've seen you can mix the distillation loss with the label"}, {"start": 1979.3200000000002, "end": 1985.64, "text": " loss if you have lots of labels then you drop in performance again and you can see right here"}, {"start": 1985.64, "end": 1990.3600000000001, "text": " the drop in performance is proportional to how many labeled examples you have and that's that's"}, {"start": 1990.3600000000001, "end": 1996.8400000000001, "text": " natural right if you have the labels you can actually mix that information in with the distillation"}, {"start": 1996.84, "end": 2004.76, "text": " loss and that make you better and here they drop 0.1% and here they drop less than 1% by leaving"}, {"start": 2004.76, "end": 2014.6, "text": " away the label but their point basically is that it is more important to distill using also unlabeled"}, {"start": 2014.6, "end": 2022.36, "text": " data than it is to distill including the label loss and it's much easier to not include the label"}, {"start": 2022.36, "end": 2031.6399999999999, "text": " loss so they don't do it I guess all right so I think that was it they compare as I said they"}, {"start": 2031.6399999999999, "end": 2039.3999999999999, "text": " compare like self distillation where you distill into an equally sized model and down distillation"}, {"start": 2039.3999999999999, "end": 2046.36, "text": " where you distill into a smaller model maybe that's vice versa and they do a lot of comparison to"}, {"start": 2046.36, "end": 2054.2799999999997, "text": " other methods so this is a very thorough work I feel and yeah if you want more about the exact"}, {"start": 2054.2799999999997, "end": 2060.12, "text": " experiments I invite you to look at the paper and let's just have a final look at the broader"}, {"start": 2060.12, "end": 2068.2, "text": " impact statement right here so the broader remember the broader impact statement is supposed to"}, {"start": 2068.2, "end": 2079.72, "text": " to force you to think about how society might be impacted at large by your work so it says the"}, {"start": 2079.72, "end": 2084.4399999999996, "text": " finding described in this paper can potentially be harnessed to improve accuracy in any application"}, {"start": 2084.4399999999996, "end": 2089.48, "text": " or computer vision where it is more expensive or difficult to label additional data than to train"}, {"start": 2089.48, "end": 2096.6, "text": " larger models such applications are clearly beneficial to society for example in medical applications"}, {"start": 2096.6, "end": 2101.88, "text": " where acquiring high quality labels requires care for annotation by clinicians better semi-supervised"}, {"start": 2101.88, "end": 2107.0, "text": " learning approaches can potentially help save lives application of computer vision to agriculture"}, {"start": 2107.0, "end": 2113.3199999999997, "text": " can increase crop yields which may help to improve availability of food however we also recognize"}, {"start": 2113.3199999999997, "end": 2119.7999999999997, "text": " that approach can become a potent component of harmful surveillance systems more over there is"}, {"start": 2119.7999999999997, "end": 2125.24, "text": " an entire industry built around human labeling services and technology that reduces the need"}, {"start": 2125.24, "end": 2129.16, "text": " for these services could lead to short term loss of income for some of those currently employed"}, {"start": 2129.16, "end": 2138.4399999999996, "text": " or contracted to provide labels so ask yourself how much of that statement has to do with the actual"}, {"start": 2138.4399999999996, "end": 2147.3199999999997, "text": " novelty of this paper and the answer is of course zero right like you can replace like our method"}, {"start": 2147.3199999999997, "end": 2153.7999999999997, "text": " in this thing with like machine learning or computer vision in general like oh really sim clear"}, {"start": 2153.8, "end": 2162.1200000000003, "text": " V2 specifically can increase crop yields like that specific invention of this paper will lead to"}, {"start": 2162.1200000000003, "end": 2172.44, "text": " higher crop yields will lead to surveillance systems so I'm yeah you know I think like I'm not"}, {"start": 2172.44, "end": 2183.1600000000003, "text": " want to get too upset about this I mean this I think it's quite funny but just again I I wonder"}, {"start": 2183.16, "end": 2190.7599999999998, "text": " whether the people advocating for these things are happy with these statements because clearly"}, {"start": 2190.7599999999998, "end": 2199.3199999999997, "text": " clearly this is just a template that you copy paste from paper to paper replacing like a few words"}, {"start": 2199.3199999999997, "end": 2205.7999999999997, "text": " and if it's computer vision you're like oh my deepfakes and if it's a NLP it's like oh my fake news"}, {"start": 2205.8, "end": 2218.44, "text": " and yeah I wonder if really anything like particularly is has I wonder whether these people are happy"}, {"start": 2218.44, "end": 2225.8, "text": " now yeah I just I wonder and if if they are I wonder whether it's really for the reason that they"}, {"start": 2225.8, "end": 2233.0800000000004, "text": " claim that oh now we have a statement here of how it impacts society because I could have told you"}, {"start": 2233.08, "end": 2237.64, "text": " that before could have told you that before I even read the title of the paper right what the"}, {"start": 2237.64, "end": 2244.04, "text": " broader impact statement is going to be in any case rent too long check out paper share it out"}, {"start": 2244.04, "end": 2273.88, "text": " leave a like comment if you disagree or agree yeah bye bye"}] |
Yannic Kilcher | 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 François Cholet. 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 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 it at 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 Scarf, 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 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 go or. Like something very, very measurable and IQ test is a specific task. So these things right here throw all tasks, but these tasks aren't the thing we're interested in just because the 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 Sholeh says you have to optimize directly for generality and flexibility rather than task performance if you want to build a an intelligent agent, right? 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 that's almost a quote, quote worthy thing. So if you just give it a single task, it says that the learner will will just take any available shortcuts. So if you just say you have to be good at chess, you can 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. Okay. That's why we say hard coded chat bots are not intelligent. So hard coded chat bots, they simply match your input to a database of reg X's 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 X's, they... 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 Sholes 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 2, 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, Sholes 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, 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 environments are really a dense sampling of the environment space. It will be able, even though it has never seen environment 2, right, 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 2. But also, we wouldn't view that as intelligent because in a sense, this skill has been bought with data. And this notion of buying skill is comes up a lot in this paper. So Sholes 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, Sholes 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 a GPT3, 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 GPT3 came out, I've had people commenting on the part one of this paper saying, isn't GPT3 intelligent? Because it can sort of generalize to these tasks that it hasn't been trained on. By the way, if you haven't seen the GPT3 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, GPT3 can solve these tasks that it wasn't trained for, right? And therefore you might argue in this definition right here, it could be intelligent because it can generalize. But there is this counteraction where Sholei 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 GPT3 generalizes to task it has never seen before, but also it has had a lot of data. So as of right now, it is not really clear where the line is here. Like when are we going to argue that GPT3 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 there is like a wishy, washy thing going on. But he basically says, okay, there's the spectrum of hard coding over here and then fully learning from data and with all of these methods and in between methods, like a CNN would be here because it has like considerable priors because of its architecture and so on. 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, Sholes says this has nothing to do with this damage. 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 a it's 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 it a system has had, the more it can generalize to a new skill that doesn't mean it's intelligent. It just means it 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 that in mind, that is why we basically need to 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 priors has nothing to do with intelligence. It's just more experience, more priors. So it goes back to human intelligence. It says how universal is actually human intelligence and it gets to the point where it 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 DG factor which is used sometimes to assess human intelligence, or 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 human's tasks where they don't differentiate from one another. So it's going to be a range 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 understandable by humans and understandable ideally by any human. You don't have to have special pre-knowledge, not have studied biology in order to answer the questions or not 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 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 the longest path problem, which shouldn't be that much harder if you just look at 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 longest path problems. Because in our history, in our evolutionary history, it made a lot of sense to build in a navigational unit in the brain that calculates shortest rowdings, but it's probably like the, your fitness is not very much affected by you being able to calculate the longest path and bless you and really avoid something. And just, 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 when we talk about general artificial intelligence, what we mean is it's tied 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. Yeah, 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 is 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 we ask ourselves, what are priors of humans? What has evolution built into humans? And Sholei decides on three levels of priors, the low level priors which are like reflexes. So if I pinch you, you flick, like if I flick you, you move back and if I shine a bright light at your eyes, you close them and so on. So this Sholei says, it's not very interesting because that's say nothing to do. Like we feel that it has nothing to do with intelligence. Okay. And then there are, I'm going to skip this one, say 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 these objects. The navigation capability, we say, okay, 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 direct itness. 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 Shulei says, if we measure intelligence, this is what we must account for. Okay. So 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 wouldn't test human intelligence by making them count because that's built into the humans. Now the third kind of priors that you have are meta learning priors. And the meta learning priors is basically your ability to learn something. Okay. 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 unencounter 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. Okay, when we compare to humans. So Sholes 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 don'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 there's 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 the calculator app right here. And each layer has access to maybe also memory. I would guess memory is one of those priors as well. Or 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 because 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, let the difference between the humans and the machines into the measure of our 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 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 the language, the better you score at these tests and therefore the tests are more like a measure of language ability than intelligence. So this is a lot much informed by, so I think 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 object-ness 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 if 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 learn 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 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, I'm here, but you know, it's not my opinion, it's a show of this. 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 Sholei 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 agent, nest and goal direct nest, 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 in 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 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 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 super charge that drive for orientation. So again, this, it sort of feels like there is a lot of nature versus nurture going on in here in that all of these things, yes, you probably have a tendency built into 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, super charge 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 in prior. And then secondly, even if we could list them pretty exactly what says that we can exactly program them into an agent such that it can make use of it. That's an entirely, that's even harder challenge. So I'm not so sure of it, this AI systems should hard code core knowledge. He is going to try that with this arc challenge that we're going to look at in like the last part of this series. But it's a cool test for intelligence. I admit that, but I doubt that anyone really manages to hard code the core knowledge and he says test should only involve core knowledge. And we're going to see how valid that that claim is for his own arc challenge. Now luckily in the math part that's going to come up, 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. All right, so that was part two of this series. 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. Yeah, as I said, usually much higher quality videos than mine. And I'll see you next time. Bye-bye. | [{"start": 0.0, "end": 5.74, "text": " Hi there, today we're going to continue with on the measure of intelligence by Fran\u00e7ois"}, {"start": 5.74, "end": 6.74, "text": " Cholet."}, {"start": 6.74, "end": 12.02, "text": " Now, if you remember last time, if you haven't seen last time, go watch part one if you're"}, {"start": 12.02, "end": 13.22, "text": " interested."}, {"start": 13.22, "end": 16.12, "text": " This is a multi-part series on this paper."}, {"start": 16.12, "end": 17.12, "text": " Why?"}, {"start": 17.12, "end": 18.6, "text": " Because the paper itself is very long."}, {"start": 18.6, "end": 22.96, "text": " It's 40 pages, the main part, and it's a big wall of text."}, {"start": 22.96, "end": 29.22, "text": " So I've opted to basically pull out notes and show you the notes that I have pulled out."}, {"start": 29.22, "end": 31.38, "text": " And to divide this into multiple parts."}, {"start": 31.38, "end": 36.54, "text": " So last time we went over the history of assessing intelligence and the basics."}, {"start": 36.54, "end": 42.22, "text": " And I know I said this time I'm going to get into the math, but I lied."}, {"start": 42.22, "end": 47.739999999999995, "text": " So I realized that there's still a lot that comes up in part two of the paper before we"}, {"start": 47.739999999999995, "end": 49.019999999999996, "text": " get into it at the actual math."}, {"start": 49.019999999999996, "end": 55.5, "text": " So this part is going to be about the prerequisites to that, and then next time math."}, {"start": 55.5, "end": 58.42, "text": " I'm sorry to disappoint anyone."}, {"start": 58.42, "end": 60.58, "text": " You might just skip this one if you want."}, {"start": 60.58, "end": 67.7, "text": " I do have to shout out Tim Scarf, who of course runs the Machine Learning Street Talk channel"}, {"start": 67.7, "end": 70.78, "text": " podcast with me and Connor Shorten together."}, {"start": 70.78, "end": 76.54, "text": " Tim has just made an entire video about this paper, about on the measure of intelligence."}, {"start": 76.54, "end": 81.74000000000001, "text": " And his videos are usually like super high quality, like higher than mine."}, {"start": 81.74000000000001, "end": 84.22, "text": " And it's the entire paper."}, {"start": 84.22, "end": 89.86, "text": " So if you want to know the end of the story or have a different take on the paper, definitely"}, {"start": 89.86, "end": 92.14, "text": " can recommend his video."}, {"start": 92.14, "end": 95.42, "text": " I do make a guest appearance there."}, {"start": 95.42, "end": 99.14, "text": " So yeah, that's that's a given."}, {"start": 99.14, "end": 106.25999999999999, "text": " And I will still finish the paper on this channel just in my regular in this style right here."}, {"start": 106.25999999999999, "end": 109.82, "text": " So all the options are available to you."}, {"start": 109.82, "end": 111.22, "text": " Let's dive into part two."}, {"start": 111.22, "end": 118.14, "text": " So if you remember part one, we sort of went over what it means to be intelligent."}, {"start": 118.14, "end": 124.98, "text": " And we differentiated basically two things, which are skills and abilities."}, {"start": 124.98, "end": 132.22, "text": " So a skill is how well you achieve a given task or how well you can do in a given task."}, {"start": 132.22, "end": 137.26, "text": " So this could be chess or go or."}, {"start": 137.26, "end": 141.89999999999998, "text": " Like something very, very measurable and IQ test is a specific task."}, {"start": 141.89999999999998, "end": 147.34, "text": " So these things right here throw all tasks, but these tasks aren't the thing we're interested"}, {"start": 147.34, "end": 149.62, "text": " in just because the machine is good at chess."}, {"start": 149.62, "end": 151.82, "text": " Doesn't mean it's intelligent."}, {"start": 151.82, "end": 157.14, "text": " And what we want is sort of a generalizable skill."}, {"start": 157.14, "end": 161.42, "text": " So we want to assess how generalizable is an ability."}, {"start": 161.42, "end": 166.82, "text": " So can I throw a computer at a new problem that it has never seen before and it can solve"}, {"start": 166.82, "end": 167.82, "text": " that."}, {"start": 167.82, "end": 172.34, "text": " And that's going to be this generalizability, this notion of can you solve things that"}, {"start": 172.34, "end": 177.62, "text": " you have never encountered before and weren't prepared for that is going to be the basis"}, {"start": 177.62, "end": 181.14, "text": " for us to measure intelligence."}, {"start": 181.14, "end": 187.98, "text": " So Sholeh says you have to optimize directly for generality and flexibility rather than"}, {"start": 187.98, "end": 193.01999999999998, "text": " task performance if you want to build a an intelligent agent, right?"}, {"start": 193.02, "end": 197.26000000000002, "text": " You have to sort of build something that is not just good at a thing."}, {"start": 197.26000000000002, "end": 200.66000000000003, "text": " It is good at getting good at things."}, {"start": 200.66000000000003, "end": 206.94, "text": " That's that's almost a quote, quote worthy thing."}, {"start": 206.94, "end": 212.38, "text": " So if you just give it a single task, it says that the learner will will just take any available"}, {"start": 212.38, "end": 213.38, "text": " shortcuts."}, {"start": 213.38, "end": 218.54000000000002, "text": " So if you just say you have to be good at chess, you can the developer of a system can exploit"}, {"start": 218.54, "end": 223.54, "text": " all the tricks that make you good at chess and you don't have to be smart."}, {"start": 223.54, "end": 227.34, "text": " You just know basically if you had enough memory, you could just memorize all the moves"}, {"start": 227.34, "end": 229.18, "text": " of all the chess games ever."}, {"start": 229.18, "end": 230.18, "text": " Okay."}, {"start": 230.18, "end": 234.18, "text": " That's why we say hard coded chat bots are not intelligent."}, {"start": 234.18, "end": 240.01999999999998, "text": " So hard coded chat bots, they simply match your input to a database of reg X's and then"}, {"start": 240.01999999999998, "end": 241.14, "text": " they answer."}, {"start": 241.14, "end": 245.98, "text": " And we're not very impressed because as soon as I give them something that is not covered"}, {"start": 245.98, "end": 248.01999999999998, "text": " by their reg X's, they..."}, {"start": 248.02, "end": 249.02, "text": " They fail."}, {"start": 249.02, "end": 253.14000000000001, "text": " They just say, I don't know or something like this."}, {"start": 253.14000000000001, "end": 257.26, "text": " In fact, what is intelligent is the engineer in that case."}, {"start": 257.26, "end": 262.86, "text": " So the engineer that makes the program is intelligent."}, {"start": 262.86, "end": 270.18, "text": " So he has this drawing, I think I've shown it last time, where you have the environment."}, {"start": 270.18, "end": 273.38, "text": " And there is this agent."}, {"start": 273.38, "end": 280.26, "text": " And if the agent is really good with the environment, you might consider that intelligent, but in"}, {"start": 280.26, "end": 285.65999999999997, "text": " Sholes mind, you have to also consider here the developer of the agent."}, {"start": 285.65999999999997, "end": 291.65999999999997, "text": " It could be that the developer is very intelligent and just builds the agent to interact with"}, {"start": 291.65999999999997, "end": 294.78, "text": " the environment in a matter that it gets a lot of reward."}, {"start": 294.78, "end": 300.98, "text": " It's very good at a skill, but the agent itself might not be intelligent."}, {"start": 300.98, "end": 307.42, "text": " So it says intelligence, the intelligence of a process is not encoded by the performance"}, {"start": 307.42, "end": 313.06, "text": " of a system, but by the fact that the same process can be applied to different tasks."}, {"start": 313.06, "end": 318.82, "text": " So in this case, if I have a new task, a new environment, so E2 right here, the question"}, {"start": 318.82, "end": 325.46000000000004, "text": " is, could I throw the same agent at that, even if it hasn't seen it before, or would I"}, {"start": 325.46, "end": 331.34, "text": " be able to take the same developer that develops me a new agent, agent 2, that then can solve"}, {"start": 331.34, "end": 332.34, "text": " the task."}, {"start": 332.34, "end": 337.9, "text": " In the case where I can throw over the agent, that would make an argument that the agent"}, {"start": 337.9, "end": 339.14, "text": " is intelligent."}, {"start": 339.14, "end": 344.06, "text": " But if I can't, you'd have to make the argument that the developer is the intelligent part"}, {"start": 344.06, "end": 349.26, "text": " here, which of course is the point of what he's saying right here."}, {"start": 349.26, "end": 353.82, "text": " So hard coded programs themselves are not intelligent."}, {"start": 353.82, "end": 358.14, "text": " But, and this is the case, the same counts for adding more training data."}, {"start": 358.14, "end": 365.82, "text": " So not only is the hard coding not intelligent, it's also, Sholes says, not intelligence if"}, {"start": 365.82, "end": 367.74, "text": " you simply add more training data."}, {"start": 367.74, "end": 373.42, "text": " So a machine learning system that sort of learns to how to interact with these environments."}, {"start": 373.42, "end": 380.74, "text": " If you can imagine that you have lots of environments, environment, environment, environment,"}, {"start": 380.74, "end": 386.38, "text": " and so on, that give you a dense sampling of the environment space."}, {"start": 386.38, "end": 390.98, "text": " So you have all of these environments, you build all of them, and you train this agent"}, {"start": 390.98, "end": 392.82, "text": " to interact well with all of them."}, {"start": 392.82, "end": 398.7, "text": " So you give it lots of compute, lots of data, and the environments are really a dense sampling"}, {"start": 398.7, "end": 400.46000000000004, "text": " of the environment space."}, {"start": 400.46000000000004, "end": 405.06, "text": " It will be able, even though it has never seen environment 2, right, this environment right"}, {"start": 405.06, "end": 410.46000000000004, "text": " here, it might be just able to generalize to this environment, given that it has been"}, {"start": 410.46, "end": 416.7, "text": " trained on all the environments here, like it has been trained on every possible environment"}, {"start": 416.7, "end": 421.97999999999996, "text": " around this environment that is similar to this environment, it could generally generalize"}, {"start": 421.97999999999996, "end": 424.34, "text": " to environment 2."}, {"start": 424.34, "end": 430.41999999999996, "text": " But also, we wouldn't view that as intelligent because in a sense, this skill has been bought"}, {"start": 430.41999999999996, "end": 432.09999999999997, "text": " with data."}, {"start": 432.09999999999997, "end": 437.26, "text": " And this notion of buying skill is comes up a lot in this paper."}, {"start": 437.26, "end": 440.82, "text": " So Sholes says there are two ways to buy a skill."}, {"start": 440.82, "end": 448.62, "text": " And by buying, he basically means you don't buying as opposed to intelligently solving the"}, {"start": 448.62, "end": 449.62, "text": " skill."}, {"start": 449.62, "end": 455.53999999999996, "text": " So whenever you buy a skill, that's not intelligence, Sholes says, and you can buy a skill by either"}, {"start": 455.53999999999996, "end": 458.3, "text": " hard coding the solution or giving lots of data."}, {"start": 458.3, "end": 464.26, "text": " And there is like this spectrum where you hard code, completely hard code a solution."}, {"start": 464.26, "end": 467.86, "text": " And here is where you completely only feed data."}, {"start": 467.86, "end": 472.62, "text": " So here would be something like a GPT3, right?"}, {"start": 472.62, "end": 474.46, "text": " There are almost no priors there."}, {"start": 474.46, "end": 481.38, "text": " It's just a transformer, big transformer, and you just throw in data, lots and lots and"}, {"start": 481.38, "end": 482.5, "text": " lots and lots and lots of data."}, {"start": 482.5, "end": 487.5, "text": " So in this measure, last time I've had lots of people, when GPT3 came out, I've had people"}, {"start": 487.5, "end": 494.21999999999997, "text": " commenting on the part one of this paper saying, isn't GPT3 intelligent?"}, {"start": 494.22, "end": 498.98, "text": " Because it can sort of generalize to these tasks that it hasn't been trained on."}, {"start": 498.98, "end": 505.1, "text": " By the way, if you haven't seen the GPT3 video, you should go watch it."}, {"start": 505.1, "end": 507.06, "text": " Something tells me this video is popular."}, {"start": 507.06, "end": 511.74, "text": " It might be the five times as many views as any other video."}, {"start": 511.74, "end": 516.02, "text": " So at least it's not a terrible video."}, {"start": 516.02, "end": 521.5400000000001, "text": " But in essence, GPT3 can solve these tasks that it wasn't trained for, right?"}, {"start": 521.54, "end": 526.2199999999999, "text": " And therefore you might argue in this definition right here, it could be intelligent because it"}, {"start": 526.2199999999999, "end": 527.54, "text": " can generalize."}, {"start": 527.54, "end": 534.3399999999999, "text": " But there is this counteraction where Sholei says, maybe you have just bought that skill"}, {"start": 534.3399999999999, "end": 536.26, "text": " with lots and lots of data."}, {"start": 536.26, "end": 541.9, "text": " Now I actually don't know what to say to this because I mean, it really seems like GPT3"}, {"start": 541.9, "end": 549.4599999999999, "text": " generalizes to task it has never seen before, but also it has had a lot of data."}, {"start": 549.46, "end": 554.22, "text": " So as of right now, it is not really clear where the line is here."}, {"start": 554.22, "end": 559.22, "text": " Like when are we going to argue that GPT3 is actually like it could be that it has had"}, {"start": 559.22, "end": 561.9000000000001, "text": " lots of data, but also it is intelligent."}, {"start": 561.9000000000001, "end": 564.3000000000001, "text": " How are we going to make that distinction?"}, {"start": 564.3000000000001, "end": 569.94, "text": " And I guess we're going to get into the math part, but I can tell you right now, the"}, {"start": 569.94, "end": 576.5, "text": " math part is so abstract as it is not really practical."}, {"start": 576.5, "end": 583.5, "text": " It is like a theoretical framework that you might be able to approximate, but there is"}, {"start": 583.5, "end": 586.3, "text": " like a wishy, washy thing going on."}, {"start": 586.3, "end": 591.9, "text": " But he basically says, okay, there's the spectrum of hard coding over here and then fully"}, {"start": 591.9, "end": 597.22, "text": " learning from data and with all of these methods and in between methods, like a CNN would"}, {"start": 597.22, "end": 601.98, "text": " be here because it has like considerable priors because of its architecture and so on."}, {"start": 601.98, "end": 608.02, "text": " Over here would be something like an A-star search with like a learned heuristic or things"}, {"start": 608.02, "end": 610.54, "text": " like this."}, {"start": 610.54, "end": 616.98, "text": " You can get good with any of these things, but the intelligence is orthogonal to that."}, {"start": 616.98, "end": 621.46, "text": " So orthogonal to that is the intelligence axis."}, {"start": 621.46, "end": 625.98, "text": " It has nothing, Sholes says this has nothing to do with this damage."}, {"start": 625.98, "end": 631.3000000000001, "text": " You can buy skill with this, but it's basically like it's like a triangle, almost sort"}, {"start": 631.3, "end": 638.06, "text": " of where you have hard coding data and then intelligence."}, {"start": 638.06, "end": 642.74, "text": " And it's like a it's own axis."}, {"start": 642.74, "end": 648.9399999999999, "text": " So the hard coding refers to the priors of a system that the developer has basically built"}, {"start": 648.9399999999999, "end": 655.2199999999999, "text": " in and the learning from data refers to its experience."}, {"start": 655.2199999999999, "end": 660.42, "text": " So basically the more experience it a system has had, the more it can generalize to a new"}, {"start": 660.42, "end": 662.42, "text": " skill that doesn't mean it's intelligent."}, {"start": 662.42, "end": 668.9399999999999, "text": " It just means it had more experience or respectively more priors."}, {"start": 668.9399999999999, "end": 672.9799999999999, "text": " So the example gives a locality sensitive hashing which is basically like a nearest neighbor"}, {"start": 672.9799999999999, "end": 677.66, "text": " method with enough data can solve any task, right?"}, {"start": 677.66, "end": 681.0999999999999, "text": " Like nearest neighbor enough data can solve any task."}, {"start": 681.0999999999999, "end": 686.26, "text": " That's I think it's a famous theorem that that establishes that."}, {"start": 686.26, "end": 693.58, "text": " So keep that in mind, that is why we basically need to pay attention to how much data went"}, {"start": 693.58, "end": 699.9399999999999, "text": " into this algorithm and sort of subtract that from our notion of how good, how intelligent"}, {"start": 699.9399999999999, "end": 701.9399999999999, "text": " it is."}, {"start": 701.9399999999999, "end": 704.3, "text": " Yeah, that's what he says."}, {"start": 704.3, "end": 708.5, "text": " When we measure intelligence via skill and this is really the only thing we can measure,"}, {"start": 708.5, "end": 712.5, "text": " we can only measure how good an agent is at a given skill."}, {"start": 712.5, "end": 714.78, "text": " Anything higher than that we can't measure."}, {"start": 714.78, "end": 721.6999999999999, "text": " So we must measure a skill but we should factor out priors and experience and that's going"}, {"start": 721.6999999999999, "end": 722.6999999999999, "text": " to come up later."}, {"start": 722.6999999999999, "end": 725.22, "text": " We should also pay attention to generalization difficulty."}, {"start": 725.22, "end": 732.5799999999999, "text": " So generally how difficult is the task to solve given the experience we had because if"}, {"start": 732.5799999999999, "end": 736.38, "text": " the task is more difficult in a generalization sense."}, {"start": 736.38, "end": 742.9399999999999, "text": " So if it's harder to from what we know get to the point where we can solve the task,"}, {"start": 742.94, "end": 746.34, "text": " then that would display higher intelligence."}, {"start": 746.34, "end": 753.46, "text": " Yeah, it says solving tasks via experience priors has nothing to do with intelligence."}, {"start": 753.46, "end": 757.1800000000001, "text": " It's just more experience, more priors."}, {"start": 757.1800000000001, "end": 760.1, "text": " So it goes back to human intelligence."}, {"start": 760.1, "end": 766.82, "text": " It says how universal is actually human intelligence and it gets to the point where it says it's"}, {"start": 766.82, "end": 772.82, "text": " not very universal because first of all there's no free lunch theorem where it says any"}, {"start": 772.82, "end": 778.5400000000001, "text": " two optimization algorithms will perform the same if you integrate across all possible"}, {"start": 778.5400000000001, "end": 779.5400000000001, "text": " problems."}, {"start": 779.5400000000001, "end": 784.94, "text": " So it's even questionable whether something like general intelligence could even like universal"}, {"start": 784.94, "end": 786.94, "text": " intelligence could even exist."}, {"start": 786.94, "end": 793.34, "text": " But if we look at the DG factor which is used sometimes to assess human intelligence,"}, {"start": 793.34, "end": 800.0200000000001, "text": " or is the measure for human intelligence that is established right now, then they only"}, {"start": 800.02, "end": 803.8199999999999, "text": " encompass tasks that humans can perform and understand."}, {"start": 803.8199999999999, "end": 809.26, "text": " Of course, and I would say they only encompass tasks where human actually differ with respect"}, {"start": 809.26, "end": 814.3, "text": " to each other because if you're making these tests and you have a human for 40 minutes"}, {"start": 814.3, "end": 818.86, "text": " or so, you're not going to give the human's tasks where they don't differentiate from one"}, {"start": 818.86, "end": 819.86, "text": " another."}, {"start": 819.86, "end": 826.42, "text": " So it's going to be a range like a very, very small subset of tasks that are exactly hard"}, {"start": 826.42, "end": 832.02, "text": " enough such that a couple of humans can solve them, a couple of humans can't solve them."}, {"start": 832.02, "end": 840.8199999999999, "text": " They're going to be understandable by humans and understandable ideally by any human."}, {"start": 840.8199999999999, "end": 845.86, "text": " You don't have to have special pre-knowledge, not have studied biology in order to answer"}, {"start": 845.86, "end": 850.6999999999999, "text": " the questions or not have a higher degree in math or something."}, {"start": 850.7, "end": 859.74, "text": " So the reference for the G factor is very much a reference frame of human values."}, {"start": 859.74, "end": 862.4200000000001, "text": " And he compares this to physical fitness."}, {"start": 862.4200000000001, "end": 867.46, "text": " So if we call someone physically fit, what do we mean?"}, {"start": 867.46, "end": 872.9000000000001, "text": " We mean this general abstract concept, right, of physical fitness where it's not really"}, {"start": 872.9000000000001, "end": 875.0200000000001, "text": " one skill."}, {"start": 875.0200000000001, "end": 879.34, "text": " So you can measure humans in how fast they run, how high they jump, you know, how fast"}, {"start": 879.34, "end": 884.1, "text": " they swim and so on and how much they can lift."}, {"start": 884.1, "end": 889.7800000000001, "text": " And across that you'll find generally that all of these things correlate and the result"}, {"start": 889.7800000000001, "end": 892.0600000000001, "text": " we call physical fitness."}, {"start": 892.0600000000001, "end": 895.7, "text": " But it's not like physical fitness is a universal measure."}, {"start": 895.7, "end": 901.7800000000001, "text": " So we only measure humans at tasks that humans can solve and are different at."}, {"start": 901.7800000000001, "end": 907.9000000000001, "text": " So the physical fitness is very human centric and so is intelligence."}, {"start": 907.9, "end": 912.22, "text": " So that's the analogy is I think it's a very good one."}, {"start": 912.22, "end": 919.9399999999999, "text": " He says, he gives this example where humans are, for example, very, very good at shortest"}, {"start": 919.9399999999999, "end": 925.66, "text": " path traveling salesman problems, give up to a certain number of nodes in the graph."}, {"start": 925.66, "end": 930.26, "text": " Humans can solve them extremely well to like very good degree."}, {"start": 930.26, "end": 935.74, "text": " But as soon as you go to the longest path problem, which shouldn't be that much harder if"}, {"start": 935.74, "end": 941.9, "text": " you just look at it from an algorithmic perspective, but humans are terrible at it."}, {"start": 941.9, "end": 943.3, "text": " Absolutely terrible."}, {"start": 943.3, "end": 950.42, "text": " And that probably has to do with the fact that we have a prior and the prior is much,"}, {"start": 950.42, "end": 955.22, "text": " much more adapt to shortest path problems than longest path problems."}, {"start": 955.22, "end": 960.1, "text": " Because in our history, in our evolutionary history, it made a lot of sense to build in"}, {"start": 960.1, "end": 967.4200000000001, "text": " a navigational unit in the brain that calculates shortest rowdings, but it's probably like"}, {"start": 967.4200000000001, "end": 973.66, "text": " the, your fitness is not very much affected by you being able to calculate the longest path"}, {"start": 973.66, "end": 978.74, "text": " and bless you and really avoid something."}, {"start": 978.74, "end": 984.1800000000001, "text": " And just, I don't know, you really want to walk in these shoes."}, {"start": 984.1800000000001, "end": 987.3000000000001, "text": " So that should be taken into effect."}, {"start": 987.3, "end": 991.9799999999999, "text": " And it shows that intelligence is a very human centric concept."}, {"start": 991.9799999999999, "end": 999.38, "text": " So when we talk about general artificial intelligence, what we mean is it's tied to"}, {"start": 999.38, "end": 1000.78, "text": " a scope of problems."}, {"start": 1000.78, "end": 1005.0999999999999, "text": " And that's going to be important that we can only measure intelligence in this framework"}, {"start": 1005.0999999999999, "end": 1014.74, "text": " with respect to a scope of problems and the scope that we consider is the human scope."}, {"start": 1014.74, "end": 1018.7, "text": " Yeah, so why human centric?"}, {"start": 1018.7, "end": 1020.46, "text": " Because we must have a scope."}, {"start": 1020.46, "end": 1022.62, "text": " And the human scope is the only meaningful scope."}, {"start": 1022.62, "end": 1029.46, "text": " It's the only one we know that, you know, there is one thing in the universe that we think"}, {"start": 1029.46, "end": 1032.5, "text": " is intelligent that we know of and that's humans."}, {"start": 1032.5, "end": 1038.5, "text": " And or to a degree like, what can make the argument is general biological life on earth."}, {"start": 1038.5, "end": 1045.42, "text": " But we measure intelligence with a human scope intelligence test and that's the thing we"}, {"start": 1045.42, "end": 1046.42, "text": " have."}, {"start": 1046.42, "end": 1050.26, "text": " We don't have anything else."}, {"start": 1050.26, "end": 1055.26, "text": " So we ask ourselves, what are priors of humans?"}, {"start": 1055.26, "end": 1059.9, "text": " What has evolution built into humans?"}, {"start": 1059.9, "end": 1066.54, "text": " And Sholei decides on three levels of priors, the low level priors which are like reflexes."}, {"start": 1066.54, "end": 1075.1, "text": " So if I pinch you, you flick, like if I flick you, you move back and if I shine a bright"}, {"start": 1075.1, "end": 1079.3, "text": " light at your eyes, you close them and so on."}, {"start": 1079.3, "end": 1084.18, "text": " So this Sholei says, it's not very interesting because that's say nothing to do."}, {"start": 1084.18, "end": 1086.98, "text": " Like we feel that it has nothing to do with intelligence."}, {"start": 1086.98, "end": 1087.98, "text": " Okay."}, {"start": 1087.98, "end": 1093.06, "text": " And then there are, I'm going to skip this one, say there are knowledge priors."}, {"start": 1093.06, "end": 1101.86, "text": " So the knowledge priors are, you know, things like the fact that there are objects in this"}, {"start": 1101.86, "end": 1102.86, "text": " world."}, {"start": 1102.86, "end": 1104.3799999999999, "text": " That's a knowledge prior that the human have."}, {"start": 1104.3799999999999, "end": 1111.1399999999999, "text": " That's built into you, the notion that the world consists of objects and you can interact"}, {"start": 1111.1399999999999, "end": 1114.1399999999999, "text": " with these objects."}, {"start": 1114.1399999999999, "end": 1119.94, "text": " The navigation capability, we say, okay, navigate there."}, {"start": 1119.94, "end": 1121.58, "text": " Humans can do it very, very well."}, {"start": 1121.58, "end": 1128.9399999999998, "text": " As I already said, they're very good at shortest path problems and so on, intuitive navigation."}, {"start": 1128.9399999999998, "end": 1131.22, "text": " That's built into you by evolution."}, {"start": 1131.22, "end": 1134.62, "text": " That's a prior goal direct itness."}, {"start": 1134.62, "end": 1141.86, "text": " Humans generally view the world in terms of agents and in terms of agents having a goal,"}, {"start": 1141.86, "end": 1145.26, "text": " like chasing after something, he makes this example."}, {"start": 1145.26, "end": 1150.3799999999999, "text": " And if we observe something, we often want to frame it in terms of agents that pursue"}, {"start": 1150.38, "end": 1155.94, "text": " goals and as soon as we can do that, that allows us to some degree to predict the world."}, {"start": 1155.94, "end": 1157.7800000000002, "text": " And that's probably why this evolved."}, {"start": 1157.7800000000002, "end": 1161.2600000000002, "text": " So very valuable skill."}, {"start": 1161.2600000000002, "end": 1167.8600000000001, "text": " Social intuition and things like counting, like basic arithmetic are built into humans."}, {"start": 1167.8600000000001, "end": 1172.94, "text": " And Shulei says, if we measure intelligence, this is what we must account for."}, {"start": 1172.94, "end": 1173.94, "text": " Okay."}, {"start": 1173.94, "end": 1178.94, "text": " So these things should not count towards intelligence because they're already built"}, {"start": 1178.94, "end": 1180.1000000000001, "text": " into humans."}, {"start": 1180.1, "end": 1185.2199999999998, "text": " If we measure human intelligence, so you wouldn't give, you wouldn't test human intelligence"}, {"start": 1185.2199999999998, "end": 1191.86, "text": " by making them count because that's built into the humans."}, {"start": 1191.86, "end": 1196.98, "text": " Now the third kind of priors that you have are meta learning priors."}, {"start": 1196.98, "end": 1202.1, "text": " And the meta learning priors is basically your ability to learn something."}, {"start": 1202.1, "end": 1203.1, "text": " Okay."}, {"start": 1203.1, "end": 1207.54, "text": " This is your meta learning priors, just your ability to learn something that is not learned."}, {"start": 1207.54, "end": 1210.78, "text": " No one has to teach you how to learn something."}, {"start": 1210.78, "end": 1216.3799999999999, "text": " I guess they're like learning strategies and so on, but you as a human are incredibly"}, {"start": 1216.3799999999999, "end": 1223.58, "text": " good at picking up new skills and the skill of picking up new skills, that's your, that's"}, {"start": 1223.58, "end": 1225.78, "text": " built into you."}, {"start": 1225.78, "end": 1231.46, "text": " Among these are assumptions that the world is a hierarchical and causal place."}, {"start": 1231.46, "end": 1232.98, "text": " That's how you see the world."}, {"start": 1232.98, "end": 1238.54, "text": " And because you see the world like this, you can pick up these new skills very, very quickly."}, {"start": 1238.54, "end": 1240.94, "text": " You can explain through explaining the world."}, {"start": 1240.94, "end": 1243.02, "text": " You can pick up new skills."}, {"start": 1243.02, "end": 1246.5, "text": " And that is usually what we mean by intelligence."}, {"start": 1246.5, "end": 1253.66, "text": " If someone sees a new unencounter before situation, thinks about it, which basically interprets"}, {"start": 1253.66, "end": 1259.66, "text": " the world in the hierarchical and causal way, and then is able to come up with a skill"}, {"start": 1259.66, "end": 1261.3, "text": " that solves the problem."}, {"start": 1261.3, "end": 1264.86, "text": " And we generally view that as intelligence."}, {"start": 1264.86, "end": 1269.34, "text": " So if we want to measure intelligence, we should measure this, basically how good you"}, {"start": 1269.34, "end": 1273.74, "text": " are picking up new skills while accounting for these things."}, {"start": 1273.74, "end": 1278.34, "text": " Okay, when we compare to humans."}, {"start": 1278.34, "end": 1283.82, "text": " So Sholes says tests of intelligence should be founded on human like knowledge priors."}, {"start": 1283.82, "end": 1290.78, "text": " And basically makes the case that these should, if we build machines and compare them"}, {"start": 1290.78, "end": 1299.3799999999999, "text": " to humans in, let's say in terms of intelligence, we should build into the machines, these things"}, {"start": 1299.3799999999999, "end": 1304.34, "text": " right here, these we should give them like we should give them a counting module that they"}, {"start": 1304.34, "end": 1306.46, "text": " can use like a calculator app."}, {"start": 1306.46, "end": 1312.18, "text": " We should just build that in and make that available for the agent to use like basic arithmetic."}, {"start": 1312.18, "end": 1313.78, "text": " You don't have to learn this."}, {"start": 1313.78, "end": 1317.18, "text": " We should build in the notion that there are objects."}, {"start": 1317.18, "end": 1322.1000000000001, "text": " We should build in the basic navigation module and so on that the agent can use."}, {"start": 1322.1000000000001, "end": 1328.18, "text": " You can almost think of it like there's whatever your reinforcement learning agent A, it consists"}, {"start": 1328.18, "end": 1333.9, "text": " of like this, maybe this big neural network with lots of layers, but then each layer maybe"}, {"start": 1333.9, "end": 1338.5800000000002, "text": " has access to the calculator app right here."}, {"start": 1338.5800000000002, "end": 1342.26, "text": " And each layer has access to maybe also memory."}, {"start": 1342.26, "end": 1346.3400000000001, "text": " I would guess memory is one of those priors as well."}, {"start": 1346.34, "end": 1349.02, "text": " Or it has access to a navigation prior."}, {"start": 1349.02, "end": 1351.3, "text": " Let's draw a little world map right here."}, {"start": 1351.3, "end": 1352.58, "text": " This is Google Maps."}, {"start": 1352.58, "end": 1355.3799999999999, "text": " It can do that, it can query that sort of."}, {"start": 1355.3799999999999, "end": 1362.4599999999998, "text": " And we shouldn't, if we want to build something that's intelligent because compared to humans,"}, {"start": 1362.4599999999998, "end": 1365.6599999999999, "text": " we shouldn't, we should build in the navigation."}, {"start": 1365.6599999999999, "end": 1369.58, "text": " We shouldn't at least as much as human can do it."}, {"start": 1369.58, "end": 1374.22, "text": " I mean, it's cool to have a machine learning system learn navigation, but that makes it"}, {"start": 1374.22, "end": 1375.62, "text": " less comparable."}, {"start": 1375.62, "end": 1380.9399999999998, "text": " So it says either we should match the humans or we should account for the difference."}, {"start": 1380.9399999999998, "end": 1386.5, "text": " So we should kind of let the difference be in, let the difference between the humans and"}, {"start": 1386.5, "end": 1390.9399999999998, "text": " the machines into the measure of our intelligence."}, {"start": 1390.9399999999998, "end": 1397.4199999999998, "text": " Further, if you test intelligence, all of these priors should be explicitly described and"}, {"start": 1397.4199999999998, "end": 1400.1399999999999, "text": " not rely on additional priors."}, {"start": 1400.14, "end": 1407.5400000000002, "text": " So that's often the case in IQ tests, there are so many priors that are not explicitly"}, {"start": 1407.5400000000002, "end": 1412.3000000000002, "text": " described because we just, you know, we just think, yeah, every human can count."}, {"start": 1412.3000000000002, "end": 1418.7, "text": " We don't need to write down that our prior assumptions are that the humans can count"}, {"start": 1418.7, "end": 1420.38, "text": " or understand language."}, {"start": 1420.38, "end": 1426.42, "text": " And that's, I hear sometimes a problem in IQ tests that basically the better you understand"}, {"start": 1426.42, "end": 1431.66, "text": " the language, the better you score at these tests and therefore the tests are more like"}, {"start": 1431.66, "end": 1434.3400000000001, "text": " a measure of language ability than intelligence."}, {"start": 1434.3400000000001, "end": 1443.3000000000002, "text": " So this is a lot much informed by, so I think the psychometrics community is on the same"}, {"start": 1443.3000000000002, "end": 1445.9, "text": " path right here."}, {"start": 1445.9, "end": 1452.26, "text": " Yeah, he goes into this theory of human core knowledge where he basically expands on what"}, {"start": 1452.26, "end": 1454.74, "text": " the human priors are."}, {"start": 1454.74, "end": 1461.02, "text": " So this core knowledge theory takes four, takes on four different categories."}, {"start": 1461.02, "end": 1465.58, "text": " So the first one is object-ness and elementary physics, which means you as a human have an"}, {"start": 1465.58, "end": 1470.58, "text": " inherent knowledge that there are objects, as I said, but also of elementary physics that"}, {"start": 1470.58, "end": 1474.18, "text": " stuff sticks together, persistence of objects."}, {"start": 1474.18, "end": 1476.98, "text": " And some people say, you know, this is learned."}, {"start": 1476.98, "end": 1481.58, "text": " So children, young children, they do, they do not know object persistence and that's why"}, {"start": 1481.58, "end": 1487.46, "text": " peekaboo is so interesting, but because they think you're gone, right?"}, {"start": 1487.46, "end": 1492.82, "text": " They think, you know, if if if if parent goes to the to the toilet, they really think the"}, {"start": 1492.82, "end": 1498.3, "text": " parent doesn't exist anymore and only later they learn object persistence."}, {"start": 1498.3, "end": 1502.86, "text": " But I would question whether or not that's actually a learn thing or simply a built-in"}, {"start": 1502.86, "end": 1508.78, "text": " module that gets switched on at that particular point because probably evolution deems it"}, {"start": 1508.78, "end": 1513.82, "text": " not necessary to to waste resources on that module before that."}, {"start": 1513.82, "end": 1520.26, "text": " So I would, you know, I would, I would be cautionary saying that object persistence and all of"}, {"start": 1520.26, "end": 1523.1, "text": " these things, in fact, are learned."}, {"start": 1523.1, "end": 1529.5, "text": " I would argue more that they are built in and are simply switched on at a given time"}, {"start": 1529.5, "end": 1531.74, "text": " during development."}, {"start": 1531.74, "end": 1536.02, "text": " Because we also know these things like if like object persistence, I think that's you"}, {"start": 1536.02, "end": 1541.34, "text": " can almost pinpoint the month of a human's life when that's switched on."}, {"start": 1541.34, "end": 1543.26, "text": " That will be so accurate."}, {"start": 1543.26, "end": 1549.34, "text": " And if this is really learned, then, you know, you'd have to assume like a very regular"}, {"start": 1549.34, "end": 1554.74, "text": " structure of the training data distribution that a baby gets to experience."}, {"start": 1554.74, "end": 1561.7, "text": " So I'm not sure, I'm here, but you know, it's not my opinion, it's a show of this."}, {"start": 1561.7, "end": 1566.74, "text": " Yeah, contact interaction, the fact that you can interact with objects by contacting"}, {"start": 1566.74, "end": 1572.3, "text": " them, or that objects can interact with each other by being next to each other."}, {"start": 1572.3, "end": 1573.94, "text": " That's built into you as well."}, {"start": 1573.94, "end": 1575.18, "text": " You don't have to learn that."}, {"start": 1575.18, "end": 1582.5, "text": " If you compare this to like an RL agent that has to learn all of this from pixels, basically,"}, {"start": 1582.5, "end": 1590.14, "text": " you can see why Sholei has a problem with the current direction of deep learning and"}, {"start": 1590.14, "end": 1597.8200000000002, "text": " claiming that things are intelligent there because the comparison is just very invalid."}, {"start": 1597.8200000000002, "end": 1602.5400000000002, "text": " So the second core knowledge you have is agent, nest and goal direct nest, and we have"}, {"start": 1602.5400000000002, "end": 1604.3400000000001, "text": " already discussed that."}, {"start": 1604.3400000000001, "end": 1608.94, "text": " Then natural numbers and elementary arithmetic in, you know, you can small numbers, you can"}, {"start": 1608.94, "end": 1615.1000000000001, "text": " add subtract, compare, sort, that sort of thing, and elementary geometry and topology, where"}, {"start": 1615.1, "end": 1621.4199999999998, "text": " in there would be orientation and navigation and then distance orientation."}, {"start": 1621.4199999999998, "end": 1625.5, "text": " If it's something is inside or outside of in a room and so on."}, {"start": 1625.5, "end": 1632.82, "text": " Now I have heard and this might be a myth that there are languages where left and right,"}, {"start": 1632.82, "end": 1637.54, "text": " like relative directions have no meaning, like doesn't exist in the language, but they"}, {"start": 1637.54, "end": 1640.34, "text": " always use absolute directions."}, {"start": 1640.34, "end": 1646.62, "text": " And then these people automatically have a much, much better orientation at all time."}, {"start": 1646.62, "end": 1650.9399999999998, "text": " Like if they get into a building, they can always tell you where north is."}, {"start": 1650.9399999999998, "end": 1656.6599999999999, "text": " I don't that's maybe that's a myth, but I would guess that's pretty cool and just shows"}, {"start": 1656.6599999999999, "end": 1659.62, "text": " you the flexibility of something like orientation."}, {"start": 1659.62, "end": 1663.86, "text": " Sure, we can all orient, but it seems like by simply learning a different language, you"}, {"start": 1663.86, "end": 1669.3799999999999, "text": " can sort of super charge that drive for orientation."}, {"start": 1669.38, "end": 1675.3400000000001, "text": " So again, this, it sort of feels like there is a lot of nature versus nurture going on"}, {"start": 1675.3400000000001, "end": 1680.98, "text": " in here in that all of these things, yes, you probably have a tendency built into learn"}, {"start": 1680.98, "end": 1688.3000000000002, "text": " objectness and physics and so on, but then also probably a lot of it might be learned in"}, {"start": 1688.3000000000002, "end": 1693.3400000000001, "text": " addition, or you might just be able to, you know, super charge one of these modules that's"}, {"start": 1693.3400000000001, "end": 1695.22, "text": " inside of you."}, {"start": 1695.22, "end": 1701.54, "text": " Yeah, I think there's lots of lots of room for discussion here."}, {"start": 1701.54, "end": 1708.82, "text": " So he says tests for intelligence should only involve core knowledge and the AI systems"}, {"start": 1708.82, "end": 1712.06, "text": " taking these tests should hard code that core knowledge."}, {"start": 1712.06, "end": 1718.26, "text": " So basically what he said before, we should build in these things right here, these core"}, {"start": 1718.26, "end": 1723.9, "text": " knowledge things, we should build these into the AI systems if we want to compare them"}, {"start": 1723.9, "end": 1729.7800000000002, "text": " to humans, because if they have these things and only these things built in, then they"}, {"start": 1729.7800000000002, "end": 1732.5400000000002, "text": " sort of have the same starting point as a human."}, {"start": 1732.5400000000002, "end": 1739.18, "text": " Now in this case, this is where I sort of disagree because like the notion that we can ever"}, {"start": 1739.18, "end": 1745.1000000000001, "text": " explicitly list the priors that humans have to me seems a bit ridiculous."}, {"start": 1745.1000000000001, "end": 1752.02, "text": " So I guess we can sort of approximate this at first, but we will never exhaustively exactly"}, {"start": 1752.02, "end": 1756.86, "text": " describe what the priors are, what is learned, we've seen this with the orientation, like"}, {"start": 1756.86, "end": 1759.46, "text": " how much of that is learned in prior."}, {"start": 1759.46, "end": 1766.98, "text": " And then secondly, even if we could list them pretty exactly what says that we can exactly"}, {"start": 1766.98, "end": 1773.1, "text": " program them into an agent such that it can make use of it."}, {"start": 1773.1, "end": 1775.66, "text": " That's an entirely, that's even harder challenge."}, {"start": 1775.66, "end": 1781.3, "text": " So I'm not so sure of it, this AI systems should hard code core knowledge."}, {"start": 1781.3, "end": 1785.58, "text": " He is going to try that with this arc challenge that we're going to look at in like the last"}, {"start": 1785.58, "end": 1787.62, "text": " part of this series."}, {"start": 1787.62, "end": 1790.62, "text": " But it's a cool test for intelligence."}, {"start": 1790.62, "end": 1797.5, "text": " I admit that, but I doubt that anyone really manages to hard code the core knowledge and"}, {"start": 1797.5, "end": 1800.8999999999999, "text": " he says test should only involve core knowledge."}, {"start": 1800.8999999999999, "end": 1807.8999999999999, "text": " And we're going to see how valid that that claim is for his own arc challenge."}, {"start": 1807.9, "end": 1814.7, "text": " Now luckily in the math part that's going to come up, he doesn't strictly rely on these"}, {"start": 1814.7, "end": 1815.7, "text": " things."}, {"start": 1815.7, "end": 1821.8200000000002, "text": " So he gives us a way how we can compare even if the priors of two systems are different."}, {"start": 1821.8200000000002, "end": 1824.5, "text": " We can compare which ones more intelligent."}, {"start": 1824.5, "end": 1828.22, "text": " All right, so that was part two of this series."}, {"start": 1828.22, "end": 1832.5, "text": " It's already been a while now and this is only part two."}, {"start": 1832.5, "end": 1836.14, "text": " And I do promise next time we're going to get into the math."}, {"start": 1836.14, "end": 1842.66, "text": " I hope you like this and go check out Tim Scarves video on the same topic."}, {"start": 1842.66, "end": 1847.46, "text": " Yeah, as I said, usually much higher quality videos than mine."}, {"start": 1847.46, "end": 1848.8600000000001, "text": " And I'll see you next time."}, {"start": 1848.86, "end": 1877.86, "text": " Bye-bye."}] |
Yannic Kilcher | 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 OpenAI 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, 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 are 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 that just produces one pixel by one pixel. Maybe 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 Janik 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 Marc Chen, Alakaratford, Révin Child, Jeff Wu, Hironjou, Praffala, Dariwal, David Luan and Ilya Satsukir. And since Henry A.I. 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 and it's fun to look at it, but the actual objective of the paper is the following. What if we train, we pre-traine on a large data set to generate 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 the 96.3% accuracy with a linear probe outperforming a 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 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 net, it's 1000. And the data set is these images together with these labels. Now the idea of pre-training is that you somewhere 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 want to 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 learned 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-trained these large models like we've just seen GPT-3 or BERT was one of them, they pre-trained 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-trained a transformer that is a GPT-2 scale model, they pre-trained 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 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 with pre-trained, this pre-training task 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 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 a fully unrolled image on let's say image net 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 down scale the image. So they down scale it's not as drastic as here where you just get a three by three image but they do down scale 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 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 auto regressive generative pre training which is the sort of GPT2 style pre training and 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, sorry, that's the sequence that you input. And you always want to predict what is the next pixel. And in this case 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 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 auto regressive 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 birth. And I've also made a video on birth. What you do in birth is you simply take that image and you cross a block out two of the pixels or many of the pixels. And you simply ask your network to reconstruct those pixels. And now you can see the attention flows in all direction. By the B stands actually for bidirectional. So this is the contrast to the auto regressive pre-training framework. Now these two things have been applied in text both. The auto regressive 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. Whereas in birth 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 XL net. I forget it's 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'll 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 birth 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 images and just feed this 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 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 networks. 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 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 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 it's assessing how linearly classifiable a representation is, which isn't the same as how useful or how informative, but it is one way to assess these things. Okay? So these are the two things they assess. All right. So for as for data sets, for C for 10, they use like C for 10 and C for 100 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 you pre-trained on ImageNet without the labels, and then you transfer learn or fine tune or linear probe on these small data sets. Whereas later we're going to look at ImageNet and there the pre-training as I understand it is done on ImageNet itself, but also a wider collection of a hundred 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 a 96% on C for 10. 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 C for 10 as far as I understand. It's been trained on ImageNet. So the this is to stress how cool or how significant this result is basically that just the 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 idea here is or the way they interpret it is that if you have an image right here and you block 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. So 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 similar to a CNN. They're going to be doing some low level feature transformation thing. But also the last layers they're going to really care about what's the exact pixel that goes here. Since it's their job to do that. They're going to care what color does it need to have, what exact luminosity and so on. How does it fit in with the previous pixels and so on. So 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. Such because the images are consistent throughout. So there needs to be 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 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. 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 IGPTL 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 GPT2. Either a little bigger or a little smaller. It's not like GPT3 scale where you need a 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 XS scale. 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 is 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 is a connection of the perplexity of your language model and the quality 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 text papers has stressed that the larger models, they seem to be somehow more capable of forming good representations, even if they have the same loss. So again, this could just be sort of a training data, 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. I formulate that 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. And 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 GPIP is supervised, pre-trained on image net, 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 birth objective. So until now this was all this was all this auto regressive objective. And I feel the open AI people are a bit more of a fan of the auto regressive 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 image net. Again, C410 is pre-trained with image net. And image net 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 the 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. Well, 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 find tune, whenever you find 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 find 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. 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? So does the curve go like this? This is the linear probe when you simply pre-trained. 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. And as you can see these BERT and OREROgressive objective, they sort of trade off. So the BERT detends to do poorly in the linear probe setting, but then it catches up during fine tuning in C410, almost being at the level of the OREROgressive and in an image net actually outperforming it. This darker thing here, it simply means that you average across different masking of BERT because 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 end 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 all the representations of the sequence. And the last thing that I've also forgotten, there's a lot of stuff. When they find tune, while fine tuning, well 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 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'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 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 funny and these full samples up here look fairly cool for what it's trained to do and that it has no spatial awareness whatsoever. It simply uses learn position in coatings. And yeah, check it out. That was it from me. Bye bye. | [{"start": 0.0, "end": 6.72, "text": " Okay, I'm sure many of you have already seen this because it was rather widely announced,"}, {"start": 6.72, "end": 15.32, "text": " but the OpenAI team has announced a new model that produces pictures instead of text."}, {"start": 15.32, "end": 21.52, "text": " So as you can see right here, on the left you'll always see like a half a picture."}, {"start": 21.52, "end": 23.64, "text": " And on the right is the ground truth."}, {"start": 23.64, "end": 28.84, "text": " So they took this picture, they simply cut the bottom half right here."}, {"start": 28.84, "end": 33.28, "text": " And then they let the model sort of imagine what they cut away."}, {"start": 33.28, "end": 36.480000000000004, "text": " And what it comes up with is pretty cool, I have to say."}, {"start": 36.480000000000004, "end": 40.88, "text": " Like look at the birds, like this is just awesome."}, {"start": 40.88, "end": 46.56, "text": " But the special thing about this isn't that it simply completes pictures."}, {"start": 46.56, "end": 51.08, "text": " The special thing about it is it does it one pixel by pixel."}, {"start": 51.08, "end": 57.480000000000004, "text": " So basically it goes at this pixel right here and asks, okay, what's that pixel?"}, {"start": 57.48, "end": 61.959999999999994, "text": " And then what's that pixel and then what's that pixel and so on."}, {"start": 61.959999999999994, "end": 70.67999999999999, "text": " So it is basically a like a language model, but for pixels in that it goes over the images"}, {"start": 70.67999999999999, "end": 79.36, "text": " in order basically like this or like always from left to right left to right left to right."}, {"start": 79.36, "end": 84.32, "text": " And it has no clue of the spatial relations between the pixels."}, {"start": 84.32, "end": 89.75999999999999, "text": " It needs to learn that by itself as opposed to a convolutional neural network, which is"}, {"start": 89.75999999999999, "end": 95.96, "text": " specifically designed such that if you want to predict this pixel right here, then it's"}, {"start": 95.96, "end": 100.8, "text": " specifically designed to say, okay, the most important information is probably around"}, {"start": 100.8, "end": 102.16, "text": " that pixel."}, {"start": 102.16, "end": 108.08, "text": " And then some like other important information is widely around that pixel."}, {"start": 108.08, "end": 113.08, "text": " So CNNs are built with this in mind, whereas this model right here, which is also known"}, {"start": 113.08, "end": 117.67999999999999, "text": " as image GPT, doesn't have any of that."}, {"start": 117.67999999999999, "end": 124.4, "text": " It's simply a transformer model that goes over these pixels one by one."}, {"start": 124.4, "end": 125.56, "text": " And we'll see how that's done."}, {"start": 125.56, "end": 129.68, "text": " There are some more examples right here, particularly cool is the cat."}, {"start": 129.68, "end": 135.28, "text": " And you see that there is the beginning of this little white thing right here, which is"}, {"start": 135.28, "end": 137.36, "text": " this card."}, {"start": 137.36, "end": 148.20000000000002, "text": " And the completions of the model, yes, very interesting."}, {"start": 148.20000000000002, "end": 154.44000000000003, "text": " The model can of course as a language model can also sample by itself, just random images."}, {"start": 154.44000000000003, "end": 157.16000000000003, "text": " You sample them once through."}, {"start": 157.16000000000003, "end": 159.20000000000002, "text": " And this is what it comes up with."}, {"start": 159.20000000000002, "end": 165.20000000000002, "text": " So these are pretty good quality images for a model that just produces one pixel by one"}, {"start": 165.20000000000002, "end": 166.20000000000002, "text": " pixel."}, {"start": 166.2, "end": 168.67999999999998, "text": " Maybe of one pixel by pixel isn't new."}, {"start": 168.67999999999998, "end": 177.23999999999998, "text": " This has been around before, but the investigation here is basically how much can we, how far can"}, {"start": 177.23999999999998, "end": 181.51999999999998, "text": " we push these generative models for pre-training?"}, {"start": 181.51999999999998, "end": 184.48, "text": " Hi there, this is Janik from Post Production."}, {"start": 184.48, "end": 188.88, "text": " I've realized that I've forgotten to even read the name of the paper."}, {"start": 188.88, "end": 193.44, "text": " So it's called Generative Pre-training from Pixels by Marc Chen, Alakaratford, R\u00e9vin"}, {"start": 193.44, "end": 201.88, "text": " Child, Jeff Wu, Hironjou, Praffala, Dariwal, David Luan and Ilya Satsukir."}, {"start": 201.88, "end": 207.24, "text": " And since Henry A.I. Labs has already made a video on this, this video is going to be"}, {"start": 207.24, "end": 213.4, "text": " more of kind of a rumble rant about what I find interesting about the paper and some thoughts"}, {"start": 213.4, "end": 216.84, "text": " about it, rather than like a classic explanation."}, {"start": 216.84, "end": 218.64, "text": " I hope you still enjoy that."}, {"start": 218.64, "end": 222.76, "text": " So what you saw on the right wasn't even the, this isn't the final result."}, {"start": 222.76, "end": 224.2, "text": " The supposed result."}, {"start": 224.2, "end": 230.32, "text": " This is simply the pre-training task and it's fun to look at it, but the actual objective"}, {"start": 230.32, "end": 232.6, "text": " of the paper is the following."}, {"start": 232.6, "end": 243.76, "text": " What if we train, we pre-traine on a large data set to generate good images like these"}, {"start": 243.76, "end": 248.35999999999999, "text": " or we to complete images like these."}, {"start": 248.36, "end": 252.8, "text": " And then we fine tune on a classification task."}, {"start": 252.8, "end": 262.06, "text": " And the answer is here, they say, on C410 we achieve the 96.3% accuracy with a linear"}, {"start": 262.06, "end": 270.40000000000003, "text": " probe outperforming a supervised, wide resonant and a 99% accuracy with full fine tuning,"}, {"start": 270.40000000000003, "end": 274.52000000000004, "text": " matching the top supervised pre-trained models."}, {"start": 274.52, "end": 280.52, "text": " And even larger model trained on a mixture of image net and web images is competitive with"}, {"start": 280.52, "end": 287.79999999999995, "text": " self supervised benchmarks on image net, achieving 72 top one accuracy on a linear probe of our"}, {"start": 287.79999999999995, "end": 289.28, "text": " features."}, {"start": 289.28, "end": 298.24, "text": " So the goal here is that you have a data set that you want to train a classifier on."}, {"start": 298.24, "end": 305.08, "text": " So usually you have a data set and the data set has images and you put them through like"}, {"start": 305.08, "end": 310.92, "text": " a convolutional neural network and then you have to classify the image into one of, I"}, {"start": 310.92, "end": 315.96000000000004, "text": " don't know how many classes on C410, that's 10 classes on image net, it's 1000."}, {"start": 315.96000000000004, "end": 320.48, "text": " And the data set is these images together with these labels."}, {"start": 320.48, "end": 327.40000000000003, "text": " Now the idea of pre-training is that you somewhere have a bigger data set that is sort"}, {"start": 327.4, "end": 333.15999999999997, "text": " of similar to the small data set, but yeah, it's similar enough such that the network could"}, {"start": 333.15999999999997, "end": 334.15999999999997, "text": " learn something."}, {"start": 334.15999999999997, "end": 339.0, "text": " So what you want to do first is you want to first want to take the large data set, train"}, {"start": 339.0, "end": 341.23999999999995, "text": " this network right here."}, {"start": 341.23999999999995, "end": 345.56, "text": " And then in a second step fine tune the network on this smaller data set."}, {"start": 345.56, "end": 350.67999999999995, "text": " And you sort of hope that what you learned from the large data set right here transfers"}, {"start": 350.67999999999995, "end": 355.28, "text": " over a little bit of knowledge, you already have a little bit of knowledge and you can make"}, {"start": 355.28, "end": 359.0, "text": " better use of the data that you have right here."}, {"start": 359.0, "end": 362.35999999999996, "text": " Now the question is how do you do this pre-training?"}, {"start": 362.35999999999996, "end": 367.84, "text": " And of course this has a long tradition, well long for maybe two or three years right"}, {"start": 367.84, "end": 374.71999999999997, "text": " now in the language community where people, they pre-trained these large models like we've"}, {"start": 374.71999999999997, "end": 382.15999999999997, "text": " just seen GPT-3 or BERT was one of them, they pre-trained these large transformer models"}, {"start": 382.16, "end": 388.76000000000005, "text": " on text and then to fine tune them on classification tasks for text and that's what this paper is"}, {"start": 388.76000000000005, "end": 390.04, "text": " doing right here."}, {"start": 390.04, "end": 399.56, "text": " They pre-trained a transformer that is a GPT-2 scale model, they pre-trained it on image"}, {"start": 399.56, "end": 407.48, "text": " generation and then they fine tune it or transfer learn it to classification tasks."}, {"start": 407.48, "end": 414.48, "text": " And the point of the paper is to say that like in text data, in text data we have made pretty"}, {"start": 414.48, "end": 423.56, "text": " good experiences with doing this, with pre-training a generative model and then fine tuning on a"}, {"start": 423.56, "end": 425.32, "text": " classification task."}, {"start": 425.32, "end": 431.88, "text": " While so far in images all we've ever done is with pre-trained, this pre-training task"}, {"start": 431.88, "end": 438.36, "text": " usually is a classification task or like a self supervised task with a contrastive loss"}, {"start": 438.36, "end": 441.8, "text": " or something like this."}, {"start": 441.8, "end": 447.76, "text": " What they're doing new is the generative modeling as a pre-training."}, {"start": 447.76, "end": 454.12, "text": " And again this isn't like entirely new but they show that if you throw a lot of computers"}, {"start": 454.12, "end": 461.6, "text": " at it and lots of data and a big model then that can work equally well to the self supervised"}, {"start": 461.6, "end": 462.6, "text": " tasks."}, {"start": 462.6, "end": 465.24, "text": " So their model as I said is pretty, pretty simple."}, {"start": 465.24, "end": 468.28000000000003, "text": " They take an image and they unroll the image."}, {"start": 468.28000000000003, "end": 477.0, "text": " Now a fully unrolled image on let's say image net has 224 squared pixels and that times"}, {"start": 477.0, "end": 479.96000000000004, "text": " three right because you have three color channels."}, {"start": 479.96000000000004, "end": 485.52000000000004, "text": " That's too large even for an open AI supercomputer."}, {"start": 485.52000000000004, "end": 489.68, "text": " So what they do is first they down scale the image."}, {"start": 489.68, "end": 494.40000000000003, "text": " So they down scale it's not as drastic as here where you just get a three by three image"}, {"start": 494.40000000000003, "end": 499.76, "text": " but they do down scale it to like a 32 by 32 or a 64 by 64."}, {"start": 499.76, "end": 506.0, "text": " Then they unroll it which simply means they go through the image like this and make a"}, {"start": 506.0, "end": 512.48, "text": " sequence out of it because their models are naturally made for text sequences."}, {"start": 512.48, "end": 515.4, "text": " They simply put the image into a text sequence."}, {"start": 515.4, "end": 522.0, "text": " They further simplify this by reducing the three color channels to a single one."}, {"start": 522.0, "end": 528.1999999999999, "text": " So they have their own color representation and basically they reduce the three color"}, {"start": 528.1999999999999, "end": 534.4399999999999, "text": " channels to one channel that simply indexes the color in their color representation."}, {"start": 534.4399999999999, "end": 537.24, "text": " And they say it's still pretty good."}, {"start": 537.24, "end": 539.6, "text": " It's pretty faithful."}, {"start": 539.6, "end": 548.8000000000001, "text": " So ultimately they end up with like a 32 squared length representation of their image."}, {"start": 548.8000000000001, "end": 550.8000000000001, "text": " And then they do one of two things."}, {"start": 550.8000000000001, "end": 557.28, "text": " They either do auto regressive generative pre training which is the sort of GPT2 style"}, {"start": 557.28, "end": 565.4, "text": " pre training and the idea here is that you always want to predict the next pixel of a sequence."}, {"start": 565.4, "end": 571.48, "text": " So you can see right here that's the sequence that you, sorry, that's the sequence that"}, {"start": 571.48, "end": 572.88, "text": " you input."}, {"start": 572.88, "end": 578.36, "text": " And you always want to predict what is the next pixel."}, {"start": 578.36, "end": 582.68, "text": " And in this case you see that we've already predicted everything here."}, {"start": 582.68, "end": 586.0799999999999, "text": " We've already predicted everything up to this red pixel."}, {"start": 586.0799999999999, "end": 591.6, "text": " So you want to know what's this next pixel, this thing right here."}, {"start": 591.6, "end": 594.24, "text": " What's this going to be?"}, {"start": 594.24, "end": 597.72, "text": " And the diagram here basically shows you how the attention flows."}, {"start": 597.72, "end": 600.28, "text": " So every position in this transformer."}, {"start": 600.28, "end": 604.6, "text": " And if you don't know what a transformer is, I haven't made a video about attention is"}, {"start": 604.6, "end": 607.6, "text": " all you need where these are explained."}, {"start": 607.6, "end": 616.12, "text": " But briefly every position here can sort of send information, can send information only"}, {"start": 616.12, "end": 620.6, "text": " in one direction as to so you train all of these in parallel."}, {"start": 620.6, "end": 627.6, "text": " And when you predict this pixel right here, you only want information from whatever was"}, {"start": 627.6, "end": 628.6, "text": " before that pixel."}, {"start": 628.6, "end": 630.76, "text": " Otherwise the model could cheat, right?"}, {"start": 630.76, "end": 637.0400000000001, "text": " Otherwise the model could simply learn to copy over the value."}, {"start": 637.0400000000001, "end": 641.32, "text": " But the attention pattern here is simply to show you that this is auto regressive and"}, {"start": 641.32, "end": 642.32, "text": " it's in one direction."}, {"start": 642.32, "end": 644.52, "text": " So you always want to predict the next pixel."}, {"start": 644.52, "end": 647.0400000000001, "text": " And then from all of this you want to predict the next pixel."}, {"start": 647.0400000000001, "end": 650.1600000000001, "text": " And then from all of this you want to predict the next pixel."}, {"start": 650.16, "end": 654.7199999999999, "text": " This is in contrast to this objective here that comes from birth."}, {"start": 654.7199999999999, "end": 657.0, "text": " And I've also made a video on birth."}, {"start": 657.0, "end": 662.16, "text": " What you do in birth is you simply take that image and you cross a block out two of the"}, {"start": 662.16, "end": 665.7199999999999, "text": " pixels or many of the pixels."}, {"start": 665.7199999999999, "end": 670.24, "text": " And you simply ask your network to reconstruct those pixels."}, {"start": 670.24, "end": 673.12, "text": " And now you can see the attention flows in all direction."}, {"start": 673.12, "end": 676.12, "text": " By the B stands actually for bidirectional."}, {"start": 676.12, "end": 681.96, "text": " So this is the contrast to the auto regressive pre-training framework."}, {"start": 681.96, "end": 687.08, "text": " Now these two things have been applied in text both."}, {"start": 687.08, "end": 691.84, "text": " The auto regressive is usually it's easier to actually make it produce something like we"}, {"start": 691.84, "end": 695.16, "text": " saw producing these images."}, {"start": 695.16, "end": 700.32, "text": " Because you can always just predict the next pixel and then the next and then the next."}, {"start": 700.32, "end": 705.12, "text": " Whereas in birth it's a bit more unclear how you would produce things in a consistent"}, {"start": 705.12, "end": 711.5600000000001, "text": " manner because the predictions of these two pixels right here they are independent."}, {"start": 711.5600000000001, "end": 716.48, "text": " It's one forward pass and then both of these are predicted."}, {"start": 716.48, "end": 722.92, "text": " But other papers have tried to solve this like this not XL net."}, {"start": 722.92, "end": 723.92, "text": " I forget it's name."}, {"start": 723.92, "end": 728.04, "text": " It's something with an X."}, {"start": 728.04, "end": 733.12, "text": " And yeah, but these are the two objectives they look at."}, {"start": 733.12, "end": 735.68, "text": " And it turns out they sort of trade off a bit."}, {"start": 735.68, "end": 741.76, "text": " They work equally well or a bit better and a bit worse depending on the task."}, {"start": 741.76, "end": 746.16, "text": " So once they have done this so they simply feed images and you'll notice that you don't"}, {"start": 746.16, "end": 748.36, "text": " need any labels for this."}, {"start": 748.36, "end": 755.76, "text": " So what you'll do is simply input an image and then simply take away half of it like this"}, {"start": 755.76, "end": 761.64, "text": " and then predict that pixel and then you want to predict that pixel and then you want"}, {"start": 761.64, "end": 763.64, "text": " to predict that pixel right."}, {"start": 763.64, "end": 768.1999999999999, "text": " That's all like you do with text and in birth you simply input an image cross out pixels"}, {"start": 768.1999999999999, "end": 769.8, "text": " and then predict them."}, {"start": 769.8, "end": 776.4, "text": " So you don't need labels for this and that's why you can do it with this big data set."}, {"start": 776.4, "end": 778.16, "text": " And you can do it in an unsupervised fashion."}, {"start": 778.16, "end": 784.92, "text": " So you can just crawl the internet for images and just feed this into there and it will sort"}, {"start": 784.92, "end": 787.72, "text": " of learn to produce these images."}, {"start": 787.72, "end": 793.52, "text": " Now the question is if you produce, if you learn to produce these images, does that help"}, {"start": 793.52, "end": 796.0400000000001, "text": " you for classification?"}, {"start": 796.0400000000001, "end": 801.48, "text": " And there, they have two methods of assessing this."}, {"start": 801.48, "end": 804.1600000000001, "text": " The bottom one here is the fine tuning method."}, {"start": 804.1600000000001, "end": 809.6800000000001, "text": " Where you simply, so this is supposed to be the representation you learn in the different"}, {"start": 809.6800000000001, "end": 811.4, "text": " layers of the networks."}, {"start": 811.4, "end": 814.52, "text": " So this is supposed to be this thing right here."}, {"start": 814.52, "end": 817.48, "text": " What you'll do is you'll simply fine tune."}, {"start": 817.48, "end": 822.8000000000001, "text": " That means you on top of this representation, you add a classification head that has two"}, {"start": 822.8000000000001, "end": 825.84, "text": " outputs, cat or dog."}, {"start": 825.84, "end": 831.4, "text": " And you train this entire network on your small data set that we discussed before."}, {"start": 831.4, "end": 834.36, "text": " So you train the entire network, all of the parameters."}, {"start": 834.36, "end": 836.6, "text": " This is called fine tuning."}, {"start": 836.6, "end": 842.36, "text": " In contrast to that, what you can do is you can simply, and this is the easy way, you"}, {"start": 842.36, "end": 845.96, "text": " can simply add this classification head with two outputs."}, {"start": 845.96, "end": 849.32, "text": " And then only train this classification head."}, {"start": 849.32, "end": 855.76, "text": " And that is won't perform as well, but it gives you sort of a better idea of how good"}, {"start": 855.76, "end": 860.12, "text": " is the representation that this network right here learned."}, {"start": 860.12, "end": 866.2800000000001, "text": " And on top of that, so if you spin this idea further, you can actually go and do this"}, {"start": 866.2800000000001, "end": 869.1600000000001, "text": " at any intermediate layer right here."}, {"start": 869.1600000000001, "end": 872.64, "text": " So you can forward propagate until layer two right here."}, {"start": 872.64, "end": 880.24, "text": " And then here, you add your classification head into the two classes, and you only train"}, {"start": 880.24, "end": 882.24, "text": " the classification head."}, {"start": 882.24, "end": 887.6, "text": " That being said, you can also do this with fine tuning, but in this case, this is called"}, {"start": 887.6, "end": 889.68, "text": " a linear probe."}, {"start": 889.68, "end": 895.92, "text": " And it is often used to assess how good the A representation in intermediate layers is."}, {"start": 895.92, "end": 901.8, "text": " Whereas what it actually does is it's assessing how linearly classifiable a representation is,"}, {"start": 901.8, "end": 909.76, "text": " which isn't the same as how useful or how informative, but it is one way to assess these"}, {"start": 909.76, "end": 910.76, "text": " things."}, {"start": 910.76, "end": 911.76, "text": " Okay?"}, {"start": 911.76, "end": 914.04, "text": " So these are the two things they assess."}, {"start": 914.04, "end": 915.04, "text": " All right."}, {"start": 915.04, "end": 922.12, "text": " So for as for data sets, for C for 10, they use like C for 10 and C for 100 as data sets"}, {"start": 922.12, "end": 924.24, "text": " and the STL 10."}, {"start": 924.24, "end": 929.0, "text": " And there you have to keep in mind, the pre-training is done on ImageNet for those."}, {"start": 929.0, "end": 934.52, "text": " So you pre-trained on ImageNet without the labels, and then you transfer learn or fine"}, {"start": 934.52, "end": 941.84, "text": " tune or linear probe on these small data sets."}, {"start": 941.84, "end": 947.0, "text": " Whereas later we're going to look at ImageNet and there the pre-training as I understand"}, {"start": 947.0, "end": 954.56, "text": " it is done on ImageNet itself, but also a wider collection of a hundred million or so"}, {"start": 954.56, "end": 958.96, "text": " images from the web, from the internet."}, {"start": 958.96, "end": 959.96, "text": " Okay."}, {"start": 959.96, "end": 968.12, "text": " So as you can see right here, this is what happens if you do this linear probing."}, {"start": 968.12, "end": 970.72, "text": " And you can see it works pretty well."}, {"start": 970.72, "end": 976.1600000000001, "text": " So you get like a 95, 96% accuracy with linear probes."}, {"start": 976.1600000000001, "end": 977.64, "text": " This is very powerful."}, {"start": 977.64, "end": 982.1600000000001, "text": " So it's not easy to get a 96% on C for 10."}, {"start": 982.1600000000001, "end": 985.76, "text": " I mean current state of the art is like 99%."}, {"start": 985.76, "end": 989.56, "text": " But still 96% is pretty good."}, {"start": 989.56, "end": 993.96, "text": " And this is the so the entire network."}, {"start": 993.96, "end": 997.76, "text": " There is this big giant network that you input your image into."}, {"start": 997.76, "end": 1002.6, "text": " And then there is this one linear layer that does the classification."}, {"start": 1002.6, "end": 1007.92, "text": " And all of this right here has not been trained with classification in mind."}, {"start": 1007.92, "end": 1012.52, "text": " It simply has been trained to reproduce images."}, {"start": 1012.52, "end": 1016.04, "text": " It hasn't even been trained on C for 10 as far as I understand."}, {"start": 1016.04, "end": 1017.64, "text": " It's been trained on ImageNet."}, {"start": 1017.64, "end": 1027.56, "text": " So the this is to stress how cool or how significant this result is basically that just"}, {"start": 1027.56, "end": 1032.76, "text": " the linear probe on top of that will give you such a good accuracy."}, {"start": 1032.76, "end": 1039.44, "text": " And the second thing that is obvious right here is this bottom axis is the layer."}, {"start": 1039.44, "end": 1044.0, "text": " So this is the layer where they attach the linear probe."}, {"start": 1044.0, "end": 1049.72, "text": " And usually if you pre-train a network with a classification task in mind."}, {"start": 1049.72, "end": 1054.2, "text": " So you pre-train it with the labels or maybe even without the labels in a self supervised"}, {"start": 1054.2, "end": 1056.2, "text": " way or something like this."}, {"start": 1056.2, "end": 1061.4, "text": " Usually the last layer has the best representation for classification."}, {"start": 1061.4, "end": 1069.0, "text": " But here the special thing is that the intermediate layers in the middle have the best representation."}, {"start": 1069.0, "end": 1075.32, "text": " You can see that the representation quality in terms of linear probing falls off as they"}, {"start": 1075.32, "end": 1082.32, "text": " sort of it falls off as they go into higher layers."}, {"start": 1082.32, "end": 1086.04, "text": " And this is consistent across the data sets as you can see."}, {"start": 1086.04, "end": 1095.56, "text": " And the idea here is or the way they interpret it is that if you have an image right here"}, {"start": 1095.56, "end": 1100.12, "text": " and you block part of it."}, {"start": 1100.12, "end": 1107.24, "text": " So you've blocked this and this wrong way around this."}, {"start": 1107.24, "end": 1114.44, "text": " So you've generated everything."}, {"start": 1114.44, "end": 1118.48, "text": " And now your task is to predict the next pixel."}, {"start": 1118.48, "end": 1124.44, "text": " So you train to predict this next pixel right here."}, {"start": 1124.44, "end": 1133.24, "text": " And the idea is that as you put the image through the network what it will do is sort of"}, {"start": 1133.24, "end": 1138.1200000000001, "text": " since the first layers they're going to be similar to a CNN."}, {"start": 1138.1200000000001, "end": 1143.16, "text": " They're going to be doing some low level feature transformation thing."}, {"start": 1143.16, "end": 1148.88, "text": " But also the last layers they're going to really care about what's the exact pixel that"}, {"start": 1148.88, "end": 1149.88, "text": " goes here."}, {"start": 1149.88, "end": 1153.04, "text": " Since it's their job to do that."}, {"start": 1153.04, "end": 1159.1599999999999, "text": " They're going to care what color does it need to have, what exact luminosity and so on."}, {"start": 1159.1599999999999, "end": 1165.0, "text": " How does it fit in with the previous pixels and so on."}, {"start": 1165.0, "end": 1166.56, "text": " So that's also good."}, {"start": 1166.56, "end": 1172.12, "text": " But it's not just low level information and consistency with other pixels or something"}, {"start": 1172.12, "end": 1173.6399999999999, "text": " like this."}, {"start": 1173.6399999999999, "end": 1179.68, "text": " At some point if you want to generate consistent images and we saw that this model can generate"}, {"start": 1179.68, "end": 1181.1599999999999, "text": " consistent images."}, {"start": 1181.16, "end": 1186.8400000000001, "text": " At some point there needs to be some kind of a notion of the global information in the"}, {"start": 1186.8400000000001, "end": 1188.8400000000001, "text": " picture."}, {"start": 1188.8400000000001, "end": 1192.92, "text": " Such because the images are consistent throughout."}, {"start": 1192.92, "end": 1198.2, "text": " So there needs to be some notion of what is in that image as a whole."}, {"start": 1198.2, "end": 1202.4, "text": " And that's the exact information that we need for classification."}, {"start": 1202.4, "end": 1207.3600000000001, "text": " And the only way that could actually be is here in the middle since you know that's"}, {"start": 1207.3600000000001, "end": 1208.3600000000001, "text": " the place."}, {"start": 1208.36, "end": 1215.1599999999999, "text": " So the hypothesis is that these models somehow learn a higher level representation of global"}, {"start": 1215.1599999999999, "end": 1221.4799999999998, "text": " information somewhere in the middle before they then specify that information again down"}, {"start": 1221.4799999999998, "end": 1224.12, "text": " to predict the actual pixel."}, {"start": 1224.12, "end": 1228.8, "text": " And that's why the best representations for classification are in the middle."}, {"start": 1228.8, "end": 1234.36, "text": " So this is one of the, this is actually the interesting finding or one of the interesting"}, {"start": 1234.36, "end": 1235.36, "text": " findings of this paper."}, {"start": 1235.36, "end": 1241.56, "text": " It's cool that they can reach a good accuracy, but to recognize that maybe in these these"}, {"start": 1241.56, "end": 1249.1999999999998, "text": " generative models, they have some intermediate stage where they represent the global information"}, {"start": 1249.1999999999998, "end": 1252.9599999999998, "text": " and that will actually make the best representation."}, {"start": 1252.9599999999998, "end": 1261.0, "text": " Okay, the second cool thing right here is that you can see they have different sizes of"}, {"start": 1261.0, "end": 1262.0, "text": " models."}, {"start": 1262.0, "end": 1267.56, "text": " So the IGPTL I believe is something like 60 layers."}, {"start": 1267.56, "end": 1271.64, "text": " Then this is like 48 layers and this is 32 layers."}, {"start": 1271.64, "end": 1275.92, "text": " We don't really, so these are on the, all of, on the scale of GPT2."}, {"start": 1275.92, "end": 1278.88, "text": " Either a little bigger or a little smaller."}, {"start": 1278.88, "end": 1284.08, "text": " It's not like GPT3 scale where you need a ginormous supercomputer."}, {"start": 1284.08, "end": 1288.2, "text": " Though they do do a lot of computation."}, {"start": 1288.2, "end": 1297.92, "text": " But this still sort of fits within hardware of a standard size and not like XS scale."}, {"start": 1297.92, "end": 1303.6000000000001, "text": " What's interesting right here is that you can see the larger models, they reach a lower"}, {"start": 1303.6000000000001, "end": 1304.76, "text": " validation loss."}, {"start": 1304.76, "end": 1308.04, "text": " So here is the validation loss, larger model if you train them on."}, {"start": 1308.04, "end": 1312.0, "text": " So these checkpoints here are always after the same amount of steps."}, {"start": 1312.0, "end": 1317.56, "text": " The larger models do reach a lower validation loss right here, as you can see."}, {"start": 1317.56, "end": 1321.28, "text": " So this is the large, this is the medium, this is the small."}, {"start": 1321.28, "end": 1328.24, "text": " And also you can see that on this axis is the linear probe accuracy."}, {"start": 1328.24, "end": 1333.48, "text": " So this is whenever you go and you find the best intermediate layer for linear probing,"}, {"start": 1333.48, "end": 1336.28, "text": " you probe it and you record the accuracy."}, {"start": 1336.28, "end": 1342.08, "text": " So you can see a general trend as your validation loss goes down, the linear probe accuracy"}, {"start": 1342.08, "end": 1343.08, "text": " goes up."}, {"start": 1343.08, "end": 1348.28, "text": " So there is a connection like it is in text models, in text models, there is a connection"}, {"start": 1348.28, "end": 1354.6, "text": " of the perplexity of your language model and the quality of the representation you get"}, {"start": 1354.6, "end": 1356.6, "text": " for downstream tasks."}, {"start": 1356.6, "end": 1359.04, "text": " In this model, it seems to be the exact same thing."}, {"start": 1359.04, "end": 1366.28, "text": " There is a connection between reaching lower validation loss and reaching a higher performance"}, {"start": 1366.28, "end": 1369.08, "text": " on classification."}, {"start": 1369.08, "end": 1375.4399999999998, "text": " So that's one interesting thing, the general trend to up to the upper right corner."}, {"start": 1375.4399999999998, "end": 1380.1999999999998, "text": " The other interesting, and even arguably even more interesting thing is that if you look"}, {"start": 1380.1999999999998, "end": 1382.84, "text": " at the same validation loss."}, {"start": 1382.84, "end": 1387.04, "text": " So at this point, all of these models have the same validation loss."}, {"start": 1387.04, "end": 1390.9199999999998, "text": " Yet still, the bigger model is better, right?"}, {"start": 1390.9199999999998, "end": 1396.76, "text": " You can see right here, the bigger model outperforms the smaller model, even though they have the"}, {"start": 1396.76, "end": 1402.72, "text": " same validation loss on the image modeling task."}, {"start": 1402.72, "end": 1408.2, "text": " And this is also something that OpenAI in their text papers has stressed that the larger"}, {"start": 1408.2, "end": 1415.52, "text": " models, they seem to be somehow more capable of forming good representations, even if they"}, {"start": 1415.52, "end": 1418.24, "text": " have the same loss."}, {"start": 1418.24, "end": 1426.12, "text": " So again, this could just be sort of a training data, better training data, remembering"}, {"start": 1426.12, "end": 1427.6799999999998, "text": " thing."}, {"start": 1427.6799999999998, "end": 1433.1999999999998, "text": " And when I said that in GPT-3, I didn't actually mean explicit remembering of training data."}, {"start": 1433.1999999999998, "end": 1437.28, "text": " I meant kind of a fuzzy remembering of training data."}, {"start": 1437.28, "end": 1444.8799999999999, "text": " I formulate that in the comments, but I feel a lot of people have misunderstood me there."}, {"start": 1444.8799999999999, "end": 1451.3999999999999, "text": " Here I think it's a much harder, harder to estimate what's going on also since image pixels."}, {"start": 1451.4, "end": 1458.0, "text": " And don't have a super good model on image pixels in their head as we have about text."}, {"start": 1458.0, "end": 1463.1200000000001, "text": " As you can see, if you then fine tune, so for now, we've just do linear probing."}, {"start": 1463.1200000000001, "end": 1471.96, "text": " If you fine tune these architectures, then you reach like a 99% accuracy on C410, which"}, {"start": 1471.96, "end": 1476.24, "text": " is on par with the best models that we have."}, {"start": 1476.24, "end": 1483.2, "text": " So GPIP is supervised, pre-trained on image net, but also I guess uses a bunch of data"}, {"start": 1483.2, "end": 1489.72, "text": " augmentation while these image GPT, it uses minimal data augmentation, I think."}, {"start": 1489.72, "end": 1495.0, "text": " They simply random crop a little bit."}, {"start": 1495.0, "end": 1498.04, "text": " And that's about it."}, {"start": 1498.04, "end": 1504.44, "text": " So they also experiment around with this birth objective."}, {"start": 1504.44, "end": 1510.28, "text": " So until now this was all this was all this auto regressive objective."}, {"start": 1510.28, "end": 1514.72, "text": " And I feel the open AI people are a bit more of a fan of the auto regressive objective,"}, {"start": 1514.72, "end": 1519.28, "text": " just given what they've done so far in their papers."}, {"start": 1519.28, "end": 1528.24, "text": " And you can see here comparison of the two objectives on C410 and on image net."}, {"start": 1528.24, "end": 1531.68, "text": " Again, C410 is pre-trained with image net."}, {"start": 1531.68, "end": 1536.92, "text": " And image net itself is pre-trained with like a larger collection of images from the web."}, {"start": 1536.92, "end": 1540.28, "text": " All the pre-training is done without labels."}, {"start": 1540.28, "end": 1545.5600000000002, "text": " Now the blue is what you can reach with the linear probe."}, {"start": 1545.5600000000002, "end": 1550.3600000000001, "text": " And the orange is then on top of that what you can reach by fine tuning."}, {"start": 1550.3600000000001, "end": 1552.68, "text": " Okay, so no linear probe but fine tuning."}, {"start": 1552.68, "end": 1556.44, "text": " Well, I have to say that the fine tuning is always done at the end."}, {"start": 1556.44, "end": 1563.8, "text": " So even though the linear probe, even though the linear probe can be attached anywhere in"}, {"start": 1563.8, "end": 1568.3200000000002, "text": " between and it's often useful to do that as we saw because the in between layers are"}, {"start": 1568.3200000000002, "end": 1569.3200000000002, "text": " the best."}, {"start": 1569.3200000000002, "end": 1576.28, "text": " They say they tried fine tuning also in from in between, but it always worked out best"}, {"start": 1576.28, "end": 1581.52, "text": " whenever you find tune, whenever you find tune you take actually the last layer."}, {"start": 1581.52, "end": 1588.44, "text": " So that kind of gives you an idea that the model is then it's sort of what seems to be"}, {"start": 1588.44, "end": 1594.4, "text": " important is this coming up with the higher level representation."}, {"start": 1594.4, "end": 1601.44, "text": " And then once you find tune, you're probably able to push that representation through to"}, {"start": 1601.44, "end": 1604.0, "text": " the end because of your training signal."}, {"start": 1604.0, "end": 1610.16, "text": " But if you hadn't done the pre-training, you wouldn't even have that higher level representation."}, {"start": 1610.16, "end": 1614.88, "text": " And then the signal I guess is not strong enough to back propagate through the whole model."}, {"start": 1614.88, "end": 1621.3600000000001, "text": " It would be very interesting if they investigate, if they do this linear probe analysis again"}, {"start": 1621.3600000000001, "end": 1623.76, "text": " after they fine tune the model."}, {"start": 1623.76, "end": 1631.24, "text": " And to see if then still it is the intermediate layers that have the best representation."}, {"start": 1631.24, "end": 1638.0400000000002, "text": " Or if now the best representation in a linear probe sense shifted towards the end."}, {"start": 1638.04, "end": 1643.84, "text": " I'm going to guess it's shifted towards the end, but I sort of want to even see if the"}, {"start": 1643.84, "end": 1648.24, "text": " accuracy of the linear probe in the middle does it keep the same?"}, {"start": 1648.24, "end": 1651.52, "text": " So does the curve go like this?"}, {"start": 1651.52, "end": 1656.28, "text": " This is the linear probe when you simply pre-trained."}, {"start": 1656.28, "end": 1658.6, "text": " This is linear probe accuracy."}, {"start": 1658.6, "end": 1667.32, "text": " The question would be does it change to be like this or does it change to be like this?"}, {"start": 1667.32, "end": 1669.9199999999998, "text": " This is supposed to be the same at the end."}, {"start": 1669.9199999999998, "end": 1675.4399999999998, "text": " So basically does it stay as good as it is but simply get better at the end?"}, {"start": 1675.4399999999998, "end": 1680.8, "text": " Or does the representation like in this curve, does the good representation now shift towards"}, {"start": 1680.8, "end": 1686.96, "text": " the end and leave the lower layer with even more capacity to do some low level stuff?"}, {"start": 1686.96, "end": 1688.12, "text": " Yeah."}, {"start": 1688.12, "end": 1689.84, "text": " Maybe they've done this."}, {"start": 1689.84, "end": 1692.76, "text": " I haven't seen it."}, {"start": 1692.76, "end": 1698.52, "text": " And as you can see these BERT and OREROgressive objective, they sort of trade off."}, {"start": 1698.52, "end": 1704.72, "text": " So the BERT detends to do poorly in the linear probe setting, but then it catches up during"}, {"start": 1704.72, "end": 1713.36, "text": " fine tuning in C410, almost being at the level of the OREROgressive and in an image net"}, {"start": 1713.36, "end": 1715.12, "text": " actually outperforming it."}, {"start": 1715.12, "end": 1721.92, "text": " This darker thing here, it simply means that you average across different masking of BERT"}, {"start": 1721.92, "end": 1729.8000000000002, "text": " because even in classification it's not entirely clear how to get a signal out of BERT because"}, {"start": 1729.8000000000002, "end": 1732.6000000000001, "text": " they don't do this CLS vector with BERT."}, {"start": 1732.6000000000001, "end": 1740.04, "text": " What they do for classification end linear probing and that's written up here, they simply"}, {"start": 1740.04, "end": 1744.52, "text": " take the, they do an average pooling."}, {"start": 1744.52, "end": 1751.88, "text": " I think they do an average pooling of all the representations of the sequence."}, {"start": 1751.88, "end": 1758.1200000000001, "text": " And the last thing that I've also forgotten, there's a lot of stuff."}, {"start": 1758.1200000000001, "end": 1768.8400000000001, "text": " When they find tune, while fine tuning, well fine tuning, the classification loss yields"}, {"start": 1768.8400000000001, "end": 1771.0800000000002, "text": " reasonable downstream performance."}, {"start": 1771.0800000000002, "end": 1777.0, "text": " We find empirically that the joint objective, the generative objective and the classification"}, {"start": 1777.0, "end": 1780.0400000000002, "text": " objective works even better."}, {"start": 1780.04, "end": 1786.12, "text": " Okay, so even when you fine tune with this model, you have to keep the generative modeling"}, {"start": 1786.12, "end": 1795.36, "text": " part, the generative loss around and then it performs even more better, more well."}, {"start": 1795.36, "end": 1798.08, "text": " Whatever that word is."}, {"start": 1798.08, "end": 1799.92, "text": " So that's also something to think about."}, {"start": 1799.92, "end": 1806.8, "text": " I think this paper right here, it kind of lays down a lot of cool things that you can"}, {"start": 1806.8, "end": 1813.8, "text": " think about and it gives rise to a lot of hypotheses of how does this stuff work, why does"}, {"start": 1813.8, "end": 1815.44, "text": " this stuff work."}, {"start": 1815.44, "end": 1819.12, "text": " I don't even think that the numbers are the most important thing."}, {"start": 1819.12, "end": 1824.84, "text": " It's mostly the fact of the effects and what does it mean?"}, {"start": 1824.84, "end": 1830.12, "text": " Okay, so this was my take on it."}, {"start": 1830.12, "end": 1835.56, "text": " It's more kind of a my rant of what I find special about this paper than about the actual"}, {"start": 1835.56, "end": 1837.44, "text": " paper."}, {"start": 1837.44, "end": 1840.2, "text": " You can look at the paper, their numbers are pretty good."}, {"start": 1840.2, "end": 1847.76, "text": " On ImageNet, they do not reach the same like super duper performance as they do on C410."}, {"start": 1847.76, "end": 1853.56, "text": " And I guess that's probably because they have to downscale the ImageNet images way more"}, {"start": 1853.56, "end": 1860.56, "text": " than they have to downscale the C410 images because those are of course only 32 by 32."}, {"start": 1860.56, "end": 1865.12, "text": " So because they have to downscale so much, they lose probably a lot of information."}, {"start": 1865.12, "end": 1874.32, "text": " And I would be interested to see if there is a way to involve convolutions in all of this."}, {"start": 1874.32, "end": 1880.1599999999999, "text": " So to do the downscaling that in a learned manner with convolutions or something, I'm sure"}, {"start": 1880.1599999999999, "end": 1881.8, "text": " this has all been done already."}, {"start": 1881.8, "end": 1884.32, "text": " I'm just lazy to look it up."}, {"start": 1884.32, "end": 1888.84, "text": " Yeah, so I invite you to look at their blog post where they have these samples."}, {"start": 1888.84, "end": 1897.24, "text": " They look pretty funny and these full samples up here look fairly cool for what it's"}, {"start": 1897.24, "end": 1900.32, "text": " trained to do and that it has no spatial awareness whatsoever."}, {"start": 1900.32, "end": 1903.3999999999999, "text": " It simply uses learn position in coatings."}, {"start": 1903.3999999999999, "end": 1904.3999999999999, "text": " And yeah, check it out."}, {"start": 1904.3999999999999, "end": 1905.3999999999999, "text": " That was it from me."}, {"start": 1905.4, "end": 1920.4, "text": " Bye bye."}] |
Yannic Kilcher | 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, 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 same clear and then remove the negative samples. And that seems to work pretty well even though it's magic. So yeah, 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 introduce Bootstrap your own latent or be all 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 ResNet50. Okay, so what you want to do is you want to train a neural network like a ResNet50 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 task. 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, learn, 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 image net. The image net 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 a different variance of that same image. So you'll take the image and you'll make many, many variants of it. Oh, 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. B.O. 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 trained 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 resonant 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 h. So this is the h, what's called that h original, this is h plus because it's the same image, but slightly differently augmented. And this is h 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 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 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 representations 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 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 than 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, 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. It's actually better 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. B y o l. Boots strap your own latent. There is the input image. You 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, 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, 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 that 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 we have the target to be not the same as 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. 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 network that they actually learned and then the target network that is copied over every such and such episodes and so on. So 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 representor. So after this procedure, we discard the entire thing right here except that. So this here is your whatever your resin at 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 resin at 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 ZZ 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 versions. 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 at an augmentation of Z should be one bracket to 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 a 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-segmentic information, sorry, non-semantic information. And random cropping is one of those methods. Horizontal flipping is one of those methods because we say, well, whatever an image goes left to right to 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, we learn Q to predict the representation under the expectation of our augmentations. And that means it can't be dependent on one particular augmentation. Okay, it 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 initialization and the learning procedure itself that it 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 advise 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 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 resonant 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 know. There is a lot of unclarity 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 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 4,096 split over 512 TPU V3 course. With this setup, training takes approximately eight hours for resonant 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 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 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 same clear baseline. So you can see right here that they have a own implementation of SIM clear. And they actually compare this to the numbers that they find in the SIM clear paper. And you can see, for example, here, there's like four percentage points that the that the their implementation of SIM clear 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 forgot 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, they be B Y O L is much more resistant to like changes in hyper parameters. So here you can see that it falls off much later when you reduce the batch size, which makes sense right because SIM clear 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 actual numbers here. First, I'm not super duper interested that they get like a two or one point more in something, but they do perform like a lot of experiments. And that 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 at 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 coral I have with the paper and where is it? Where is it? Somewhere they say that we release the code that 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 deep mind 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 museur of pseudo code you can't even like run it in its basic form if you fill in the things. It's 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's still heavily relies on these augmentation methods. So and that's what they say right here. Nevertheless, BY will remain dependent on existing sets of augmentations that are specific to vision applications to generalise beyond 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 step to generalise beyond 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 bootstrapia. 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. I could try to estimate the perplexity of this broader impact statement. Let's go. The presented research should be categorised 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 B.O. 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 or not? I mean, let's just cross out some word here. Blank. Let's blend like field. Let's just put field or machine learning. Why not machine learning? Machine learning. This work inspired 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's a copy thing that you can apparently put into any and all papers that you write from now on. And hey, deep minds 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.0, "text": " Hello there. Today we're looking at Bootstrap your own latent, a new approach to self-supervised"}, {"start": 6.0, "end": 14.92, "text": " learning by researchers of DeepMind and Imperial College. So, almost no day goes by where"}, {"start": 14.92, "end": 21.080000000000002, "text": " we don't hear some sort of new self-supervised algorithm right here. This paper on a high level"}, {"start": 21.080000000000002, "end": 27.0, "text": " tries to get rid of the necessary negative samples when doing the contrastive loss for"}, {"start": 27.0, "end": 34.76, "text": " self-supervised learning. And they basically combine momentum contrast and same clear and"}, {"start": 34.76, "end": 40.6, "text": " then remove the negative samples. And that seems to work pretty well even though it's magic."}, {"start": 40.6, "end": 47.519999999999996, "text": " So yeah, if you want to see how it's done stick around, share the video out if you want"}, {"start": 47.519999999999996, "end": 54.480000000000004, "text": " other people to see how it's done and leave a comment. This one I really don't get what's"}, {"start": 54.48, "end": 60.8, "text": " going on. So, if you have ideas, put them there, I'll read them through. It'll be fun."}, {"start": 60.8, "end": 69.88, "text": " Alright, so they say we introduce Bootstrap your own latent or be all a new approach to"}, {"start": 69.88, "end": 75.52, "text": " self-supervised image representation learning. Okay, so image representation learning is the"}, {"start": 75.52, "end": 82.16, "text": " simple task of taking an image and then feeding it through a function which is usually like"}, {"start": 82.16, "end": 88.24, "text": " a neural network. Let's just say this is a neural network. And in fact, all of these, the"}, {"start": 88.24, "end": 94.0, "text": " community has sort of standardized this to be most of the time it's something like a"}, {"start": 94.0, "end": 101.12, "text": " ResNet50. Okay, so what you want to do is you want to train a neural network like a ResNet50"}, {"start": 101.12, "end": 107.4, "text": " to give you a good representation of the image. So this would be like H and H is a vector"}, {"start": 107.4, "end": 114.92, "text": " and H is a representation of this image and the representation should be such that you"}, {"start": 114.92, "end": 121.48, "text": " can then take this representation and solve many tasks with it which either can be like"}, {"start": 121.48, "end": 127.80000000000001, "text": " linear, you can put a linear classifier on top of the H or you can fine tune the entire"}, {"start": 127.80000000000001, "end": 134.76, "text": " architecture to solve some other task. The idea is if you have a large data set here,"}, {"start": 134.76, "end": 140.07999999999998, "text": " you may use this data set to train these good representations of these images and then"}, {"start": 140.07999999999998, "end": 146.56, "text": " you can transfer, learn, 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": 156.84, "text": " like this, but it is enough to take an architecture that's been trained with the large data set"}, {"start": 156.84, "end": 162.68, "text": " and just adapt it to your small data set. And that usually it tends to work pretty well."}, {"start": 162.68, "end": 170.88, "text": " This is called transfer learning. This step here is called fine tuning sometimes and it's"}, {"start": 170.88, "end": 176.0, "text": " sort of the approach that comes from natural language processing from these big transformers"}, {"start": 176.0, "end": 181.92000000000002, "text": " like Bert where you first train on a really big data set that might not be the data set"}, {"start": 181.92000000000002, "end": 187.32, "text": " that you want in the end, but it's really big. So you can sort of learn a lot of things"}, {"start": 187.32, "end": 193.4, "text": " from that data set and then the only thing left to do is to fine tune it to basically"}, {"start": 193.4, "end": 198.79999999999998, "text": " adapt it to the nuances of your data set, but it will have learned most things already."}, {"start": 198.79999999999998, "end": 204.76, "text": " And that's called representation learning. So the goal is to learn a good representation."}, {"start": 204.76, "end": 212.16, "text": " Now the self supervised here is also important because representation learning can be as easy"}, {"start": 212.16, "end": 218.28, "text": " as if this here is image net. The image net data set contains like a million images all"}, {"start": 218.28, "end": 224.24, "text": " with labels. You can simply train your ResNet 50 to predict the class. This is the this"}, {"start": 224.24, "end": 231.16, "text": " is called supervised pre training or supervised representation learning and that works pretty"}, {"start": 231.16, "end": 237.48, "text": " well, but you need a labeled data set in self supervised learning. You do not need labels."}, {"start": 237.48, "end": 243.56, "text": " What you do is you do self supervision and self supervision. It has many there are many"}, {"start": 243.56, "end": 250.51999999999998, "text": " ways to do self supervision, but what we'll see in this particular paper is that you will"}, {"start": 250.51999999999998, "end": 256.71999999999997, "text": " take an image and you'll make a different variance of that same image. So you'll take"}, {"start": 256.71999999999997, "end": 264.32, "text": " the image and you'll make many, many variants of it. Oh, let's just say two. So you have"}, {"start": 264.32, "end": 269.15999999999997, "text": " some procedure to sort of change the picture a little bit, but it's essentially still the"}, {"start": 269.15999999999997, "end": 275.8, "text": " same. And you do that through data augmentation. So this could be a random crop or you color,"}, {"start": 275.8, "end": 282.03999999999996, "text": " jitter, or you rotate it or something like this. And then you exploit the fact that you"}, {"start": 282.03999999999996, "end": 287.8, "text": " know that these two things they should be still sort of the same image. So once you send"}, {"start": 287.8, "end": 294.03999999999996, "text": " them through your through your encoder, the representations of the two images, they should"}, {"start": 294.04, "end": 300.8, "text": " be fairly close. Now, let's actually read on right here."}, {"start": 300.8, "end": 310.84000000000003, "text": " B.O. relies on two neural networks referred to as online and target networks that interact"}, {"start": 310.84000000000003, "end": 314.8, "text": " and learn from each other from an augmented view of an image. We trained the online network"}, {"start": 314.8, "end": 321.12, "text": " to predict the target representation of the same image under a different augmented view."}, {"start": 321.12, "end": 328.32, "text": " Okay, that's sort of what we saw. So we have we have the same image under a different augmented"}, {"start": 328.32, "end": 335.24, "text": " view. So what does it mean? What what I just said, you make two versions of the same image,"}, {"start": 335.24, "end": 340.24, "text": " one that are slightly different and then their representation should be close. Now until"}, {"start": 340.24, "end": 348.6, "text": " this point, we have always thought that this would degenerate because what if you think"}, {"start": 348.6, "end": 353.84000000000003, "text": " of this neural network that does this encoding to the hidden space, this resonant 50 right"}, {"start": 353.84000000000003, "end": 359.36, "text": " here, if it wants to, if you simply want to make the two representations close, what's"}, {"start": 359.36, "end": 365.20000000000005, "text": " the best thing it can do? It can simply map all map the hidden, it can simply have the"}, {"start": 365.20000000000005, "end": 371.36, "text": " constant function h equals zero or something like this, just a constant function because"}, {"start": 371.36, "end": 378.0, "text": " then this loss here is always going to be zero like perfect. Okay. So no matter what image"}, {"start": 378.0, "end": 383.52, "text": " comes in, if you always map it to the same thing, you will always be close in representation"}, {"start": 383.52, "end": 390.32, "text": " space and therefore you always win. That doesn't learn a really good representation, right?"}, {"start": 390.32, "end": 398.84, "text": " So what people have done is they have included so called negative samples where you'll say,"}, {"start": 398.84, "end": 403.92, "text": " I'll take a different image from, you know, from this data set, but it's a different"}, {"start": 403.92, "end": 411.08000000000004, "text": " image than this image. And I also do some maybe some data augmentation with that image."}, {"start": 411.08000000000004, "end": 417.24, "text": " And then I send this through the same encoder to also give me an h. So this is the h, what's"}, {"start": 417.24, "end": 424.48, "text": " called that h original, this is h plus because it's the same image, but slightly differently"}, {"start": 424.48, "end": 432.72, "text": " augmented. And this is h minus, which is a different image. And now the task is let's"}, {"start": 432.72, "end": 440.16, "text": " make those two very similar to each other, but let's distance them from this other one."}, {"start": 440.16, "end": 446.0, "text": " So we want, we want this to be as far away as possible and these two to be close to each"}, {"start": 446.0, "end": 452.40000000000003, "text": " other. Now the network can't simply map everything to a constant function anymore, right?"}, {"start": 452.40000000000003, "end": 460.28000000000003, "text": " It needs to actually do something to make these be close together and this be far apart."}, {"start": 460.28, "end": 466.11999999999995, "text": " And the combination of this together with the augmentation procedure that goes into augmenting"}, {"start": 466.11999999999995, "end": 472.88, "text": " the images has been sort of a good combo to learn good representations. And a lot of"}, {"start": 472.88, "end": 479.59999999999997, "text": " papers have alluded to the fact that this is so the negative samples are to not have these"}, {"start": 479.59999999999997, "end": 486.47999999999996, "text": " degeneracy, right? So to not have the simple solutions. But the fact that the representation"}, {"start": 486.48, "end": 493.64000000000004, "text": " then is actually good, like is good for image, image tasks down the line probably comes"}, {"start": 493.64000000000004, "end": 498.96000000000004, "text": " from the fact of these augmentations right here. And there's a lot of evidence from the"}, {"start": 498.96000000000004, "end": 504.64000000000004, "text": " fact that depending on which augmentations we choose, these representations are going"}, {"start": 504.64000000000004, "end": 511.84000000000003, "text": " to be better or worse. For example, random cropping of an image. So the random sub like"}, {"start": 511.84, "end": 521.76, "text": " taking a random crop from the image tends to be very, very beneficial because so here"}, {"start": 521.76, "end": 528.1999999999999, "text": " this is the same image twice, right? Let's say we take a random crop here and one up here."}, {"start": 528.1999999999999, "end": 533.4, "text": " It's sort of maybe there's an overlap here in the middle, right? So it sort of needs to"}, {"start": 533.4, "end": 541.88, "text": " understand that these random crops sort of needs to communicate between these two places"}, {"start": 541.88, "end": 548.76, "text": " in these random crops. So the representation has to somehow make sure that the object that"}, {"start": 548.76, "end": 553.68, "text": " is overlapping here is somehow represented, but it can't represent it just as a pixel"}, {"start": 553.68, "end": 560.12, "text": " value because it doesn't know where the crops come from. So there's a lot of evidence"}, {"start": 560.12, "end": 565.76, "text": " that these representations are the thing that's responsible for making the representations"}, {"start": 565.76, "end": 574.84, "text": " so good. Okay. Now this paper simply says, do we really need these negative samples"}, {"start": 574.84, "end": 582.0, "text": " right here? Let's just get rid of them. And with a couple of tricks, this seems to work."}, {"start": 582.0, "end": 589.88, "text": " And this is this is what seems like magic to me because as we go forward, think of it,"}, {"start": 589.88, "end": 598.88, "text": " nothing, nothing keeps this model right here from doing the degenerate solution, H equals"}, {"start": 598.88, "end": 606.48, "text": " constant, nothing, right? Now for some reason, it doesn't do that. And I have the feeling"}, {"start": 606.48, "end": 611.12, "text": " that this is a super delicate balance that you have to do because when you train, when"}, {"start": 611.12, "end": 617.4, "text": " you start out, it's probably not the constant function, right? It's probably some distribution."}, {"start": 617.4, "end": 623.12, "text": " And then simply by the fact that you train it and kind of keep it in the, so this is certainly"}, {"start": 623.12, "end": 630.0799999999999, "text": " an optimal solution. But you might be like in some sort of local minimum once you start"}, {"start": 630.0799999999999, "end": 636.48, "text": " training and you simply don't get out of it during training. And that's why the network"}, {"start": 636.48, "end": 642.68, "text": " has an easier time step by step as it updates itself in very small incremental steps. It"}, {"start": 642.68, "end": 649.12, "text": " has an easier time actually going for the good representation than it has to see this"}, {"start": 649.12, "end": 656.2399999999999, "text": " solution right here and converge to that. But yeah, it seems delicate. So what are they"}, {"start": 656.2399999999999, "end": 665.88, "text": " doing? They are taking that idea of taking an input image right here. And so by the way,"}, {"start": 665.88, "end": 670.76, "text": " why is it important that there are no negative samples? Because now the question is always,"}, {"start": 670.76, "end": 676.36, "text": " where do you get these negative samples from? Right? Should they be uniformly sampled?"}, {"start": 676.36, "end": 680.76, "text": " Should we keep a buffer? Should we order them? There is this task of hard negative mining"}, {"start": 680.76, "end": 685.36, "text": " where you say, oh, any old negative won't do. It's actually better if we take negatives"}, {"start": 685.36, "end": 691.84, "text": " that are, you know, just hard enough. There is a curriculum learning problems and so"}, {"start": 691.84, "end": 698.04, "text": " on. So it'd be best to actually just get rid of these negative things. So that's why"}, {"start": 698.04, "end": 705.24, "text": " we want to get rid of them. So that's the approach. B y o l. Boots strap your own latent."}, {"start": 705.24, "end": 712.0, "text": " There is the input image. You take one image at a time and you apply two different random"}, {"start": 712.0, "end": 719.24, "text": " augmentations to it. Right? So you create two slightly different variants of that image"}, {"start": 719.24, "end": 723.8399999999999, "text": " through augmentation. And again, this can be something like a random crop. It can be"}, {"start": 723.84, "end": 730.08, "text": " a horizontal flip randomly. You color jitter, you solarize, you blur, and so on. There are"}, {"start": 730.08, "end": 741.0400000000001, "text": " all these variants of data augmentation. And the fact that down the line, the representation"}, {"start": 741.0400000000001, "end": 747.48, "text": " of these two things has to be close to each other. I think these random, these augmentations"}, {"start": 747.48, "end": 755.28, "text": " here are responsible to make the, to make the, these augmentations are responsible to make"}, {"start": 755.28, "end": 760.24, "text": " the representations powerful. Okay. The fact that later down the line, the network has to"}, {"start": 760.24, "end": 766.4, "text": " sort of learn to ignore these. It has to learn that, oh, you know, it doesn't matter where"}, {"start": 766.4, "end": 771.0, "text": " in the image this object is because it's been random cropped for different, you know,"}, {"start": 771.0, "end": 776.8000000000001, "text": " at different locations. It doesn't matter where in the image this object is. I simply"}, {"start": 776.8, "end": 782.7199999999999, "text": " need to have my hidden representation have this particular object in the image. And that's"}, {"start": 782.7199999999999, "end": 788.76, "text": " what makes it powerful. Okay. I've said that enough now. Then you have these two slightly"}, {"start": 788.76, "end": 794.3599999999999, "text": " different versions. And then you map it through your encoder. Okay. Let's go the top path"}, {"start": 794.3599999999999, "end": 800.0799999999999, "text": " first. You see the bottom path has the same encoder, but the parameters are different."}, {"start": 800.0799999999999, "end": 805.4799999999999, "text": " And this is going to be one of the crucial elements right here. So this here are your"}, {"start": 805.48, "end": 812.2, "text": " actual parameters that you learn. And this here are what are called the target parameters."}, {"start": 812.2, "end": 818.52, "text": " Now after each, and you can see this for all of these components right here. So what happens"}, {"start": 818.52, "end": 824.0, "text": " is that the target parameters are basically a copy of these, what's what are called"}, {"start": 824.0, "end": 830.6800000000001, "text": " the online parameters. Okay. So after each step, you copy over from the online parameters,"}, {"start": 830.68, "end": 835.8, "text": " you copy over to the target parameters. You never learn the target parameters. You simply"}, {"start": 835.8, "end": 841.88, "text": " copy them after each step. Now you don't copy them outright. What you do is you do an"}, {"start": 841.88, "end": 848.68, "text": " exponential moving average. So the target parameters are always going to be sort of a lagging"}, {"start": 848.68, "end": 856.64, "text": " average of your online parameters. And that idea comes from the momentum contrast principle,"}, {"start": 856.64, "end": 863.64, "text": " where the reasoning sort of behind it is that you need a kind of a stable, you kind of need"}, {"start": 863.64, "end": 871.8, "text": " a stable representation as a target. But I think it hasn't been fully explored or explained"}, {"start": 871.8, "end": 880.8, "text": " why exactly that is so helpful. But we just know that if we have the target to be not"}, {"start": 880.8, "end": 887.8, "text": " the same as the online parameters, but actually a kind of a stable version of the past of"}, {"start": 887.8, "end": 893.04, "text": " the online parameters, then that tends to work well. Again, it's kind of the same principle"}, {"start": 893.04, "end": 898.4, "text": " as with the augmentations. With the augmentations, we have two different versions of the same"}, {"start": 898.4, "end": 904.4799999999999, "text": " image. And now with this procedure here, we sort of have two different versions of the"}, {"start": 904.48, "end": 912.32, "text": " same neural network, but they're slightly different. This idea has been around for much longer,"}, {"start": 912.32, "end": 919.12, "text": " like the first Q, deep Q networks and so on. They had the same principles where they had"}, {"start": 919.12, "end": 924.4, "text": " the network that they actually learned and then the target network that is copied over every"}, {"start": 924.4, "end": 931.52, "text": " such and such episodes and so on. So this seems to work, seems to be a fundamental principle"}, {"start": 931.52, "end": 939.56, "text": " that seems to work. Alright, so we take our two slightly different augmented versions"}, {"start": 939.56, "end": 947.0, "text": " of the same image and we run them through our two slightly different encoders to obtain"}, {"start": 947.0, "end": 953.56, "text": " two representations. Now this thing right here, that's going to be our representor. So"}, {"start": 953.56, "end": 960.76, "text": " after this procedure, we discard the entire thing right here except that. So this here is"}, {"start": 960.76, "end": 968.56, "text": " your whatever your resin at 50. Okay. After that follows a projection. And the projection"}, {"start": 968.56, "end": 977.68, "text": " is is here to reduce the dimensionality. And honestly, I'm actually not sure why it is"}, {"start": 977.68, "end": 984.08, "text": " here because you can do it without like technically the algorithm doesn't require this projection."}, {"start": 984.08, "end": 990.64, "text": " So you can imagine the algorithm without the projection, but just really quickly the projection"}, {"start": 990.64, "end": 997.64, "text": " simply brings down the representation, which is like 2048 dimensional that comes out of"}, {"start": 997.64, "end": 1003.6, "text": " the resin at 50. It has it is a two layer neural network that first pumps this up to like"}, {"start": 1003.6, "end": 1014.6, "text": " 4092 and then compresses it down to 256 dimensions. Okay. So that's the projection network. Again,"}, {"start": 1014.6, "end": 1019.04, "text": " there is a part that's learned and then the target projector is simply the exponential"}, {"start": 1019.04, "end": 1027.2, "text": " moving average of the online projector. But again, this is why exactly this is here,"}, {"start": 1027.2, "end": 1036.08, "text": " probably simply because it works. Right. But probably because there is no there is no distinction"}, {"start": 1036.08, "end": 1040.24, "text": " because you don't have different losses, you simply back propagate through everything"}, {"start": 1040.24, "end": 1045.1599999999999, "text": " and then train everything. So there is no logical distinction between the projection and"}, {"start": 1045.16, "end": 1050.64, "text": " the representation other than you have a different dimensionality. But maybe that's the"}, {"start": 1050.64, "end": 1056.64, "text": " point here that you make a different dimensionality. Even though you could you could do the rest"}, {"start": 1056.64, "end": 1064.48, "text": " in this 2048 space. Yeah. So for now, just this doesn't exist. Let's just say this doesn't"}, {"start": 1064.48, "end": 1072.1200000000001, "text": " exist. And we just work with this representation here. Let's call this ZZ prime. Okay. So what"}, {"start": 1072.12, "end": 1079.12, "text": " happens is we take the representation. And now we have one neural network, the predictor"}, {"start": 1079.12, "end": 1088.1999999999998, "text": " right here that takes the representation of one of the image versions. And it simply tries"}, {"start": 1088.1999999999998, "end": 1095.6, "text": " to predict the representation of the other image versions. So what you want is that Q of"}, {"start": 1095.6, "end": 1111.24, "text": " Z equals Z prime. Okay. And if we expand that is that Q of F of Z is equal to F target"}, {"start": 1111.24, "end": 1121.1599999999999, "text": " of Z prime. And if we expand that even further, you can see that Q. I'll just write Q and F"}, {"start": 1121.16, "end": 1132.88, "text": " for now Q of F of A, which is an augmentation at an augmentation of Z should be one bracket"}, {"start": 1132.88, "end": 1147.3200000000002, "text": " to bracket three bracket should be F of A of Z. Sorry, not Z. That's the image X. All right."}, {"start": 1147.32, "end": 1154.28, "text": " So this makes a lot of sense. You're simply with Q. Since these are all different here."}, {"start": 1154.28, "end": 1161.4399999999998, "text": " So F is the target instead of the online parameters A is also different. It's a different augmentation"}, {"start": 1161.4399999999998, "end": 1170.96, "text": " that you do. But the X is the same. Okay. So the Q simply tries to somehow negate this augmentation"}, {"start": 1170.96, "end": 1177.52, "text": " and this difference between the target and the online parameters. But you don't tell the Q,"}, {"start": 1177.52, "end": 1183.56, "text": " which augmentation was used. And you don't tell the Q. What are the exact parameters of that"}, {"start": 1183.56, "end": 1192.28, "text": " network? So what the Q has to do is it has to somehow. It's like it's like a it has to"}, {"start": 1192.28, "end": 1200.44, "text": " take its best guess, right? So basically the Q is trained to output the expected value"}, {"start": 1200.44, "end": 1213.0800000000002, "text": " of the representation, right? The expected value of the representation F of A of X under"}, {"start": 1213.0800000000002, "end": 1221.4, "text": " all of the different possible image augmentations. And that's why it learns to ignore these"}, {"start": 1221.4, "end": 1227.8400000000001, "text": " augmentations. So your entire goal with these methods is you learn to ignore these augmentations."}, {"start": 1227.84, "end": 1233.8799999999999, "text": " So you want to learn some method that is independent of the augmentations. So by crafting the"}, {"start": 1233.8799999999999, "end": 1240.1999999999998, "text": " augmentations in a smart way, we can make these representations contain a lot of semantic"}, {"start": 1240.1999999999998, "end": 1245.1999999999998, "text": " information. Because what we want to do with the augmentation is basically we want to destroy"}, {"start": 1245.1999999999998, "end": 1250.6799999999998, "text": " all the non-segmentic information, sorry, non-semantic information. And random cropping"}, {"start": 1250.6799999999998, "end": 1256.3999999999999, "text": " is one of those methods. Horizontal flipping is one of those methods because we say, well,"}, {"start": 1256.4, "end": 1261.24, "text": " whatever an image goes left to right to right to left, most of the time the semantics are"}, {"start": 1261.24, "end": 1266.2800000000002, "text": " the same. The pixels are different, but the semantics are the same. So by putting an augmentation"}, {"start": 1266.2800000000002, "end": 1273.88, "text": " in there, we learn to ignore that augmentation because our representation now needs to be"}, {"start": 1273.88, "end": 1284.48, "text": " predictable, right? Q, we learn Q to predict the representation under the expectation of"}, {"start": 1284.48, "end": 1290.24, "text": " our augmentations. And that means it can't be dependent on one particular augmentation."}, {"start": 1290.24, "end": 1299.84, "text": " Okay, it learns to ignore it. So that's basically what's happening here. Again, there is nothing"}, {"start": 1299.84, "end": 1305.56, "text": " keeping this from simply collapsing it to a trivial solution. And it's probably a combination"}, {"start": 1305.56, "end": 1314.4, "text": " of the initialization and the learning procedure itself that it goes on in little, little steps,"}, {"start": 1314.4, "end": 1320.4, "text": " one by one, that keeps it in the realm of rather having to like it's easier to learn a good"}, {"start": 1320.4, "end": 1329.1200000000001, "text": " representation than it is to collapse to that to that solution. Okay. So again, components"}, {"start": 1329.1200000000001, "end": 1335.24, "text": " is image, then you augment differently, then you run it through different encoders, but"}, {"start": 1335.24, "end": 1339.2800000000002, "text": " the encoders are similar in the fact that one is the exponential moving average of the"}, {"start": 1339.28, "end": 1348.3999999999999, "text": " other. And then you try to predict one from the other. And that ultimately makes the representation"}, {"start": 1348.3999999999999, "end": 1354.36, "text": " be independent of the augmentation. And that means that the representation can only include"}, {"start": 1354.36, "end": 1359.92, "text": " things that are not destroyed by the augmentations. And if you construct the augmentations,"}, {"start": 1359.92, "end": 1368.04, "text": " smartly, that means you only retain the semantic information. That's it. So the loss function"}, {"start": 1368.04, "end": 1374.6399999999999, "text": " is pretty simple. As you can see right here, what you want is, and this bar is a normalization,"}, {"start": 1374.6399999999999, "end": 1382.36, "text": " what you want is the L2 norm between the this representation, be close to the queue of"}, {"start": 1382.36, "end": 1388.3999999999999, "text": " that representation. So the queue simply tries to predict the other representation. And"}, {"start": 1388.3999999999999, "end": 1393.8799999999999, "text": " you do that for both ways. So you want to stick the image in here and try to predict the"}, {"start": 1393.88, "end": 1399.44, "text": " other one. And you do advise versa. So you get two loss components each time. It's a symmetric"}, {"start": 1399.44, "end": 1407.2800000000002, "text": " loss. Okay. And that's it. That's the method. And they beat all the other self supervised"}, {"start": 1407.2800000000002, "end": 1414.8400000000001, "text": " methods. And they get pretty close to the supervised supervised representation learning method."}, {"start": 1414.8400000000001, "end": 1419.96, "text": " As you can see right here, as the number of parameters goes up in their model. So one of"}, {"start": 1419.96, "end": 1425.56, "text": " them is resonant 50, but I'm going to guess this one right here. But you can also get to higher"}, {"start": 1425.56, "end": 1432.8400000000001, "text": " architectures. And then it appears to work even better and come even closer to this supervised"}, {"start": 1432.8400000000001, "end": 1438.6000000000001, "text": " baseline. This could be because you know, if you have more parameters technically in a supervised"}, {"start": 1438.6000000000001, "end": 1444.04, "text": " method, you would also need more labeled images, maybe. And therefore it doesn't scale as well."}, {"start": 1444.04, "end": 1450.92, "text": " I don't know. There is a lot of unclarity in this research. Like all they show is that their"}, {"start": 1450.92, "end": 1456.6, "text": " numbers are good, which is cool, right? And it's cool that you don't need you don't need the"}, {"start": 1456.6, "end": 1462.68, "text": " negative samples anymore. And it actually doesn't collapse when you do that kind of stuff. But"}, {"start": 1463.56, "end": 1468.92, "text": " there's a lot of I don't know. There's a lot of things here. For example,"}, {"start": 1468.92, "end": 1480.76, "text": " we use a batch size of 4,096 split over 512 TPU V3 course. With this setup, training takes"}, {"start": 1480.76, "end": 1490.92, "text": " approximately eight hours for resonant 50. So they train eight hours on 512 TPUs. Just imagine"}, {"start": 1490.92, "end": 1498.04, "text": " that. So that's sort of crazy amount of computation again going into these models. And then the second"}, {"start": 1498.04, "end": 1503.24, "text": " thing here is that you can see that there are some things missing right here. And there are all"}, {"start": 1503.24, "end": 1509.48, "text": " these annotations, which probably means that they take these numbers from those papers. Now,"}, {"start": 1510.36, "end": 1518.76, "text": " they allude to the fact that they try to follow their protocol as closely as possible. But I mean,"}, {"start": 1518.76, "end": 1527.08, "text": " that's never that's never given or almost never unless they release like the exact code. And even then,"}, {"start": 1528.12, "end": 1534.36, "text": " there are still going to be differences in even like you'd have to replicate the exact thing on"}, {"start": 1534.36, "end": 1544.6, "text": " the exact same number of TPU cores and whatnot. So I highly like these numbers seem to be"}, {"start": 1544.6, "end": 1552.12, "text": " I'm not sure, especially if you then go and look. And at some point, they actually do"}, {"start": 1553.08, "end": 1560.28, "text": " reproduce the same clear baseline. So you can see right here that they have a own implementation"}, {"start": 1560.28, "end": 1565.8, "text": " of SIM clear. And they actually compare this to the numbers that they find in the SIM clear"}, {"start": 1565.8, "end": 1571.32, "text": " paper. And you can see, for example, here, there's like four percentage points that the"}, {"start": 1571.32, "end": 1578.04, "text": " that the their implementation of SIM clear gains above this implementation. And if you look at"}, {"start": 1578.04, "end": 1584.52, "text": " this supervised baseline, that's also from that paper. And there is a graph further down"}, {"start": 1585.3999999999999, "end": 1593.8799999999999, "text": " where they also implement their own version of the their own version of the supervised baseline."}, {"start": 1593.88, "end": 1602.0400000000002, "text": " I forgot here. So you can see that between the supervised in that paper and the supervised of them,"}, {"start": 1602.0400000000002, "end": 1608.5200000000002, "text": " sometimes there's like a giant gap right here for the same model, it seems. So"}, {"start": 1610.2800000000002, "end": 1616.3600000000001, "text": " all of these numbers, I'm I'm not sure you should put too much weight on the fact that this is now"}, {"start": 1616.36, "end": 1624.28, "text": " outperforming the other methods. I would not put like unless this is like super duper replicated"}, {"start": 1624.28, "end": 1629.9599999999998, "text": " very often, I would not put a lot of weight on the fact that it is better. What I would put a lot"}, {"start": 1629.9599999999998, "end": 1637.24, "text": " of weight on is the fact that it works at all and and achieves, you know, good performance. And"}, {"start": 1637.24, "end": 1643.0, "text": " there is more they make they have like experiments right here that show that their method,"}, {"start": 1643.0, "end": 1651.72, "text": " they be B Y O L is much more resistant to like changes in hyper parameters. So here you can see"}, {"start": 1651.72, "end": 1658.6, "text": " that it falls off much later when you reduce the batch size, which makes sense right because"}, {"start": 1658.6, "end": 1664.2, "text": " SIM clear is one of these methods that uses negative samples. And for negative samples, it uses"}, {"start": 1664.2, "end": 1669.4, "text": " the other samples in the mini batch. Now if you have less samples in the mini batch, that means you"}, {"start": 1669.4, "end": 1676.1200000000001, "text": " have a less representative distribution of your entire data set as negative samples. And therefore"}, {"start": 1676.1200000000001, "end": 1683.0, "text": " if you increase as decrease the mini batch, then this drops off. And also they show that for"}, {"start": 1683.0, "end": 1690.92, "text": " example, their method is much more robust to the removal of a couple of these image augmentations."}, {"start": 1690.92, "end": 1700.6000000000001, "text": " So all of this I find actually pretty cool, but the actual numbers here. First, I'm not super"}, {"start": 1700.6000000000001, "end": 1707.3200000000002, "text": " duper interested that they get like a two or one point more in something, but they do perform"}, {"start": 1707.3200000000002, "end": 1715.88, "text": " like a lot of experiments. And that it shows that you can apply the method to different things."}, {"start": 1715.88, "end": 1722.1200000000001, "text": " It's not only like in one setting. So that's pretty cool. It works at least at you can say it works"}, {"start": 1722.1200000000001, "end": 1729.0800000000002, "text": " at least as well as other methods. And it is a lot easier because you don't have this negative"}, {"start": 1729.0800000000002, "end": 1737.8000000000002, "text": " sample things. Now the last coral I have with the paper and where is it? Where is it?"}, {"start": 1737.8, "end": 1749.72, "text": " Somewhere they say that we release the code that they release the pseudo code. They don't release"}, {"start": 1749.72, "end": 1757.56, "text": " the code. They release the pseudo code in the appendix. So I mean there are reasons why you sometimes"}, {"start": 1757.56, "end": 1763.72, "text": " want to release pseudo code. And that's if an algorithm is so high level and so simple in"}, {"start": 1763.72, "end": 1772.68, "text": " its high levelity and so modular to be fleshed out that you can't, like it makes more sense."}, {"start": 1772.68, "end": 1782.28, "text": " But here it's like pseudo code in jacks. And come on. Is it really that competitively"}, {"start": 1782.28, "end": 1788.76, "text": " advantageous to retain your code? This is it's just not reproducible with this. You know that they"}, {"start": 1788.76, "end": 1796.76, "text": " have like 50 billion hacks in their code. And yeah so deep mind has this history of just not releasing"}, {"start": 1796.76, "end": 1803.0, "text": " like publishing behind paywalls and just giving pseudo code that has lots of mistakes in them."}, {"start": 1803.0, "end": 1809.8799999999999, "text": " Like the museur of pseudo code you can't even like run it in its basic form if you fill in the"}, {"start": 1809.88, "end": 1818.7600000000002, "text": " things. It's it's a bit annoying. In any way the method itself seems promising for representation"}, {"start": 1818.7600000000002, "end": 1824.44, "text": " learning. As I said, especially because it's pretty simple. It's still heavily relies on these"}, {"start": 1824.44, "end": 1831.24, "text": " augmentation methods. So and that's what they say right here. Nevertheless, BY will remain"}, {"start": 1831.24, "end": 1836.92, "text": " dependent on existing sets of augmentations that are specific to vision applications to generalise"}, {"start": 1836.92, "end": 1843.5600000000002, "text": " beyond to other modalities. It is necessary to obtain similarly suitable augmentations for each"}, {"start": 1843.5600000000002, "end": 1849.3200000000002, "text": " of them. Designing such augmentations may require significant effort and expertise. Therefore"}, {"start": 1849.3200000000002, "end": 1853.16, "text": " automating the search for these augmentations would be an important step to generalise"}, {"start": 1853.16, "end": 1859.4, "text": " beyond to other modalities. And I'm not sure if you can do this automating the search for"}, {"start": 1859.4, "end": 1864.68, "text": " these augmentations. I guess you can do it if you have like a supervised data set and then you"}, {"start": 1864.68, "end": 1868.8400000000001, "text": " can search and then you can use those augmentations for the unsupervised. But it seems a bit"}, {"start": 1868.8400000000001, "end": 1877.0800000000002, "text": " bootstrapia. No pun intended right here. I think the power of these representations again comes from"}, {"start": 1877.0800000000002, "end": 1886.52, "text": " the fact that we have these augmentations carefully constructed. So oh yes, the last thing broader"}, {"start": 1886.52, "end": 1892.28, "text": " impact statement. Just read this. I could try to estimate the perplexity of this broader impact"}, {"start": 1892.28, "end": 1898.84, "text": " statement. Let's go. The presented research should be categorised as research in the field of"}, {"start": 1898.84, "end": 1905.96, "text": " unsupervised learning. This work may inspire new algorithms, theoretical and experimental"}, {"start": 1905.96, "end": 1912.28, "text": " investigation. The algorithm presented here can be used for many different vision applications"}, {"start": 1912.28, "end": 1918.92, "text": " and a particular use may have both positive or negative impacts, which is known as the dual"}, {"start": 1918.92, "end": 1925.96, "text": " use problem. Besides, as vision data sets could be biased, the representation learned by B.O."}, {"start": 1925.96, "end": 1934.3600000000001, "text": " could be susceptible to replicate these biases. Like come on. So people who advocated for making"}, {"start": 1934.3600000000001, "end": 1940.68, "text": " everyone do this. Is this what you wanted? Is this like, is this a satisfactory result for you?"}, {"start": 1940.68, "end": 1947.48, "text": " And if you have this as a reviewer, is this okay or not? I mean, let's just cross out some word"}, {"start": 1947.48, "end": 1956.04, "text": " here. Blank. Let's blend like field. Let's just put field or machine learning. Why not machine learning?"}, {"start": 1956.68, "end": 1962.68, "text": " Machine learning. This work inspired new algorithms. Yes, the algorithm presented here can be used"}, {"start": 1962.68, "end": 1968.1200000000001, "text": " for many different machine learning applications. And a particular use may have both negative"}, {"start": 1968.12, "end": 1978.04, "text": " yes. Besides, as data sets could be biased, the representation learned by this paper could be"}, {"start": 1978.04, "end": 1985.1599999999999, "text": " susceptible to replicate these biases. Well, there's a copy thing that you can apparently put into"}, {"start": 1985.1599999999999, "end": 1991.4799999999998, "text": " any and all papers that you write from now on. And hey, deep minds doing it. So, you know,"}, {"start": 1991.48, "end": 1998.6, "text": " there you go. Okay, maybe a bit cynical, but I'm like, I told you this would happen. I told you"}, {"start": 1998.6, "end": 2007.88, "text": " and, you know, okay. So that was it for my comments right here. They do have like a giant ton"}, {"start": 2007.88, "end": 2013.48, "text": " of experiments. And I appreciate that, right? They really try to show that it works in many different"}, {"start": 2013.48, "end": 2020.84, "text": " situations. And yeah, yet to solve why this doesn't collapse, but apparently it doesn't. So try it"}, {"start": 2020.84, "end": 2024.76, "text": " out. Give it a try. And I'll see you next time. Bye bye."}] |
Yannic Kilcher | 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 Kyung-joon-e Baik, Yoon-jae Choi, Yong-jong-u, Ja-joon-u and Jung-jong-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 will 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 it's 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'd 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 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 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 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 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 a 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 discriminator. So general adversarial network. But they have like a bit of some sort of twists. So you can already see from the, 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 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 of 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, 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 discriminator's point of view, it's simply a label conditioned discriminator discriminating between real and false. And I think that's how you train the discriminator is you would give an image and you would let this 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 you'd 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 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 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 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 zero and dot, dot, dot, dot, k minus one. 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 these 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. Alright. 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 the 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 explain. If we look at the loss, it becomes clear 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. 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 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 it a lot easier. 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, random crop or a horizontal flip and so on. So 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're going to augment it. So that means we're going to like random crop it or 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. The class label here, so P is going to be the class distribution. Alright, so that's going to be like a histogram or maybe the log it's already. 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 the entropy is really high of the distribution P, that means that different images get assigned to different classes, 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 list is class five. Okay. This image is class five. 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 blue or 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 detach anywhere here, that means that we do get gradient back propagation from the generator to the style code. So that means 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. They 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 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 it. You train them, 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 end in queue and use. 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 this 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 X1, X2, X3 are different images. So we put X1 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 X1 to be X1 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, 3 and 2. 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. It's the same principle again. We want, we'll say that these augmentations, they don't really change anything about the style. Now this argument is a bit more wonky, but if you think of random crops and random flips, don't really change anything about the fur color or so of a cat. So we want those two to be closer together than S is to any of these other images. 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're going to see, this 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 end-poss-on-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 in animal faces from this to that compared to the previous overclustering 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. Alright. 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 discrimin, 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. 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 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 here and we get its label from the encoder. The 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 you see right here, the generator never has access to Y tilde. 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 also the encoder gives, but doesn't tell to the generator. Okay. 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. Okay. Otherwise, that would be a valid tactic. So that's cool. That's the adversarial loss. That's the most important loss. Now there's also additional losses. So 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 generate. So now there's still the danger that the degenerate or simply produces a valid image from the data set or even from the domain Y tilde. Though I don't know how it would know why 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 I, 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. All right. 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 would not be aligned. And with this, you force that the style of an image itself, if you put that into the generator, it will lead to that image itself. Okay. That's it. So 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 it's 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 this 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'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 eight domain, eight domains of cuts. And you can simply divide your data set into these eight domains, right? One, two, three, four, five, 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 ganthing, 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 gant 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 down like a non-linear 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 purposes of investigating, will visualize the labels with colors. And what you'll see here are 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. That means the style is sort of representative of the domain. Okay, and 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 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, TSNI visualization of the style 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 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 will group them together, which is pretty cool and sort of verifies that it recognizes 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 is actually learned to separate things. I still find this pretty magical to this is completely unsupervised. And it sort of finds these clusters by itself. 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 it works pretty well. So they always have one adult animal and one child animal. 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 fox. 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 are 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 the 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-Sniplots 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.6000000000000005, "text": " Hi there. Today we'll look at rethinking the truly unsupervised image to image translation"}, {"start": 6.6000000000000005, "end": 16.84, "text": " by Kyung-joon-e Baik, Yoon-jae Choi, Yong-jong-u, Ja-joon-u and Jung-jong-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.64, "text": " So on a high level, they replace the need for domain or really single image label annotations"}, {"start": 31.64, "end": 37.44, "text": " in image to image translation by training a guiding network that is able to sort of do"}, {"start": 37.44, "end": 44.08, "text": " a self-clustering of the image domain. And therefore, that guides the image to image translation"}, {"start": 44.08, "end": 51.68, "text": " instead of the previously needed labels. I myself don't know too much about image to image"}, {"start": 51.68, "end": 56.68, "text": " translation and style transfer and all of this stuff. This has always been kind of a mystery"}, {"start": 56.68, "end": 63.480000000000004, "text": " to me and will try to make as much sense as possible out of this paper if you're with"}, {"start": 63.480000000000004, "end": 70.52, "text": " me. I might not get everything right, but I will give my best of course. As always,"}, {"start": 70.52, "end": 75.24, "text": " if you like content like this, consider sharing it out and leaving a like and a comment."}, {"start": 75.24, "end": 81.91999999999999, "text": " I do read the comments, so I get a good idea of what you have to say about it. Cool."}, {"start": 81.91999999999999, "end": 87.64, "text": " So what we're seeing here is an example of image to image translation of like a sort of"}, {"start": 87.64, "end": 94.24, "text": " a style transfer. Now what you'll have on the left is a source image. Now the goal is"}, {"start": 94.24, "end": 100.8, "text": " to translate this source image to a different domain while sort of keeping the features"}, {"start": 100.8, "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.12, "text": " we keep the pose of the cat the same. Okay. So we sort of keep the same cat, but we want"}, {"start": 112.12, "end": 119.03999999999999, "text": " to change its style, which means it's breed in this particular case. So on the top, you"}, {"start": 119.03999999999999, "end": 125.92, "text": " can see that the domain images are they come in these different groups. And in fact,"}, {"start": 125.92, "end": 130.92000000000002, "text": " it's not only those four, but the entire data set is split into these different groups."}, {"start": 130.92000000000002, "end": 137.64000000000001, "text": " And among these different groups, you have some sort of a shared style. Now this shared"}, {"start": 137.64000000000001, "end": 144.08, "text": " style is what you would like to transfer to the source image. So if you transfer the style"}, {"start": 144.08, "end": 150.4, "text": " of all of these cats right here, which all seem to be sort of ginger cats to this instance"}, {"start": 150.4, "end": 155.8, "text": " right here, what you'll end up with is a cat. Okay. It was ginger before might not be the"}, {"start": 155.8, "end": 162.84, "text": " best example, but you sort of get what I mean is that the thing that you transfer is whatever"}, {"start": 162.84, "end": 171.08, "text": " is common among these domain images. Okay. And that's what I guess explains why the pose"}, {"start": 171.08, "end": 178.32, "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.6, "text": " image to image transfer or translation. Now until this paper, at least that's what the"}, {"start": 192.6, "end": 200.0, "text": " paper claims, these image to image translation models, they required labels. And why is that?"}, {"start": 200.0, "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.72, "text": " different style vectors out or you actually would need label annotations for each image,"}, {"start": 213.72, "end": 218.56, "text": " for each single image, you would need to know which one you need to know which one of the"}, {"start": 218.56, "end": 223.0, "text": " source corresponds to which one of the target. So they have a graphic right here where they"}, {"start": 223.0, "end": 230.28, "text": " explain the sort of different the different stages that image to image translation went"}, {"start": 230.28, "end": 236.60000000000002, "text": " through historically. So first you'd have to have corresponding images one to one where"}, {"start": 236.6, "end": 242.44, "text": " you'd say, okay, here is an example of a sketch of a shoe and here is the corresponding"}, {"start": 242.44, "end": 246.95999999999998, "text": " shoe. Here is the sketch of another shoe and here is the corresponding shoe and so on."}, {"start": 246.95999999999998, "end": 253.6, "text": " And from that you could learn a model that translates from one domain to the other because"}, {"start": 253.6, "end": 260.71999999999997, "text": " you have corresponding image level annotations which image corresponds to which. So basically"}, {"start": 260.71999999999997, "end": 265.84, "text": " which element of the domain A corresponds to which element in the domain B. Then the"}, {"start": 265.84, "end": 270.91999999999996, "text": " next stage of this was when you only need set level annotations and that's sort of what"}, {"start": 270.91999999999996, "end": 277.28, "text": " we looked at if you had supervised labels for domains. So what you'll say is that there"}, {"start": 277.28, "end": 285.55999999999995, "text": " are three domains A, B and C and actually let's forget C for a moment and just deal with"}, {"start": 285.55999999999995, "end": 290.91999999999996, "text": " A and B to make it equivalent to the thing on the left. Now I just know that these things"}, {"start": 290.92, "end": 297.84000000000003, "text": " are instances of class A and these things are instances of class B. Yet I don't, there's"}, {"start": 297.84000000000003, "end": 305.08000000000004, "text": " no correspondence, right? There is no this corresponds to this or something like this."}, {"start": 305.08000000000004, "end": 310.40000000000003, "text": " So image to image translation is now possible between domains when I just have domain"}, {"start": 310.40000000000003, "end": 318.16, "text": " level labels. But this is still expensive collecting these labels, you know, it's like collecting"}, {"start": 318.16, "end": 323.0, "text": " labels for a supervised data set. A human needs to look at each image and then conclude"}, {"start": 323.0, "end": 330.76000000000005, "text": " what sort of domain it is. Their paper introduces the following where you do not have domains"}, {"start": 330.76000000000005, "end": 337.76000000000005, "text": " anymore. You simply have a data set X. Now this data set your hypothesis is that there"}, {"start": 337.76000000000005, "end": 343.08000000000004, "text": " are still going to be domains in the data set. They can, I guess they can be overlapping"}, {"start": 343.08000000000004, "end": 347.68, "text": " or not but there are still going to be domains. You just don't know what they are. So in"}, {"start": 347.68, "end": 355.16, "text": " this case, I guess you could differentiate these people into many, many different ways."}, {"start": 355.16, "end": 359.68, "text": " But in essence, you're going to assume that there is some kind of a domain structure."}, {"start": 359.68, "end": 366.48, "text": " You just don't know what it is. But if you knew what it was, then you could simply apply"}, {"start": 366.48, "end": 374.48, "text": " methods from here to the data set and you'd be done. Now their paper shows that if you"}, {"start": 374.48, "end": 379.12, "text": " apply something like a self clustering approach and we've seen these approaches before in"}, {"start": 379.12, "end": 385.56, "text": " the paper about learning to classify images without labels. If you have techniques like"}, {"start": 385.56, "end": 391.56, "text": " this, you can do like a self clustering approach on this data set X right here. And then you"}, {"start": 391.56, "end": 396.8, "text": " could learn your image to image translation. Yet this paper shows that if you do that,"}, {"start": 396.8, "end": 403.48, "text": " the quality is not as good as if you do both things jointly. So what this paper does"}, {"start": 403.48, "end": 412.08000000000004, "text": " is it jointly learns to cluster, let's say to self label the images and to make the,"}, {"start": 412.08000000000004, "end": 417.20000000000005, "text": " to do this image to image translation. And by doing the tasks jointly, they help each"}, {"start": 417.20000000000005, "end": 425.0, "text": " other perform better. Okay. That's a general overview. So how do they do this? They have"}, {"start": 425.0, "end": 433.84, "text": " three different parts to their model. There is the encoder or they call this the guiding"}, {"start": 433.84, "end": 439.72, "text": " network. There is the generator and there is the discriminator. So the generator and"}, {"start": 439.72, "end": 445.44, "text": " the discriminator, they are fairly standard, gan generators and discriminator. So general"}, {"start": 445.44, "end": 451.8, "text": " adversarial network. But they have like a bit of some sort of twists. So you can already"}, {"start": 451.8, "end": 459.04, "text": " see from the, from the drawings right here, the discriminator is probably the easiest."}, {"start": 459.04, "end": 464.68, "text": " The discriminator gets an image right here. It doesn't have to be a generated. It is"}, {"start": 464.68, "end": 471.40000000000003, "text": " either a generated image or a real image. And it needs to decide, you can see right here,"}, {"start": 471.40000000000003, "end": 477.48, "text": " this means that the input domain is a vector or an image in this case. And the output is"}, {"start": 477.48, "end": 485.08000000000004, "text": " a number. It needs to decide if it's real or fake. Now, in fact, it's not as easy because"}, {"start": 485.08000000000004, "end": 491.08000000000004, "text": " you can see there are these multiple heads right here. So this whole thing, as I said,"}, {"start": 491.08000000000004, "end": 496.12, "text": " is built on this kind of pseudo clustering approach. There is this pseudo label that comes"}, {"start": 496.12, "end": 502.88, "text": " out of the left side. We're going to look at that in a second. But in essence, you assume"}, {"start": 502.88, "end": 508.32, "text": " that there are multiple classes, multiple domains in the data set. And the discriminator"}, {"start": 508.32, "end": 514.92, "text": " here has one classification head for each of those classes. So from somewhere outside,"}, {"start": 514.92, "end": 520.04, "text": " it will get the information of this is now supposed to be one of those ginger cats,"}, {"start": 520.04, "end": 525.48, "text": " right? As opposed to one of those black and white cats or one of the brown haired cats."}, {"start": 525.48, "end": 531.64, "text": " No, it's one of the ginger cats. And then there is a special head on top of the classifier"}, {"start": 531.64, "end": 538.52, "text": " that only classifies fake from real ginger cats, which is a different classifier from"}, {"start": 538.52, "end": 544.04, "text": " the other domains. So the discriminator, it's sort of a conditional discriminator conditioned"}, {"start": 544.04, "end": 549.72, "text": " on a label. Okay, from the discriminator's point of view, it's simply a label conditioned"}, {"start": 549.72, "end": 556.64, "text": " discriminator discriminating between real and false. And I think that's how you train"}, {"start": 556.64, "end": 565.16, "text": " the discriminator is you would give an image and you would let this encoder here, this"}, {"start": 565.16, "end": 570.4, "text": " guiding network label the image and how we come up with this label again that will look"}, {"start": 570.4, "end": 576.12, "text": " in a second. But this just gives a label. And then you'd you'd for that particular label,"}, {"start": 576.12, "end": 582.48, "text": " you'd classify the image into real or false. Now, the fact that there is this shared part"}, {"start": 582.48, "end": 588.08, "text": " right here, of course, is you could also think of having one discriminator per class."}, {"start": 588.08, "end": 592.24, "text": " But the shared part gives you some shared features and so on. But it's not necessary."}, {"start": 592.24, "end": 598.04, "text": " It's not the the point is that there is a discriminator per class. It's class conditional."}, {"start": 598.04, "end": 606.88, "text": " Okay. So what about the generator? I think is I guess is the most complex. What about"}, {"start": 606.88, "end": 613.0, "text": " this encoding network right here? It's e for encoder, I guess, but they also call it"}, {"start": 613.0, "end": 619.64, "text": " the guiding network. So what this does is this is what's supposed to do is it'll take"}, {"start": 619.64, "end": 626.68, "text": " an image, any image, and it will output two things. One is a label and one is a style"}, {"start": 626.68, "end": 636.4, "text": " code. So the label is supposed to be a number between zero and dot, dot, dot, dot, k minus"}, {"start": 636.4, "end": 642.2399999999999, "text": " one. So that's supposed to be a class label. And how do you know how many classes there"}, {"start": 642.2399999999999, "end": 648.12, "text": " are if there are no labels? You just guess. And your best bet is to slightly over guess."}, {"start": 648.12, "end": 654.9599999999999, "text": " So if you expect there to be between 10 and 15 classes, maybe put k to 20. Okay. You don't"}, {"start": 654.96, "end": 661.84, "text": " want to under guess, but you can over guess. But not by too much, of course. So you have"}, {"start": 661.84, "end": 669.6800000000001, "text": " to have this, this estimation of how many classes, but then these e, it simply comes up with"}, {"start": 669.6800000000001, "end": 676.24, "text": " a class label and it also comes up with the style code. Now these two things are going"}, {"start": 676.24, "end": 683.76, "text": " to go then different pathways in this in this network. The label is directly going to"}, {"start": 683.76, "end": 693.36, "text": " the discriminator. Right. The generator does not see the label. Okay. The style code does"}, {"start": 693.36, "end": 698.36, "text": " not go to the discriminator, but goes to the generator. Alright. So the two inputs from"}, {"start": 698.36, "end": 704.52, "text": " the encoder, they one goes to the discriminator, which is the label and one goes to the generator,"}, {"start": 704.52, "end": 713.84, "text": " which is the style. Now the generator, lastly, it takes a source image and it takes the"}, {"start": 713.84, "end": 719.96, "text": " style code right here. Now the style code is encapsulating as we said, the style of the"}, {"start": 719.96, "end": 728.48, "text": " reference image. So the style is supposed to be whatever, whatever, whatever makes this"}, {"start": 728.48, "end": 734.96, "text": " domain of images the same. So the style, the way we're going to train this is that the"}, {"start": 734.96, "end": 740.64, "text": " style is going to describe somehow all the images that are from this label. The style"}, {"start": 740.64, "end": 747.44, "text": " is going to describe whatever the style is. It's very hard to explain. If we look at the"}, {"start": 747.44, "end": 755.44, "text": " loss, it becomes clear why the things are how they are. So it takes the style code and it"}, {"start": 755.44, "end": 762.0400000000001, "text": " takes the source image and it combines them and its task is to output this generated image."}, {"start": 762.0400000000001, "end": 766.24, "text": " As you can see in this example, the generated image is basically this cat, but with the"}, {"start": 766.24, "end": 773.5600000000001, "text": " style of the reference image. And it outputs an image and the discriminator of course then"}, {"start": 773.5600000000001, "end": 779.2800000000001, "text": " is tasked with differentiating whether that image is real or fake for the given label"}, {"start": 779.28, "end": 785.9599999999999, "text": " over here. So this is the entire thing and you all train this jointly. So you jointly"}, {"start": 785.9599999999999, "end": 792.28, "text": " train the encoder to produce these class labels and the styles. You train the generator"}, {"start": 792.28, "end": 797.1999999999999, "text": " to take in the styles and the source images and output the generated image to fool the"}, {"start": 797.1999999999999, "end": 802.56, "text": " discriminator and the discriminator at the same time is trained to differentiate between"}, {"start": 802.56, "end": 811.92, "text": " real and fake images based on the label that the encoder gives. Very convoluted and complicated,"}, {"start": 811.92, "end": 819.1999999999999, "text": " but there are a few things that make it easier. First of all, as you can see here, the pseudo"}, {"start": 819.1999999999999, "end": 826.52, "text": " label is detached, is argmaxed and detached. So the pseudo label really is a number and"}, {"start": 826.52, "end": 835.4399999999999, "text": " there is no gradient back propagation along this line. Okay, that makes it a lot easier."}, {"start": 835.4399999999999, "end": 843.48, "text": " So what we first need is we need a way to train the encoder to come up with suitable class"}, {"start": 843.48, "end": 849.12, "text": " labels even though it doesn't get any back propagation signal into that part of its"}, {"start": 849.12, "end": 855.56, "text": " network. So that's where we start with the loss functions. The way we're going to do this"}, {"start": 855.56, "end": 862.9599999999999, "text": " is we're going to take the following approach. We're going to take an image and we're going"}, {"start": 862.9599999999999, "end": 869.92, "text": " to take a randomly augmented version. So for example, random crop or a horizontal flip"}, {"start": 869.92, "end": 875.28, "text": " and so on. So now we bring in ideas from self-supervision. And again, if you watch the video"}, {"start": 875.28, "end": 881.0799999999999, "text": " on learning to classify images without labels, this is one of their main staples. These"}, {"start": 881.08, "end": 889.08, "text": " self-supervised approaches really tend to learn representations that allow you to self-cluster."}, {"start": 889.08, "end": 893.4000000000001, "text": " Now in that paper, they go further and they do this nearest neighbor thing. In this paper,"}, {"start": 893.4000000000001, "end": 898.76, "text": " they just do sort of the first step of this self-clustering, which I guess makes it such"}, {"start": 898.76, "end": 905.44, "text": " that you could potentially improve this paper by applying the other paper, but who knows."}, {"start": 905.44, "end": 911.6400000000001, "text": " So we're going to take an image and we're going to augment it. So that means we're going"}, {"start": 911.6400000000001, "end": 918.48, "text": " to like random crop it or change its luminance or whatnot. So we have two versions of the"}, {"start": 918.48, "end": 923.96, "text": " same image. And what we want to maximize, we want to maximize the mutual information"}, {"start": 923.96, "end": 930.72, "text": " between, not between the images themselves, but P is going to be this output of the encoder."}, {"start": 930.72, "end": 938.64, "text": " So X goes into the encoder and the encoder outputs the style and the class label. The"}, {"start": 938.64, "end": 944.6800000000001, "text": " class label here, so P is going to be the class distribution. Alright, so that's going"}, {"start": 944.6800000000001, "end": 951.76, "text": " to be like a histogram or maybe the log it's already. Yeah, so it's going to be a histogram"}, {"start": 951.76, "end": 960.6, "text": " over classes from which we're going to sample the label C or L or whatnot, Y hat, Y. But"}, {"start": 960.6, "end": 966.48, "text": " the P is the distribution over output classes. So since we don't have a label, we can't"}, {"start": 966.48, "end": 972.9200000000001, "text": " train the distribution like in a supervised way, supervised way. So what we'll have to"}, {"start": 972.9200000000001, "end": 977.72, "text": " say is we want to maximize the mutual information between the output distribution of the image"}, {"start": 977.72, "end": 983.76, "text": " and the output distribution of the augmented image. Now that entails the following two"}, {"start": 983.76, "end": 991.56, "text": " quantities. There's the entropy of P and there's the conditional entropy of P given P"}, {"start": 991.56, "end": 1000.72, "text": " augmented. Now, first of all, it means we want to maximize this, the entropy of P. And"}, {"start": 1000.72, "end": 1006.48, "text": " that's supposed to be over the entire data set. So this is the entropy over the entire"}, {"start": 1006.48, "end": 1016.08, "text": " data set X. What it means is that we want different X's. So if there's X1, X2, X3 and so"}, {"start": 1016.08, "end": 1025.32, "text": " on, we want those to have different distributions in labels. Okay. So if the entropy is really"}, {"start": 1025.32, "end": 1031.84, "text": " high of the distribution P, that means that different images get assigned to different"}, {"start": 1031.84, "end": 1037.36, "text": " classes, something like this. All right. If this is low, then that would mean all the"}, {"start": 1037.36, "end": 1043.3999999999999, "text": " images basically get assigned to the same class. And that's not good. We want our classifier,"}, {"start": 1043.3999999999999, "end": 1048.1599999999999, "text": " since we don't have labels, it's a, it's basically a cluster. We want our cluster to sort"}, {"start": 1048.1599999999999, "end": 1053.6399999999999, "text": " of fill the space of possible clusters with the images. So that's the first thing. We"}, {"start": 1053.6399999999999, "end": 1058.1599999999999, "text": " want to maximize the mutual information. We need to maximize this entropy. And then"}, {"start": 1058.16, "end": 1065.44, "text": " second, since this is a minus here, we need to minimize the conditional entropy of P given"}, {"start": 1065.44, "end": 1074.3200000000002, "text": " P augmented. What does that mean? That means if we know the augmented version of an image,"}, {"start": 1074.3200000000002, "end": 1081.76, "text": " its class labeling should be the same as the un augmented version. So that means that"}, {"start": 1081.76, "end": 1090.28, "text": " if I now take one of these X's to X1 augmented, or they do a plus augmented, right, then that"}, {"start": 1090.28, "end": 1096.8, "text": " shouldn't really change its class label. And this is what these so that should sort of"}, {"start": 1096.8, "end": 1103.48, "text": " keep the class labeling. This is horrible. But the idea here is that it's kind of a reverse"}, {"start": 1103.48, "end": 1109.6, "text": " thinking from supervised learning in supervised learning. We have the label like this is class"}, {"start": 1109.6, "end": 1116.0, "text": " list is class five. Okay. This image is class five. And our thinking is this augmentation"}, {"start": 1116.0, "end": 1120.9599999999998, "text": " techniques. If I random crop an image or if I change its colorization a little bit,"}, {"start": 1120.9599999999998, "end": 1125.28, "text": " the class is not going to change, right? An airplane with a, in front of a blue sky is"}, {"start": 1125.28, "end": 1131.8799999999999, "text": " still an airplane in front of a bit blue or sky. So I assume that it'll still have the"}, {"start": 1131.8799999999999, "end": 1138.08, "text": " same label here. I don't have the label, but what I can require is to say whatever you"}, {"start": 1138.08, "end": 1144.6799999999998, "text": " output for the image, it should be the same for the augmented image. So these two objectives"}, {"start": 1144.6799999999998, "end": 1150.72, "text": " are enough to give you sort of a rough clustering of the output space, maximize the entropy,"}, {"start": 1150.72, "end": 1157.32, "text": " minimize the conditional entropy between two versions of the same image. Okay. That's"}, {"start": 1157.32, "end": 1162.8799999999999, "text": " how we train this pseudo labeling approach. So now we have a, we have a model that can"}, {"start": 1162.88, "end": 1174.8000000000002, "text": " give a label to each image. Very cool. So how do we train the other parts? Now there"}, {"start": 1174.8000000000002, "end": 1185.0, "text": " are additional, additional losses here. So I'm not sure. Yeah, we'll go over it. So this"}, {"start": 1185.0, "end": 1190.92, "text": " style part is also has to be trained, right? This encoder outputs a labeling. We got"}, {"start": 1190.92, "end": 1195.8400000000001, "text": " that covered and it outputs a style part. Now the style part, if you can see from the"}, {"start": 1195.8400000000001, "end": 1204.16, "text": " graphic, it actually goes into, let me erase some of that stuff here, the style part actually"}, {"start": 1204.16, "end": 1211.1200000000001, "text": " is down here and it feeds into the generator. And luckily they write detach here. And"}, {"start": 1211.1200000000001, "end": 1216.4, "text": " since they don't write detach anywhere here, that means that we do get gradient back"}, {"start": 1216.4, "end": 1225.76, "text": " propagation from the generator to the style code. So that means our encoder here is trained"}, {"start": 1225.76, "end": 1233.64, "text": " to help the generator with its task of fooling the discriminator. Okay. But first of"}, {"start": 1233.64, "end": 1238.68, "text": " all, we're going to forget about that for now. What we're going to do is simply look at"}, {"start": 1238.68, "end": 1243.16, "text": " a loss that they impose on the style. They wouldn't, they don't have to impose that"}, {"start": 1243.16, "end": 1249.2, "text": " loss, but they have an additional loss on the style codes for the encoder in addition"}, {"start": 1249.2, "end": 1253.92, "text": " to the fact that there is gradient back propagating from G. So the second loss we're"}, {"start": 1253.92, "end": 1261.52, "text": " going to look at is this style loss. The style loss is almost the same. So the style loss"}, {"start": 1261.52, "end": 1268.92, "text": " is a contrastive loss. So what you want to do is if you have your data set, you have"}, {"start": 1268.92, "end": 1274.44, "text": " your data set of images and you, you know, take images out and you train your network"}, {"start": 1274.44, "end": 1278.72, "text": " on it. You train them, take the next image or you take batches of image, you take train"}, {"start": 1278.72, "end": 1285.3200000000002, "text": " and so on. Like this, right? And now you have this image. What you want to do for this"}, {"start": 1285.3200000000002, "end": 1289.52, "text": " to work is you want to build up sort of a queue of images that you have already looked"}, {"start": 1289.52, "end": 1295.0, "text": " at, like these images. These are going and the queue can be, let's say, 10 long and you"}, {"start": 1295.0, "end": 1298.96, "text": " would always throw out the oldest and end in queue and use. So when you're done with this"}, {"start": 1298.96, "end": 1304.48, "text": " image right here, you'll put it into the queue, you load your next image and so on. So now"}, {"start": 1304.48, "end": 1310.56, "text": " what does this mean? You now always have a queue of other images and it's not important"}, {"start": 1310.56, "end": 1319.52, "text": " what they are as long as they are others, right? Because now we're going to compare ourselves"}, {"start": 1319.52, "end": 1324.8799999999999, "text": " with others and this is this contrastive loss right here. So this style loss is going to"}, {"start": 1324.8799999999999, "end": 1333.2, "text": " be a contrastive loss between this and this. Now the bottom part, this here, these are"}, {"start": 1333.2, "end": 1342.36, "text": " the others. These are the other images and whether the individual quantities. So S is"}, {"start": 1342.36, "end": 1348.28, "text": " the style code of the image you're considering right now. S plus, you could have already"}, {"start": 1348.28, "end": 1355.84, "text": " guessed it is the style code of the augmented image, right? So we had our image X, let's"}, {"start": 1355.84, "end": 1363.56, "text": " go again with X1, X2, X3 are different images. So we put X1 through the encoder that gives"}, {"start": 1363.56, "end": 1368.52, "text": " us S, the style. It also gives us the class label, but now we care about this head that gives"}, {"start": 1368.52, "end": 1378.04, "text": " us the style code and we augment X1 to be X1 plus and we go, we put that through the"}, {"start": 1378.04, "end": 1386.28, "text": " encoder that gives us S plus. And now we also put all of these other images. Remember these"}, {"start": 1386.28, "end": 1390.6, "text": " are the images that we've looked at previously, but the only real importance is that there"}, {"start": 1390.6, "end": 1397.92, "text": " are other images. We put those through here and they get the S minus, I in this case,"}, {"start": 1397.92, "end": 1407.36, "text": " 3 and 2. So now what will require is that the S, the style code of our image is closer"}, {"start": 1407.36, "end": 1413.28, "text": " to the style code of its augmented version. It's the same principle again. We want, we'll"}, {"start": 1413.28, "end": 1418.9199999999998, "text": " say that these augmentations, they don't really change anything about the style. Now this"}, {"start": 1418.9199999999998, "end": 1424.1999999999998, "text": " argument is a bit more wonky, but if you think of random crops and random flips, don't"}, {"start": 1424.1999999999998, "end": 1431.6399999999999, "text": " really change anything about the fur color or so of a cat. So we want those two to be"}, {"start": 1431.64, "end": 1439.5600000000002, "text": " closer together than S is to any of these other images. So this is a contrast of loss where"}, {"start": 1439.5600000000002, "end": 1446.44, "text": " you pull together two things that you think should be close and you push apart things"}, {"start": 1446.44, "end": 1454.0, "text": " that you think should be far away from each other. So this style loss basically guarantees"}, {"start": 1454.0, "end": 1460.48, "text": " that you have a distinct style for each image that is robust to the kind of transformations"}, {"start": 1460.48, "end": 1469.64, "text": " that you do under augmentation. Okay. Specifically, this style loss doesn't care about the domain,"}, {"start": 1469.64, "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": 1482.1200000000001, "text": " or from different domains. And that's why the style is basically individual to the image."}, {"start": 1482.12, "end": 1490.84, "text": " But as we're going to see, this style does capture something of the domain as well. But this"}, {"start": 1490.84, "end": 1496.9199999999998, "text": " loss right here is supposed to be, each image has a style, right? So this is the style"}, {"start": 1496.9199999999998, "end": 1501.6, "text": " code of X, this end-poss-on-way classification enables E to utilize not only the similarity"}, {"start": 1501.6, "end": 1506.9599999999998, "text": " of the positive pair, but also the dissimilarity of the negative pairs, where the negative style"}, {"start": 1506.96, "end": 1514.08, "text": " codes are stored into a queue using previously sampled images. We observe that adding this"}, {"start": 1514.08, "end": 1519.08, "text": " objective significantly improves unsupervised classification accuracy in animal faces from"}, {"start": 1519.08, "end": 1527.56, "text": " this to that compared to the previous overclustering approach. Okay. So we have two outputs now."}, {"start": 1527.56, "end": 1535.16, "text": " And now we go to the adversarial loss. So the question is how do we train the generator"}, {"start": 1535.16, "end": 1542.16, "text": " and the discriminator? So they have three different losses for the generator and the discriminator."}, {"start": 1542.16, "end": 1548.3200000000002, "text": " And the most important one, of course, is this adversarial loss right here. So the discriminator"}, {"start": 1548.3200000000002, "end": 1557.4, "text": " simply tries to distinguish. Is an image real or fake conditioned on a class? So in case"}, {"start": 1557.4, "end": 1564.1200000000001, "text": " of a real image, and that's this line right here, it tries to distinguish, is this real"}, {"start": 1564.12, "end": 1572.9599999999998, "text": " or fake based on Y and Y is X fed to the encoder and the encoder gives you a label. Alright."}, {"start": 1572.9599999999998, "end": 1578.8799999999999, "text": " That's and the label selects the head of the discriminator. At the same time that the"}, {"start": 1578.8799999999999, "end": 1583.3999999999999, "text": " discriminator is trying to distinguish real from fake. So these two lines, the generator"}, {"start": 1583.3999999999999, "end": 1589.6399999999999, "text": " is trying to fool the discriminator. So the upper, if you've never seen a GaN loss,"}, {"start": 1589.64, "end": 1596.72, "text": " the upper part here, that's the real data and the bottom part here is the fake data."}, {"start": 1596.72, "end": 1603.3200000000002, "text": " Now at the same time, the discriminator is trying to distinguish real from fake and"}, {"start": 1603.3200000000002, "end": 1609.48, "text": " the generator is trying to make the discrimin, fool the discriminator. So both are of the generator"}, {"start": 1609.48, "end": 1615.8000000000002, "text": " and the discriminator are actually using that loss, but the sign in front of it is different."}, {"start": 1615.8, "end": 1620.8799999999999, "text": " And since the generator is not involved in the top line, you can usually leave that away"}, {"start": 1620.8799999999999, "end": 1628.56, "text": " because there's no back prop path through that. And there's no back prop path here because"}, {"start": 1628.56, "end": 1635.52, "text": " we detach the graph right here. So there is no gradient signal going to the encoder."}, {"start": 1635.52, "end": 1641.3999999999999, "text": " So this bottom line, what does it mean? The generator will take in an image and the"}, {"start": 1641.4, "end": 1649.3200000000002, "text": " style, now S tilde comes from X tilde. It's X tilde going through the encoder, giving"}, {"start": 1649.3200000000002, "end": 1656.92, "text": " you S tilde. So this is the reference image, right? This is, you want this style right here."}, {"start": 1656.92, "end": 1663.48, "text": " This is the reference image and X is the source image. So the generator is supposed to take"}, {"start": 1663.48, "end": 1672.4, "text": " the source image and basically apply the style from the reference image and generate X,"}, {"start": 1672.4, "end": 1680.76, "text": " I don't even know how to call this X, it's not tilde, whatever, X fake, X F. And that's"}, {"start": 1680.76, "end": 1690.3600000000001, "text": " supposed to fool the discriminator. Now the question is which discriminator, right? Because"}, {"start": 1690.36, "end": 1694.9599999999998, "text": " you need a label for the discriminator, the label is conditional with this discriminator"}, {"start": 1694.9599999999998, "end": 1702.3999999999999, "text": " is pretty easy because it's simply the label of this image. Now, however, as you can see,"}, {"start": 1702.3999999999999, "end": 1708.6399999999999, "text": " the generator learns to translate X to the target domain while reflecting the style code"}, {"start": 1708.6399999999999, "end": 1716.3999999999999, "text": " S tilde. So Y tilde is going to be the label that comes out of this X. So this encoder"}, {"start": 1716.4, "end": 1726.6000000000001, "text": " right here is also going to give us Y tilde. And that's going to go here. All right."}, {"start": 1726.6000000000001, "end": 1737.0800000000002, "text": " So recap. What we want to put into the discriminator is one time a real image like we do up here"}, {"start": 1737.0800000000002, "end": 1744.52, "text": " and we get its label from the encoder. The encoder gets us a label for each image. Very"}, {"start": 1744.52, "end": 1751.28, "text": " cool. We'll also take the same image, put it through the generator, task the generator"}, {"start": 1751.28, "end": 1758.0, "text": " with transferring the style of another image from here onto it. We get the style from the"}, {"start": 1758.0, "end": 1765.08, "text": " encoder. And then the generator is supposed to make an image and we feed that to the"}, {"start": 1765.08, "end": 1772.12, "text": " discriminator and the discriminator discriminates assuming it comes from class Y tilde. Now"}, {"start": 1772.12, "end": 1780.6399999999999, "text": " you see right here, the generator never has access to Y tilde. So the generator is kind"}, {"start": 1780.6399999999999, "end": 1786.2399999999998, "text": " of at a disadvantage here. The discriminator gets told what kind of image it is in terms"}, {"start": 1786.2399999999998, "end": 1791.9199999999998, "text": " of class. While the generator, because it needs to fool the discriminator, it needs to"}, {"start": 1791.9199999999998, "end": 1796.6, "text": " come up with an image of that class. But it has no idea of the class. It only has the"}, {"start": 1796.6, "end": 1806.4399999999998, "text": " style code. So it is forced to learn to sort of, it is forced to learn to map a style,"}, {"start": 1806.4399999999998, "end": 1811.0, "text": " to associate a style with a particular class. And that's how you get the domain into the"}, {"start": 1811.0, "end": 1817.36, "text": " style. That's why the style can capture something like fur color of the different cat breeds."}, {"start": 1817.36, "end": 1823.84, "text": " Because the generator is forced to take the style that the encoder gives and map it to"}, {"start": 1823.84, "end": 1831.1599999999999, "text": " an image of the class Y tilde that also the encoder gives, but doesn't tell to the generator."}, {"start": 1831.1599999999999, "end": 1838.4399999999998, "text": " Okay. And in fact, there is a more path because you now back propagate the loss to the encoder,"}, {"start": 1838.4399999999998, "end": 1847.24, "text": " which means that the encoder will even help the generator. It will help the generator"}, {"start": 1847.24, "end": 1853.52, "text": " make style codes that are very class specific. Now you can maybe think why, why wouldn't"}, {"start": 1853.52, "end": 1859.2, "text": " you just have one output? Why doesn't the encoder simply output the label also as the style?"}, {"start": 1859.2, "end": 1864.2, "text": " Because that would be the easiest. And the reason is because we have different losses"}, {"start": 1864.2, "end": 1874.32, "text": " on the style and the label. Okay. Otherwise, that would be a valid tactic. So that's cool."}, {"start": 1874.32, "end": 1879.56, "text": " That's the adversarial loss. That's the most important loss. Now there's also additional"}, {"start": 1879.56, "end": 1885.8, "text": " losses. So they do additional losses that they add on top for the generator. They say in"}, {"start": 1885.8, "end": 1892.12, "text": " order to prevent degenerate situation where the generator ignores the style code and synthesizes"}, {"start": 1892.12, "end": 1898.32, "text": " a random image in the domain Y or in the domain Y tilde, we impose a style contrastive loss"}, {"start": 1898.32, "end": 1902.84, "text": " to the generate. So now there's still the danger that the degenerate or simply produces"}, {"start": 1902.84, "end": 1910.4399999999998, "text": " a valid image from the data set or even from the domain Y tilde. Though I don't know how"}, {"start": 1910.4399999999998, "end": 1919.24, "text": " it would know why tilde or I've just not seen something in my mind. It doesn't get the"}, {"start": 1919.24, "end": 1927.6, "text": " Y tilde, but it could read it from the style, but here the danger is to ignore the style."}, {"start": 1927.6, "end": 1932.9599999999998, "text": " I'm slightly, I'm slightly confused by this part, but maybe looking at the loss will"}, {"start": 1932.9599999999998, "end": 1939.4399999999998, "text": " clear it out. So they say we impose a style contrastive loss to the generator. Now this"}, {"start": 1939.4399999999998, "end": 1947.04, "text": " is almost the same as we imposed on the encoder. So the generator, you can see there is a"}, {"start": 1947.04, "end": 1952.7199999999998, "text": " contrastive loss again, where you want to be, you want these things to be close and you"}, {"start": 1952.72, "end": 1959.56, "text": " want these things to be far apart. So these S minuses, these are going to be the ones from"}, {"start": 1959.56, "end": 1964.52, "text": " your, the style codes of the images from your queue. So these are just going to be other"}, {"start": 1964.52, "end": 1972.76, "text": " images. Here S tilde, that's going to be the style that you get from your reference image."}, {"start": 1972.76, "end": 1977.52, "text": " So your reference image is going through the encoder and that's going to give you this"}, {"start": 1977.52, "end": 1984.16, "text": " right here. Now the question is what is S prime here? Because in the before, we simply"}, {"start": 1984.16, "end": 1992.44, "text": " had S, which was our source image, our source image style. Now what is S prime here? S prime"}, {"start": 1992.44, "end": 2000.12, "text": " is going to be, it gets more complicated. Yes. S prime is going to be, whoops, it's"}, {"start": 2000.12, "end": 2009.76, "text": " going to be the round trip to the encoder. So it's going to be if I generate my image"}, {"start": 2009.76, "end": 2019.76, "text": " from the source image X and the style S tilde of the reference and then I ask my generate"}, {"start": 2019.76, "end": 2026.6399999999999, "text": " my encoder again, what style does this have? I get the S prime. So it's kind of a round"}, {"start": 2026.64, "end": 2036.64, "text": " trip, right? So I take, I take this, I'd ask the encoder what style is it? That's S tilde,"}, {"start": 2036.64, "end": 2045.5200000000002, "text": " right? Then I take S tilde, go to the generator together with a source image X and that gives"}, {"start": 2045.5200000000002, "end": 2053.2400000000002, "text": " me like X fake. And then I ask my generator again, what style would you assign to the fake"}, {"start": 2053.24, "end": 2060.3599999999997, "text": " image I just produced? And then the encoder will tell you, I'll give it S fake or S prime"}, {"start": 2060.3599999999997, "end": 2069.64, "text": " in this case. And then I compare that S prime with the one I gave before. Okay. So it's"}, {"start": 2069.64, "end": 2078.64, "text": " sort of a round trip loss of my reference image, right? So what does that do? If I, now"}, {"start": 2078.64, "end": 2084.6, "text": " I, and then I ask that S prime be close to S tilde. So that means if I generate an image"}, {"start": 2084.6, "end": 2090.3599999999997, "text": " with the style of my reference image, the outcoming image should better have the style"}, {"start": 2090.3599999999997, "end": 2096.56, "text": " of the reference image. That's all it says. So the style of the thing I generate, given"}, {"start": 2096.56, "end": 2103.52, "text": " this style, they should better be close and especially closer together than the style"}, {"start": 2103.52, "end": 2109.7599999999998, "text": " with any other image in my queue. It makes sense, but it's kind of convoluted. So you go"}, {"start": 2109.7599999999998, "end": 2116.48, "text": " with your out, it's kind of a reconstruction loss, except in style space. All right. And"}, {"start": 2116.48, "end": 2124.96, "text": " then the last thing is an actual image reconstruction loss. So what you'll do is your generator will"}, {"start": 2124.96, "end": 2132.52, "text": " produce X, sorry, will produce an image from the source image and its own style. Right?"}, {"start": 2132.52, "end": 2141.44, "text": " Here, that's important. Before we input S tilde here. So this now is we input the source"}, {"start": 2141.44, "end": 2150.04, "text": " image and its own style. So we go with X, we go to the E and we put the style here and"}, {"start": 2150.04, "end": 2156.52, "text": " we tell the generator if I input the source image and its own style, then what you give"}, {"start": 2156.52, "end": 2162.0, "text": " me back better be the source image itself. Right? This is a consistency loss that tells"}, {"start": 2162.0, "end": 2172.76, "text": " the generator that basically it learns now the generator learns to the generator learns"}, {"start": 2172.76, "end": 2179.24, "text": " to map to recognize an image with its own style sort of because it doesn't know, right?"}, {"start": 2179.24, "end": 2187.8, "text": " It doesn't know that what's coming in here is the style of it of the image X. But now you"}, {"start": 2187.8, "end": 2195.88, "text": " teach it. And I think before this loss, you'd have a good chance that the styles would just"}, {"start": 2195.88, "end": 2200.1600000000003, "text": " be all over the place. They would sort of be consistent, but they would not be aligned."}, {"start": 2200.1600000000003, "end": 2206.5600000000004, "text": " And with this, you force that the style of an image itself, if you put that into the"}, {"start": 2206.5600000000004, "end": 2216.84, "text": " generator, it will lead to that image itself. Okay. That's it. So this is extremely convoluted,"}, {"start": 2216.84, "end": 2222.44, "text": " right? The discriminator is the easiest. The discriminator is a class conditional discriminator"}, {"start": 2222.44, "end": 2229.28, "text": " that gets the label from some mechanism that decides on a label. Right? Okay. That's"}, {"start": 2229.28, "end": 2236.6800000000003, "text": " the easiest. The encoder has two parts, the pseudo label, which is over here, which"}, {"start": 2236.6800000000003, "end": 2243.7200000000003, "text": " is trained completely unsupervised detached from everything else in a self-clustering approach."}, {"start": 2243.72, "end": 2251.54, "text": " While the style part here is trained, first of all, in a contrastive way, which makes"}, {"start": 2251.54, "end": 2258.7999999999997, "text": " sense, and also in a back-propagated way from the generator. So the style generation mechanism"}, {"start": 2258.7999999999997, "end": 2265.16, "text": " tries to help the generator. Okay. And that means it's going to leak some information"}, {"start": 2265.16, "end": 2269.8799999999997, "text": " about the label into the style because that helps the generator. The generator needs to,"}, {"start": 2269.88, "end": 2275.12, "text": " if the generator knows what sort of class it's going to produce, it's going to be better."}, {"start": 2275.12, "end": 2279.92, "text": " Okay. So you can count on that information being in there, but also, also because of"}, {"start": 2279.92, "end": 2285.08, "text": " all the other losses that the generator has and the contrastive loss on the style, the"}, {"start": 2285.08, "end": 2293.1600000000003, "text": " style code is going to sort of describe the individual style of an image. And, but it's"}, {"start": 2293.1600000000003, "end": 2298.28, "text": " also going to describe what the style of that class is because it technically needs to"}, {"start": 2298.28, "end": 2306.52, "text": " contain information about the class. And that's why I think this works with this style"}, {"start": 2306.52, "end": 2312.1600000000003, "text": " because there is no inherent notion of like this is this is a this is the pose of a cat"}, {"start": 2312.1600000000003, "end": 2319.0, "text": " or something like this. Yeah. It still seems like a bit magic to me. And then the generator"}, {"start": 2319.0, "end": 2326.0, "text": " is, first of all, trained to fool the discriminator given an image a source image and a style."}, {"start": 2326.0, "end": 2332.84, "text": " And you can fool the discriminator by producing an image that's so good. It looks real. And"}, {"start": 2332.84, "end": 2340.4, "text": " specifically, it looks real in the class that the pseudo label has given, right? So in the"}, {"start": 2340.4, "end": 2344.92, "text": " class that the encoder has given to it. So the generator must somehow come up with an"}, {"start": 2344.92, "end": 2353.08, "text": " image that's of that class. And so it will it will be forced to interpret the style"}, {"start": 2353.08, "end": 2360.24, "text": " code in terms of that class label, which makes the style code the style code. And also we"}, {"start": 2360.24, "end": 2367.44, "text": " have these two additional losses, which is the round trip loss to the style space. So whatever"}, {"start": 2367.44, "end": 2373.7999999999997, "text": " the generator outputs, you should be able to recover the style from it by putting it"}, {"start": 2373.7999999999997, "end": 2378.7999999999997, "text": " through the encoder again. And then lastly, there is a consistency loss where you say if"}, {"start": 2378.8, "end": 2385.0, "text": " I own put an image into a source image and I own put its own style again going through"}, {"start": 2385.0, "end": 2393.4, "text": " the encoder, you should give me back the source image itself. Very complex. And all of the"}, {"start": 2393.4, "end": 2399.44, "text": " generator loss is back propagated through to the encoder. So this is the full loss. As"}, {"start": 2399.44, "end": 2406.6800000000003, "text": " I said, discriminator easy adversarial loss generator adversarial loss plus this style"}, {"start": 2406.68, "end": 2415.2, "text": " round trip consistency plus the own image round trip consistency encoder gets all of the"}, {"start": 2415.2, "end": 2424.64, "text": " generator loss all of it. So all of this goes here. So the encoder fully helps the generator."}, {"start": 2424.64, "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.4, "text": " some losses. Wow, that's a lot of damage. So they do different investigations into their"}, {"start": 2441.4, "end": 2446.7999999999997, "text": " model here. And I don't even know if we've missed some of the pictures. But ultimately,"}, {"start": 2446.7999999999997, "end": 2451.44, "text": " what you can now do is you can do image to image translation either. That's the cool thing."}, {"start": 2451.44, "end": 2459.12, "text": " You can have a reference image for one or what you can do is you can ask your discriminator"}, {"start": 2459.12, "end": 2465.7999999999997, "text": " what kind of domains are there? Sorry, you can ask your encoder what kind of domains are"}, {"start": 2465.7999999999997, "end": 2472.48, "text": " there? You've guessed the number of domains. So it's maybe 10 or in this case, it's eight"}, {"start": 2472.48, "end": 2479.24, "text": " domain, eight domains of cuts. And you can simply divide your data set into these eight"}, {"start": 2479.24, "end": 2484.7999999999997, "text": " domains, right? One, two, three, four, five, and so on. Now this is 10. Okay, I can't"}, {"start": 2484.8, "end": 2491.36, "text": " see anymore. So 10 domains. And then you can simply calculate for each image, you calculate"}, {"start": 2491.36, "end": 2499.5600000000004, "text": " the style vector. So the style, the style, and then you simply take the average one over"}, {"start": 2499.5600000000004, "end": 2505.6000000000004, "text": " the number in that in that domain. You take the average style vector. And that's going"}, {"start": 2505.6000000000004, "end": 2510.1200000000003, "text": " to be your target style. So you can do image to image translation with a reference image"}, {"start": 2510.12, "end": 2515.68, "text": " or you can do image to image translation for an entire group of images. For example, all"}, {"start": 2515.68, "end": 2520.8399999999997, "text": " the images in a given domain. And that's how they do these graphs right here. Now just"}, {"start": 2520.8399999999997, "end": 2527.3599999999997, "text": " quickly wait until my tablet decides to show me the paper again. Thank you. All right."}, {"start": 2527.3599999999997, "end": 2534.3199999999997, "text": " They do a bunch of investigations into their holy, unholy mixture of losses, especially"}, {"start": 2534.32, "end": 2543.1600000000003, "text": " the first concern is, couldn't we just train the guiding network like by its own on its"}, {"start": 2543.1600000000003, "end": 2548.52, "text": " own. And then after that train this ganthing, right? That's what we had at the very beginning."}, {"start": 2548.52, "end": 2553.6800000000003, "text": " We said, there's this guiding network. And it does the clustering and all. And couldn't"}, {"start": 2553.6800000000003, "end": 2560.1600000000003, "text": " we just train this gant architecture on top of the frozen guiding network. And their conclusion"}, {"start": 2560.16, "end": 2566.16, "text": " is no, if we train everything together, it works better. So on the left, you have whenever"}, {"start": 2566.16, "end": 2574.2, "text": " you train the guiding network by itself. And what you're seeing here is the T-SNE visualization,"}, {"start": 2574.2, "end": 2582.08, "text": " T-SNE is a down like a non-linear visualization tool of style codes extracted by our guiding"}, {"start": 2582.08, "end": 2588.68, "text": " network. The ground truth domains of all test images is represented in different colors."}, {"start": 2588.68, "end": 2593.56, "text": " So this is a data set that has labels, but you don't, you don't provide the labels to"}, {"start": 2593.56, "end": 2598.96, "text": " this algorithm. The algorithm is completely unlabeled for purposes of investigating, will"}, {"start": 2598.96, "end": 2605.12, "text": " visualize the labels with colors. And what you'll see here are the T-SNE visualizations"}, {"start": 2605.12, "end": 2610.08, "text": " of the style codes. So things that are close together, they have similar style codes."}, {"start": 2610.08, "end": 2619.04, "text": " And the ideal case would be if things that are close together here have the same label."}, {"start": 2619.04, "end": 2625.2799999999997, "text": " That means the style is sort of representative of the domain. Okay, and that's what we want."}, {"start": 2625.2799999999997, "end": 2631.48, "text": " We want the style to capture the domain of an image. And ideally not the image itself"}, {"start": 2631.48, "end": 2637.56, "text": " too much. Now on the left, you see that there is quite a bit of overlap between these"}, {"start": 2637.56, "end": 2643.24, "text": " quite a bit of wash between the style and the group. And on the right, if you jointly"}, {"start": 2643.24, "end": 2650.84, "text": " train the GAN together with the guiding network, you see that these classes of the style codes,"}, {"start": 2650.84, "end": 2656.36, "text": " which have no reason to cluster, are much more clustered and separated. And they are separated"}, {"start": 2656.36, "end": 2665.36, "text": " much more along the lines of the ground truth classes. Okay, so that's pretty cool. Now,"}, {"start": 2665.36, "end": 2669.36, "text": " I would actually be interested in what happens if you do the separate training with the full"}, {"start": 2669.36, "end": 2674.44, "text": " pipeline of this learning to classify images without labels thing and their nearest neighbor"}, {"start": 2674.44, "end": 2680.6400000000003, "text": " thing because they've also shown that just purely this self clustering doesn't work too"}, {"start": 2680.6400000000003, "end": 2686.32, "text": " well. But if you then do the nearest neighbor thing on top, then that improves the classification"}, {"start": 2686.32, "end": 2693.32, "text": " significantly. So this could potentially help either the separate or the joint training"}, {"start": 2693.32, "end": 2698.52, "text": " right here. And there might be a connection between the joint training and whatever they're"}, {"start": 2698.52, "end": 2706.28, "text": " doing. In any case, they also show that then these FID, which is a quality metric for GANs"}, {"start": 2706.28, "end": 2713.6400000000003, "text": " lower is better that the joint training goes way lower in the FID than the separate training."}, {"start": 2713.6400000000003, "end": 2719.8, "text": " Okay, that's the reason why they built this convoluted thing because it works way better."}, {"start": 2719.8, "end": 2724.5600000000004, "text": " And here they ablate, they ablate some of the losses to investigate what's really going"}, {"start": 2724.5600000000004, "end": 2731.6800000000003, "text": " on. And in this case, TSNI visualization of the style space of our guiding network trained"}, {"start": 2731.6800000000003, "end": 2736.28, "text": " on this, since this does not have ground truth domain labels, each data point is colored"}, {"start": 2736.28, "end": 2743.28, "text": " with the guiding networks prediction. So each color is whatever the guiding network says"}, {"start": 2743.28, "end": 2751.28, "text": " the classes and the dot is one style, each dot is one style vector. And they're projected"}, {"start": 2751.28, "end": 2758.96, "text": " down to two dimensions. You can see pretty clearly that the individual classes, the individual"}, {"start": 2758.96, "end": 2763.92, "text": " clusters of style vectors correspond to different labels of the guiding network, which is to"}, {"start": 2763.92, "end": 2770.84, "text": " be expected. But also, since they overestimate the number of classes in this case, you can"}, {"start": 2770.84, "end": 2780.04, "text": " see that even though the class label is different, the style network will group the very similar"}, {"start": 2780.04, "end": 2785.6400000000003, "text": " classes together. You can see here, these are both cheetahs and here are both lions. So"}, {"start": 2785.6400000000003, "end": 2791.92, "text": " it will group them together, which is pretty cool and sort of verifies that it recognizes"}, {"start": 2791.92, "end": 2797.1200000000003, "text": " these different things because you force the guiding network to make 10 classes. But the"}, {"start": 2797.12, "end": 2803.48, "text": " style network is simply continuous. So it's cool to see that the style network will make"}, {"start": 2803.48, "end": 2809.0, "text": " one cluster with styles, even though it's different labels. And here you can see different"}, {"start": 2809.0, "end": 2813.56, "text": " samples from these domains, just to verify that the guiding network is actually learned"}, {"start": 2813.56, "end": 2822.24, "text": " to separate things. I still find this pretty magical to this is completely unsupervised."}, {"start": 2822.24, "end": 2829.8799999999997, "text": " And it sort of finds these clusters by itself. They have a bunch of images here. As I said,"}, {"start": 2829.8799999999997, "end": 2835.6, "text": " this is no longer with one reference images. Image, this is where you take the entire domain,"}, {"start": 2835.6, "end": 2840.72, "text": " so you self label with your guiding network. And then you take the mean vector and that's"}, {"start": 2840.72, "end": 2845.7999999999997, "text": " going to be your target style vector. And these are the source images that you transfer."}, {"start": 2845.7999999999997, "end": 2851.04, "text": " And you can see that it works pretty well. So they always have one adult animal and one"}, {"start": 2851.04, "end": 2859.68, "text": " child animal. I guess not or just two different ones. Here, this is particularly cute though."}, {"start": 2859.68, "end": 2867.64, "text": " I have to show you this fox right here. What's going on with that fox? Like someone help"}, {"start": 2867.64, "end": 2876.56, "text": " that fox. Yeah. So we're not at perfection yet as you can see, but it's, you know, that"}, {"start": 2876.56, "end": 2885.2, "text": " looks like a pretty, pretty cool fox. Maybe. Okay. Where did it go? Maybe it slipped."}, {"start": 2885.2, "end": 2892.12, "text": " Maybe it's an it's an offshoot of this one on the top left. Yeah, who knows. These"}, {"start": 2892.12, "end": 2897.2799999999997, "text": " data sets, they have their way. And so this is sort of where you can see the limitations"}, {"start": 2897.2799999999997, "end": 2905.36, "text": " right here. That's not how a baby snow leopard looks. You see the limitations here in that"}, {"start": 2905.36, "end": 2912.08, "text": " all of these animal faces. They are still pretty aligned. Like they're fairly frontal,"}, {"start": 2912.08, "end": 2919.0, "text": " not exactly, but they're fairly frontal pictures. They're fairly standardized and so on."}, {"start": 2919.0, "end": 2927.1200000000003, "text": " So we're I don't think we're yet at the level where we can just do, you know, fully image"}, {"start": 2927.1200000000003, "end": 2933.2400000000002, "text": " to image. And you see it, especially with faces because we as us humans are extremely good"}, {"start": 2933.24, "end": 2938.6, "text": " at, you know, seeing when there's something wrong with a face. But still, it's still"}, {"start": 2938.6, "end": 2945.2799999999997, "text": " pretty impressive. What's possible? And I think if the past is of any indication, here"}, {"start": 2945.2799999999997, "end": 2952.24, "text": " is summer to winter. That actually looks good. If the past is of any indication, then this"}, {"start": 2952.24, "end": 2958.4799999999996, "text": " technology will be pushed pretty hard and soon we'll be able to do this with a simple"}, {"start": 2958.48, "end": 2964.52, "text": " smartphone app or something like this. So I invite you to check out the paper right here."}, {"start": 2964.52, "end": 2971.6, "text": " They have lots and lots and lots of examples and T-Sniplots and whatnot in their appendix."}, {"start": 2971.6, "end": 2977.96, "text": " They have the code online as far as I have seen. And with that, let me know what you think"}, {"start": 2977.96, "end": 2987.96, "text": " in the comments. Bye, bye."}] |
Yannic Kilcher | 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 by-stable recurrent cell allows for long-lasting memory by Nicolas Vecovan, Damien Ernst, and Jean-Driandreon of the University of Liesch. 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 by-stability property, and tries to introduce it to recurrent neural networks. On toy data or a 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. 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, diving 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 in the comment if you have any sort of comments. Alright, they basically say recurrent neural networks provide state-of-the-art performance in a wide variety of tasks that require memory, which is true. 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 x1, x2, x3, x4, 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 applications of this are very wide and any sort 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 this H0, 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 to before itself. It only depends on the hidden state right before itself and the input that corresponds to it. So this is the information flow. 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 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 this 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 have looked like this right here. So the next hidden state is a nonlinear function G and G can be some nonlinearity like a sigmoid or a hyperpolic tangent but 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 a 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 GRU and we're going to try to deconstruct these formulas. So as you can see the inputs are the same. The inputs are going to be this points input, this time steps input and the last hidden state. Those are all the quantities that we need and we need to output somehow the next hidden state. 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 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 X t here. So first we're going to calculate the Z t 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 Z t 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 the 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 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 so and the option is given by Z. So Z t let's how do we draw a switch like this maybe. So Z t is responsible for modulating this switch right here. Okay this gives you the next hidden state. You see Z t modulates that switch so h t 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 from the back right here tan h. What's the input to the tan h? It's two things. First of all the the x is an input to the tan h so we can draw directly a line from here. The x modulated every arrow as you might remember is mod is 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. 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 tan h. 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 this 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 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 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 passed 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 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 or 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 by 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 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. That can be waiting what not. 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 send back is added to this input and then send 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 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 whenever the neuron is going 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 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 f of v post is this here. It's v post minus alpha ton 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 this, if this is the signal minus the tan h, then something very, very, very interesting happens. And 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 will always push it back towards zero. However, if we change the function and we change, 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 high, the same thing happens is going to put me push 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-fill 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. It's clear. And why this is so fascinating because we can use this, this, 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 by stable recurrent cell, BRC. And the formulas are these right here. Maybe a little smaller. Come on. Can't zoom anymore. Okay. Now 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 or 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 that 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 is 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 X t. The second thing is here. And this is the same as well, right? The tan H, 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 tan H. This is a very, very slight modification. It's tan H because tan H 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 is 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 bicepability. 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 bicepable 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. All right? 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 tan H. 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 it's between, 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 bi-model 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 their A parameters aren't 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 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 hear. And that pushed it up again. But now it jumps over here because the signal is even lower. And then this 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 neuron 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 neuromodulation. 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 alone 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 neuromodulation, but it's 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 10 H, 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, create into cent iterations. And you can see that when these time steps, when the series are pretty small, the LSTM's 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 LSTM's they start to fail because they are not made explicitly to remember for that long day. 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, the copy input benchmark. You can see right here that even at this 300 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 that 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 this 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 the copy input benchmark is interesting as it 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 5, 8, 2, 9. Actually, these are numbers sampled from a uniform Gaussian or so. So they're not actually 5, 8, 2, and 9. But you can imagine it like this. 5, 8, 2, 9, 3, 4, 0, 2, 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 1. So you have a negative one again and then you have a 1. And the negative one again, and at the last point of the sequence, you'll have a 0. And so the 0 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 9, 4. So all the elements where there was a 1 in order. So it, remember what it needs to learn. It needs to learn to every time it sees a 1 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 it sees a 1 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 age 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, G or U's and Dallas TMs 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 is a parameter that is 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 G or U's 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 G or U's and the LSTMs fail, while the B or C's 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's 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, um, after, after it, they, 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, 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 M-nest, where they just feed an M-nest digit, digit by digit. And at the end, I think the, the, what, the output of the neural network needs to be the class of the, of the M-nest digit. And again, here, they have a parameter called N-black, which means that, so they have an M-nest digit, it's like a three, they unroll it to a single vector, right? Da, da, da, da, da, da, da, da, they feed this one by one into the recurrent network. And then after that, they attach a certain number of just empty pixels, black pixels. And after that, the network needs to predict the Y. You can see if they ask the network, the class of the digit, immediately after it's done, then the G are using the LSTM perform fairly well, as do the BRCs. But if you attach a whole bunch of these black pixels, remember an M-nest digit has some seven, sorry, seven hundred and eighty-four maybe entries. So attaching 300 black pixels is quite significant in, in terms of the length of these sequences. And then the G are using 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 3146, 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 analyse two things. They analyse the proportion of bisable neurons. So basically they analyse these, these A quantities and they analyse how many of the neurons in the layer have an A that's higher than one, which means that they are in this bisable mode. And also they analyse 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, this, the network drops, immediately drops the C values. The different colours here are different layers. They build, they have a 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 realises it now must let in the new information. And then it immediately shoots back up, makes it seem like, so the network says, oh, okay, as long as, so all of these inputs here, they have the negative one in the second dimension, right? So it recognises 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 is the fact that it recognises 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 recognise, wait, I need to remember this, it also recognises, I probably shouldn't, you know, completely forget what I had previously, because 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 by 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 by 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 build does what we say it does. They also actually have a proof here of the by 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 a long memory isn't necessary. I feel this could be a 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. Alright, 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": 5.28, "text": " Hi there! Today we're looking at a bio-inspired by-stable recurrent cell"}, {"start": 5.28, "end": 11.68, "text": " allows for long-lasting memory by Nicolas Vecovan, Damien Ernst, and Jean-Driandreon"}, {"start": 11.68, "end": 17.080000000000002, "text": " of the University of Liesch. This paper here is not a paper that wants to push"}, {"start": 17.080000000000002, "end": 21.76, "text": " state-of-the-art on anything. It is a paper that takes a concept from the"}, {"start": 21.76, "end": 27.76, "text": " biological research on actual neurons, which is the by-stability property, and"}, {"start": 27.76, "end": 34.32, "text": " tries to introduce it to recurrent neural networks. On toy data or a small"}, {"start": 34.32, "end": 38.800000000000004, "text": " data, they show that this has the interesting property that these recurrent"}, {"start": 38.800000000000004, "end": 44.36, "text": " neural networks can then remember important things for much, much longer than"}, {"start": 44.36, "end": 50.160000000000004, "text": " our current recurrent architectures can do. I believe this is a very"}, {"start": 50.160000000000004, "end": 54.96, "text": " interesting paper and it's a nice, you know, refresher from the whole state-of-the-art"}, {"start": 54.96, "end": 62.2, "text": " number-pushing papers. So, diving with me to explore this, if you like content like"}, {"start": 62.2, "end": 67.76, "text": " this, also consider subscribing if you aren't and sharing it out and leaving a"}, {"start": 67.76, "end": 73.88, "text": " like in the comment if you have any sort of comments. Alright, they basically say"}, {"start": 73.88, "end": 76.96000000000001, "text": " recurrent neural networks provide state-of-the-art performance in a wide"}, {"start": 76.96000000000001, "end": 82.96000000000001, "text": " variety of tasks that require memory, which is true. So we have these recurrent"}, {"start": 82.96, "end": 87.96, "text": " neural networks and what the recurrent neural networks do is they're basically"}, {"start": 87.96, "end": 94.0, "text": " so a classic recurrent neural network goes something like this. There is a hidden"}, {"start": 94.0, "end": 100.6, "text": " state at time step t and there is a sequence of inputs that you have to work"}, {"start": 100.6, "end": 108.08, "text": " with. So we'll call them x1, x2, x3, x4, and so on. And then at some point you have"}, {"start": 108.08, "end": 113.03999999999999, "text": " to provide an output. This could be at every single time step or sometimes it's"}, {"start": 113.03999999999999, "end": 118.2, "text": " just at the end you have to provide an output y. So for example, this here could be"}, {"start": 118.2, "end": 122.2, "text": " a piece of text and you need to decide whether or not that piece of text maybe"}, {"start": 122.2, "end": 127.32, "text": " it's an email, whether or not that's spam. This could be a time series of a"}, {"start": 127.32, "end": 131.16, "text": " patient in an ICU and you need to decide whether or not to give some"}, {"start": 131.16, "end": 139.12, "text": " medication to the patient. So the applications of this are very wide and any sort"}, {"start": 139.12, "end": 144.6, "text": " of series data will do. So there's this hidden state and at each time step this"}, {"start": 144.6, "end": 151.32, "text": " hidden state is updated to a new hidden state. So this called this H0, it's"}, {"start": 151.32, "end": 158.51999999999998, "text": " updated to a new hidden state by incorporating the input. So somehow the input x"}, {"start": 158.52, "end": 164.04000000000002, "text": " and the previous hidden state are made into a new hidden state. And then the"}, {"start": 164.04000000000002, "end": 168.84, "text": " next input is taken in and by using this hidden state a new hidden state is"}, {"start": 168.84, "end": 175.76000000000002, "text": " made and so on. So one property here is that the newest hidden state always"}, {"start": 175.76000000000002, "end": 180.96, "text": " only depends on the previous hidden state and it doesn't really directly depend"}, {"start": 180.96, "end": 185.8, "text": " on like the hidden state to before itself. It only depends on the hidden state"}, {"start": 185.8, "end": 191.56, "text": " right before itself and the input that corresponds to it. So this is the"}, {"start": 191.56, "end": 196.48000000000002, "text": " information flow. The other important property here is that these connections"}, {"start": 196.48000000000002, "end": 201.76000000000002, "text": " that make a hidden state into the next hidden state and also that incorporate"}, {"start": 201.76000000000002, "end": 206.52, "text": " input they're always the same. So these these functions here that incorporate"}, {"start": 206.52, "end": 211.08, "text": " the input they're always the same in each time step. So the parameters are"}, {"start": 211.08, "end": 217.36, "text": " shared between them and the same the same goes for the the functions here that"}, {"start": 217.36, "end": 221.04000000000002, "text": " transform one hidden state into the next hidden state. Of course this there is a"}, {"start": 221.04000000000002, "end": 225.52, "text": " joint function between the two that actually produces the next hidden state. So"}, {"start": 225.52, "end": 231.84, "text": " these weights are all shared and for each time step and that's what makes the"}, {"start": 231.84, "end": 237.84, "text": " network recurrent. So we call the single time step here we call that a"}, {"start": 237.84, "end": 243.28, "text": " recurrent cell. And the question now is how do you construct a recurrent cell?"}, {"start": 243.28, "end": 247.56, "text": " Usually recurrent neural networks they run into this problem of either gradient"}, {"start": 247.56, "end": 254.04, "text": " explosion or vanishing gradients because usually this here if you are into"}, {"start": 254.04, "end": 259.6, "text": " neural networks you know this this is a weight matrix multiplied by the previous"}, {"start": 259.6, "end": 264.68, "text": " hidden state and if you just multiply the same weight matrix over and over and"}, {"start": 264.68, "end": 269.08, "text": " over again it pretty much depends on the singular value of that weight matrix. If"}, {"start": 269.08, "end": 274.56, "text": " the top singular value is higher than one then this signal is going to explode"}, {"start": 274.56, "end": 279.08, "text": " and if it's lower than one the signal is going to fade over time and there's"}, {"start": 279.08, "end": 286.68, "text": " pretty much nothing you can do. So classic RNNs have been have looked like this"}, {"start": 286.68, "end": 294.84000000000003, "text": " right here. So the next hidden state is a nonlinear function G and G can be"}, {"start": 294.84000000000003, "end": 302.08, "text": " some nonlinearity like a sigmoid or a hyperpolic tangent but it's a"}, {"start": 302.08, "end": 308.56, "text": " function of the current input and the last hidden state by simply matrix"}, {"start": 308.56, "end": 313.8, "text": " multiplying these two things by some weight matrices and then adding them up."}, {"start": 313.8, "end": 319.24, "text": " So that's what we've just looked at. Now this is problematic as I said because of"}, {"start": 319.24, "end": 325.44, "text": " the vanishing or exploding gradients and therefore people have come up with"}, {"start": 325.44, "end": 332.48, "text": " methods to solve this and you might know things like LSTMs and GRUs that are"}, {"start": 332.48, "end": 338.36, "text": " used to solve this. Now these cells here are much more complicated than the"}, {"start": 338.36, "end": 344.04, "text": " standard cell that we saw here but they also are much more effective because"}, {"start": 344.04, "end": 348.68, "text": " they don't have this vanishing or exploding gradient problems. Their promise is"}, {"start": 348.68, "end": 354.12, "text": " that they can remember things for a longer because they allow the gradient to"}, {"start": 354.12, "end": 360.32, "text": " flow without these problems during back propagation. Now how does one of these"}, {"start": 360.32, "end": 365.28000000000003, "text": " look? In this paper they mainly look at the GRU the Gated Recurrent Unit which"}, {"start": 365.28, "end": 372.59999999999997, "text": " is a simpler version of the LSTM. The LSTM is slightly more complex but the"}, {"start": 372.59999999999997, "end": 378.28, "text": " principles are the same. So they look at the GRU right here. What does the GRU do?"}, {"start": 378.28, "end": 384.55999999999995, "text": " These are the formulas for the GRU and we're going to try to deconstruct these"}, {"start": 384.55999999999995, "end": 389.15999999999997, "text": " formulas. So as you can see the inputs are the same. The inputs are going to be"}, {"start": 389.16, "end": 395.88000000000005, "text": " this points input, this time steps input and the last hidden state. Those are all"}, {"start": 395.88000000000005, "end": 400.40000000000003, "text": " the quantities that we need and we need to output somehow the next hidden"}, {"start": 400.40000000000003, "end": 405.88, "text": " state. The last hidden state is then used to predict the Y by the way in all"}, {"start": 405.88, "end": 412.48, "text": " of these cases. So first we need to calculate two things called Z and R and both"}, {"start": 412.48, "end": 417.56, "text": " of them are the same. They're multiplying these two things by weight matrices"}, {"start": 417.56, "end": 421.92, "text": " and then running them through a sigmoid non-linearity. Okay let's do that. Let's"}, {"start": 421.92, "end": 430.0, "text": " say we have X sorry the last hidden state here and we have X t here. So first we're"}, {"start": 430.0, "end": 440.0, "text": " going to calculate the Z t and the RT from that. Now every one of these arrows"}, {"start": 440.0, "end": 446.56, "text": " right here is a multiplication by a weight matrix. So every one of these arrows is"}, {"start": 446.56, "end": 455.92, "text": " transforming the input and let's also let's join this into a sigmoid node and"}, {"start": 455.92, "end": 466.0, "text": " that gives you Z t and let's join these into a sigmoid that gives you RT. Okay so"}, {"start": 466.0, "end": 471.08, "text": " far so good. Now we need to combine all of this in this last line right here. So"}, {"start": 471.08, "end": 478.8, "text": " you can see that the Z thing here sort of acts as a switch. So Z is the result of"}, {"start": 478.8, "end": 485.0, "text": " a sigmoid and therefore it's between zero and one and here this is the the the"}, {"start": 485.0, "end": 492.08, "text": " Hadamard product. This is the element wise product between vectors which sort of"}, {"start": 492.08, "end": 497.68, "text": " mean this is like a gating. This is like a switch. If it's one it selects this"}, {"start": 497.68, "end": 502.76, "text": " quantity and if it's zero it selects the quantity over here and of course it can"}, {"start": 502.76, "end": 508.68, "text": " be between zero and one but those are the the ends of the spectrum. So Z is a"}, {"start": 508.68, "end": 513.8, "text": " switch that selects between the last hidden state. So let's draw that right here."}, {"start": 513.8, "end": 522.72, "text": " So the last hidden state goes here and is one of the options of the output."}, {"start": 522.72, "end": 530.36, "text": " Right so and the option is given by Z. So Z t let's how do we draw a switch like"}, {"start": 530.36, "end": 538.52, "text": " this maybe. So Z t is responsible for modulating this switch right here. Okay this"}, {"start": 538.52, "end": 545.1600000000001, "text": " gives you the next hidden state. You see Z t modulates that switch so h t is a"}, {"start": 545.1600000000001, "end": 550.8000000000001, "text": " one possibility that the switch can select what's the other possibility. The"}, {"start": 550.8, "end": 556.8399999999999, "text": " other possibility is this quantity right here which is a hyperbolic tangent of"}, {"start": 556.8399999999999, "end": 568.0799999999999, "text": " whatever that is. So that is combined of x. So let's go from the from the back"}, {"start": 568.0799999999999, "end": 576.0, "text": " right here tan h. What's the input to the tan h? It's two things. First of all the"}, {"start": 576.0, "end": 583.08, "text": " the x is an input to the tan h so we can draw directly a line from here. The x"}, {"start": 583.08, "end": 588.64, "text": " modulated every arrow as you might remember is mod is can be a function. Not"}, {"start": 588.64, "end": 592.88, "text": " all arrows are functions like this arrow right here is not a function. It's just"}, {"start": 592.88, "end": 601.12, "text": " an arrow. Maybe that's confusing. You get what I mean. And the next thing is"}, {"start": 601.12, "end": 608.92, "text": " r times the hidden the last hidden state or the last hidden state modulated by"}, {"start": 608.92, "end": 615.48, "text": " this matrix. So r is an r is acting as another gate r can be again between zero"}, {"start": 615.48, "end": 620.84, "text": " and one because it's the result of a sigmoid. So this hidden state will also go"}, {"start": 620.84, "end": 628.72, "text": " here. It will be modulated running out of colors here. Be modulated by r here as"}, {"start": 628.72, "end": 635.84, "text": " a sort of gate. So r can either close or open this gate right here and then"}, {"start": 635.84, "end": 641.0400000000001, "text": " that's fed into the tan h. So it's rather complicated setup as you can see"}, {"start": 641.0400000000001, "end": 650.52, "text": " right here. So let's analyze this. First of all the hidden state is either the last"}, {"start": 650.52, "end": 656.6, "text": " hidden state or it is something new. And that's modulated by this z right here."}, {"start": 656.6, "end": 663.76, "text": " And z is calculated from the hidden state and the current input. Okay. So this"}, {"start": 663.76, "end": 668.16, "text": " allows the cell to basically look at the hidden state is sort of the"}, {"start": 668.16, "end": 672.44, "text": " information of what happened so far. And the current input is the new"}, {"start": 672.44, "end": 677.24, "text": " information that it gets from the sequence. And it sort of gets to look at these"}, {"start": 677.24, "end": 682.88, "text": " two things and decides do I even want to update my hidden state. If not I can"}, {"start": 682.88, "end": 686.92, "text": " just select this path right here and then nothing happens to the hidden state."}, {"start": 686.92, "end": 692.12, "text": " The next hidden state will be exactly the same as the last hidden state. If it"}, {"start": 692.12, "end": 696.52, "text": " decides if it thinks wow this new thing in the sequence that's actually"}, {"start": 696.52, "end": 702.48, "text": " important. I should remember that right because remember these the task of the"}, {"start": 702.48, "end": 707.64, "text": " network sometimes is to remember things from this sequence. I think we drew this"}, {"start": 707.64, "end": 712.24, "text": " over here. So if this is an email and we want to detect whether it's spam"}, {"start": 712.24, "end": 716.36, "text": " then this word in the sequence right here might be really important because it"}, {"start": 716.36, "end": 721.48, "text": " would say something like gold like buy gold. These two things might be buy gold."}, {"start": 721.48, "end": 727.48, "text": " And you need to remember that in the hidden state because the only way that"}, {"start": 727.48, "end": 732.1, "text": " information from x is going to flow to y is through the hidden states. So you"}, {"start": 732.1, "end": 736.08, "text": " would want at this point you would want to remember this input in the hidden"}, {"start": 736.08, "end": 739.52, "text": " state. So you'd actually want to update the hidden state. And then this here"}, {"start": 739.52, "end": 744.4399999999999, "text": " might be not as important. So you might want to say I don't want to I still want"}, {"start": 744.4399999999999, "end": 749.88, "text": " my hidden state to be the old hidden state. Okay. So z is that gate that allows"}, {"start": 749.88, "end": 757.4, "text": " us to do this. If we decide to update the hidden state then what do we do? Again"}, {"start": 757.4, "end": 766.36, "text": " if we decide to update the hidden state we can we can we we will incorporate the"}, {"start": 766.36, "end": 773.32, "text": " new input. But we will we can also decide to mix that how to mix that new"}, {"start": 773.32, "end": 779.04, "text": " input with the old hidden state. Okay. So if we decide to update the hidden"}, {"start": 779.04, "end": 782.32, "text": " state we don't simply discard the old hidden state because the old hidden"}, {"start": 782.32, "end": 788.6800000000001, "text": " state will still have a path to the to to be sort of still there to be"}, {"start": 788.68, "end": 796.56, "text": " remembered. But it's a longer path and it needs to go through this thing here and"}, {"start": 796.56, "end": 801.8, "text": " through this thing here. So this thing here decides which of the old hidden"}, {"start": 801.8, "end": 806.9599999999999, "text": " state passed through. So at each you can see right here this is an element wise"}, {"start": 806.9599999999999, "end": 811.4, "text": " product. This r is going to be between zero and one at each point in the"}, {"start": 811.4, "end": 816.4799999999999, "text": " vector. So at each point in the vector the r decides is this worth remembering"}, {"start": 816.48, "end": 822.28, "text": " or not. Okay. And if it's not worth remembering then this is going to be zero"}, {"start": 822.28, "end": 827.2, "text": " and that that position of the old hidden state is going to be zero and then"}, {"start": 827.2, "end": 833.16, "text": " that's going to be forgotten. And that's the opportunity for for the hidden"}, {"start": 833.16, "end": 837.64, "text": " state to incorporate new information because then there's a it can delete"}, {"start": 837.64, "end": 843.32, "text": " this old information and it can incorporate the new input. And that will"}, {"start": 843.32, "end": 847.5600000000001, "text": " result then on this path on the new hidden state. Okay. So there's two major"}, {"start": 847.5600000000001, "end": 851.48, "text": " things. First we can decide whether or not to even incorporate new"}, {"start": 851.48, "end": 856.88, "text": " information that's achieved by the z gate. And then we can decide which parts of"}, {"start": 856.88, "end": 861.5600000000001, "text": " the old hidden state if we want to update it which parts to forget that's the"}, {"start": 861.5600000000001, "end": 867.36, "text": " or gate. And how to update it is then basically a result of the weight matrix"}, {"start": 867.36, "end": 873.72, "text": " that's associated with this function right here. Alright. So that's the gated"}, {"start": 873.72, "end": 881.6800000000001, "text": " recurrent unit. And it works a lot better than the classic RNNs. So having said"}, {"start": 881.6800000000001, "end": 887.36, "text": " that they now turn to this property of neuronal by stability that happens in"}, {"start": 887.36, "end": 892.88, "text": " actual neurons. So this here is sort of a model of a neuron with this property."}, {"start": 892.88, "end": 897.04, "text": " Now forget everything we said about GRUs. We're just going to look at this"}, {"start": 897.04, "end": 902.92, "text": " right now. What happens in a neuron usually is you have this is a single neuron."}, {"start": 902.92, "end": 909.28, "text": " You have input synapses from other neurons. So these are connections coming from"}, {"start": 909.28, "end": 917.88, "text": " other neurons into you. They are accumulated right here. Usually they are just in"}, {"start": 917.88, "end": 921.7199999999999, "text": " a classic model of a neuron. They're just summed up. You would sum up all these"}, {"start": 921.72, "end": 927.9200000000001, "text": " all these input signals. And then you decide you'd run it through like a step"}, {"start": 927.9200000000001, "end": 936.12, "text": " function. So if the sum of all the things is smaller than a particular threshold"}, {"start": 936.12, "end": 941.12, "text": " the output would be just nothing. And if it's higher than a particular threshold"}, {"start": 941.12, "end": 946.88, "text": " then the output of the neuron would be sort of a firing of the neuron. That"}, {"start": 946.88, "end": 952.2, "text": " can be waiting what not. But in this case it's just a function of the inputs."}, {"start": 952.2, "end": 957.16, "text": " And that gives you your input signal. So this is like this is this is your input"}, {"start": 957.16, "end": 962.72, "text": " signal to the neuron. Now there is this property right here that makes it"}, {"start": 962.72, "end": 971.48, "text": " interesting. The signal goes out here and is integrated. This is an integrator."}, {"start": 971.48, "end": 975.84, "text": " And that's going to be in the output signal. But there's this this connection,"}, {"start": 975.84, "end": 980.9200000000001, "text": " this back connection right here. And that means that the signal that comes out"}, {"start": 980.9200000000001, "end": 987.44, "text": " at time step t is going to be fed back into the signal and actually added to"}, {"start": 987.44, "end": 995.84, "text": " the signal before itself. And sort of self modulating right. The signal comes"}, {"start": 995.84, "end": 1001.96, "text": " out is send back is added to this input and then send through again. And this"}, {"start": 1001.96, "end": 1007.24, "text": " here is just an integrator that's integrating everything that's happening. So if"}, {"start": 1007.24, "end": 1014.2, "text": " you if you look a bit closer you'll see that there is a minus here. So it's"}, {"start": 1014.2, "end": 1018.64, "text": " actually not added. It's subtracted. And there is an F here, which means that"}, {"start": 1018.64, "end": 1023.72, "text": " this is a nonlinear function. Now if this weren't a nonlinear function we"}, {"start": 1023.72, "end": 1028.72, "text": " can just sort of try or let's say this is a monotonic function. We can sort of"}, {"start": 1028.72, "end": 1034.64, "text": " try to estimate what happens. If all of this right here is very high, it's a"}, {"start": 1034.64, "end": 1039.64, "text": " high number, big number. This will be a big number. Then this sum will be a big"}, {"start": 1039.64, "end": 1045.1200000000001, "text": " number. This output will be a big number. What happens is this here will be a"}, {"start": 1045.1200000000001, "end": 1050.28, "text": " big number. This is monotonic. So it will also be a big number. And that means it"}, {"start": 1050.28, "end": 1057.4, "text": " will subtract that big number. So that means whenever the neuron is going to"}, {"start": 1057.4, "end": 1063.92, "text": " be very excited, this feedback would actually push it back. Now when it is not"}, {"start": 1063.92, "end": 1068.92, "text": " very excited, so when it's a very low number, very negatively excited, then the"}, {"start": 1068.92, "end": 1072.5600000000002, "text": " feedback would work in the exact opposite direction. This will be very negative."}, {"start": 1072.5600000000002, "end": 1077.3200000000002, "text": " This will be very negative. And this here would push it towards the positive. So"}, {"start": 1077.3200000000002, "end": 1084.5600000000002, "text": " this neuron somehow self stabilizes over time to this to the zero point right"}, {"start": 1084.56, "end": 1093.72, "text": " here. And that's simply if this f is the identity function right now. So you can"}, {"start": 1093.72, "end": 1099.44, "text": " sort of see how this property works. Now we'll make it a bit more complicated in"}, {"start": 1099.44, "end": 1106.6399999999999, "text": " that we'll assume that this f here is not the identity function, but let's say"}, {"start": 1106.64, "end": 1117.76, "text": " they have it somewhere. But this right here. So the f f of v post is this here. It's"}, {"start": 1117.76, "end": 1130.8000000000002, "text": " v post minus alpha ton h of v post. Or is this the entire f? Yes, that's this this thing"}, {"start": 1130.8, "end": 1140.3999999999999, "text": " right here. If this is the case, if this is this, if this is the signal minus the tan"}, {"start": 1140.3999999999999, "end": 1147.56, "text": " h, then something very, very, very interesting happens. And that's depending on this alpha"}, {"start": 1147.56, "end": 1156.08, "text": " right here. In that if this alpha is between, if the alpha is between zero and one, then"}, {"start": 1156.08, "end": 1162.1999999999998, "text": " we simply have our monotonic function. So here you can see how big v post is. So how"}, {"start": 1162.1999999999998, "end": 1166.1599999999999, "text": " big the output signal is here. That's the experiment we made before. And here you can"}, {"start": 1166.1599999999999, "end": 1173.96, "text": " see what the feedback signal is. Okay. Or the integrator, the integrated signal. Maybe"}, {"start": 1173.96, "end": 1179.8, "text": " this is in the wrong place. And maybe f is just minus the tan h. I'm not sure. But in"}, {"start": 1179.8, "end": 1184.0, "text": " any case, the way they build it after in the GRU, it's pretty explicit. So this is the"}, {"start": 1184.0, "end": 1195.52, "text": " thing we said before, namely if, if the signal is very high, then this signal here will be"}, {"start": 1195.52, "end": 1203.56, "text": " high as well. And because it's subtracted right here, it's going to push the signal back"}, {"start": 1203.56, "end": 1210.64, "text": " towards zero. Again, if this is lower than zero, then this thing here will also be lower"}, {"start": 1210.64, "end": 1215.1200000000001, "text": " than zero. And because it's subtracted, it's going to push the signal towards zero. So"}, {"start": 1215.1200000000001, "end": 1222.3600000000001, "text": " this thing here is the stable point. It will always push it back towards zero. However,"}, {"start": 1222.3600000000001, "end": 1230.0, "text": " if we change the function and we change, change just the parameter alpha to be 1.5, a very"}, {"start": 1230.0, "end": 1237.0, "text": " different thing happens that you can see right here. Then it turns out if your output"}, {"start": 1237.0, "end": 1242.92, "text": " signal is very high, the same thing happens is going to put me push back. But if your"}, {"start": 1242.92, "end": 1250.04, "text": " output signal is between zero and this point right here, there is a regime where actually,"}, {"start": 1250.04, "end": 1257.2, "text": " even though the output signal is positive, you will be pushed towards this point right"}, {"start": 1257.2, "end": 1263.2, "text": " here. And therefore, there is, there are these two stable points right now. And the stable"}, {"start": 1263.2, "end": 1266.96, "text": " point basically means if you deviate, if the signal deviates from it, it's going to be"}, {"start": 1266.96, "end": 1271.0, "text": " pushed back towards that point. And you can see these two stable points, they're not"}, {"start": 1271.0, "end": 1279.6000000000001, "text": " at zero. They're actually at these two points here. And that's pretty interesting because"}, {"start": 1279.6000000000001, "end": 1285.68, "text": " that means you can potentially remember things with the cell, right? An output signal of"}, {"start": 1285.68, "end": 1292.32, "text": " zero is basically not informative. But here you can be in either the state here or in"}, {"start": 1292.32, "end": 1299.1599999999999, "text": " the state here. And the little, little perturbations will still keep you in that state. So you could"}, {"start": 1299.1599999999999, "end": 1305.4399999999998, "text": " potentially be in this state right here as an output. And the cell will just keep updating"}, {"start": 1305.4399999999998, "end": 1312.96, "text": " itself and be stable and always output that signal right here. And then you could go ahead."}, {"start": 1312.96, "end": 1320.12, "text": " And if you can provide some huge input signal right here, you could potentially throw this"}, {"start": 1320.12, "end": 1325.7199999999998, "text": " over to the other side over this hill. And then it would stabilize at this point. So this"}, {"start": 1325.7199999999998, "end": 1331.36, "text": " is sort of a way to remember things within these biological cells. Pretty cool. Now this"}, {"start": 1331.36, "end": 1337.6799999999998, "text": " here is a non-fill out circle. That means it's an unstable point. It's technically stable"}, {"start": 1337.6799999999998, "end": 1343.3999999999999, "text": " in the sense that if you're exactly at zero, you will remain at zero. But if you perturb"}, {"start": 1343.4, "end": 1352.0400000000002, "text": " even a little bit, you will go, if you perturb a bit, you will go away from it. Okay. I hope"}, {"start": 1352.0400000000002, "end": 1356.88, "text": " this sort of property is right. It's clear. And why this is so fascinating because we can"}, {"start": 1356.88, "end": 1362.64, "text": " use this, this, this fact that the stable points are not at zero and are more than just one"}, {"start": 1362.64, "end": 1370.72, "text": " stable point for remembering things. And they're now trying to fill this into the gated recurrent"}, {"start": 1370.72, "end": 1382.6000000000001, "text": " unit. So they call this the by stable recurrent cell, BRC. And the formulas are these right here."}, {"start": 1382.6000000000001, "end": 1393.68, "text": " Maybe a little smaller. Come on. Can't zoom anymore. Okay. Now it looks almost the same as the"}, {"start": 1393.68, "end": 1403.5600000000002, "text": " GRU. So the formulas are these, this and this. So let's analyze the differences to the GRU."}, {"start": 1403.5600000000002, "end": 1409.3600000000001, "text": " The first most striking difference is that a lot of weight matrices here have become single"}, {"start": 1409.3600000000001, "end": 1415.88, "text": " numbers. So or single vectors. This here used to be a weight matrix. And this used to be"}, {"start": 1415.88, "end": 1420.72, "text": " a matrix multiplication. And you'll see this sort of throughout whenever the last hidden"}, {"start": 1420.72, "end": 1427.52, "text": " state is incorporated into these things. Then you'll see that it is no longer a weight"}, {"start": 1427.52, "end": 1436.2, "text": " matrix, but is in fact a, in a product with a vector, a element wise product. And that"}, {"start": 1436.2, "end": 1441.48, "text": " has a reason, namely what they want to model is individual neurons. So on a biological"}, {"start": 1441.48, "end": 1449.76, "text": " level, a neuron can only feed back onto itself. If there is a layer of neurons right here,"}, {"start": 1449.76, "end": 1457.92, "text": " they can only each feed back onto themselves. Whereas in a recurrent neural network, my"}, {"start": 1457.92, "end": 1464.24, "text": " hidden vector, my hidden state is a vector. And if I transform this into the next hidden"}, {"start": 1464.24, "end": 1470.24, "text": " state or any quantity that say I transform this H into this R right here, and this R is"}, {"start": 1470.24, "end": 1479.36, "text": " a vector too. Then any interaction is possible. So any cell, any entry in the vector here"}, {"start": 1479.36, "end": 1484.6, "text": " can influence any other vector because there's a big weight matrix in the middle. They want"}, {"start": 1484.6, "end": 1489.08, "text": " to leave this away. They want to model this as close as possible to actual layers of"}, {"start": 1489.08, "end": 1495.12, "text": " neurons. And therefore they say, okay, the input X can, you know, be distributed to all"}, {"start": 1495.12, "end": 1500.08, "text": " the neurons because technically the input comes from some other neurons down here. And they"}, {"start": 1500.08, "end": 1505.4399999999998, "text": " can all have connections to these neurons. But these feedbacks, we only really observe"}, {"start": 1505.44, "end": 1511.96, "text": " them in individual neuron, this feedback cycle. So that's why they model these recurrent"}, {"start": 1511.96, "end": 1518.48, "text": " weight products by just element wise products with vectors. And then the second difference,"}, {"start": 1518.48, "end": 1526.6000000000001, "text": " you again see that there is this switch right here, this C switch. And the C switch is like"}, {"start": 1526.6000000000001, "end": 1535.3600000000001, "text": " before, it's a sigmoid with where combine the output and the previous hidden state. There"}, {"start": 1535.36, "end": 1540.04, "text": " is nothing new here. So this switch is the same. The cell has the possibility of letting"}, {"start": 1540.04, "end": 1548.52, "text": " in new information or just ignoring the new current information, the X t. The second thing"}, {"start": 1548.52, "end": 1554.6799999999998, "text": " is here. And this is the same as well, right? The tan H, this is a combination of the new"}, {"start": 1554.6799999999998, "end": 1560.0, "text": " information. It's in case we want to let in the new information of the new information"}, {"start": 1560.0, "end": 1568.16, "text": " and you need to decide what things of the old information to forget or remember. Now the"}, {"start": 1568.16, "end": 1576.28, "text": " difference here is in this A. So this A used to be again, this sigmoid of the combination."}, {"start": 1576.28, "end": 1584.88, "text": " And now it's just slightly different. It used to be sigmoid. Now it's one plus tan H."}, {"start": 1584.88, "end": 1592.3600000000001, "text": " This is a very, very slight modification. It's tan H because tan H is between minus one"}, {"start": 1592.3600000000001, "end": 1598.44, "text": " and one instead of zero and one like the sigmoid and the one plus makes it such that this"}, {"start": 1598.44, "end": 1604.3200000000002, "text": " is between zero and two. And we've seen before that this critical behavior, there is two"}, {"start": 1604.3200000000002, "end": 1610.16, "text": " regimes to these functions. When it's between zero and one, this behaves like a classic"}, {"start": 1610.16, "end": 1617.2, "text": " gated recurrent unit like a classic GRU. But when it's between one and two, then you have"}, {"start": 1617.2, "end": 1622.92, "text": " that exact behavior that we saw before of the bicepability. Okay? So depending on what"}, {"start": 1622.92, "end": 1629.96, "text": " 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"}, {"start": 1629.96, "end": 1636.0400000000002, "text": " a bicepable cell. And the network can decide by itself what it wants to do because here"}, {"start": 1636.04, "end": 1643.0, "text": " it has, it can actually learn how to do that. All right? So this is the only change."}, {"start": 1643.0, "end": 1648.12, "text": " The only change really apart from it only being individual neurons feeding back on themselves"}, {"start": 1648.12, "end": 1653.6399999999999, "text": " is that now this is no longer between zero and one with the sigmoid. This is now between"}, {"start": 1653.6399999999999, "end": 1662.12, "text": " zero and two because it's one plus the tan H. Very simple change. But the effect of this"}, {"start": 1662.12, "end": 1670.56, "text": " is pretty, pretty cool. So they do some, here is like a schematic drawing of this. If"}, {"start": 1670.56, "end": 1676.76, "text": " this A is between zero and one again, you have this stable state that's at zero. But it's"}, {"start": 1676.76, "end": 1684.6399999999999, "text": " between, if it's between one and two, you have two stable states at two non zero points."}, {"start": 1684.6399999999999, "end": 1691.3999999999999, "text": " And again, this, we already saw this. But now this is for, I believe, this recurrent"}, {"start": 1691.4, "end": 1698.0400000000002, "text": " cell, this bi-model recurrent cell, not for the neuron itself. And here they give an"}, {"start": 1698.0400000000002, "end": 1704.2800000000002, "text": " example of what happens when you run this particular signal, this particular time series,"}, {"start": 1704.2800000000002, "end": 1709.64, "text": " through a cell like this while fixing the C and the A parameters. So now the C and"}, {"start": 1709.64, "end": 1716.24, "text": " their A parameters aren't learned. They're just fixed. And you see what happens. Now,"}, {"start": 1716.24, "end": 1725.68, "text": " as you can see, the blue should be a classic, the classic behavior. So in this blue case,"}, {"start": 1725.68, "end": 1734.32, "text": " what happens? You see right here, this C is moderately low. So we saw the C is the switch"}, {"start": 1734.32, "end": 1740.0, "text": " of whether to leave in old information or take up new information. If it's low, it means"}, {"start": 1740.0, "end": 1744.4, "text": " we want to take up new information. This is reasonably low. And that's why when the signal"}, {"start": 1744.4, "end": 1751.16, "text": " goes up here, the blue line goes up as well. And when the signal goes down, the blue line"}, {"start": 1751.16, "end": 1756.52, "text": " goes down again and so on. So the blue line pretty straightforwardly follows the signal"}, {"start": 1756.52, "end": 1764.0400000000002, "text": " right here. Okay. Now in contrast to this, the red line is over this threshold. So A is"}, {"start": 1764.0400000000002, "end": 1772.8400000000001, "text": " fixed at 1.5. C is still at 0.2. So again, when this line goes up, then this line goes up."}, {"start": 1772.84, "end": 1780.28, "text": " But because this is near this stable point, if it goes down again, it doesn't appear to"}, {"start": 1780.28, "end": 1786.32, "text": " go down enough. It sort of remembers that state it was in. It doesn't go down with the"}, {"start": 1786.32, "end": 1793.0, "text": " signal. Only now that it goes down even further, it's over this threshold. So we were in"}, {"start": 1793.0, "end": 1799.4399999999998, "text": " this situation now. And the first bump down was only like to hear. And that pushed it"}, {"start": 1799.44, "end": 1805.6000000000001, "text": " up again. But now it jumps over here because the signal is even lower. And then this"}, {"start": 1805.6000000000001, "end": 1812.0800000000002, "text": " cell sort of switches to another state. As you can see here, it goes down. But then"}, {"start": 1812.0800000000002, "end": 1816.8400000000001, "text": " this bump here is not enough to bring it up again. So it kind of remains in the state."}, {"start": 1816.8400000000001, "end": 1826.0, "text": " So you can see the, it sort of remembers the input and small deviations or small changes"}, {"start": 1826.0, "end": 1832.72, "text": " in signal. Don't manage to throw it away from that. Only larger things. Only it needs"}, {"start": 1832.72, "end": 1838.36, "text": " to go very, the signal needs to go very much down in order for it to change state. So"}, {"start": 1838.36, "end": 1844.68, "text": " that's pretty cool that there's this remembering behavior. And now remember in the actual implementation,"}, {"start": 1844.68, "end": 1852.56, "text": " these C and A parameters, this C and this A right here aren't fixed. They are also determined"}, {"start": 1852.56, "end": 1858.28, "text": " by the cell itself. And therefore the cell can decide by itself when it wants to remember"}, {"start": 1858.28, "end": 1864.44, "text": " things, how hard it wants to remember things and so on. So we're going to check this out"}, {"start": 1864.44, "end": 1870.6, "text": " in an actual implementation. So there's this one last modification they make where they"}, {"start": 1870.6, "end": 1877.48, "text": " say, okay, they tried this and it doesn't really work because it works sometimes. But there"}, {"start": 1877.48, "end": 1884.32, "text": " is this issue of these neurons connecting only back on themselves, which really makes the"}, {"start": 1884.32, "end": 1890.72, "text": " model much less powerful than a classic recurrent cell. It's closer to biology, but it's"}, {"start": 1890.72, "end": 1897.44, "text": " much less powerful. And there is this property. They say of neuron modulation where technically"}, {"start": 1897.44, "end": 1907.08, "text": " in real neurons, the one neuron here could influence another neuron by modulating these"}, {"start": 1907.08, "end": 1914.08, "text": " A and C parameters, okay, these A and C parameters. This is called neuromodulation. So there are"}, {"start": 1914.08, "end": 1919.1599999999999, "text": " interconnections between the neurons that influence how much other neurons remember and"}, {"start": 1919.1599999999999, "end": 1925.56, "text": " forget things. So they decide, let's model that and alone behold, we're now back to having"}, {"start": 1925.56, "end": 1935.08, "text": " weight matrices right here. So this, this is sort of they say this is a not really a super"}, {"start": 1935.08, "end": 1941.6399999999999, "text": " biologically plausible way of implementing neuromodulation, but it's sort of, it's an easier"}, {"start": 1941.6399999999999, "end": 1949.6, "text": " way and it brings us closer to the G back to the GRU. And yeah, so now the only difference"}, {"start": 1949.6, "end": 1958.24, "text": " to the GRU is that the fact that here there was a sigmoid, now it's a one plus 10 H, okay."}, {"start": 1958.24, "end": 1965.32, "text": " I find this, this pretty cool. So now also the only difference here is this property"}, {"start": 1965.32, "end": 1971.24, "text": " of bi stability. This is the only difference. And now we can actually compare. So let's"}, {"start": 1971.24, "end": 1979.16, "text": " compare. They first give, they do these sort of benchmarks, which are, they're pretty,"}, {"start": 1979.16, "end": 1985.16, "text": " pretty neat. So they have this first benchmark where it's the copy, first input benchmark."}, {"start": 1985.16, "end": 1992.76, "text": " I'm having some trouble here moving this paper around with my fingers. So the copy, first"}, {"start": 1992.76, "end": 1997.8400000000001, "text": " input benchmark is simply a time series. In this benchmark, the network is presented"}, {"start": 1997.8400000000001, "end": 2004.88, "text": " with a one dimensional time series of t time steps and the each entry is a is a random"}, {"start": 2004.88, "end": 2011.1200000000001, "text": " number. After receiving the last time step, the network output value should approximate"}, {"start": 2011.12, "end": 2016.4799999999998, "text": " the very, very first input step, okay. So all the network needs to do is remember the"}, {"start": 2016.4799999999998, "end": 2022.76, "text": " first thing it sees. And that's, that should be learnable, right? That should be learnable"}, {"start": 2022.76, "end": 2029.8799999999999, "text": " because you can, so you can, it's not specified whether the zero with hidden state, the initial"}, {"start": 2029.8799999999999, "end": 2035.36, "text": " hidden state is given into the network, but technically it doesn't matter because it"}, {"start": 2035.36, "end": 2043.52, "text": " can just learn whatever that is. I can learn to have a designated bit in this hidden state."}, {"start": 2043.52, "end": 2050.12, "text": " So this hidden state is of size 100, I believe. One designated bit in the hidden state of"}, {"start": 2050.12, "end": 2056.72, "text": " whether it has already encountered the first thing or not. If it has not encountered, it"}, {"start": 2056.72, "end": 2060.92, "text": " means that it's at the first time step. Therefore, it should incorporate the new information"}, {"start": 2060.92, "end": 2067.04, "text": " into the hidden state and if, and also set this bit. And then for each subsequent step,"}, {"start": 2067.04, "end": 2071.48, "text": " it can see I've already set this bit and it can simply close that gate that makes it"}, {"start": 2071.48, "end": 2076.8, "text": " incorporate new information. So it should be able to carry this information all the way"}, {"start": 2076.8, "end": 2084.6, "text": " to the end by simply always closing that gate after the first step. And what happens"}, {"start": 2084.6, "end": 2098.08, "text": " in this? So as you can see, when the result is, all the results up here. So this is after"}, {"start": 2098.08, "end": 2103.04, "text": " three, so they train it for 300,000, create into cent iterations. And you can see that when"}, {"start": 2103.04, "end": 2109.72, "text": " these time steps, when the series are pretty small, the LSTM's or the GRUs tend to perform"}, {"start": 2109.72, "end": 2115.72, "text": " well. But you can see that these BRCs, they don't tend to perform poorly. They're just"}, {"start": 2115.72, "end": 2122.2799999999997, "text": " performing worse, right? It's zero. It's still the 0.01 regime or something like this of"}, {"start": 2122.2799999999997, "end": 2128.68, "text": " error. However, when you go up to like 300 steps, then you can see the GRUs and the LSTM's"}, {"start": 2128.68, "end": 2135.2799999999997, "text": " they start to fail because they are not made explicitly to remember for that long day."}, {"start": 2135.28, "end": 2141.8, "text": " They don't have this by stability property. Whereas now these things excel. You can see"}, {"start": 2141.8, "end": 2147.1600000000003, "text": " they're still pretty low. And at 600 steps, these things completely fail. They completely"}, {"start": 2147.1600000000003, "end": 2154.92, "text": " forget the input. So and the NBRC at least is still able to remember the first thing"}, {"start": 2154.92, "end": 2163.5600000000004, "text": " pretty, pretty well. And yeah, so the second one is, no, this is the first experiment,"}, {"start": 2163.56, "end": 2170.68, "text": " the copy input benchmark. You can see right here that even at this 300 thing where the"}, {"start": 2170.68, "end": 2176.64, "text": " GRU still learns it, it learns it much, much later than the BRC, which learns it pretty"}, {"start": 2176.64, "end": 2184.48, "text": " fast. Only here when the when it's only five, when that series are only five steps long,"}, {"start": 2184.48, "end": 2192.52, "text": " does the GRU slightly outperform the BRC? So the general notion here is that these classic"}, {"start": 2192.52, "end": 2202.92, "text": " cells are more powerful in like classic tasks, whereas these things are shining whenever"}, {"start": 2202.92, "end": 2208.24, "text": " these things fail because they can't remember things for very long. So they're not these"}, {"start": 2208.24, "end": 2214.84, "text": " new cells are not state of the art yet. Possibly there are still some modifications to be made."}, {"start": 2214.84, "end": 2220.7599999999998, "text": " We've had a pretty long history of optimizing GRUs and LSTMs. They haven't always worked"}, {"start": 2220.76, "end": 2226.84, "text": " so well as they do now because we kind of know how to handle them. And I expect if these"}, {"start": 2226.84, "end": 2235.2400000000002, "text": " cells here take off, especially this NBRC, then with time will be as proficient at handling"}, {"start": 2235.2400000000002, "end": 2242.8, "text": " them and they will probably become on par or even outperform the LSTMs or GRUs on every"}, {"start": 2242.8, "end": 2248.6800000000003, "text": " day, like on all the tasks and then be especially good on tasks where you have to remember things."}, {"start": 2248.68, "end": 2255.0, "text": " But for now they're outperformed by LSTMs and GRUs. Okay, so the second thing is a more"}, {"start": 2255.0, "end": 2262.8799999999997, "text": " interesting experiment, the denoising benchmark, where they say the the copy input benchmark"}, {"start": 2262.8799999999997, "end": 2266.96, "text": " is interesting as it means to highlight the memorization capacity of the recurrent neural"}, {"start": 2266.96, "end": 2272.2, "text": " network, but it does not tackle its ability to successfully exploit complex relationships"}, {"start": 2272.2, "end": 2277.12, "text": " between different elements of the input signal to predict the output. They have a new"}, {"start": 2277.12, "end": 2282.7599999999998, "text": " benchmark. In the denoising benchmark, the network is presented with a two-dimensional"}, {"start": 2282.7599999999998, "end": 2288.2, "text": " time series of T time steps. Five different time steps are sampled uniformly with"}, {"start": 2288.2, "end": 2295.88, "text": " okay, and are communicated to the network. Okay, I'll just tell you what's going on. So"}, {"start": 2295.88, "end": 2301.0, "text": " this new time series is two-dimensional. In the lower dimension, you simply have a bunch"}, {"start": 2301.0, "end": 2309.48, "text": " of random numbers like 5, 8, 2, 9. Actually, these are numbers sampled from a uniform Gaussian"}, {"start": 2309.48, "end": 2314.2, "text": " or so. So they're not actually 5, 8, 2, and 9. But you can imagine it like this. 5, 8,"}, {"start": 2314.2, "end": 2324.96, "text": " 2, 9, 3, 4, 0, 2, and so on. And in the second dimension, you have a negative one, I believe,"}, {"start": 2324.96, "end": 2329.64, "text": " almost anywhere. And then at some points you have a 1. So you have a negative one again"}, {"start": 2329.64, "end": 2334.4, "text": " and then you have a 1. And the negative one again, and at the last point of the sequence,"}, {"start": 2334.4, "end": 2342.56, "text": " you'll have a 0. And so the 0 is simply a marker that it's the end of the sequence. What"}, {"start": 2342.56, "end": 2348.6, "text": " the network needs to do is it needs to output all the elements. So the output of the network"}, {"start": 2348.6, "end": 2357.68, "text": " should be, in this case, should be 9, 4. So all the elements where there was a 1 in order."}, {"start": 2357.68, "end": 2364.8799999999997, "text": " So it, remember what it needs to learn. It needs to learn to every time it sees a 1 in the"}, {"start": 2364.8799999999997, "end": 2372.12, "text": " second dimension. It needs to take the first dimension, put it somehow into the hidden state,"}, {"start": 2372.12, "end": 2377.6, "text": " and then carry that hidden state forward. And it sees a 1 again. It needs to take the"}, {"start": 2377.6, "end": 2383.24, "text": " second thing, also put it into the hidden state. But not override the first thing it put"}, {"start": 2383.24, "end": 2387.56, "text": " into the hidden state. Like if it were to just realize I need to put this into the hidden"}, {"start": 2387.56, "end": 2393.16, "text": " state, then it would almost surely override the previous information. So it needs to be"}, {"start": 2393.16, "end": 2401.12, "text": " able to say, I've already kind of in my age is going to be a vector of 100 dimensions."}, {"start": 2401.12, "end": 2407.3199999999997, "text": " It needs to be able to say, well, I've already stored a bunch of stuff in that part of the"}, {"start": 2407.32, "end": 2413.4, "text": " vector. Maybe I should store that thing here over here. So this is fairly complex things"}, {"start": 2413.4, "end": 2418.52, "text": " to remember. And technically, G or U's and Dallas TMs are able to do it. But as we'll"}, {"start": 2418.52, "end": 2430.1200000000003, "text": " see, they're not as much. The results are in this table where you can clearly see that"}, {"start": 2430.12, "end": 2439.8399999999997, "text": " whenever the n, so the n is a parameter that is how far in this direction are these ones."}, {"start": 2439.8399999999997, "end": 2446.64, "text": " So when n is zero, the ones can be anywhere. But when n here is like five, that means that"}, {"start": 2446.64, "end": 2454.3599999999997, "text": " the last five ones surely don't contain a one. That means only the first, whatever L minus"}, {"start": 2454.3599999999997, "end": 2460.08, "text": " L minus five contain the one. So the higher this number n is, the harder the task, because"}, {"start": 2460.08, "end": 2469.3199999999997, "text": " your learning signal is way, way farther away from the from what's when you get the output."}, {"start": 2469.3199999999997, "end": 2474.92, "text": " So you can see when the n is low, then the G or U's and the LSTMs, they perform pretty"}, {"start": 2474.92, "end": 2482.0, "text": " well. But also these cells perform pretty well. They're just not performing as well. However,"}, {"start": 2482.0, "end": 2487.68, "text": " when the task gets harder and you actually need to learn a sparse signal over a long period"}, {"start": 2487.68, "end": 2493.3599999999997, "text": " of time, where in between you don't get any signal, the G or U's and the LSTMs fail, while"}, {"start": 2493.3599999999997, "end": 2500.2799999999997, "text": " the B or C's would still be able to learn these kinds of things. So that's that's fairly"}, {"start": 2500.2799999999997, "end": 2506.24, "text": " cool. Now it's if from a researcher's perspective, I wonder if they just first tried this task,"}, {"start": 2506.24, "end": 2510.56, "text": " you know, as I described it, and then they discovered like, ah crap, they can still do"}, {"start": 2510.56, "end": 2515.6, "text": " it. And like, okay, how can we make it such that there's a difference? Okay, let's actually"}, {"start": 2515.6, "end": 2520.2, "text": " make the task harder like this. And then they did that. I wonder if they always had the"}, {"start": 2520.2, "end": 2527.88, "text": " idea with the n here or just introduced this, um, after, after it, they, they failed to"}, {"start": 2527.88, "end": 2533.3199999999997, "text": " produce a difference in the first place. I'm not sure. But they have, they have another"}, {"start": 2533.3199999999997, "end": 2538.56, "text": " benchmark, but they basically show that these cells are, are actually good, can incorporate"}, {"start": 2538.56, "end": 2543.48, "text": " this information, can reason about what they need to remember and whatnot. And in the"}, {"start": 2543.48, "end": 2549.12, "text": " end, they also have this sequential M-nest, where they just feed an M-nest digit, digit"}, {"start": 2549.12, "end": 2554.72, "text": " by digit. And at the end, I think the, the, what, the output of the neural network needs"}, {"start": 2554.72, "end": 2561.52, "text": " to be the class of the, of the M-nest digit. And again, here, they have a parameter called"}, {"start": 2561.52, "end": 2567.48, "text": " N-black, which means that, so they have an M-nest digit, it's like a three, they unroll"}, {"start": 2567.48, "end": 2573.28, "text": " it to a single vector, right? Da, da, da, da, da, da, da, da, they feed this one by one"}, {"start": 2573.28, "end": 2578.68, "text": " into the recurrent network. And then after that, they attach a certain number of just empty"}, {"start": 2578.68, "end": 2586.12, "text": " pixels, black pixels. And after that, the network needs to predict the Y. You can see if they"}, {"start": 2586.12, "end": 2592.16, "text": " ask the network, the class of the digit, immediately after it's done, then the G are using"}, {"start": 2592.16, "end": 2599.44, "text": " the LSTM perform fairly well, as do the BRCs. But if you attach a whole bunch of these"}, {"start": 2599.44, "end": 2606.2, "text": " black pixels, remember an M-nest digit has some seven, sorry, seven hundred and eighty-four"}, {"start": 2606.2, "end": 2614.8799999999997, "text": " maybe entries. So attaching 300 black pixels is quite significant in, in terms of the length"}, {"start": 2614.8799999999997, "end": 2620.52, "text": " of these sequences. And then the G are using the LSTMs, they can't learn, they can't"}, {"start": 2620.52, "end": 2628.8, "text": " learn to ignore these things because the learning signal is just too far away right here."}, {"start": 2628.8, "end": 2634.84, "text": " But these things, they can, because they can exploit this by stability property and remember"}, {"start": 2634.84, "end": 2642.2, "text": " things. Again, I wonder how this came to be. It seems pretty funny. But the last thing"}, {"start": 2642.2, "end": 2647.52, "text": " they do is they investigate what happens in their cells. And this, I feel, is the most"}, {"start": 2647.52, "end": 2652.36, "text": " interesting part. And they do this on this denoising benchmark. So the task we've looked"}, {"start": 2652.36, "end": 2658.0, "text": " at before, where you need to remember five randomly selected numbers that are indicated"}, {"start": 2658.0, "end": 2667.12, "text": " by the second dimension. Here they show a sequence where the five numbers occur at 3146,"}, {"start": 2667.12, "end": 2674.0, "text": " at 300 and at 376. So these are the five positions where the sequence indicates that the network"}, {"start": 2674.0, "end": 2681.96, "text": " should remember the thing in the first dimension and then output. They analyse two things. They"}, {"start": 2681.96, "end": 2688.24, "text": " analyse the proportion of bisable neurons. So basically they analyse these, these A quantities"}, {"start": 2688.24, "end": 2694.84, "text": " and they analyse how many of the neurons in the layer have an A that's higher than one,"}, {"start": 2694.84, "end": 2700.64, "text": " which means that they are in this bisable mode. And also they analyse what's the average"}, {"start": 2700.64, "end": 2707.64, "text": " value of C. So C, if you remember, if this is high, it means it doesn't let in new information."}, {"start": 2707.64, "end": 2712.8399999999997, "text": " And if this is low, it means it lets in new information. If you first look at the C, you"}, {"start": 2712.8399999999997, "end": 2718.44, "text": " can see that every single time when the second dimension indicates that this is one of the"}, {"start": 2718.44, "end": 2724.6, "text": " inputs to remember, this, the network drops, immediately drops the C values. The different"}, {"start": 2724.6, "end": 2729.6, "text": " colours here are different layers. They build, they have a recurrent network has multiple"}, {"start": 2729.6, "end": 2737.3199999999997, "text": " layers of these cells, as is usual in the recurrent neural networks. So this C, as you can see,"}, {"start": 2737.3199999999997, "end": 2743.6, "text": " it goes up pretty quickly. And then as soon as one of these inputs appear, the C drops,"}, {"start": 2743.6, "end": 2749.68, "text": " which basically means that the network realises it now must let in the new information. And"}, {"start": 2749.68, "end": 2756.0, "text": " then it immediately shoots back up, makes it seem like, so the network says, oh, okay,"}, {"start": 2756.0, "end": 2760.8, "text": " as long as, so all of these inputs here, they have the negative one in the second dimension,"}, {"start": 2760.8, "end": 2765.52, "text": " right? So it recognises it says there's no reason for me to incorporate that information."}, {"start": 2765.52, "end": 2772.16, "text": " It's not important. And as soon as the second input comes, it immediately shoots down again."}, {"start": 2772.16, "end": 2776.68, "text": " Now you can see this here is the last layer of the network, the highest layer. So sort"}, {"start": 2776.68, "end": 2784.2, "text": " of the highest abstractive information. And you can see that from input to input, this"}, {"start": 2784.2, "end": 2790.72, "text": " value of C gets higher and higher. And these spikes as they go down, but they go down to"}, {"start": 2790.72, "end": 2798.8799999999997, "text": " a higher and higher point, which is the fact that it recognises it needs to let in new"}, {"start": 2798.8799999999997, "end": 2805.64, "text": " information. But it lets in less and less new information, the more things it needs to"}, {"start": 2805.64, "end": 2810.16, "text": " remember. So not only does it recognise, wait, I need to remember this, it also recognises,"}, {"start": 2810.16, "end": 2818.2799999999997, "text": " I probably shouldn't, you know, completely forget what I had previously, because it is"}, {"start": 2818.2799999999997, "end": 2823.3599999999997, "text": " important for me to remember these previous things. So that's a pretty cool demonstration,"}, {"start": 2823.3599999999997, "end": 2829.3199999999997, "text": " the fact that these go down at the input and the fact that generally they go up every"}, {"start": 2829.3199999999997, "end": 2836.04, "text": " time after a new input is incorporated into the hidden state. This basically, this shows"}, {"start": 2836.04, "end": 2843.36, "text": " that the, or this is a pretty good indication that what they're saying is really happening,"}, {"start": 2843.36, "end": 2849.52, "text": " right? Okay, the second thing shows almost the same, it shows how many of these neurons"}, {"start": 2849.52, "end": 2856.04, "text": " are actually in their by stable mode. And you can also see right here that especially"}, {"start": 2856.04, "end": 2863.16, "text": " in the last layer, you can see that the number of neurons in the by stable mode goes up"}, {"start": 2863.16, "end": 2870.56, "text": " and up and up and up after each of these steps. And these spikes here correspond to always"}, {"start": 2870.56, "end": 2880.6, "text": " the points where they have to let in new information. Okay, cool. So I find that, I find this"}, {"start": 2880.6, "end": 2885.2799999999997, "text": " to be pretty cool and I find this last experiment to be the coolest where they can actually"}, {"start": 2885.2799999999997, "end": 2892.08, "text": " show, look here, there's a pretty good indication that the thing we, we build does what we"}, {"start": 2892.08, "end": 2901.2799999999997, "text": " say it does. They also actually have a proof here of the by stability when this A is higher"}, {"start": 2901.2799999999997, "end": 2907.64, "text": " than one. I won't go through this right here, but if you want, you can look at that. I'm"}, {"start": 2907.64, "end": 2912.7999999999997, "text": " excited to see what happens with these kinds of architectures in the future because it seems"}, {"start": 2912.7999999999997, "end": 2918.64, "text": " to be a pretty minor modification. And maybe with a little bit of more modification, or if"}, {"start": 2918.64, "end": 2923.3199999999997, "text": " we sort of just tune this a little bit and kind of figure out what we have to do to make"}, {"start": 2923.3199999999997, "end": 2930.7999999999997, "text": " these things actually compete with the classic GRUs and LSTMs in regimes where a long memory"}, {"start": 2930.7999999999997, "end": 2937.56, "text": " isn't necessary. I feel this could be a kind of a standard building block in the recurrent"}, {"start": 2937.56, "end": 2942.6, "text": " neural network toolkit, even though it's been sort of outperformed by transformers in"}, {"start": 2942.6, "end": 2949.6, "text": " previous years. Alright, that was it for me and I hope you had fun with this paper. I invite"}, {"start": 2949.6, "end": 2974.6, "text": " you to check it out and bye-bye."}] |
Yannic Kilcher | 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 hiddenore tonaka, daniel kuneen, daniel lk, yummins, and suria gangouli. 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 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 or 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 subnetworks 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's 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 buy 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 may be 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 so 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 your 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 at Paltas is 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 out here takes that idea and says 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 our 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 name 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 it like very high compression ratios is because they do premature layer collapse. They then formulate this maximum 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 prove 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, sin flow that does all of this and never looks at any data. All right this is quite a story but remember what we're doing. First layer collapses the 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 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 pruning's 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's 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 flow 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'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 while still avoiding layer collapse and they say for example for network with L layers and N parameters the max compression is N over L which it 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 to 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 they there are also two more advanced methods these SNIP and the grass piece of 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 grass even involves the 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 critical 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 forest you can push the algorithm without him without sorry if 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 achieved this maximum compression ratio so they formulate this here as a guiding principle they formulate is an axiom 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 is 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 the 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 if we're only layer collapse what you'll see is that they do the same 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 disconnect so they established two things they established a layer collapse problem and now they established 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 there 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 scalarization one of the first network pruning algorithms the resulting metric metric is also closely related to this right here that 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 hasten 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 to surprising conservation laws that hold at any initialization and step in training so these are not either 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 feat 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 reloose 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 is 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 feat forward neural network with homogeneous activation functions equals that so it basically says it remains equal so what does it mean what does it 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 saliency that's going to be equal to the sum of all the synaptic saliency of the outgoing connections of that layer and you 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 sin flow 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 as already 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 sin flow 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 at 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 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 that 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 count 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 or 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 retains the network basically recomputes the magnitudes and therefore recomputes the scores and then it prunes again and then it recomputes and and 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 an 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 10 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 and then again three out of the 10 whereas the one iteration would prune all of the nine at in one go okay 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 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 you 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 if prune the way 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 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 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 layer wise 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 layer wise conservation and if the algorithm so respecting layer wise 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 re-evaluates the scores every time a parameter is pruned then the algorithm satisfies the maximal critical compression axiom okay so that's basically saying that if you have any algorithm that prunes with a saliency score like theirs is going to do and is going to to be able to be pushed to the limit until the maximal capacity is reached if you re-evaluate 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'll guaranteed to achieve the maximum possible compression if you if you push it but of course we know that whatever the lottery ticket hypothesis paper did is impractical because it needs to retrain the network every single time it wants to prune right so if you want 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 sin flow algorithm they say theorem 3 directly motivates the design of our novel pruning algorithm sin flow that provably reaches maximal critical oh no okay this was bad maximal 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 the step motivates the development of an efficient data independent scoring procedure second positivity and conservation motive motive 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 what we have we have the parameters of layer L the absolute product as already 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 do 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 you're 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 you need to do 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 points gets when the when the loss function is just the sum of the outputs that's that's the 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 r 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 propagates it signal and that's going to be your score for each parameter now this doesn't seem too hard right you so you just need you don't 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 i.e. 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-linearity we can factor the synaptic flow score for for any parameter as such so the score this is now not the the or 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 it 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 scores 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 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 resonant they have a bunch of datasets 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 resonant 18 right here maybe you can find a connection between maybe there's differently sized layers in resonant 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 datasets 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 overread something but I'm pretty sure that the baselines remain single shot while the sin flow algorithm here is now of course no longer 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-shot and it it seems like they should give the other algorithms the opportunity to also do multi-shot just to compare them fairly maybe as I said maybe they're doing that but I'm I haven't read 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 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 am 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 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 initialize 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 all right again if you like 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": 4.96, "text": " Hi there! Today we're looking at pruning neural networks without any data by"}, {"start": 4.96, "end": 10.84, "text": " iteratively conserving synaptic flow, by hiddenore tonaka, daniel kuneen, daniel"}, {"start": 10.84, "end": 16.84, "text": " lk, yummins, and suria gangouli. So this paper on a high level does what the"}, {"start": 16.84, "end": 22.12, "text": " lottery ticket hypothesis does, but does so without any data it prunes a neural"}, {"start": 22.12, "end": 28.080000000000002, "text": " network at the beginning and it does so it's able to do that because it claims"}, {"start": 28.08, "end": 33.72, "text": " that its algorithm avoids this problem called layer collapse and then is based"}, {"start": 33.72, "end": 40.64, "text": " on conserving a quantity they call the synaptic flow and we're going to look at"}, {"start": 40.64, "end": 45.959999999999994, "text": " this and it's pretty cool algorithm it seems to work pretty well. As always if"}, {"start": 45.959999999999994, "end": 51.36, "text": " you want to help or out you can share this video and let me know in the"}, {"start": 51.36, "end": 57.64, "text": " comments what you think of it. I do read the comments and I would love to hear"}, {"start": 57.64, "end": 63.0, "text": " from you. Alright let's dive in. So they're saying pruning the parameters of"}, {"start": 63.0, "end": 68.16, "text": " deep neural networks has generated intense interest due to potential savings in"}, {"start": 68.16, "end": 74.48, "text": " time, memory and energy both during training and at test time. Recent works have"}, {"start": 74.48, "end": 79.2, "text": " identified through an expensive sequence of training and pruning cycles the"}, {"start": 79.2, "end": 83.68, "text": " existence of winning lottery tickets or sparse, trainable subnetworks at"}, {"start": 83.68, "end": 90.04, "text": " initialization. So what is this paper talking about? If you if you don't know much"}, {"start": 90.04, "end": 94.28, "text": " about pruning here is kind of a basic overview. So if you have a neural network"}, {"start": 94.28, "end": 100.2, "text": " that's consists of many many layers of neurons. What you can do that one way of"}, {"start": 100.2, "end": 107.12, "text": " pruning that what what the goal is is to end up with a small neural network that"}, {"start": 107.12, "end": 112.72, "text": " performs well. But for now we have a big neural network that doesn't perform"}, {"start": 112.72, "end": 117.28, "text": " well. It hasn't been trained yet. Right. So what you can do is you can first train"}, {"start": 117.28, "end": 122.44, "text": " the neural network. And then you have a big neural network that performs well."}, {"start": 122.44, "end": 129.12, "text": " And then you can prune it. Now a lot of times a lot of the time this this has"}, {"start": 129.12, "end": 133.92, "text": " been seen as sort of the pruning way. You would train the big neural network and"}, {"start": 133.92, "end": 138.96, "text": " then you would prune it because the other way was not feasible. First pruning and"}, {"start": 138.96, "end": 146.16, "text": " then training was not feasible. You might you might ask okay we might just want"}, {"start": 146.16, "end": 150.92000000000002, "text": " to start with a small one. And yeah that's correct. So what does this first way"}, {"start": 150.92000000000002, "end": 157.4, "text": " buy you? This first way is buys you mainly two things. So imagine this network"}, {"start": 157.4, "end": 163.60000000000002, "text": " right here is much smaller than the original network. So it is less it uses"}, {"start": 163.6, "end": 168.76, "text": " less storage. So you can potentially if you want to ship it to like a customer"}, {"start": 168.76, "end": 173.24, "text": " over the internet you may be instead of a gigabyte you only have to transfer a"}, {"start": 173.24, "end": 178.79999999999998, "text": " few megabytes. And that's pretty cool. The second thing if you prune in the"}, {"start": 178.79999999999998, "end": 183.84, "text": " correct way you can also make it faster because now there's less weights to"}, {"start": 183.84, "end": 191.44, "text": " multiply with you can actually make it go faster. So pruning is a now this this"}, {"start": 191.44, "end": 196.2, "text": " combines with techniques called distillation and so on is our ways to make the"}, {"start": 196.2, "end": 202.12, "text": " networks smaller and faster. So if your customers are for example on on mobile"}, {"start": 202.12, "end": 207.6, "text": " phones then you can ship you can train a big network to a good performance on your"}, {"start": 207.6, "end": 213.24, "text": " big GPU server and then ship it out to a mobile phone once it's small and it"}, {"start": 213.24, "end": 219.56, "text": " will perform fairly well on that mobile phone without GPU. So what about this"}, {"start": 219.56, "end": 225.52, "text": " other way? Now in order to do the other way we would sort of have to have an"}, {"start": 225.52, "end": 232.52, "text": " idea which one of these big networks which sub parts of these layers are the"}, {"start": 232.52, "end": 237.56, "text": " good ones right in order for us to do this first prune and then train. The"}, {"start": 237.56, "end": 241.52, "text": " interesting thing is that the paper the lottery ticket hypothesis I've done a"}, {"start": 241.52, "end": 246.28, "text": " video on this and we've also interviewed the author on our ML Street Talk"}, {"start": 246.28, "end": 251.52, "text": " podcast. This paper has shown that this is in fact possible. A long time people"}, {"start": 251.52, "end": 256.64, "text": " have thought we need the big network in order to train right we so sort of the"}, {"start": 256.64, "end": 261.36, "text": " bigness of the network the full connectedness of the network is required for"}, {"start": 261.36, "end": 265.28, "text": " the training dynamics but this paper has shown this is not possible you can prune"}, {"start": 265.28, "end": 271.44, "text": " at the very beginning. Now what does it do? It first trains in your network like"}, {"start": 271.44, "end": 276.92, "text": " in the in the olden days then it prunes the neural network and then it"}, {"start": 276.92, "end": 281.84, "text": " remembers which connections of the train neural network it has pruned and then"}, {"start": 281.84, "end": 287.12, "text": " it simply goes back to the beginning of training right here up here and says I"}, {"start": 287.12, "end": 291.72, "text": " now know which connections are important and I'm simply going to prune all the"}, {"start": 291.72, "end": 296.52, "text": " other connections other than these ones and then interestingly if you prune"}, {"start": 296.52, "end": 302.91999999999996, "text": " first and then train that works just as well and can actually work even better."}, {"start": 302.91999999999996, "end": 308.28, "text": " The interesting thing here is that I mean this is a big big cycle but the"}, {"start": 308.28, "end": 312.84, "text": " interesting thing that the paper demonstrates is that this is even possible"}, {"start": 312.84, "end": 318.35999999999996, "text": " right. People thought it wasn't possible and this paper demonstrates if you"}, {"start": 318.35999999999996, "end": 325.32, "text": " only knew if you only knew which ones you must retain you can prune at the"}, {"start": 325.32, "end": 329.78, "text": " beginning of training. The lottery ticket at Paltas is paper though still"}, {"start": 329.78, "end": 334.64, "text": " requires to actually train the full network and then do the pruning like in a"}, {"start": 334.64, "end": 339.36, "text": " classic way in order to find out which ones you need to prune and which ones"}, {"start": 339.36, "end": 348.48, "text": " you don't. This paper out here takes that idea and says can we find a pruning"}, {"start": 348.48, "end": 353.24, "text": " algorithm that prunes at the beginning of training yet does not have to"}, {"start": 353.24, "end": 358.56, "text": " train the full network. In fact doesn't look at any of the data okay and this"}, {"start": 358.56, "end": 364.16, "text": " is our going to be our starting point. So their story is going to be it's quite"}, {"start": 364.16, "end": 370.16, "text": " an involved story and I think the overview is important as we go through the"}, {"start": 370.16, "end": 377.88, "text": " paper. So first they name this problem called layer collapse. Now layer collapse"}, {"start": 377.88, "end": 382.8, "text": " is going to be whenever a pruning algorithm removes the entirety of a"}, {"start": 382.8, "end": 387.48, "text": " neural network layer which means that no information can flow anymore and"}, {"start": 387.48, "end": 391.76, "text": " therefore the network can't train and they claim that this is the main"}, {"start": 391.76, "end": 398.64, "text": " problem why these current pruning algorithms cannot achieve very high pruning"}, {"start": 398.64, "end": 403.24, "text": " ratios. So can it like very high compression ratios is because they do"}, {"start": 403.24, "end": 409.48, "text": " premature layer collapse. They then formulate this maximum critical"}, {"start": 409.48, "end": 414.6, "text": " compression axiom that has sort of a guiding principle to build pruning"}, {"start": 414.6, "end": 421.84000000000003, "text": " algorithms. Second they show that this quantity called synaptic saliency a"}, {"start": 421.84000000000003, "end": 426.48, "text": " general class of gradient based scores for pruning is conserved at every hidden"}, {"start": 426.48, "end": 432.24, "text": " unit layer of a neural network. So they show that these are conserved and they"}, {"start": 432.24, "end": 437.40000000000003, "text": " show this because this is their their argument is going to be first the"}, {"start": 437.4, "end": 443.2, "text": " argument is layer collapse is a problem. The second argument is these things"}, {"start": 443.2, "end": 449.08, "text": " are conserved and these the conservation of the synaptic saliency leads to the"}, {"start": 449.08, "end": 455.76, "text": " layer collapse and we're going to see how that happens. And then third they say"}, {"start": 455.76, "end": 462.32, "text": " the solution to that is iterative pruning. So they show this at the at the"}, {"start": 462.32, "end": 467.92, "text": " example of iterative magnitude pruning which we know avoids layer collapse."}, {"start": 467.92, "end": 472.4, "text": " So iterative magnitude pruning is something that happens in this lottery"}, {"start": 472.4, "end": 479.8, "text": " ticket way of of doing it. This lottery ticket way you can actually do it not in"}, {"start": 479.8, "end": 484.88, "text": " one step but it tends to work better when you want to go from 100% of your"}, {"start": 484.88, "end": 489.52, "text": " weights to just 5% of your weights. It tends to work better if you do it in stages."}, {"start": 489.52, "end": 497.28, "text": " So first you go to 90% to 80 to 70 and so on down to your desired thing. And this"}, {"start": 497.28, "end": 505.71999999999997, "text": " iterative procedure they claim is what is what circumvents this problem of"}, {"start": 505.71999999999997, "end": 513.88, "text": " layer collapse. And then at last they say we prove that a pruning algorithm"}, {"start": 513.88, "end": 519.64, "text": " avoids layer collapse entirely and satisfies blah blah blah if it uses"}, {"start": 519.64, "end": 525.12, "text": " iterative positive synaptic saliency scores. So they bring it all together and"}, {"start": 525.12, "end": 533.36, "text": " say if an algorithm satisfies our axiom and if the algorithm is an algorithm"}, {"start": 533.36, "end": 539.52, "text": " that uses these saliency scores like this one here and if the algorithm is"}, {"start": 539.52, "end": 545.68, "text": " iterative then it is not going to be subject to layer collapse and therefore it"}, {"start": 545.68, "end": 551.28, "text": " is going to be able to compress to a very high compression ratio. And then they"}, {"start": 551.28, "end": 557.56, "text": " actually do suggest an algorithm this synaptic sorry iterative synaptic flow"}, {"start": 557.56, "end": 563.96, "text": " pruning, sin flow that does all of this and never looks at any data. All right this"}, {"start": 563.96, "end": 569.16, "text": " is quite a story but remember what we're doing. First layer collapses the"}, {"start": 569.16, "end": 573.48, "text": " problem second why is layer collapse a problem it's because of this synaptic"}, {"start": 573.48, "end": 578.52, "text": " saliency conservation. Third we can avoid it by doing iterative pruning and"}, {"start": 578.52, "end": 588.28, "text": " lastly this algorithm does it without looking at data. Okay so layer layer"}, {"start": 588.28, "end": 594.0, "text": " collapse. Layer collapse is a pretty simple phenomenon. I've already said it if"}, {"start": 594.0, "end": 600.6, "text": " you have neural network and it has a bunch of layers and let's draw a couple"}, {"start": 600.6, "end": 605.68, "text": " of neurons here and the neurons are connected to each other via connections"}, {"start": 605.68, "end": 611.64, "text": " connections connections connections and you have a pruning algorithm. Now the"}, {"start": 611.64, "end": 615.72, "text": " pruning's algorithms they consider here are so called single-shot pruning"}, {"start": 615.72, "end": 618.52, "text": " algorithms. What they do is they look at the neural network and this can be"}, {"start": 618.52, "end": 623.4, "text": " before training or after training but they at some point they look at the"}, {"start": 623.4, "end": 629.04, "text": " neural network and they each they assign a score to each of these weights like"}, {"start": 629.04, "end": 635.34, "text": " they'll say you're one you're a five you're a nine and so on and then they"}, {"start": 635.34, "end": 641.16, "text": " simply prune away the lowest scores. Okay and you tell the network what"}, {"start": 641.16, "end": 645.36, "text": " compression ratio you want to you tell the network for example please prune away"}, {"start": 645.36, "end": 650.52, "text": " 90% of the connections. So these algorithms would look would assign the scores"}, {"start": 650.52, "end": 659.6, "text": " once and then remove the bottom 90% of weights. Okay like this. So those are the"}, {"start": 659.6, "end": 665.04, "text": " single-shot pruning algorithms. Now what is layer collapse layer collapse is"}, {"start": 665.04, "end": 671.1999999999999, "text": " whenever an algorithm removes all of one layer because maybe so here was a"}, {"start": 671.1999999999999, "end": 679.1999999999999, "text": " nine maybe you have like 11's 12 13 here. Okay so and then you're in you're in"}, {"start": 679.2, "end": 683.0, "text": " this situation right here and the algorithm is pretty it's pretty dumb it's"}, {"start": 683.0, "end": 688.24, "text": " simply removing the bottom 90% of the connections and here it figures I need to"}, {"start": 688.24, "end": 692.12, "text": " remove one more to meet that goal. I remove the one with the lowest score I'm"}, {"start": 692.12, "end": 695.6400000000001, "text": " going to remove this one and it's pretty obvious that now no more information"}, {"start": 695.6400000000001, "end": 702.2, "text": " can flow from the beginning to the end of the network because well what's"}, {"start": 702.2, "end": 706.5600000000001, "text": " where is it going to flow to. It's a bit more complex than that like you can"}, {"start": 706.56, "end": 710.9599999999999, "text": " just retain a layer like a connection for example if this were a connection"}, {"start": 710.9599999999999, "end": 714.16, "text": " there would also be no information flow because you'd have no outgoing"}, {"start": 714.16, "end": 719.3199999999999, "text": " connection here but ultimately layer collapse is whenever an entire layer is"}, {"start": 719.3199999999999, "end": 732.04, "text": " removed. Okay and they they do say somewhere that's the case I think layer"}, {"start": 732.04, "end": 738.28, "text": " collapse here layer collapse occurs when an algorithm prunes all parameters in a"}, {"start": 738.28, "end": 742.5999999999999, "text": " single-weight layer even when prunable parameters remain elsewhere in the"}, {"start": 742.5999999999999, "end": 749.92, "text": " network. So I'm not as such I'm not sure that this is like a giant problem it"}, {"start": 749.92, "end": 754.68, "text": " gets to be a problem but it could be circumvented fairly easily right by"}, {"start": 754.68, "end": 759.64, "text": " simply saying if you're about to prune a connection that's integral to the"}, {"start": 759.64, "end": 763.84, "text": " information flow from the start to the end don't prune that connection prune"}, {"start": 763.84, "end": 768.04, "text": " some other connection right and then you could simply avoid that and I'd be"}, {"start": 768.04, "end": 773.88, "text": " interested in how that works out so but in this case for purposes of this"}, {"start": 773.88, "end": 779.52, "text": " paper they simply consider algorithms that assign a score and then prune the"}, {"start": 779.52, "end": 784.48, "text": " bottom couple of percent okay for so we don't want any like handcrafted rules"}, {"start": 784.48, "end": 790.84, "text": " in here or something. So they look at this quantity called the max compression"}, {"start": 790.84, "end": 796.5600000000001, "text": " the max compression is a quantity that's basically the maximum achievable"}, {"start": 796.5600000000001, "end": 801.16, "text": " compression while still avoiding layer collapse and they say for example for"}, {"start": 801.16, "end": 805.5600000000001, "text": " network with L layers and N parameters the max compression is N over L which"}, {"start": 805.5600000000001, "end": 811.0, "text": " it basically means every layer only has one parameter remaining and therefore"}, {"start": 811.0, "end": 818.28, "text": " if it's the correct one therefore information can flow from start to the end"}, {"start": 818.28, "end": 823.32, "text": " all right so this is the maximum achievable compression anything beyond that"}, {"start": 823.32, "end": 828.72, "text": " would automatically induce layer collapse now anything before that could induce"}, {"start": 828.72, "end": 834.08, "text": " layer collapse but there is a way to compress the network to the same level"}, {"start": 834.08, "end": 838.08, "text": " without inducing layer collapse and their point is basically that these other"}, {"start": 838.08, "end": 842.72, "text": " compression algorithms that they compare with they always they always induce"}, {"start": 842.72, "end": 847.84, "text": " layer collapse before they actually have to because they cut off a connection"}, {"start": 847.84, "end": 853.32, "text": " that leads to layer collapse before they like there would be another connection"}, {"start": 853.32, "end": 857.08, "text": " that they could cut off that would not lead to layer collapse and of course if"}, {"start": 857.08, "end": 862.5600000000001, "text": " you are layer if you have done a layer collapse then you accuracy immediately"}, {"start": 862.56, "end": 868.8399999999999, "text": " drops to zero or to random because no more information flow so they look at"}, {"start": 868.8399999999999, "end": 873.3199999999999, "text": " these things here random pruning is where you simply assign a random score to"}, {"start": 873.3199999999999, "end": 879.16, "text": " each connection magnitude pruning is what the lottery ticket hypothesis does"}, {"start": 879.16, "end": 886.7199999999999, "text": " but just they look here at a single shot so you simply look at the magnitude of"}, {"start": 886.7199999999999, "end": 890.1999999999999, "text": " the weights and this can be before after training I think they do it after"}, {"start": 890.2, "end": 893.72, "text": " training here which is classically done you look at the magnitude of the weights"}, {"start": 893.72, "end": 900.48, "text": " and you prune the bottom 90% away they there are also two more advanced"}, {"start": 900.48, "end": 907.44, "text": " methods these SNIP and the grass piece of snip and grasp which look at the"}, {"start": 907.44, "end": 913.2, "text": " gradient of the training loss in the network and they decide according to that"}, {"start": 913.2, "end": 919.0400000000001, "text": " gradient which which things to cut and which things not to cut away the"}, {"start": 919.04, "end": 924.04, "text": " grass even involves the the Hessian right here so they're fairly you know"}, {"start": 924.04, "end": 929.04, "text": " complex method that have some thoughts behind them about why they do what they"}, {"start": 929.04, "end": 934.76, "text": " do yet they all induce layer collapse before they actually have to so they"}, {"start": 934.76, "end": 939.1999999999999, "text": " define this thing here called the critical compression the critical"}, {"start": 939.1999999999999, "end": 943.9599999999999, "text": " critical compression is the maximal compression ratio a given algorithm can"}, {"start": 943.9599999999999, "end": 947.9599999999999, "text": " achieve without inducing layer collapse so the critical compression here is"}, {"start": 947.96, "end": 952.08, "text": " basically whenever that algorithm goes to zero that's the critical compression"}, {"start": 952.08, "end": 957.52, "text": " that's kind of the forest you can push the algorithm without him without sorry"}, {"start": 957.52, "end": 965.96, "text": " if German speaker without it induced without it inducing layer collapse okay so"}, {"start": 965.96, "end": 970.0, "text": " you can see that for these baseline algorithms the layer collapse occurs way"}, {"start": 970.0, "end": 975.12, "text": " below the theoretically possible max compression and we're going to see that"}, {"start": 975.12, "end": 980.12, "text": " in their algorithm this sin flow that this max compression is achieved and"}, {"start": 980.12, "end": 984.6, "text": " it's actually achieved without any of these handcrafted rules that I mentioned"}, {"start": 984.6, "end": 989.5600000000001, "text": " it is the algorithm by design already achieved this maximum compression"}, {"start": 989.5600000000001, "end": 993.36, "text": " ratio so they formulate this here as a guiding principle they formulate is an"}, {"start": 993.36, "end": 999.28, "text": " axiom I would rather say it's like this kind of a it's kind of a guiding"}, {"start": 999.28, "end": 1005.0, "text": " principle of building these algorithms that any algorithm you build should have"}, {"start": 1005.0, "end": 1008.72, "text": " so the critical compression ratio of a pruning algorithm applied to a"}, {"start": 1008.72, "end": 1013.52, "text": " network should always equal the max compression of that network it basically"}, {"start": 1013.52, "end": 1018.48, "text": " means when you build a pruning algorithm if you push that pruning algorithm to"}, {"start": 1018.48, "end": 1024.6, "text": " its limits it should not do layer collapse unless it absolutely needs to"}, {"start": 1024.6, "end": 1031.2, "text": " okay again the extent of this problem I don't I don't know but they do"}, {"start": 1031.2, "end": 1036.76, "text": " demonstrate that that they can push their algorithm a fair bit further now"}, {"start": 1036.76, "end": 1041.72, "text": " without inducing layer collapse you already see that these other algorithms"}, {"start": 1041.72, "end": 1045.64, "text": " like in this regime apparently layer collapse hasn't happened yet because they"}, {"start": 1045.64, "end": 1049.8, "text": " still have sizable accuracy but there is still a you know there is a"}, {"start": 1049.8, "end": 1054.8, "text": " reasonable difference here between those and the sin flow algorithm so I'm not"}, {"start": 1054.8, "end": 1061.6, "text": " too convinced yet that layer collapse as such is the problem because they have a"}, {"start": 1061.6, "end": 1066.8, "text": " difference before their layer collapsing as you can see right here and I have"}, {"start": 1066.8, "end": 1072.32, "text": " the feeling that this difference here is due to this iterative procedure and"}, {"start": 1072.32, "end": 1078.84, "text": " not actually due to the phenomenon of layer collapse but yeah so if if we're"}, {"start": 1078.84, "end": 1083.72, "text": " only layer collapse what you'll see is that they do the same same the same and"}, {"start": 1083.72, "end": 1090.1200000000001, "text": " then at some point is like boom now I have layer collapse okay yeah so the"}, {"start": 1090.1200000000001, "end": 1095.96, "text": " layer collapse story I'm not sure but it's part of the story so let's let's"}, {"start": 1095.96, "end": 1101.24, "text": " go with that the second part which is kind of disconnect so they established"}, {"start": 1101.24, "end": 1104.8, "text": " two things they established a layer collapse problem and now they established"}, {"start": 1104.8, "end": 1109.52, "text": " the synaptic saliency which then later they're going to connect to the layer"}, {"start": 1109.52, "end": 1119.28, "text": " collapse so the synaptic saliency they say is a score is any score metric that can"}, {"start": 1119.28, "end": 1127.24, "text": " be expressed as the Hadamard product of this thing with the parameters okay so"}, {"start": 1127.24, "end": 1134.04, "text": " each parameter is going to be multiplied by the gradient of some function with"}, {"start": 1134.04, "end": 1140.0, "text": " respect to that parameter they say where r is a scalar loss function of the"}, {"start": 1140.0, "end": 1146.8, "text": " output of a feed forward neural network parameterized by theta okay so many of"}, {"start": 1146.8, "end": 1151.28, "text": " these pruning algorithms can be formulated in this framework right here and"}, {"start": 1151.28, "end": 1156.56, "text": " there their algorithm can also be formulated in this framework so you can see"}, {"start": 1156.56, "end": 1162.56, "text": " the score that the algorithm assigns to a weight can be defined as such and as"}, {"start": 1162.56, "end": 1169.32, "text": " I said many fall into this category or are similar to this especially for"}, {"start": 1169.32, "end": 1177.44, "text": " example they say when r is the training loss l so this is the simplest case you"}, {"start": 1177.44, "end": 1182.28, "text": " take you put data through the network and then you take the training loss of"}, {"start": 1182.28, "end": 1186.72, "text": " that data and you sort of back propagate it and now you're going to prune these"}, {"start": 1186.72, "end": 1190.32, "text": " connections according to how big the gradient is if you say the gradient is very"}, {"start": 1190.32, "end": 1197.0, "text": " big that must mean the connection is very important because there's lots of"}, {"start": 1197.0, "end": 1200.8799999999999, "text": " information flowing through it so if it's the training loss l the resulting"}, {"start": 1200.8799999999999, "end": 1205.4399999999998, "text": " synaptic saliency metric is equivalent to the score metric used in"}, {"start": 1205.4399999999998, "end": 1210.72, "text": " scalarization one of the first network pruning algorithms the resulting"}, {"start": 1210.72, "end": 1216.84, "text": " metric metric is also closely related to this right here that this you can see"}, {"start": 1216.84, "end": 1221.36, "text": " it's not exactly the same but it's closely related to the one used in this"}, {"start": 1221.36, "end": 1227.12, "text": " snip baseline and also closely related to this thing right here used in"}, {"start": 1227.12, "end": 1233.8799999999999, "text": " grasp where it's not just the gradient it's actually the gradient multiplied by"}, {"start": 1233.8799999999999, "end": 1242.9599999999998, "text": " the hasten to account for curvature okay so they're going to investigate this"}, {"start": 1242.96, "end": 1248.8, "text": " synaptic saliency in neural networks they formulate two theorems right here"}, {"start": 1248.8, "end": 1253.56, "text": " about the conservation of synaptic saliency remember synaptic saliency is any"}, {"start": 1253.56, "end": 1262.52, "text": " score that respects this that is built like this any score s the conservation of"}, {"start": 1262.52, "end": 1266.64, "text": " synaptic saliency all synaptic saliency metrics respect to surprising"}, {"start": 1266.64, "end": 1271.68, "text": " conservation laws that hold at any initialization and step in training so these"}, {"start": 1271.68, "end": 1275.8400000000001, "text": " are not either like in distribution or something like this with high"}, {"start": 1275.8400000000001, "end": 1282.72, "text": " probability these things hold at any point in the neural network first is the"}, {"start": 1282.72, "end": 1287.28, "text": " neuron wise conservation of synaptic saliency for a feat forward neural"}, {"start": 1287.28, "end": 1291.48, "text": " network with homogeneous activation functions and a homogeneous activation"}, {"start": 1291.48, "end": 1296.3200000000002, "text": " function is an activation function that is can be expressed like this for"}, {"start": 1296.32, "end": 1302.48, "text": " example reloose fall into that category the sum of the synaptic saliency for"}, {"start": 1302.48, "end": 1308.1599999999999, "text": " the incoming parameters is to a hidden neuron is equal to the sum of the"}, {"start": 1308.1599999999999, "end": 1313.8, "text": " synaptic saliency for the outgoing parameters from the hidden neuron so what"}, {"start": 1313.8, "end": 1317.76, "text": " does it mean is actually pretty simple if you have a hidden neuron and you look"}, {"start": 1317.76, "end": 1323.84, "text": " at all the incoming weights and you look at their synaptic saliency which is"}, {"start": 1323.84, "end": 1328.56, "text": " this s score of each of these weights like what would the pruning algorithm"}, {"start": 1328.56, "end": 1334.84, "text": " assign to that and you look at the outgoing ones then the sum of all the"}, {"start": 1334.84, "end": 1340.52, "text": " incoming ones is going to be equal to the sum of all the outgoing ones so that's"}, {"start": 1340.52, "end": 1350.32, "text": " pretty interesting and they extend that to layer to the entire network so an"}, {"start": 1350.32, "end": 1355.24, "text": " extension of that network wise conservation of synaptic saliency the sum of"}, {"start": 1355.24, "end": 1359.4399999999998, "text": " the synaptic saliency across any set of parameters that exactly separates the"}, {"start": 1359.4399999999998, "end": 1362.8799999999999, "text": " input neurons from the output neurons of a feat forward neural network with"}, {"start": 1362.8799999999999, "end": 1368.4399999999998, "text": " homogeneous activation functions equals that so it basically says it remains"}, {"start": 1368.4399999999998, "end": 1372.84, "text": " equal so what does it mean what does it mean to exactly separate the input from"}, {"start": 1372.84, "end": 1376.76, "text": " the output that's basically the definition of a layer in a neural network so"}, {"start": 1376.76, "end": 1382.52, "text": " what they're saying is that you have a bunch of layers and if you look at a"}, {"start": 1382.52, "end": 1387.84, "text": " particular layer like this one here and you look at the incoming connections and"}, {"start": 1387.84, "end": 1395.16, "text": " you sum up all of their synaptic saliency that's going to be equal to the sum of"}, {"start": 1395.16, "end": 1401.16, "text": " all the synaptic saliency of the outgoing connections of that layer and you can"}, {"start": 1401.16, "end": 1405.32, "text": " also apply to like a group of layers and so on but the synaptic saliency is"}, {"start": 1405.32, "end": 1411.0, "text": " conserved in that way now why is that important and here is where we make the"}, {"start": 1411.0, "end": 1419.72, "text": " connection with the layer was it later drop layer whatever okay the fact that"}, {"start": 1419.72, "end": 1425.0, "text": " the fact that these algorithms tend to drop entire layers before they have to"}, {"start": 1425.0, "end": 1431.9199999999998, "text": " if you have in your network layers that are of different sizes so you have large"}, {"start": 1431.92, "end": 1438.0, "text": " layers and then smaller layers and smaller layers what will happen is that since"}, {"start": 1438.0, "end": 1443.3200000000002, "text": " the synaptic saliency is conserved the sum is conserved if you have more"}, {"start": 1443.3200000000002, "end": 1448.3200000000002, "text": " connections in one layer so lots of connections lots of connections and in the"}, {"start": 1448.3200000000002, "end": 1453.3600000000001, "text": " small layers you don't have as many connections the sum is equal so that means"}, {"start": 1453.3600000000001, "end": 1458.64, "text": " each individual one here is much much smaller so the S is very small for each"}, {"start": 1458.64, "end": 1464.16, "text": " individual one here and the S is very large in there that means the pruning"}, {"start": 1464.16, "end": 1470.72, "text": " algorithm is going to really really kill off this these connections in the big"}, {"start": 1470.72, "end": 1475.8000000000002, "text": " layers right and it's actually going to kill them off to a point where it"}, {"start": 1475.8000000000002, "end": 1481.68, "text": " probably is going to eliminate that layer before it even prunes many of the"}, {"start": 1481.68, "end": 1488.0400000000002, "text": " connections of the small layer just because of that conservation fact and they"}, {"start": 1488.04, "end": 1499.48, "text": " do experiments like this I think there's an experiment up here where I like this"}, {"start": 1499.48, "end": 1507.2, "text": " one down here better where they basically show that you have inverse layer"}, {"start": 1507.2, "end": 1512.76, "text": " size on the bottom and you have the average score that the pruning algorithm"}, {"start": 1512.76, "end": 1521.8, "text": " assigns to any connection now these as we've seen they're not exactly"}, {"start": 1521.8, "end": 1526.44, "text": " assigning the scores of this saliency but they're very close to it the sin"}, {"start": 1526.44, "end": 1532.68, "text": " flow algorithm does exactly assign the synaptic saliency as the score for the"}, {"start": 1532.68, "end": 1537.8799999999999, "text": " pruning now we've basically seen that this leads to a bad result but the"}, {"start": 1537.8799999999999, "end": 1542.08, "text": " synaptic flow is going to compensate for that but in essence as you can see as"}, {"start": 1542.08, "end": 1549.3999999999999, "text": " the layers get so inverse layer size grows which means that layer size shrinks as"}, {"start": 1549.3999999999999, "end": 1555.3999999999999, "text": " the layer size gets smaller the average score of the connections in the"}, {"start": 1555.3999999999999, "end": 1560.24, "text": " layer is higher and higher which basically means that the pruning algorithm if"}, {"start": 1560.24, "end": 1565.08, "text": " you just let it go by itself it's going to kill off the smaller as already the"}, {"start": 1565.08, "end": 1569.4399999999998, "text": " larger layers first because they have the smaller scores and you can see that"}, {"start": 1569.44, "end": 1575.04, "text": " even though the other algorithms don't conform exactly to that they conform to"}, {"start": 1575.04, "end": 1580.92, "text": " this approximately so these here because their score is closely related to what"}, {"start": 1580.92, "end": 1590.56, "text": " the sin flow does and the magnitude pruning because mostly because now I'm not"}, {"start": 1590.56, "end": 1593.68, "text": " sure if that's at the end of the training at the beginning of the training if"}, {"start": 1593.68, "end": 1601.0800000000002, "text": " you just initialize then the score is going to be proportional to it's going to be"}, {"start": 1601.0800000000002, "end": 1604.1200000000001, "text": " proportional to their magnitude and their magnitude is determined by the"}, {"start": 1604.1200000000001, "end": 1609.92, "text": " initialization scheme and the initialization scheme is most of the time like"}, {"start": 1609.92, "end": 1615.24, "text": " modern initialization schemes compensate for the fact that you have different"}, {"start": 1615.24, "end": 1618.88, "text": " number of incoming and outgoing connections and therefore they would"}, {"start": 1618.88, "end": 1626.5600000000002, "text": " automatically assign higher number sorry a higher initialization constant to"}, {"start": 1626.5600000000002, "end": 1631.6000000000001, "text": " layers that have the lower number of parameters so even the magnitude pruning"}, {"start": 1631.6000000000001, "end": 1637.64, "text": " will conform to this now it might be absolutely reasonable to say that that's"}, {"start": 1637.64, "end": 1641.68, "text": " also at the case at the end of training because most parameters aren't going to"}, {"start": 1641.68, "end": 1647.7600000000002, "text": " move super much during training so this still approximately holds as you can"}, {"start": 1647.76, "end": 1653.96, "text": " see here of course the random one doesn't doesn't do that yet because you prune"}, {"start": 1653.96, "end": 1658.64, "text": " randomly you're still absolutely subject to this layer collapse in fact in the"}, {"start": 1658.64, "end": 1663.6, "text": " random one the smallest layers would be the ones to go away first because that"}, {"start": 1663.6, "end": 1672.76, "text": " it's just more probable okay so we've discovered that if you do something like"}, {"start": 1672.76, "end": 1678.72, "text": " saliency scoring or something that's correlated to it then you're going to"}, {"start": 1678.72, "end": 1685.68, "text": " remove the biggest layers first and that's a problem and that's what they say"}, {"start": 1685.68, "end": 1691.96, "text": " this count this fact of this conservation laws and the single-shot nature of"}, {"start": 1691.96, "end": 1696.36, "text": " these algorithms that they only assign scores once and then they prune away"}, {"start": 1696.36, "end": 1703.1599999999999, "text": " whatever the bottom such and such percent or leads to layer collapse right that's"}, {"start": 1703.1599999999999, "end": 1707.6, "text": " I think we've established this now that the combination of the two things leads"}, {"start": 1707.6, "end": 1713.76, "text": " to layer collapse now they make a little bit of an excursion and they say there"}, {"start": 1713.76, "end": 1720.1599999999999, "text": " is actually something that doesn't run into layer collapse and that's iterative"}, {"start": 1720.1599999999999, "end": 1725.6799999999998, "text": " pruning algorithms so specifically they look at magnitude pruning they say"}, {"start": 1725.68, "end": 1733.16, "text": " magnitude pruning which remember is also if you do it single-shot it also runs"}, {"start": 1733.16, "end": 1737.8400000000001, "text": " into layer collapse magnitude pruning avoids layer collapse with conservation"}, {"start": 1737.8400000000001, "end": 1745.16, "text": " and iteration so because it iterates it avoids that and that's what these"}, {"start": 1745.16, "end": 1750.16, "text": " lottery ticket hypothesis paper does it does it iteratively removes a couple of"}, {"start": 1750.16, "end": 1754.8400000000001, "text": " connections then it retains the network basically recomputes the"}, {"start": 1754.84, "end": 1759.28, "text": " magnitudes and therefore recomputes the scores and then it prunes again and"}, {"start": 1759.28, "end": 1764.84, "text": " then it recomputes and and prunes again and by recomputing you can basically"}, {"start": 1764.84, "end": 1769.84, "text": " these some of the connections that weren't important before but just survive"}, {"start": 1769.84, "end": 1775.04, "text": " the pruning they can now be like wait I have now way more responsibility as a"}, {"start": 1775.04, "end": 1782.1999999999998, "text": " connection and they will shoot up an importance to avoid being pruned so you"}, {"start": 1782.2, "end": 1790.4, "text": " can see if you push your network to a sorry to a high compression ratio then if"}, {"start": 1790.4, "end": 1794.68, "text": " you just do this single-shot pruning you run into this layer collapse at some"}, {"start": 1794.68, "end": 1800.52, "text": " compression ratio you simply crash to random performance or zero"}, {"start": 1800.52, "end": 1806.88, "text": " performance yet if you do multiple iterations you can see here already two"}, {"start": 1806.88, "end": 1813.1200000000001, "text": " iterations then it's much longer before you run right here into layer collapse"}, {"start": 1813.1200000000001, "end": 1818.7600000000002, "text": " and if you do three iterations you do much more now this the three iterations"}, {"start": 1818.7600000000002, "end": 1824.3200000000002, "text": " doesn't mean you prune more like at this at this point right here to 10 to the"}, {"start": 1824.3200000000002, "end": 1830.64, "text": " one all of these things prune nine out of every 10 connections it's just the"}, {"start": 1830.64, "end": 1836.68, "text": " thing that has three iterations prunes maybe first three and then again three"}, {"start": 1836.68, "end": 1841.92, "text": " and then again three out of the 10 whereas the one iteration would prune all of"}, {"start": 1841.92, "end": 1852.2, "text": " the nine at in one go okay and they give a reason for this they give they say"}, {"start": 1852.2, "end": 1860.44, "text": " that it's the fact that gradient descent encourages conservation so they"}, {"start": 1860.44, "end": 1863.96, "text": " give a little toy example here they say to better understand the dynamics of the"}, {"start": 1863.96, "end": 1874.04, "text": " IMP algorithm during training we will consider the a differentiable score this"}, {"start": 1874.04, "end": 1879.16, "text": " one so this is not exactly magnitude pruning but it is very close right the"}, {"start": 1879.16, "end": 1883.8400000000001, "text": " squared it's just the square of the parameter instead of the absolute value of"}, {"start": 1883.8400000000001, "end": 1888.3600000000001, "text": " the parameter you say it's algorithmically equivalent to magnitude score"}, {"start": 1888.36, "end": 1892.04, "text": " consider these scores throughout training with gradient descent on a loss"}, {"start": 1892.04, "end": 1897.4399999999998, "text": " function using an infinitesimal step in this setting the temporal derivative of"}, {"start": 1897.4399999999998, "end": 1901.12, "text": " the parameters is equivalent to that and thus the temporal derivative of the"}, {"start": 1901.12, "end": 1907.04, "text": " score is this so now they're going to look at how does the score evolve when"}, {"start": 1907.04, "end": 1914.4399999999998, "text": " they train the network and the score evolves exactly as the negative to the"}, {"start": 1914.44, "end": 1921.64, "text": " saliency surprisingly this is a form of synaptic saliency and thus the neuron"}, {"start": 1921.64, "end": 1927.2, "text": " wise and layer wise conservation laws from section four apply in particular"}, {"start": 1927.2, "end": 1932.24, "text": " this implies that for any two layers of a simple fully connected network then"}, {"start": 1932.24, "end": 1938.3600000000001, "text": " this quantity holds so that this is not new but what it basically says is that"}, {"start": 1938.36, "end": 1945.6799999999998, "text": " through training these connections equalize the saliency again so if you have a"}, {"start": 1945.6799999999998, "end": 1954.12, "text": " very big layer and here a very very small layer and because it's a big layer"}, {"start": 1954.12, "end": 1959.3999999999999, "text": " these scores are very much lower right it's just little S and here it's big S"}, {"start": 1959.3999999999999, "end": 1966.24, "text": " per layer but then if you prune away and you run gradient descent on this these"}, {"start": 1966.24, "end": 1971.64, "text": " scores will tend to become bigger and in this case these weights will tend to"}, {"start": 1971.64, "end": 1976.68, "text": " grow in magnitude because if prune the way the others they now have more"}, {"start": 1976.68, "end": 1981.76, "text": " signal probably flowing to them and more gradient flowing to them and"}, {"start": 1981.76, "end": 1986.32, "text": " therefore they're going to grow in size and therefore their score is going to be"}, {"start": 1986.32, "end": 1994.8, "text": " bigger so this gradient descent of this iterative procedure makes makes the"}, {"start": 1994.8, "end": 2006.44, "text": " scores better for that so basically counteracts the layer collapse so they put"}, {"start": 2006.44, "end": 2012.9199999999998, "text": " all of this together and say theorem three iterative positive conservative"}, {"start": 2012.9199999999998, "end": 2018.3999999999999, "text": " conservative scoring achieves maximal critical compression if a pruning"}, {"start": 2018.4, "end": 2025.96, "text": " algorithm with global masking and global masking means that you rank all of the"}, {"start": 2025.96, "end": 2030.3600000000001, "text": " connections and then prune from all of the connections it's a difference to"}, {"start": 2030.3600000000001, "end": 2035.16, "text": " layer wise masking where you say I want to remove 90% of each layer which"}, {"start": 2035.16, "end": 2040.24, "text": " sounds like it would avoid layer collapse but also it works a lot worse than"}, {"start": 2040.24, "end": 2045.2800000000002, "text": " the global one the global strategy assigns positive scores that respect layer"}, {"start": 2045.28, "end": 2051.68, "text": " wise conservation and if the algorithm so respecting layer wise conservation"}, {"start": 2051.68, "end": 2059.0, "text": " it basically means you your score should be or if your score is a saliency score"}, {"start": 2059.0, "end": 2064.92, "text": " then that's the case and if the algorithm re-evaluates the scores every time a"}, {"start": 2064.92, "end": 2069.92, "text": " parameter is pruned then the algorithm satisfies the maximal critical"}, {"start": 2069.92, "end": 2076.8, "text": " compression axiom okay so that's basically saying that if you have any"}, {"start": 2076.8, "end": 2083.6, "text": " algorithm that prunes with a saliency score like theirs is going to do and is"}, {"start": 2083.6, "end": 2090.08, "text": " going to to be able to be pushed to the limit until the maximal capacity is"}, {"start": 2090.08, "end": 2098.28, "text": " reached if you re-evaluate the scores every time a parameter is pruned so"}, {"start": 2098.28, "end": 2102.76, "text": " this is basically saying that whatever the lottery ticket hypothesis paper"}, {"start": 2102.76, "end": 2109.6000000000004, "text": " did with magnitude pruning if you do it with saliency based pruning you'll"}, {"start": 2109.6000000000004, "end": 2117.8, "text": " guaranteed to achieve the maximum possible compression if you if you push it"}, {"start": 2117.8, "end": 2124.88, "text": " but of course we know that whatever the lottery ticket hypothesis paper did"}, {"start": 2124.88, "end": 2130.08, "text": " is impractical because it needs to retrain the network every single time it"}, {"start": 2130.08, "end": 2133.52, "text": " wants to prune right so if you want to do this after every parameter that's"}, {"start": 2133.52, "end": 2138.32, "text": " going to be a long time it's going to be impractical we ideally want to prune"}, {"start": 2138.32, "end": 2144.36, "text": " the network before we even look at any data and they're going to do exactly"}, {"start": 2144.36, "end": 2151.48, "text": " that with the sin flow algorithm they say theorem 3 directly motivates the"}, {"start": 2151.48, "end": 2155.36, "text": " design of our novel pruning algorithm sin flow that provably reaches"}, {"start": 2155.36, "end": 2162.72, "text": " maximal critical oh no okay this was bad maximal critical compression first"}, {"start": 2162.72, "end": 2167.68, "text": " the necessity for iterative sorry first the necessity for iterative score"}, {"start": 2167.68, "end": 2171.52, "text": " evaluation discourages algorithms that involve backpropagation on batches of"}, {"start": 2171.52, "end": 2175.52, "text": " data and the step motivates the development of an efficient data independent"}, {"start": 2175.52, "end": 2180.76, "text": " scoring procedure second positivity and conservation motive motive"}, {"start": 2180.76, "end": 2186.28, "text": " probably motivates the construction of a loss function that yields positive"}, {"start": 2186.28, "end": 2191.48, "text": " synaptic saliency scores we combine these insights and introduce a new loss"}, {"start": 2191.48, "end": 2197.28, "text": " function where the one is the all one vectors okay so this is the loss"}, {"start": 2197.28, "end": 2203.5600000000004, "text": " function of their saliency scores and this might seem like so what what we"}, {"start": 2203.5600000000004, "end": 2208.88, "text": " have we have the parameters of layer L the absolute product as already absolute"}, {"start": 2208.88, "end": 2213.92, "text": " value of those parameters and then you simply multiply all of the layers"}, {"start": 2213.92, "end": 2219.44, "text": " together and you have this product here with the ones on the side so this is a"}, {"start": 2219.44, "end": 2228.92, "text": " quadratic form sort of okay this might seem a bit weird but but in practice and"}, {"start": 2228.92, "end": 2234.08, "text": " this is also what happens in their code you do you can do something pretty easy"}, {"start": 2234.08, "end": 2240.12, "text": " so first you have to transform all your weights to their absolute values now in"}, {"start": 2240.12, "end": 2244.88, "text": " their code you can look at it they they do remember the signs for later so but"}, {"start": 2244.88, "end": 2249.72, "text": " first you convert all of them to their absolute values then second you simply"}, {"start": 2249.72, "end": 2256.92, "text": " take a data point that is filled with ones that literally the number one so if"}, {"start": 2256.92, "end": 2263.36, "text": " you're if your input is an image you just put a one at each pixel you feed it"}, {"start": 2263.36, "end": 2268.6400000000003, "text": " through the network with all of these positive weights and you get out some"}, {"start": 2268.6400000000003, "end": 2274.1600000000003, "text": " output you get some output vector okay then you simply you you need to do this"}, {"start": 2274.1600000000003, "end": 2278.92, "text": " inner product with the one vector which is simply a sum right I don't I don't"}, {"start": 2278.92, "end": 2283.04, "text": " get why they it's a bit of a funky way of writing a sum right you simply"}, {"start": 2283.04, "end": 2290.1200000000003, "text": " sum that up to get a to get a single number and this single number now is your"}, {"start": 2290.12, "end": 2295.72, "text": " is your pseudo loss function it's simply the loss function that an all one"}, {"start": 2295.72, "end": 2302.6, "text": " data points gets when the when the loss function is just the sum of the outputs"}, {"start": 2302.6, "end": 2309.24, "text": " that's that's the that's it and then you back propagate that loss to you back"}, {"start": 2309.24, "end": 2314.72, "text": " propagate that loss to the layers right so this is our remember this is not the"}, {"start": 2314.72, "end": 2320.2799999999997, "text": " score itself but our score is going to be the derivative of r with respect to a"}, {"start": 2320.2799999999997, "end": 2328.56, "text": " weight times that weight okay so you want to back propagate and then you multiply"}, {"start": 2328.56, "end": 2335.9199999999996, "text": " each of these weights by the back propagates it signal and that's going to be"}, {"start": 2335.9199999999996, "end": 2341.0, "text": " your score for each parameter now this doesn't seem too hard right you so you"}, {"start": 2341.0, "end": 2345.36, "text": " just need you don't need a batch you need a single data point one back"}, {"start": 2345.36, "end": 2350.96, "text": " propagation and then you get your scores okay you don't need expensive"}, {"start": 2350.96, "end": 2357.32, "text": " training or anything like this this seems pretty cool and they give an"}, {"start": 2357.32, "end": 2366.28, "text": " example here for example for a simple come on for a simple fully connected"}, {"start": 2366.28, "end": 2373.6800000000003, "text": " network i.e. this so they consider here a linear network right just so we can"}, {"start": 2373.6800000000003, "end": 2376.7200000000003, "text": " look at exactly what happens for linear networks you can often compute"}, {"start": 2376.7200000000003, "end": 2381.0, "text": " quantities exactly so if we look at just a linear network without non-linearity"}, {"start": 2381.0, "end": 2386.48, "text": " we can factor the synaptic flow score for for any parameter as such so the"}, {"start": 2386.48, "end": 2392.32, "text": " score this is now not the the or this is going to be the score is going to be"}, {"start": 2392.32, "end": 2397.52, "text": " this thing right here so you can see that the parameter is multiplied by this"}, {"start": 2397.52, "end": 2403.7200000000003, "text": " thing and by this thing and other than for example magnitude pruning this"}, {"start": 2403.7200000000003, "end": 2409.36, "text": " actually takes into account all the input flow because it goes from this one"}, {"start": 2409.36, "end": 2415.2000000000003, "text": " sorry it goes from this goes from this one it goes through all the network"}, {"start": 2415.2000000000003, "end": 2419.56, "text": " right every path that arrives at this particular weight is going to be"}, {"start": 2419.56, "end": 2424.32, "text": " considered and every path that goes out from this particular weight is going to"}, {"start": 2424.32, "end": 2430.48, "text": " be considered and the saliency scores going to depend on all of these paths"}, {"start": 2430.48, "end": 2436.24, "text": " all of these all of the information flow from input to output that goes through"}, {"start": 2436.24, "end": 2444.32, "text": " that weight and if you do this then you get a really good pruning algorithm so"}, {"start": 2444.32, "end": 2450.0800000000004, "text": " yeah the algorithm is I've already described it and in their experiments as"}, {"start": 2450.0800000000004, "end": 2455.7200000000003, "text": " you can see right now they have a bunch of networks these VGG networks or"}, {"start": 2455.7200000000003, "end": 2460.4, "text": " like wide resonant they have a bunch of datasets like tiny image net or C410"}, {"start": 2460.4, "end": 2465.2400000000002, "text": " where they experiment with these different baselines and you can see that the"}, {"start": 2465.2400000000002, "end": 2471.7200000000003, "text": " baselines often run into this layer collapse problem sorry often run into this"}, {"start": 2471.72, "end": 2476.48, "text": " where all of a sudden let's actually look at let's look at this resonant 18"}, {"start": 2476.48, "end": 2482.16, "text": " right here maybe you can find a connection between maybe there's"}, {"start": 2482.16, "end": 2486.2799999999997, "text": " differently sized layers in resonant 18 and that's why the collapse happens even"}, {"start": 2486.2799999999997, "end": 2490.04, "text": " earlier but you can see right here there's a collapse if you do magnitude pruning"}, {"start": 2490.04, "end": 2494.68, "text": " even also if you do random pruning it falls down pretty hard after a while the"}, {"start": 2494.68, "end": 2499.52, "text": " baselines they hold up better but you can see in different models and different"}, {"start": 2499.52, "end": 2504.68, "text": " datasets that the baselines crash at some point as well now I've already said"}, {"start": 2504.68, "end": 2512.4, "text": " the comparison here it seems a little bit unfair I might I might have overread"}, {"start": 2512.4, "end": 2518.08, "text": " something but I'm pretty sure that the baselines remain single shot while the"}, {"start": 2518.08, "end": 2523.04, "text": " sin flow algorithm here is now of course no longer single shot it's actually"}, {"start": 2523.04, "end": 2528.48, "text": " multi shot and they've made the exact argument that the single shot is the"}, {"start": 2528.48, "end": 2536.2400000000002, "text": " problem and therefore their algorithm is multi-shot and it it seems like they"}, {"start": 2536.2400000000002, "end": 2541.88, "text": " should give the other algorithms the opportunity to also do multi-shot just to"}, {"start": 2541.88, "end": 2548.72, "text": " compare them fairly maybe as I said maybe they're doing that but I'm I haven't"}, {"start": 2548.72, "end": 2554.52, "text": " read anything so it you know it just seems like the comparison is a bit"}, {"start": 2554.52, "end": 2560.4, "text": " unfair if you identify the problem and then just leave the other algorithms"}, {"start": 2560.4, "end": 2565.08, "text": " with the problem sin flow is still different from these other algorithms even"}, {"start": 2565.08, "end": 2571.2, "text": " if they had the multiple steps now the counter argument to this of course is"}, {"start": 2571.2, "end": 2575.92, "text": " that these other algorithms all require the training data they require actually"}, {"start": 2575.92, "end": 2580.16, "text": " passing the data or training the network in the case of magnitude pruning and"}, {"start": 2580.16, "end": 2584.48, "text": " so on so that's pretty expensive whereas sin flow you simply pass forward one"}, {"start": 2584.48, "end": 2590.44, "text": " data point and that's it that's a good argument but it seems like the the"}, {"start": 2590.44, "end": 2597.64, "text": " effect of the synaptic saliency scores and the effect of the multiple steps"}, {"start": 2597.64, "end": 2603.52, "text": " aren't really disentangled in these experiments right here it simply shows"}, {"start": 2603.52, "end": 2609.3999999999996, "text": " that it consistently outperforms other pruning methods and what I'd like to"}, {"start": 2609.4, "end": 2617.2400000000002, "text": " see is really where that outperforming comes from okay so that's what I think of"}, {"start": 2617.2400000000002, "end": 2623.88, "text": " this and that was the paper basically I'm even even if I am not convinced quite"}, {"start": 2623.88, "end": 2631.12, "text": " yet this is pretty cool right and I think this will if not be if it's not used"}, {"start": 2631.12, "end": 2637.7200000000003, "text": " itself it will inspire kind of a a line of work into pruning at the beginning of"}, {"start": 2637.72, "end": 2643.12, "text": " training without looking at data and maybe you know maybe we can even think of"}, {"start": 2643.12, "end": 2650.0, "text": " building networks like instead of just pruning them we can think of"}, {"start": 2650.0, "end": 2655.9599999999996, "text": " constructively building networks that observe these properties and therefore"}, {"start": 2655.9599999999996, "end": 2662.3599999999997, "text": " we can just construct initialize networks already with good properties such"}, {"start": 2662.3599999999997, "end": 2666.08, "text": " that we don't even have to go to a bigger network and then prune it down it"}, {"start": 2666.08, "end": 2670.56, "text": " seems wasteful it seems like we should just be able to derive principles of"}, {"start": 2670.56, "end": 2674.88, "text": " what we want in the how the weights are structured and then construct networks"}, {"start": 2674.88, "end": 2680.6, "text": " that are according to that and I guess that's what's going to happen in a few"}, {"start": 2680.6, "end": 2685.64, "text": " papers that are coming all right again if you like this video consider subscribing"}, {"start": 2685.64, "end": 2691.52, "text": " giving it a like commenting and let me know what you think and until next time"}, {"start": 2691.52, "end": 2698.52, "text": " bye bye"}] |
Yannic Kilcher | 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 WizKids 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, this 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 systems stability learning advanced computations from examples by François Charton, Amourie Hayat, and Jean Lampel of Facebook AI research and Ecol de Pomp-Parritek 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. 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 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 gradient, if you will, or the code in 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 of 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 ask it to output the solution, it can do it. So it basically can learn to do all of these things. So that's 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 I don't really want to go 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 XE is an if XE is an equilibrium point, it means that all solutions, if all solutions converge to XE when their initial positions are close enough, the equilibrium point is said to be locally stable. This problem is well known if F is differentiable in XE 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 is a, if the system is gravity, sort of, so if these differential equations to sort of describe that the height here is the force 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 this 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 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. So if you derive 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 sign here is the cosine and knowing that this cosine doesn't matter for this particular entry because it's in x2 and here we derive by x1. 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, 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 are numerous ways, but none of these is 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 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're 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 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 the 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, log 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 sin 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 seek to seek models, not even sure what kind of models they use. I think they just they use transformers as well. So they they use standard transformers. I believe so yes. In all experiments, we use the transformer architecture with eight attention heads. We turn 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 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 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 test sample or almost never happens that a test sample is in the training data set. All right. So they generate these things and here are the results. So for local stability, they this 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 a 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 if it's two equations. So if the degree of the system is two, it achieved 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 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, these, this number here is pretty good. Compared to the 50% you'd have for, you'd, from pair 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 fairly well. So they argue here that this shows that it doesn't predict 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 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 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 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 research about it. In three of them, we predict qualitative and theoretical features into 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 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 bias 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 composed so the number 142, they would put as now there's an integer and then the token won the token for and the token too. Okay. And the decimal point representation is the sequence float 3 dot 1 for e in negative 1. 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 abstract it 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 in 64 dimensions obtains a high accuracy and such a small model would never be able to memorize that many examples, which is true, right? This is a fair defense against you're just interpolating training data, but I think the kind of 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 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 it 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.e., 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. And then what we would interpolate is sort of these things. 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. And it's not able to remember the training data, but it will be able to sort of abstract it and then 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 theorem's complex computation without built-in mathematical knowledge. All of the story here, all of this showing of, hey, look at 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 learned 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 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 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 agree with this statement right here. 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 matched patterns. And therefore you can arrive at approximately good solutions. 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 stability, then there is 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 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 the model and you evaluated it, it is really good at this task for which you thought you need to do these four steps. So what would be really interesting is to now introspect your model and see, 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 I, 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 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 would be more of an evidence that the model is simply sort of pattern matching close enough seen examples in the training data, right? So that's a bit of my criticism right here is that they show it works, which is pretty cool, but then they don't do the sort of interesting experiments of this introspection right here, which is a bit sad, but they leave it for future research, which I guess is going to be themselves, and that's how you make two papers. So now 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. | [{"start": 0.0, "end": 4.64, "text": " Hi, here's a question for the WizKids among you."}, {"start": 4.64, "end": 11.16, "text": " Is this system here controllable at a point xe with asymptotic control ue?"}, {"start": 11.16, "end": 13.84, "text": " I'll give you 10 seconds."}, {"start": 13.84, "end": 15.32, "text": " Okay, 10 seconds are over."}, {"start": 15.32, "end": 18.04, "text": " So to solve this, it's actually pretty easy."}, {"start": 18.04, "end": 22.28, "text": " All you need to do is first differentiate the system with respect to its internal variables,"}, {"start": 22.28, "end": 25.28, "text": " which are the x's, to obtain the Jacobian a."}, {"start": 25.28, "end": 31.080000000000002, "text": " Second step, differentiate the system with respect to its control variables, which are the u variables,"}, {"start": 31.080000000000002, "end": 33.36, "text": " to obtain the matrix B. Look, this is a zero."}, {"start": 33.36, "end": 35.6, "text": " Like, this is not hard."}, {"start": 35.6, "end": 39.96, "text": " Then evaluate a and b at the point that you want, and the control point that you want"}, {"start": 39.96, "end": 42.120000000000005, "text": " pretty easy."}, {"start": 42.120000000000005, "end": 44.16, "text": " Calculate the controllability matrix."}, {"start": 44.16, "end": 46.0, "text": " Come on, that's nothing."}, {"start": 46.0, "end": 48.08, "text": " Another zero."}, {"start": 48.08, "end": 52.16, "text": " And at the end, you calculate the rank of the controllability matrix."}, {"start": 52.16, "end": 57.959999999999994, "text": " Now if the if n minus d is zero, this system is controllable."}, {"start": 57.959999999999994, "end": 63.4, "text": " And optionally, if you want, if you feel like it, you can output the control feedback matrix"}, {"start": 63.4, "end": 65.92, "text": " as an equation three, which gives you this here."}, {"start": 65.92, "end": 68.36, "text": " Now what's equation three?"}, {"start": 68.36, "end": 73.12, "text": " Equation three is super duper simple."}, {"start": 73.12, "end": 81.12, "text": " It's just this little sort of integral thing inverse matrix trace transposed exponential"}, {"start": 81.12, "end": 84.96000000000001, "text": " function outer product thing."}, {"start": 84.96000000000001, "end": 86.28, "text": " Come on."}, {"start": 86.28, "end": 88.32000000000001, "text": " What's the matter with you?"}, {"start": 88.32000000000001, "end": 89.32000000000001, "text": " Okay."}, {"start": 89.32000000000001, "end": 95.52000000000001, "text": " So if you found you can't do this just on the spot, then you are in the same category as"}, {"start": 95.52000000000001, "end": 97.4, "text": " most people."}, {"start": 97.4, "end": 104.16, "text": " But interestingly, apparently according to this paper, a deep learning system can."}, {"start": 104.16, "end": 109.56, "text": " So today we're going to look at deep differential systems stability learning advanced computations"}, {"start": 109.56, "end": 117.16, "text": " from examples by Fran\u00e7ois Charton, Amourie Hayat, and Jean Lampel of Facebook AI research"}, {"start": 117.16, "end": 122.88, "text": " and Ecol de Pomp-Parritek and Rutgers University."}, {"start": 122.88, "end": 129.52, "text": " So at this in this paper, these authors basically propose that you can learn these complex"}, {"start": 129.52, "end": 133.88, "text": " mathematics with a model that has no clue about mathematics."}, {"start": 133.88, "end": 141.44, "text": " In fact, it is a language model and it can output the solutions, for example, whether or"}, {"start": 141.44, "end": 146.56, "text": " not a system is controllable, which are sort of binary solutions, but it can also output"}, {"start": 146.56, "end": 154.64, "text": " actual solutions as in numbers or as in the matrices that you would need to obtain from"}, {"start": 154.64, "end": 155.96, "text": " these problems."}, {"start": 155.96, "end": 158.35999999999999, "text": " So that's pretty cool."}, {"start": 158.36, "end": 165.68, "text": " It is built upon this other paper called, I think, some deep learning for symbolic mathematics"}, {"start": 165.68, "end": 166.68, "text": " or something."}, {"start": 166.68, "end": 173.64000000000001, "text": " I have made a video on it if you search for it and I'll also link it in the description."}, {"start": 173.64000000000001, "end": 176.76000000000002, "text": " And you can go check that out because that's sort of the basis."}, {"start": 176.76000000000002, "end": 181.92000000000002, "text": " So in this previous paper, I think it was from partially the same authors."}, {"start": 181.92000000000002, "end": 186.60000000000002, "text": " They have investigated language models into integrating functions."}, {"start": 186.6, "end": 191.68, "text": " So you have some sort of function, you're trying to find the integral and they've tried"}, {"start": 191.68, "end": 192.68, "text": " to do that."}, {"start": 192.68, "end": 194.92, "text": " Now they go a lot further."}, {"start": 194.92, "end": 202.0, "text": " So they look at these differential systems, which are characterized by these differential"}, {"start": 202.0, "end": 203.16, "text": " equations."}, {"start": 203.16, "end": 209.76, "text": " So if you've never seen differential equations, it's basically an equation where the derivation"}, {"start": 209.76, "end": 215.64, "text": " of some variable is characterized by the variable itself."}, {"start": 215.64, "end": 222.72, "text": " So the gradient, if you will, or the code in the derivation according to some input variable"}, {"start": 222.72, "end": 229.6, "text": " here, it's most often it's time and physical systems is a function of that variable itself"}, {"start": 229.6, "end": 231.6, "text": " and partially also of other variables."}, {"start": 231.6, "end": 237.07999999999998, "text": " So you can have systems of differential equations that all depend on each other."}, {"start": 237.07999999999998, "end": 239.88, "text": " And there are a number of questions about these systems."}, {"start": 239.88, "end": 245.76, "text": " These are very relevant in like physics or engineering, control theory and so on."}, {"start": 245.76, "end": 251.68, "text": " So they investigate different problems that you can solve with these."}, {"start": 251.68, "end": 257.56, "text": " They investigate specifically problems where we already know the solutions, but the solutions"}, {"start": 257.56, "end": 265.84, "text": " require very complex mathematical manipulation, such as as you've seen, calculate the integral"}, {"start": 265.84, "end": 270.11999999999995, "text": " of something, take the trace, calculate the rank, invert some matrix."}, {"start": 270.11999999999995, "end": 274.56, "text": " So all of these mathematical steps are required to solve these problems if we were to teach"}, {"start": 274.56, "end": 278.47999999999996, "text": " them to math students or engineering students."}, {"start": 278.47999999999996, "end": 287.0, "text": " And this paper basically says if we just input the problem into a big language model and"}, {"start": 287.0, "end": 290.76, "text": " ask it to output the solution, it can do it."}, {"start": 290.76, "end": 293.47999999999996, "text": " So it basically can learn to do all of these things."}, {"start": 293.48, "end": 299.32, "text": " So that's pretty surprising because you don't program it to do any math."}, {"start": 299.32, "end": 304.6, "text": " So the first problem they look at is this local stability problem."}, {"start": 304.6, "end": 313.0, "text": " So I don't really want to go into much of the actual mathematical problems, but we'll"}, {"start": 313.0, "end": 317.92, "text": " look at the first one to just give you an idea of what these sort of problems are."}, {"start": 317.92, "end": 327.88, "text": " So XE is an if XE is an equilibrium point, it means that all solutions, if all solutions"}, {"start": 327.88, "end": 333.0, "text": " converge to XE when their initial positions are close enough, the equilibrium point is"}, {"start": 333.0, "end": 336.12, "text": " said to be locally stable."}, {"start": 336.12, "end": 341.84000000000003, "text": " This problem is well known if F is differentiable in XE and answers provided by the spectral"}, {"start": 341.84000000000003, "end": 344.04, "text": " mapping theorem."}, {"start": 344.04, "end": 352.48, "text": " So in that case, you'd have a system, maybe we can draw one where you try to find local"}, {"start": 352.48, "end": 354.12, "text": " points of stability."}, {"start": 354.12, "end": 360.04, "text": " So this point here would be maybe a local point of stability if you consider this as sort"}, {"start": 360.04, "end": 366.0, "text": " of an optimization landscape because if you go from here, if you go a little bit away"}, {"start": 366.0, "end": 370.16, "text": " from it, you're always sort of pushed back."}, {"start": 370.16, "end": 376.40000000000003, "text": " If this is a, if the system is gravity, sort of, so if these differential equations"}, {"start": 376.40000000000003, "end": 386.16, "text": " to sort of describe that the height here is the force with which you're pulled down,"}, {"start": 386.16, "end": 388.8, "text": " then this thing here would be a local point of stability."}, {"start": 388.8, "end": 394.08000000000004, "text": " The question is, if I give you a system that's described by these differential equations,"}, {"start": 394.08000000000004, "end": 399.16, "text": " can you tell me whether or not it is stable at some point?"}, {"start": 399.16, "end": 405.92, "text": " Okay, and there is a spectral mapping theorem which says if you have the Jacobian matrix"}, {"start": 405.92, "end": 411.48, "text": " of F at this point, the matrix of its partial derivatives relative to its variable, and if"}, {"start": 411.48, "end": 419.72, "text": " you take lambda to be the largest real part of its complex eigenvalues, if lambda is positive,"}, {"start": 419.72, "end": 423.32000000000005, "text": " then this is an unstable equilibrium."}, {"start": 423.32000000000005, "end": 426.36, "text": " If lambda is negative, then it's a locally stable equilibrium."}, {"start": 426.36, "end": 432.8, "text": " So an unstable equilibrium likewise would be the point here on top, which means that if"}, {"start": 432.8, "end": 439.0, "text": " you're exactly at the point, then you stay there, but as soon as you're a little bit off,"}, {"start": 439.0, "end": 440.88, "text": " you drift away from it."}, {"start": 440.88, "end": 443.64, "text": " That would be an unstable equilibrium."}, {"start": 443.64, "end": 449.52000000000004, "text": " Okay, so there are complex steps involved in deriving this solution, then they list"}, {"start": 449.52000000000004, "end": 452.44, "text": " them out here just to show you how complex this is."}, {"start": 452.44, "end": 458.36, "text": " This is not meant to teach you, you don't have to understand or be able to apply this."}, {"start": 458.36, "end": 463.2, "text": " This is simply meant to tell you how complicated it is to arrive at a solution."}, {"start": 463.2, "end": 468.04, "text": " So first, you need to differentiate each function with respect to each variable and obtain"}, {"start": 468.04, "end": 469.96, "text": " the formal Jacobian."}, {"start": 469.96, "end": 475.88, "text": " So they do this here for this example system, which is this system right here."}, {"start": 475.88, "end": 483.04, "text": " This is a system of two equations, two differential equations in two variables."}, {"start": 483.04, "end": 489.04, "text": " So if you derive the Jacobian, that will give you a four entry Jacobian."}, {"start": 489.04, "end": 494.64, "text": " So each one of these is one of the equations derived with respect to one of the variables."}, {"start": 494.64, "end": 495.84, "text": " You can do that, right?"}, {"start": 495.84, "end": 501.28, "text": " But it requires fairly complex mathematical knowledge, like knowing that the derivative"}, {"start": 501.28, "end": 508.08, "text": " of the sign here is the cosine and knowing that this cosine doesn't matter for this particular"}, {"start": 508.08, "end": 512.72, "text": " entry because it's in x2 and here we derive by x1."}, {"start": 512.72, "end": 516.6, "text": " So that's already very challenging."}, {"start": 516.6, "end": 521.64, "text": " Second, you need to evaluate the Jacobian at that point."}, {"start": 521.64, "end": 524.24, "text": " So first, you've done it symbolically."}, {"start": 524.24, "end": 528.36, "text": " Now you actually need to put in the numbers at the point you're interested in, which will"}, {"start": 528.36, "end": 534.52, "text": " give you this thing right here, which is a numerical matrix, whereas this was a symbolical"}, {"start": 534.52, "end": 535.8000000000001, "text": " matrix."}, {"start": 535.8000000000001, "end": 544.4, "text": " Then you need to calculate the eigenvalues, which is, you have several methods of that."}, {"start": 544.4, "end": 547.36, "text": " You have several methods of computing the largest eigenvalue."}, {"start": 547.36, "end": 549.24, "text": " You could do power method."}, {"start": 549.24, "end": 552.24, "text": " You could do decomposition."}, {"start": 552.24, "end": 558.32, "text": " There are numerous ways, but none of these is particularly easily, right?"}, {"start": 558.32, "end": 566.1600000000001, "text": " And then lastly, you need to return the minus max of the real part, which is the speed of"}, {"start": 566.1600000000001, "end": 567.44, "text": " convergence of the system."}, {"start": 567.44, "end": 574.88, "text": " So not only do you need to be able to tell whether it is stable, which is if this is negative,"}, {"start": 574.88, "end": 581.48, "text": " you also need to be able to say, or if this is negative, sorry, you need to be able to"}, {"start": 581.48, "end": 587.32, "text": " say whether it is locally stable or locally unstable."}, {"start": 587.32, "end": 592.96, "text": " And since this is larger than zero, it's locally stable."}, {"start": 592.96, "end": 597.32, "text": " And this would be the decay rate 0.441."}, {"start": 597.32, "end": 601.1600000000001, "text": " This is what you're asking this model to output, right?"}, {"start": 601.1600000000001, "end": 607.8000000000001, "text": " Now we'll quickly go over the other things, but not as as in depth, but this is in control"}, {"start": 607.8000000000001, "end": 610.9200000000001, "text": " theory where you're trying, you have almost the same thing."}, {"start": 610.9200000000001, "end": 615.4000000000001, "text": " You have a differential equation, but now in addition to these variables, you have these"}, {"start": 615.4, "end": 621.04, "text": " control variables, which you have power over and you're trying to decide, can I control"}, {"start": 621.04, "end": 624.9599999999999, "text": " the system with the appropriate function?"}, {"start": 624.9599999999999, "end": 628.64, "text": " And in order to do that, that's kind of the problem that we had at the beginning."}, {"start": 628.64, "end": 630.56, "text": " I know it's not."}, {"start": 630.56, "end": 633.0, "text": " Oh, yeah, it is."}, {"start": 633.0, "end": 638.24, "text": " So what you need to do is, again, differentiate the system with respect to its internal variables,"}, {"start": 638.24, "end": 643.8, "text": " differentiate the system with respect to its control variables, evaluate a and b, calculate"}, {"start": 643.8, "end": 651.88, "text": " the controllability matrix with one of the functions above, calculate the rank, and optionally"}, {"start": 651.88, "end": 656.76, "text": " evaluate this equation number three that we saw before."}, {"start": 656.76, "end": 660.8, "text": " Now the last task is equally complicated."}, {"start": 660.8, "end": 666.12, "text": " It relates to the stability of partial differential equations using the Fourier transform."}, {"start": 666.12, "end": 673.16, "text": " And again, to obtain this, it is a five step intricate process where that is a mix of"}, {"start": 673.16, "end": 680.8399999999999, "text": " symbolic complex manipulation and numerical evaluation of that symbolic things."}, {"start": 680.8399999999999, "end": 688.6, "text": " And here you need to simply output two bits, one bit says whether there exists a solution"}, {"start": 688.6, "end": 694.6, "text": " and the other bit says whether it vanishes at T to infinity."}, {"start": 694.6, "end": 697.12, "text": " So what are they expecting here?"}, {"start": 697.12, "end": 702.48, "text": " What they're doing is they're going to build a data set that is composed of these things"}, {"start": 702.48, "end": 704.5600000000001, "text": " and I think they do it one by one."}, {"start": 704.5600000000001, "end": 709.44, "text": " So they take one of the tasks and they're going to build a giant data set of these things."}, {"start": 709.44, "end": 715.9200000000001, "text": " Since they all have solutions, right, you can build a data set with labels because you can"}, {"start": 715.9200000000001, "end": 721.48, "text": " actually build a, you can build software that does these steps because you program mathematical"}, {"start": 721.48, "end": 727.16, "text": " knowledge into the software, but it's custom made for that particular problem."}, {"start": 727.16, "end": 730.8000000000001, "text": " And they're simply trying to, they're not trying to beat that program."}, {"start": 730.8, "end": 736.4, "text": " They're simply trying to investigate can a language model that knows nothing of math."}, {"start": 736.4, "end": 740.7199999999999, "text": " Do this simply by learning from data."}, {"start": 740.7199999999999, "end": 745.3599999999999, "text": " So they're going to try to build the data set or they are building a data set and they"}, {"start": 745.3599999999999, "end": 752.12, "text": " do it in the same way as this previous paper, which say we generate random functions by"}, {"start": 752.12, "end": 757.76, "text": " sampling unary binary trees and randomly selecting operators, variables and integers for"}, {"start": 757.76, "end": 759.9599999999999, "text": " their internal nodes and leaves."}, {"start": 759.96, "end": 764.9200000000001, "text": " So they use any combination of plus, minus times, divide, x, log and so on."}, {"start": 764.9200000000001, "end": 770.52, "text": " So all these functions can appear in these things and they basically they build a tree"}, {"start": 770.52, "end": 777.08, "text": " where they say, okay, we go from plus and then here is five and then here maybe is minus"}, {"start": 777.08, "end": 784.72, "text": " sin of x and here over is x of y."}, {"start": 784.72, "end": 793.28, "text": " So that would be five plus sin of x minus x of y."}, {"start": 793.28, "end": 799.96, "text": " So they build trees like this by randomly sampling and then they simply feed this to their mathematical"}, {"start": 799.96, "end": 807.28, "text": " program to obtain a solution y and then they feed all of this into that's now a training"}, {"start": 807.28, "end": 808.28, "text": " data point."}, {"start": 808.28, "end": 814.6800000000001, "text": " This here is x and here you have y and they generate a giant bunch of these things."}, {"start": 814.68, "end": 819.3199999999999, "text": " And they feed them into the into the model."}, {"start": 819.3199999999999, "end": 826.7199999999999, "text": " They say here is seek to seek models, not even sure what kind of models they use."}, {"start": 826.7199999999999, "end": 830.0, "text": " I think they just they use transformers as well."}, {"start": 830.0, "end": 831.9599999999999, "text": " So they they use standard transformers."}, {"start": 831.9599999999999, "end": 833.56, "text": " I believe so yes."}, {"start": 833.56, "end": 837.8, "text": " In all experiments, we use the transformer architecture with eight attention heads."}, {"start": 837.8, "end": 841.16, "text": " We turn our models with the atom optimizer learning rate blah, blah, blah."}, {"start": 841.16, "end": 844.4399999999999, "text": " We vary the dimension and the number of layers."}, {"start": 844.44, "end": 848.84, "text": " So that's going to be interesting to see how the size of this language model influences"}, {"start": 848.84, "end": 852.7600000000001, "text": " how well this model can solve these things."}, {"start": 852.7600000000001, "end": 858.7600000000001, "text": " So as you can see here they build these data sets for local stability."}, {"start": 858.7600000000001, "end": 864.36, "text": " They include systems with two to six equations, which is already fairly fairly complicated"}, {"start": 864.36, "end": 870.6, "text": " and would take a human quite a while to to do this."}, {"start": 870.6, "end": 874.76, "text": " They say we generate a data set with over 50 million systems."}, {"start": 874.76, "end": 879.8000000000001, "text": " So it's a pretty dense sampling of this space and I feel this is one of the important components"}, {"start": 879.8000000000001, "end": 881.76, "text": " here."}, {"start": 881.76, "end": 884.6, "text": " They do make sure that none of their tests."}, {"start": 884.6, "end": 888.28, "text": " So they do a train test split and they do make sure that none of their test examples"}, {"start": 888.28, "end": 890.52, "text": " in the training data set."}, {"start": 890.52, "end": 894.8000000000001, "text": " Though they claim that they never actually have to remove anything."}, {"start": 894.8, "end": 900.8, "text": " They just check and the search space, the space of these trees here is so large that it"}, {"start": 900.8, "end": 906.8, "text": " never happens that the test sample or almost never happens that a test sample is in the"}, {"start": 906.8, "end": 909.0, "text": " training data set."}, {"start": 909.0, "end": 910.0, "text": " All right."}, {"start": 910.0, "end": 915.7199999999999, "text": " So they generate these things and here are the results."}, {"start": 915.7199999999999, "end": 922.64, "text": " So for local stability, they this trained to predict this lambda that we saw at the beginning."}, {"start": 922.64, "end": 928.1999999999999, "text": " The largest part of the eigenvalue of the Jacobian corresponding to the convergence speed"}, {"start": 928.1999999999999, "end": 929.28, "text": " of a equilibrium."}, {"start": 929.28, "end": 935.4, "text": " We consider that predictions are correct when they fall within 10% of the ground truth."}, {"start": 935.4, "end": 943.6, "text": " And here you can see that their best model achieves 96% if the degree of if if it's two"}, {"start": 943.6, "end": 944.6, "text": " equations."}, {"start": 944.6, "end": 949.24, "text": " So if the degree of the system is two, it achieved in 96% accuracy."}, {"start": 949.24, "end": 957.12, "text": " So in 96% of the time, the convergence speed is within 10% of the true convergence speed."}, {"start": 957.12, "end": 959.32, "text": " That's fairly crazy, right?"}, {"start": 959.32, "end": 962.64, "text": " That's pretty good."}, {"start": 962.64, "end": 967.44, "text": " And here the exact prediction of local convergence speed to a given precision."}, {"start": 967.44, "end": 971.16, "text": " So how many digits actually match of that conversion speed?"}, {"start": 971.16, "end": 974.0, "text": " So it's not only 10% off."}, {"start": 974.0, "end": 976.8, "text": " They also measure how many digits match."}, {"start": 976.8, "end": 984.9599999999999, "text": " And here you can see that as you up the degree of equation, sorry, here, the performance drops"}, {"start": 984.9599999999999, "end": 989.16, "text": " off as you can see less and less and less."}, {"start": 989.16, "end": 997.3199999999999, "text": " And also as you lower the number of layers in your model or lower the dimensionality,"}, {"start": 997.3199999999999, "end": 1000.68, "text": " the performance drops quite significantly."}, {"start": 1000.68, "end": 1007.16, "text": " So that means the language model sort of is doing real work here."}, {"start": 1007.16, "end": 1014.88, "text": " And here you also see that if it's degree two, the convergence speed has pretty even"}, {"start": 1014.88, "end": 1018.0, "text": " goes to two, three or four digits often."}, {"start": 1018.0, "end": 1025.96, "text": " But as you now increase the degree, this accuracy drops off fairly quickly."}, {"start": 1025.96, "end": 1028.04, "text": " All right, let's keep that in mind."}, {"start": 1028.04, "end": 1035.2, "text": " So the surprising thing is that it actually works and it works in surprisingly big amount"}, {"start": 1035.2, "end": 1036.2, "text": " of the time."}, {"start": 1036.2, "end": 1041.44, "text": " Now I don't know, you could bicker about this 10% and how bad or how easy this is and"}, {"start": 1041.44, "end": 1042.44, "text": " so on."}, {"start": 1042.44, "end": 1049.72, "text": " But it is fairly, it is fairly complicated problem to be within 10% of the solution seems"}, {"start": 1049.72, "end": 1052.1599999999999, "text": " quite remarkable."}, {"start": 1052.1599999999999, "end": 1056.76, "text": " And the same things here happen with the other tasks."}, {"start": 1056.76, "end": 1064.36, "text": " So here they say they predict controllability in the autonomous case."}, {"start": 1064.36, "end": 1068.4, "text": " So in the control theory, they predict these two things, whether it's controllable and"}, {"start": 1068.4, "end": 1074.2, "text": " then they output this K matrix that we saw before."}, {"start": 1074.2, "end": 1075.2, "text": " Yeah."}, {"start": 1075.2, "end": 1085.56, "text": " So here you can see that if they have high enough dimensions and high enough layers with"}, {"start": 1085.56, "end": 1091.76, "text": " sample systems with three to six equations, they achieve again a 97% in the prediction"}, {"start": 1091.76, "end": 1094.52, "text": " of whether the system is controllable or not."}, {"start": 1094.52, "end": 1104.12, "text": " Now remember this is a binary prediction, but still it requires a good understanding of"}, {"start": 1104.12, "end": 1106.52, "text": " math for a human to solve this."}, {"start": 1106.52, "end": 1114.36, "text": " Again, we see this drop off with dimension and layers, but you know, these, this number"}, {"start": 1114.36, "end": 1115.36, "text": " here is pretty good."}, {"start": 1115.36, "end": 1123.04, "text": " Compared to the 50% you'd have for, you'd, from pair to the 50% you'd have from random"}, {"start": 1123.04, "end": 1126.4399999999998, "text": " guessing."}, {"start": 1126.4399999999998, "end": 1132.4399999999998, "text": " Also interesting is when they look at is this correct this correct, sorry, is the feedback"}, {"start": 1132.4399999999998, "end": 1133.4399999999998, "text": " matrix correct?"}, {"start": 1133.4399999999998, "end": 1139.8, "text": " So this matrix that you optionally have to output, they find that if they analyze whether"}, {"start": 1139.8, "end": 1148.24, "text": " or not that's within 10% of the true one, they see that pretty, pretty quickly this accuracy"}, {"start": 1148.24, "end": 1150.48, "text": " drops when they up the degree."}, {"start": 1150.48, "end": 1156.48, "text": " Of course the matrix, as I understand it has more entries at degree six than at degree"}, {"start": 1156.48, "end": 1157.48, "text": " three."}, {"start": 1157.48, "end": 1164.6, "text": " So maybe that's understandable, but it drops off pretty quickly, but what is true is"}, {"start": 1164.6, "end": 1168.0, "text": " whether they call this correct feedback matrix."}, {"start": 1168.0, "end": 1174.56, "text": " So from the feedback matrix from the entries in that you can read out whether it's the"}, {"start": 1174.56, "end": 1181.92, "text": " system is controllable or not if all of the eigenvalues I believe are negative or positive"}, {"start": 1181.92, "end": 1184.2, "text": " or all the values are negative or positive."}, {"start": 1184.2, "end": 1187.68, "text": " So basically by saying whether or not these things are positive or negative, you can read"}, {"start": 1187.68, "end": 1196.24, "text": " out the controllability and if they check whether that property holds, then that is fairly"}, {"start": 1196.24, "end": 1197.24, "text": " well."}, {"start": 1197.24, "end": 1204.96, "text": " So they argue here that this shows that it doesn't predict the matrix they want, but the"}, {"start": 1204.96, "end": 1211.72, "text": " matrix that it predicts has the appropriate properties to solve this other task right"}, {"start": 1211.72, "end": 1213.2, "text": " here."}, {"start": 1213.2, "end": 1216.8, "text": " Okay, that's experiment two."}, {"start": 1216.8, "end": 1224.56, "text": " Experiment three, as you can imagine, is quite different, sorry, quite similar in that"}, {"start": 1224.56, "end": 1228.32, "text": " they investigate these partial differential equations in the Fourier transform."}, {"start": 1228.32, "end": 1233.04, "text": " The model is given differential operator and an initial condition is trying to predict"}, {"start": 1233.04, "end": 1241.24, "text": " if a solution exists and if so, whether it converges to zero when T goes to infinity, the"}, {"start": 1241.24, "end": 1243.28, "text": " dimensions between two and six."}, {"start": 1243.28, "end": 1249.6, "text": " So the random guessing here would be I guess 25% because it's two bits you need to output"}, {"start": 1249.6, "end": 1254.24, "text": " and this model performs extremely well even up to this dimension six."}, {"start": 1254.24, "end": 1261.24, "text": " There is a drop off with dimension, but it still does perform very, very well."}, {"start": 1261.24, "end": 1269.96, "text": " Now they go into the discussion a bit and they and this is the part that in this paper"}, {"start": 1269.96, "end": 1273.16, "text": " interests me like how do you interpret these results?"}, {"start": 1273.16, "end": 1278.04, "text": " Apparently, you give these mathematical things to a language model that has no clue of"}, {"start": 1278.04, "end": 1279.04, "text": " math."}, {"start": 1279.04, "end": 1283.32, "text": " And just by looking at examples, it learns to produce correct solutions."}, {"start": 1283.32, "end": 1287.6399999999999, "text": " And if you want to teach that to a human, the human would have to go through all these"}, {"start": 1287.6399999999999, "end": 1288.6399999999999, "text": " steps, right?"}, {"start": 1288.6399999999999, "end": 1293.56, "text": " So something is happening here and we want to find out what."}, {"start": 1293.56, "end": 1300.96, "text": " And the discussion is maybe they try to explain a bit why they think this happens."}, {"start": 1300.96, "end": 1305.3999999999999, "text": " They say we studied five problems of advanced mathematics from widely research about it."}, {"start": 1305.3999999999999, "end": 1310.84, "text": " In three of them, we predict qualitative and theoretical features into we perform numerical"}, {"start": 1310.84, "end": 1312.6, "text": " computations."}, {"start": 1312.6, "end": 1317.7199999999998, "text": " According to mathematical theory, solving these problems requires a combination of advanced"}, {"start": 1317.7199999999998, "end": 1324.24, "text": " techniques, symbolic and numerical that seem unlikely to be learnable from examples."}, {"start": 1324.24, "end": 1330.6, "text": " Yet our model achieves more than 95% accuracy on all qualitative tasks and between 65 and"}, {"start": 1330.6, "end": 1333.48, "text": " 85 on numerical computations."}, {"start": 1333.48, "end": 1340.36, "text": " Such high performances over difficult mathematical tasks may come as a surprise."}, {"start": 1340.36, "end": 1345.4799999999998, "text": " One way to generate data set of problems with their solutions consists in sampling the"}, {"start": 1345.4799999999998, "end": 1349.32, "text": " solution first and deriving an associated problem."}, {"start": 1349.32, "end": 1354.76, "text": " For instance, pairs of functions with their integrals can be generated by sampling and differentiating"}, {"start": 1354.76, "end": 1356.8, "text": " from random functions."}, {"start": 1356.8, "end": 1361.36, "text": " So here they hedge against there's this criticism and this was mainly a criticism of their"}, {"start": 1361.36, "end": 1367.08, "text": " other paper, which they already addressed in their other paper, was if you want to find"}, {"start": 1367.08, "end": 1372.12, "text": " if you want to create a data set where you have the function and then the label is the integral"}, {"start": 1372.12, "end": 1380.6, "text": " of the function, then there is no common solution to derive these integrals."}, {"start": 1380.6, "end": 1386.24, "text": " Sorry, the derive is a there is no common solution to integrate functions."}, {"start": 1386.24, "end": 1391.48, "text": " I mean, you can do it numerically, but there is no common symbolic solution to integrate"}, {"start": 1391.48, "end": 1392.8799999999999, "text": " any function."}, {"start": 1392.88, "end": 1397.2800000000002, "text": " And that's why what you can do if you want to produce a data set is you start with the"}, {"start": 1397.2800000000002, "end": 1406.68, "text": " integral already and then you differentiate that to get to get a thing and then you know"}, {"start": 1406.68, "end": 1411.68, "text": " that if you integrate this, you should get back your original function."}, {"start": 1411.68, "end": 1417.2, "text": " But this biases the data set because the sampling is now not over these functions, but"}, {"start": 1417.2, "end": 1423.8, "text": " the sampling is over these functions and that might lead to this distribution here being"}, {"start": 1423.8, "end": 1424.8, "text": " biased."}, {"start": 1424.8, "end": 1429.6000000000001, "text": " So they hedge against that, which I don't care because it clearly in this paper and they"}, {"start": 1429.6000000000001, "end": 1435.28, "text": " say in this paper, data sets for all considered tasks are generated using a forward approach"}, {"start": 1435.28, "end": 1439.56, "text": " by directly sampling as a result, potential bias caused by backward generative model do"}, {"start": 1439.56, "end": 1441.48, "text": " not apply here."}, {"start": 1441.48, "end": 1445.04, "text": " And they studied problems from three to so they hedge against this argument that they could"}, {"start": 1445.04, "end": 1450.48, "text": " have a bias data set, which I don't think anyone reading this paper would leverage against"}, {"start": 1450.48, "end": 1452.48, "text": " them."}, {"start": 1452.48, "end": 1461.52, "text": " Yeah, so in so here they basically say how good they are, how surprising this is, all"}, {"start": 1461.52, "end": 1463.2, "text": " of this requires math."}, {"start": 1463.2, "end": 1467.28, "text": " This part is irrelevant because it hedges against an argument that I don't think is"}, {"start": 1467.28, "end": 1469.56, "text": " reasonable against the paper."}, {"start": 1469.56, "end": 1474.1599999999999, "text": " And then the last thing in their discussion is an objection traditionally raised is that"}, {"start": 1474.16, "end": 1479.48, "text": " the model might memorize a very large number of cases and interpolate between them, which"}, {"start": 1479.48, "end": 1482.64, "text": " I think we know in language model happens often."}, {"start": 1482.64, "end": 1483.64, "text": " Right."}, {"start": 1483.64, "end": 1487.3600000000001, "text": " Oh, by the way, have I shown you how they encode this into the language model?"}, {"start": 1487.3600000000001, "end": 1489.52, "text": " I have not."}, {"start": 1489.52, "end": 1492.76, "text": " This is the, I guess this is the craziest part."}, {"start": 1492.76, "end": 1495.5600000000002, "text": " They don't even put the numbers there."}, {"start": 1495.5600000000002, "end": 1500.6000000000001, "text": " Wait, wait, they don't even put the numbers there."}, {"start": 1500.6, "end": 1505.32, "text": " They actually put the, as I understand it, they put the string tokens here."}, {"start": 1505.32, "end": 1506.32, "text": " Right."}, {"start": 1506.32, "end": 1513.84, "text": " So they put the string tokens of the math and then even like composed so the number 142,"}, {"start": 1513.84, "end": 1519.1999999999998, "text": " they would put as now there's an integer and then the token won the token for and the"}, {"start": 1519.1999999999998, "end": 1520.84, "text": " token too."}, {"start": 1520.84, "end": 1522.84, "text": " Okay."}, {"start": 1522.84, "end": 1531.6399999999999, "text": " And the decimal point representation is the sequence float 3 dot 1 for e in negative"}, {"start": 1531.6399999999999, "end": 1532.6399999999999, "text": " 1."}, {"start": 1532.6399999999999, "end": 1534.56, "text": " So this is, it's really just a string."}, {"start": 1534.56, "end": 1540.84, "text": " There is no, like the model would even have to learn the decimal representation of numbers"}, {"start": 1540.84, "end": 1548.9599999999998, "text": " to get that this four here is actually not, not just a different token than two, but"}, {"start": 1548.96, "end": 1554.28, "text": " it's 20 times larger because it is in the position one in front of two."}, {"start": 1554.28, "end": 1559.28, "text": " So it's not two times larger, like four is the two, but because four is, you know, one"}, {"start": 1559.28, "end": 1562.0, "text": " digit away from two, it's 20 times larger."}, {"start": 1562.0, "end": 1565.64, "text": " And then this here is actually 50 times larger than this."}, {"start": 1565.64, "end": 1571.1200000000001, "text": " So it seems like a quite inconvenient way to input data into the model and yet the model"}, {"start": 1571.1200000000001, "end": 1573.4, "text": " is super accurate, right?"}, {"start": 1573.4, "end": 1578.08, "text": " And we already know that these language models, what they tend to do is they tend to"}, {"start": 1578.08, "end": 1583.72, "text": " memorize the training data or abstract it in a way that they can sort of interpolate between"}, {"start": 1583.72, "end": 1587.8, "text": " fuzzy versions of the training data."}, {"start": 1587.8, "end": 1593.4399999999998, "text": " Here they say this is unlikely, sorry, this is unlikely because first, because the size"}, {"start": 1593.4399999999998, "end": 1597.9199999999998, "text": " of our problem space is too large to be memorized."}, {"start": 1597.9199999999998, "end": 1602.48, "text": " So say for all considered problems, we did not get a single duplicate over 50 million"}, {"start": 1602.48, "end": 1609.28, "text": " generated examples, second, because in some of our problems, such as non autonomous control,"}, {"start": 1609.28, "end": 1615.84, "text": " even a model with a one layer in 64 dimensions obtains a high accuracy and such a small model"}, {"start": 1615.84, "end": 1619.96, "text": " would never be able to memorize that many examples, which is true, right?"}, {"start": 1619.96, "end": 1626.6, "text": " This is a fair defense against you're just interpolating training data, but I think"}, {"start": 1626.6, "end": 1634.0, "text": " the kind of broader scope of this criticism would be something like your model is just"}, {"start": 1634.0, "end": 1640.36, "text": " kind of learning the pattern regularities of the textual data that you feed in."}, {"start": 1640.36, "end": 1645.8, "text": " It's not actually learning math, it's just learning sort of, okay, there is like a cosine"}, {"start": 1645.8, "end": 1651.28, "text": " and if there's a cosine here followed by an exponential function, that often leads to"}, {"start": 1651.28, "end": 1655.4399999999998, "text": " like a very low number of this lambda, right?"}, {"start": 1655.44, "end": 1661.56, "text": " And then if a very similar thing comes, if it comes across a very similar thing in the"}, {"start": 1661.56, "end": 1665.88, "text": " test sample, even though it's not exactly the same thing, it will map it to like a similar"}, {"start": 1665.88, "end": 1667.52, "text": " place in the label space."}, {"start": 1667.52, "end": 1672.16, "text": " I mean, this is literally machine learning, this is literally regression, but I think"}, {"start": 1672.16, "end": 1682.2, "text": " the more the broader scope of this criticism is that what your model might be doing might"}, {"start": 1682.2, "end": 1688.9, "text": " simply be sort of a very simple regression on these tokens or on these context dependent"}, {"start": 1688.9, "end": 1693.44, "text": " tokens, rather than this internal mathematical reasoning."}, {"start": 1693.44, "end": 1701.0800000000002, "text": " And I don't, while it is true that it's probably not memorizing any examples, this still"}, {"start": 1701.0800000000002, "end": 1702.92, "text": " doesn't."}, {"start": 1702.92, "end": 1708.64, "text": " And while it is also true that they did not get a single exact duplicate, what it would"}, {"start": 1708.64, "end": 1715.2800000000002, "text": " be interesting to know is how many like approximate duplicates, so can you basically solve the"}, {"start": 1715.2800000000002, "end": 1717.3600000000001, "text": " problem with a nearest neighbor approach?"}, {"start": 1717.3600000000001, "end": 1719.0400000000002, "text": " That would be my question."}, {"start": 1719.0400000000002, "end": 1725.44, "text": " Can you solve the problem with a nearest neighbor approach over their training data set?"}, {"start": 1725.44, "end": 1730.2, "text": " Because that means you basically don't need the mathematical knowledge."}, {"start": 1730.2, "end": 1738.1200000000001, "text": " They say third, because for some of our problems, we know from mathematical theory that solutions,"}, {"start": 1738.12, "end": 1743.08, "text": " I.e., the real value of eigenvalues, cannot be obtained by simple interpolation."}, {"start": 1743.08, "end": 1748.84, "text": " And I mean, that is also a valid defense, but I think the argument goes further than just"}, {"start": 1748.84, "end": 1751.1999999999998, "text": " simple interpolation."}, {"start": 1751.1999999999998, "end": 1758.0, "text": " What we mean by interpolation is not we interpolate the real values of the eigenvalues."}, {"start": 1758.0, "end": 1763.4799999999998, "text": " What we mean by interpolation is sort of interpolation in the regression space of these tokens."}, {"start": 1763.48, "end": 1772.16, "text": " Like, we know that if we go from a sine to a cosine, maybe the sine of the output flips"}, {"start": 1772.16, "end": 1774.08, "text": " at the end."}, {"start": 1774.08, "end": 1776.3600000000001, "text": " And that's what we mean by interpolation."}, {"start": 1776.3600000000001, "end": 1785.2, "text": " Like when we see two equations that are very similar, like x squared plus 4x minus the"}, {"start": 1785.2, "end": 1796.32, "text": " sine of x. And then we see x squared plus 5x minus twice the sine of x."}, {"start": 1796.32, "end": 1803.6000000000001, "text": " What we mean by interpolation is that we now get a test example that says x squared plus,"}, {"start": 1803.6000000000001, "end": 1810.16, "text": " let's say, 4x minus 3 times the sine of x."}, {"start": 1810.16, "end": 1815.6000000000001, "text": " And then what we would interpolate is sort of these things."}, {"start": 1815.6000000000001, "end": 1819.28, "text": " Yeah, I'm making a bad example right here."}, {"start": 1819.28, "end": 1824.8000000000002, "text": " Maybe I should go with x squared, and this is x third."}, {"start": 1824.8000000000002, "end": 1830.72, "text": " I know these things aren't exactly equal, but this in the middle would be sort of an interpolation"}, {"start": 1830.72, "end": 1834.1200000000001, "text": " in token space."}, {"start": 1834.12, "end": 1840.8, "text": " And if you train the language model, it will recognize that maybe I can interpolate whenever"}, {"start": 1840.8, "end": 1844.84, "text": " the coefficient here is just different, or I can interpolate when there's just, you"}, {"start": 1844.84, "end": 1848.84, "text": " know, if there's like a log x here, that doesn't really change anything."}, {"start": 1848.84, "end": 1853.32, "text": " So I can interpolate between the two, but I might not be able to interpolate when the"}, {"start": 1853.32, "end": 1855.04, "text": " exponent here is different."}, {"start": 1855.04, "end": 1859.7199999999998, "text": " So if you give a training data set, you teach the model where it can interpolate and where"}, {"start": 1859.7199999999998, "end": 1860.7199999999998, "text": " it can't."}, {"start": 1860.72, "end": 1866.64, "text": " And it's not able to remember the training data, but it will be able to sort of abstract"}, {"start": 1866.64, "end": 1871.96, "text": " it and then store it fuzzily and abstract the patterns from it, which is good, right?"}, {"start": 1871.96, "end": 1873.1200000000001, "text": " That's machine learning."}, {"start": 1873.1200000000001, "end": 1876.92, "text": " But there's no evidence here that this does any mathematical reasoning."}, {"start": 1876.92, "end": 1885.28, "text": " So up until now, all that has built up is sort of, if you read the abstract, can advanced"}, {"start": 1885.28, "end": 1891.16, "text": " mathematical computations be learned from examples?"}, {"start": 1891.16, "end": 1895.6399999999999, "text": " Neural networks can learn advanced theorem's complex computation without built-in mathematical"}, {"start": 1895.6399999999999, "end": 1898.04, "text": " knowledge."}, {"start": 1898.04, "end": 1905.52, "text": " All of the story here, all of this showing of, hey, look at what steps is required to"}, {"start": 1905.52, "end": 1907.24, "text": " solve these problems."}, {"start": 1907.24, "end": 1914.96, "text": " And even this discussion here basically says, hey, you need mathematical complex reasoning"}, {"start": 1914.96, "end": 1917.88, "text": " to arrive at the solutions."}, {"start": 1917.88, "end": 1928.48, "text": " And then in the conclusion, in the conclusion, they say, it seems that our models have learned"}, {"start": 1928.48, "end": 1933.08, "text": " to solve these problems, but that does not mean they learned these techniques we use to compute"}, {"start": 1933.08, "end": 1934.64, "text": " their solutions."}, {"start": 1934.64, "end": 1938.8400000000001, "text": " Problems such as non-autonomous control involve long and complex chain of computations, yet"}, {"start": 1938.8400000000001, "end": 1939.8400000000001, "text": " even small models."}, {"start": 1939.84, "end": 1945.24, "text": " So means one layer transformers with 64 dimensions achieve high accuracy."}, {"start": 1945.24, "end": 1950.8799999999999, "text": " Most probably our models learn shortcuts that allow them to solve specific problems without"}, {"start": 1950.8799999999999, "end": 1955.04, "text": " having to learn or understand their theoretical background."}, {"start": 1955.04, "end": 1958.9199999999998, "text": " Such a situation is common in everyday life."}, {"start": 1958.9199999999998, "end": 1960.9199999999998, "text": " Yada, yada, yada."}, {"start": 1960.9199999999998, "end": 1968.84, "text": " So here in this paragraph here, they sort of counter their whole narrative of the paper."}, {"start": 1968.84, "end": 1971.8, "text": " And that's, I guess, that's sort of to, it's fair, right?"}, {"start": 1971.8, "end": 1974.8, "text": " They criticize their own work, which is good for research."}, {"start": 1974.8, "end": 1979.0, "text": " It's also to hedge against criticism and it's to be a bit real."}, {"start": 1979.0, "end": 1981.9199999999998, "text": " This, it's a good paper, right?"}, {"start": 1981.9199999999998, "end": 1984.48, "text": " Because it's a nice and interesting story."}, {"start": 1984.48, "end": 1989.52, "text": " And then at the end, you also say, look, this might actually not be all that, what it's"}, {"start": 1989.52, "end": 1992.36, "text": " made up or what it seems like to be."}, {"start": 1992.36, "end": 1996.84, "text": " And I agree with this statement right here."}, {"start": 1996.84, "end": 2001.72, "text": " That probably the model learns shortcuts and the shortcuts might be just in a way of pattern"}, {"start": 2001.72, "end": 2002.9599999999998, "text": " matching."}, {"start": 2002.9599999999998, "end": 2008.3999999999999, "text": " The pattern matching of whatever patterns you extract from the training data, you pattern"}, {"start": 2008.3999999999999, "end": 2014.9599999999998, "text": " match that and you relatively simply interpolate between those matched patterns, not between"}, {"start": 2014.9599999999998, "end": 2018.08, "text": " the training data itself, but between the matched patterns."}, {"start": 2018.08, "end": 2021.1999999999998, "text": " And therefore you can arrive at approximately good solutions."}, {"start": 2021.1999999999998, "end": 2025.3999999999999, "text": " So what I would have liked to see from such a paper, right?"}, {"start": 2025.4, "end": 2031.0, "text": " They say that we leave that to future research after making really kind of big claims in"}, {"start": 2031.0, "end": 2033.48, "text": " the introduction and the abstract."}, {"start": 2033.48, "end": 2036.68, "text": " They have taken three different problems here, right?"}, {"start": 2036.68, "end": 2045.76, "text": " There's this local stability, then there is this control theory and then there is this"}, {"start": 2045.76, "end": 2046.76, "text": " stability."}, {"start": 2046.76, "end": 2050.28, "text": " They have three different problems and okay, they try to show that they can apply this"}, {"start": 2050.28, "end": 2052.2000000000003, "text": " to a diverse range."}, {"start": 2052.2, "end": 2061.0, "text": " But what I would have expected from a paper like this is they even spell out, here are four"}, {"start": 2061.0, "end": 2067.3599999999997, "text": " things that you need to do to solve this if we were to teach this to a human, right?"}, {"start": 2067.3599999999997, "end": 2073.08, "text": " Now if you have trained the model and you evaluated it, it is really good at this task for"}, {"start": 2073.08, "end": 2077.04, "text": " which you thought you need to do these four steps."}, {"start": 2077.04, "end": 2084.72, "text": " So what would be really interesting is to now introspect your model and see, can I somehow"}, {"start": 2084.72, "end": 2091.88, "text": " show that my model has in somewhere in the intermediate layers has this quantity right"}, {"start": 2091.88, "end": 2096.8, "text": " here and is not just nearest neighboring in some learned pattern space."}, {"start": 2096.8, "end": 2100.24, "text": " That would be an actually interesting research question, right?"}, {"start": 2100.24, "end": 2105.48, "text": " So rather, in my mind, rather than having three different things where they all, you know,"}, {"start": 2105.48, "end": 2110.28, "text": " they demonstrate the same thing over and over and over again that this actually works."}, {"start": 2110.28, "end": 2114.4, "text": " It would be a much more interesting question to introspect the model and parse out."}, {"start": 2114.4, "end": 2121.48, "text": " Can I, for example, you can see, can I reconstruct this quantity from the inside of the model"}, {"start": 2121.48, "end": 2125.68, "text": " when the model isn't specifically trained to give me back this quantity?"}, {"start": 2125.68, "end": 2131.76, "text": " Because I know this quantity would be a step on the path of the solution, right?"}, {"start": 2131.76, "end": 2136.7200000000003, "text": " If I want to get the solution, I almost have to calculate this quantity."}, {"start": 2136.7200000000003, "end": 2142.6400000000003, "text": " Can I parse this out from the middle of the model somewhere when the model isn't explicitly"}, {"start": 2142.6400000000003, "end": 2144.1200000000003, "text": " trained to give me this?"}, {"start": 2144.1200000000003, "end": 2149.2200000000003, "text": " If I can, then I can really make the point that the model does something like this and"}, {"start": 2149.2200000000003, "end": 2154.4, "text": " learn something like this from data, whereas if I can't, that would be more of an evidence"}, {"start": 2154.4, "end": 2160.2400000000002, "text": " that the model is simply sort of pattern matching close enough seen examples in the training"}, {"start": 2160.24, "end": 2162.2799999999997, "text": " data, right?"}, {"start": 2162.2799999999997, "end": 2168.8799999999997, "text": " So that's a bit of my criticism right here is that they show it works, which is pretty"}, {"start": 2168.8799999999997, "end": 2177.6, "text": " cool, but then they don't do the sort of interesting experiments of this introspection"}, {"start": 2177.6, "end": 2184.04, "text": " right here, which is a bit sad, but they leave it for future research, which I guess is"}, {"start": 2184.04, "end": 2189.4399999999996, "text": " going to be themselves, and that's how you make two papers."}, {"start": 2189.44, "end": 2194.92, "text": " So now I don't want to be too critical, it's a very cool paper, and I invite you to check"}, {"start": 2194.92, "end": 2200.64, "text": " it out and leave a like and subscribe and leave a comment of what you think of this kind"}, {"start": 2200.64, "end": 2206.04, "text": " of research of this paper, and whether or not you think I'm totally wrong, that's entirely"}, {"start": 2206.04, "end": 2207.04, "text": " possible."}, {"start": 2207.04, "end": 2208.04, "text": " Okay, I'll see you next time."}, {"start": 2208.04, "end": 2222.04, "text": " Bye."}] |
Yannic Kilcher | 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 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, works surprisingly well if you don't have much data. So 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 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 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 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. Specifically they all share this part right here. 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 dataset and the simplest variant here is you take a big image dataset such as ImageNet and then you train a classifier like we said to predict some classes on it and then because an ImageNet 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 task that's called transfer learning. The question is how do you get a good backbone. So if you train on something like ImageNet then this is of course a supervised task so you'll have a very good learning signal but even ImageNet has like one million images but for example the internet has many more images so what you could do is you could train on this much bigger dataset that you collected from the internet. Let's 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 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 is 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-training 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 ImageNet is a big dataset we can train a really good backbone but you know the internet is an even bigger dataset 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 ImageNet at least you have the label right per image but if you simply take a photo of the internet you don't even have the 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 backbone 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 their more their task is given an image I want to produce a caption and there are datasets 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 ImageNet dataset then you have to label each image but if you want to create a caption dataset that's even harder because a human really needs to sit down look at the image and in ImageNet everything is like one class but here you need to look at the image and then you have to come up with like an adequate description here the adequate description is an orange and orange and white and 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 these are very very expensive datasets but they are very high quality if you think of what does what does single label let's just take ImageNet ImageNet 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 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 a backdrop here to say hey can't we can't we do can't we pre-train a backbone from maybe a small dataset but that has so much information like a caption date image caption dataset 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 7 by 7 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 is that 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 so 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 Vasvani 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 decoder 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 resonant this resonant 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 the reason you can do it in both directions here this wasn't is not the case of course if you have a decoder like a standard transformer task 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 bidirectional 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 and 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 all right so ret 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 dataset 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 dataset was a good descriptive caption but we're just we're going to assume that the in these datasets this is the case all right that's what they do now interesting thing here is that in their standard in their standard set up 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 basically has to do most of the work and then the 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 all right 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 linear classifier and they compare this to baselines so one of the baselines 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 other types it's kind of like what big transfer loss but just on the regular 1000 class image net baseline then you have the so of the unsupervised pre training once so moco so purlis purlis um I want to go into purl 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 notice that cocoa has about 10% only of the images of image net so it's considerably smaller now let's see how these things fair right here you 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 coke on the ones that are training on image net are going to be capped here and 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 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 the 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 unsupered 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 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 in 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's 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 I was wrong actually they it's one layer of with 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 too 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 gonna leave it away so their baseline as you can see is these resonant 50 with the one layer of a thousand and 24 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 sets 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 Coco so there are several tasks on Coco one of them is image captioning which they use for pre-training if you do other tasks on Coco 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 Coco 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 the other things the other methods significantly now the lower numbers on this tasks 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 tasks yeah so they 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 sometimes the green triangles mean that they out perform 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-training basically the 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 and they don't always outperform the other base lines 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 widened out over the image air so over the air the attention is here in the sky and on the on the ocean and this 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 how 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 hear they only train on this small data set right it's smaller than image net as you can see here and they already get the same performance as if you train on the whole image net data set in a supervised fashion of course they're also supervised but they have ten 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 the people write something about the images you could like mine 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 these annotations these these datasets with these these image captioning dates sets like cocoa they have very very high quality annotations so this this text here is very high quality it's 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": 4.8, "text": " Hi there. Today we're looking at vertex learning visual representations from"}, {"start": 4.8, "end": 9.68, "text": " textual annotations by Karen Desai and Justin Johnson of the University of"}, {"start": 9.68, "end": 15.56, "text": " Michigan. So this paper at its core is pretty simple. On high level it proposes to"}, {"start": 15.56, "end": 20.080000000000002, "text": " take the task of image captioning which is where you're given an image and"}, {"start": 20.080000000000002, "end": 24.8, "text": " you're asked to produce a caption for the image and basically train a model to"}, {"start": 24.8, "end": 31.16, "text": " do this and then just take the visual part of it as a baseline to transfer"}, {"start": 31.16, "end": 37.32, "text": " learn on other visual tasks and that appears to work, works surprisingly well if"}, {"start": 37.32, "end": 44.32, "text": " you don't have much data. So if you don't have much data to pre-train on this"}, {"start": 44.32, "end": 51.2, "text": " appears to work very well. Alright, as always if you like content like this then"}, {"start": 51.2, "end": 56.480000000000004, "text": " consider sharing it out, subscribing to the channel or tell me what you think in"}, {"start": 56.480000000000004, "end": 64.96000000000001, "text": " the comments. So as I already said the idea here is pretty simple. So people have"}, {"start": 64.96000000000001, "end": 71.12, "text": " been looking for pre-training tasks for visual tasks. So a visual task is"}, {"start": 71.12, "end": 76.52000000000001, "text": " anything where the input is an image and then you usually have some sort of"}, {"start": 76.52000000000001, "end": 80.80000000000001, "text": " neural network that processes the image and then at the end you can have many"}, {"start": 80.8, "end": 85.16, "text": " things. So you could have a classifier that classifies the image into one of many"}, {"start": 85.16, "end": 93.44, "text": " classes. If you know ImageNet that's a thing. So if there's a cat here then the"}, {"start": 93.44, "end": 98.67999999999999, "text": " ImageNet classifier here would say cat or you could have something like a"}, {"start": 98.67999999999999, "end": 104.88, "text": " object detector that tries to predict on the image where the cat is like with a"}, {"start": 104.88, "end": 112.56, "text": " bounding box you could have a semantic segmentation where it's like all of these"}, {"start": 112.56, "end": 119.28, "text": " pixels here are cat and maybe all of these pixels here are sky and so it labels"}, {"start": 119.28, "end": 125.08, "text": " every pixel. There's many visual tasks that you can formulate and they all"}, {"start": 125.08, "end": 130.6, "text": " sort of share the same architecture. Specifically they all share this part"}, {"start": 130.6, "end": 135.96, "text": " right here. If you will this is the visual encoder. It's usually a convolutional"}, {"start": 135.96, "end": 141.0, "text": " neural network and what's really different between the tasks is mostly this last"}, {"start": 141.0, "end": 146.2, "text": " part here that does the actual task. But this and is often called the backbone."}, {"start": 146.2, "end": 153.44, "text": " So this is the backbone and the idea now is if I have a bunch of these tasks"}, {"start": 153.44, "end": 157.24, "text": " sometimes I don't have money labels for these tasks. I don't have many labeled"}, {"start": 157.24, "end": 162.04000000000002, "text": " images so that I could train this big architecture from scratch like in medical"}, {"start": 162.04000000000002, "end": 168.68, "text": " images or just in domains where you don't have many images. So couldn't I somehow"}, {"start": 168.68, "end": 175.32000000000002, "text": " come up with a method to create this backbone beforehand. So to create backbone"}, {"start": 175.32000000000002, "end": 179.92000000000002, "text": " given another dataset and the simplest variant here is you take a big image"}, {"start": 179.92000000000002, "end": 186.56, "text": " dataset such as ImageNet and then you train a classifier like we said to"}, {"start": 186.56, "end": 190.72, "text": " predict some classes on it and then because an ImageNet has a lot of images"}, {"start": 190.72, "end": 194.36, "text": " then this is your backbone and then whenever you have a different task you"}, {"start": 194.36, "end": 200.16, "text": " simply take the backbone transfer it over and then train the other basically"}, {"start": 200.16, "end": 205.44, "text": " you continue training on the other task that's called transfer learning. The"}, {"start": 205.44, "end": 211.2, "text": " question is how do you get a good backbone. So if you train on something like"}, {"start": 211.2, "end": 215.56, "text": " ImageNet then this is of course a supervised task so you'll have a very good"}, {"start": 215.56, "end": 220.96, "text": " learning signal but even ImageNet has like one million images but for example"}, {"start": 220.96, "end": 225.44, "text": " the internet has many more images so what you could do is you could train on"}, {"start": 225.44, "end": 230.08, "text": " this much bigger dataset that you collected from the internet. Let's call it"}, {"start": 230.08, "end": 235.12, "text": " internet but there you don't have labels right so what you'll have to resort to"}, {"start": 235.12, "end": 239.04, "text": " is instead of supervised learning is self supervised learning where you have an"}, {"start": 239.04, "end": 244.64000000000001, "text": " image and maybe you rotate it to the right so here is our cat. He rotated to the"}, {"start": 244.64, "end": 250.48, "text": " right and then you have a classifier that predicts that this image was"}, {"start": 250.48, "end": 255.23999999999998, "text": " rotated to the right and then that will become your backbone. These self-supervised"}, {"start": 255.23999999999998, "end": 261.4, "text": " methods they work very well. There is a different number of them for example"}, {"start": 261.4, "end": 266.2, "text": " moco things like this and there is also a number of techniques that do"}, {"start": 266.2, "end": 270.84, "text": " supervised pre-training and then transfer learning. You can maybe watch my"}, {"start": 270.84, "end": 276.71999999999997, "text": " video on big transfer which is a very large attempt to do to pre-training a"}, {"start": 276.71999999999997, "end": 283.76, "text": " backbone for visual tasks. All right now you can see right here that the sort"}, {"start": 283.76, "end": 289.08, "text": " of direction is that the more data the better. So that's sort of the idea here"}, {"start": 289.08, "end": 293.35999999999996, "text": " that ImageNet is a big dataset we can train a really good backbone but you know"}, {"start": 293.35999999999996, "end": 296.79999999999995, "text": " the internet is an even bigger dataset we don't have labels so there's a"}, {"start": 296.8, "end": 301.6, "text": " trade-off but we potentially can train an even better visual backbone to then"}, {"start": 301.6, "end": 307.08, "text": " transfer learn with. This paper goes into a different direction. They say look"}, {"start": 307.08, "end": 312.32, "text": " if you go in this direction right here you get more images but you get less"}, {"start": 312.32, "end": 317.32, "text": " information per image so with ImageNet at least you have the label right per"}, {"start": 317.32, "end": 321.92, "text": " image but if you simply take a photo of the internet you don't even have the"}, {"start": 321.92, "end": 326.2, "text": " label you have to resort to self supervised. What if we go into the other"}, {"start": 326.2, "end": 333.28, "text": " direction and we look for images that have very high quality annotations but"}, {"start": 333.28, "end": 337.9, "text": " maybe we don't have as many. Can we can we do the same thing? Can we learn good"}, {"start": 337.9, "end": 345.12, "text": " backbone by trading off quality for quantity in this case and their quantity and"}, {"start": 345.12, "end": 353.44, "text": " quality trade-off is they go for descriptions. So they'll go for something like"}, {"start": 353.44, "end": 361.52, "text": " this where you'll have an image and you'll have a caption for the image and so"}, {"start": 361.52, "end": 365.64, "text": " they show these on a line here semantically dense semantically sparse but"}, {"start": 365.64, "end": 370.28, "text": " their task is going to be caption generation so they're back their more their"}, {"start": 370.28, "end": 377.15999999999997, "text": " task is given an image I want to produce a caption and there are datasets that"}, {"start": 377.15999999999997, "end": 381.88, "text": " you can train this from in a supervised fashion which of course these are very"}, {"start": 381.88, "end": 387.04, "text": " expensive to create. I mean if you want to create an ImageNet dataset then you"}, {"start": 387.04, "end": 391.68, "text": " have to label each image but if you want to create a caption dataset that's even"}, {"start": 391.68, "end": 397.24, "text": " harder because a human really needs to sit down look at the image and in ImageNet"}, {"start": 397.24, "end": 401.84, "text": " everything is like one class but here you need to look at the image and then you"}, {"start": 401.84, "end": 405.64, "text": " have to come up with like an adequate description here the adequate description"}, {"start": 405.64, "end": 412.71999999999997, "text": " is an orange and orange and white and orange and white cat near a plate and the"}, {"start": 412.71999999999997, "end": 418.4, "text": " white cake okay so that's that's the caption right here and of course the"}, {"start": 418.4, "end": 423.52, "text": " caption is ambiguous so you'll have to collect multiple captions per image and"}, {"start": 423.52, "end": 427.36, "text": " you'll have to make sure that the humans that do this do a good job and so on so"}, {"start": 427.36, "end": 432.15999999999997, "text": " these are very very expensive datasets but they are very high quality if you"}, {"start": 432.16, "end": 437.64000000000004, "text": " think of what does what does single label let's just take ImageNet ImageNet has a"}, {"start": 437.64000000000004, "end": 443.84000000000003, "text": " single label per class let's say this is cat or cake for that matter it just"}, {"start": 443.84000000000003, "end": 449.28000000000003, "text": " sort of gives you very few bits of information but if you consider the text"}, {"start": 449.28000000000003, "end": 454.76000000000005, "text": " here an orange cat and a white cat an orange and white cat you know that there"}, {"start": 454.76000000000005, "end": 461.40000000000003, "text": " is a cat right you know that it's one cat you know what its color is orange and"}, {"start": 461.4, "end": 466.2, "text": " white then you know that there is a white cake right so do you know the other"}, {"start": 466.2, "end": 473.12, "text": " object and you know the relation they are near each other okay same for here a"}, {"start": 473.12, "end": 478.08, "text": " brown and white puppy so this is one object and the description of the object"}, {"start": 478.08, "end": 484.79999999999995, "text": " there is a there are apples there is a green lawn and the relations between them"}, {"start": 484.79999999999995, "end": 489.47999999999996, "text": " are also clear the puppy is lying on the green lawn and looking at the apples"}, {"start": 489.48, "end": 496.6, "text": " so the information in captions is so much more dense than just labels and that's"}, {"start": 496.6, "end": 504.96000000000004, "text": " the that's a backdrop here to say hey can't we can't we do can't we pre-train"}, {"start": 504.96000000000004, "end": 510.16, "text": " a backbone from maybe a small dataset but that has so much information like"}, {"start": 510.16, "end": 517.8000000000001, "text": " a caption date image caption dataset okay so their method is nothing more they"}, {"start": 517.8, "end": 521.52, "text": " train image captioning and then they use the visual backbone for transfer"}, {"start": 521.52, "end": 526.92, "text": " learning so this is the model there's an image the image goes into this visual"}, {"start": 526.92, "end": 531.3599999999999, "text": " backbone right here which is a resonant 50 so this is a very very standard"}, {"start": 531.3599999999999, "end": 536.5999999999999, "text": " convolutional neural network and that gives you these features so these"}, {"start": 536.5999999999999, "end": 544.0799999999999, "text": " features are 7 by 7 by 2048 this is the standard output of a resonant 50 and"}, {"start": 544.08, "end": 549.96, "text": " then from this part on they do a linear projection such that they can now"}, {"start": 549.96, "end": 555.24, "text": " input it into a language model is that they have visual features and now they"}, {"start": 555.24, "end": 559.5200000000001, "text": " feed those into the language model and the language model is just a"}, {"start": 559.5200000000001, "end": 566.24, "text": " transformer actually two transformers so one transformer they're both auto"}, {"start": 566.24, "end": 572.9200000000001, "text": " regressive one transformer tries to predict the caption in a forward way and the"}, {"start": 572.92, "end": 577.28, "text": " other transformer tries to predict the caption in a backward way that's down"}, {"start": 577.28, "end": 582.9599999999999, "text": " here so in this direction is backward because the caption has been reversed if you"}, {"start": 582.9599999999999, "end": 586.5999999999999, "text": " don't know what a transformer is I've made several videos on transformers the"}, {"start": 586.5999999999999, "end": 591.92, "text": " first one is attention is all you need and that's sort of the same the same"}, {"start": 591.92, "end": 597.52, "text": " kind of transformer they use here so as you can see right here you have this"}, {"start": 597.52, "end": 604.04, "text": " multi head attention the layer normalization attention from the decoder now"}, {"start": 604.04, "end": 608.56, "text": " the difference between the original Vasvani attention is all you need"}, {"start": 608.56, "end": 615.0799999999999, "text": " transformer and this one is that in the original transformer you had for"}, {"start": 615.0799999999999, "end": 618.48, "text": " example if you had a machine translation task you would have the French"}, {"start": 618.48, "end": 625.1999999999999, "text": " maybe a French sentence over here and then you would have the beginnings of"}, {"start": 625.2, "end": 629.36, "text": " German sentence here right this is what you have already produced and now you're"}, {"start": 629.36, "end": 634.4000000000001, "text": " asking what should the next word be and the architecture was such that there is a"}, {"start": 634.4000000000001, "end": 641.6800000000001, "text": " decoder transformer right here and that there is an encoder transformer that"}, {"start": 641.6800000000001, "end": 646.84, "text": " encodes whatever you already had and then at some point there is this cross"}, {"start": 646.84, "end": 651.88, "text": " attention right there is the signal from the decoder going into the encoder and"}, {"start": 651.88, "end": 657.4, "text": " the encoder incorporating that and then at the end right here the encoder would"}, {"start": 657.4, "end": 662.16, "text": " predict or the entire transformer would predict what the next word will be the"}, {"start": 662.16, "end": 668.76, "text": " only difference right here is that the decoder this sorry I mix this up this is"}, {"start": 668.76, "end": 673.4, "text": " the decoder this is the encoder the only difference right here is that this"}, {"start": 673.4, "end": 681.48, "text": " encoder is no longer a transformer but is this resonant this resonant 50"}, {"start": 681.48, "end": 685.9200000000001, "text": " okay because now you don't have an image as a you can think of it like a"}, {"start": 685.9200000000001, "end": 692.36, "text": " translation task you want to translate from images to text okay so your input is"}, {"start": 692.36, "end": 697.28, "text": " going to be an image and the signal is going like it would go in the original"}, {"start": 697.28, "end": 702.4, "text": " transformer into the decoder it would come from the image so from these visual"}, {"start": 702.4, "end": 711.8, "text": " features goes here so in this drawing this thing is going in here and then you"}, {"start": 711.8, "end": 715.88, "text": " simply predict the next word and you do it in both directions and the the"}, {"start": 715.88, "end": 720.88, "text": " reason you can do it in both directions here this wasn't is not the case of"}, {"start": 720.88, "end": 726.8, "text": " course if you have a decoder like a standard transformer task because you don't"}, {"start": 726.8, "end": 731.3199999999999, "text": " need to do inference at this you just need to do training and training you can"}, {"start": 731.32, "end": 736.6400000000001, "text": " do using teacher forcing and so you can do this in a bidirectional way you"}, {"start": 736.6400000000001, "end": 742.12, "text": " don't need you don't need this at inference time so at inference time you"}, {"start": 742.12, "end": 749.36, "text": " simply cut off this part right here that's your visual backbone okay and these"}, {"start": 749.36, "end": 753.84, "text": " features here those are going to be the features that you then train your"}, {"start": 753.84, "end": 758.1600000000001, "text": " task on and sometimes you fine tune this or sometimes you keep it frozen you"}, {"start": 758.16, "end": 764.28, "text": " can choose that all right so ret convolutional network to encode the images"}, {"start": 764.28, "end": 769.56, "text": " that gives you features visual features those visual features go into two"}, {"start": 769.56, "end": 773.9599999999999, "text": " transformers both try to predict the caption of the image one in a forward"}, {"start": 773.9599999999999, "end": 781.3199999999999, "text": " motion one in a backward motion and you train it to predict as accurately as"}, {"start": 781.3199999999999, "end": 786.92, "text": " possible the gold standard captions that you have in your dataset that's it if"}, {"start": 786.92, "end": 791.4799999999999, "text": " you train this model well that means the model can produce accurate captions"}, {"start": 791.4799999999999, "end": 796.3199999999999, "text": " for these images which means that it has learned something meaningful about"}, {"start": 796.3199999999999, "end": 800.76, "text": " the image to the degree of course that the original caption that was in your"}, {"start": 800.76, "end": 806.16, "text": " dataset was a good descriptive caption but we're just we're going to assume"}, {"start": 806.16, "end": 811.8399999999999, "text": " that the in these datasets this is the case all right that's what they do now"}, {"start": 811.84, "end": 819.24, "text": " interesting thing here is that in their standard in their standard set up"}, {"start": 819.24, "end": 823.84, "text": " they only have one of these transformer layers so of these things right here"}, {"start": 823.84, "end": 830.88, "text": " they only have one and that's like I think it's like 2000 units wide but or"}, {"start": 830.88, "end": 835.44, "text": " sorry the hidden dimension is 2000 units or 2048 but they only have one layer"}, {"start": 835.44, "end": 842.4000000000001, "text": " so what that means is that this transformer is not very powerful so most that"}, {"start": 842.4000000000001, "end": 848.24, "text": " you force most of the power to come from the visual encoder the visual encoder"}, {"start": 848.24, "end": 853.2, "text": " basically has to do most of the work and then the the transformer is going to"}, {"start": 853.2, "end": 860.96, "text": " simply be a very shallow language model on top of that and that of course"}, {"start": 860.96, "end": 867.32, "text": " makes your visual backbone even better all right we can pretty much skip the"}, {"start": 867.32, "end": 870.88, "text": " rest that's the idea like that there's nothing more to it you train this from"}, {"start": 870.88, "end": 874.1600000000001, "text": " the beginning you don't use any pre trained whatever you train this from"}, {"start": 874.1600000000001, "end": 879.96, "text": " scratch and then you use this and in the first experiment they simply train a"}, {"start": 879.96, "end": 884.32, "text": " linear classifier on top of that representation so they freeze the backbone"}, {"start": 884.32, "end": 890.6, "text": " and then they use linear classifier and they compare this to baselines so one of"}, {"start": 890.6, "end": 896.0400000000001, "text": " the baselines is image net supervised where you use the same backbone but you"}, {"start": 896.0400000000001, "end": 900.8000000000001, "text": " train it on image net in a supervised fashion okay and then you use that"}, {"start": 900.8000000000001, "end": 904.32, "text": " backbone to transfer other types it's kind of like what big transfer loss but"}, {"start": 904.32, "end": 913.0400000000001, "text": " just on the regular 1000 class image net baseline then you have the so of the"}, {"start": 913.0400000000001, "end": 920.28, "text": " unsupervised pre training once so moco so purlis purlis um I want to go into"}, {"start": 920.28, "end": 925.9599999999999, "text": " purl but moco is this momentum contrast which is one of these supervised"}, {"start": 925.9599999999999, "end": 931.64, "text": " methods that has been shown to work really really well and this is also moco"}, {"start": 931.64, "end": 937.88, "text": " EN is trained on image net but now without the labels because moco is unsupervised"}, {"start": 937.88, "end": 944.48, "text": " and moco coco is trained on the cocoa data set and the cocoa data set is what"}, {"start": 944.48, "end": 950.6, "text": " this paper here the vertex paper uses cocoa is this image captioning data set"}, {"start": 950.6, "end": 958.48, "text": " now what's important to notice that cocoa has about 10% only of the images of"}, {"start": 958.48, "end": 967.4, "text": " image net so it's considerably smaller now let's see how these things fair"}, {"start": 967.4, "end": 974.12, "text": " right here you see on the x axis the number of images okay the number of"}, {"start": 974.12, "end": 979.64, "text": " images that the data set or that the pre training method trains on now of"}, {"start": 979.64, "end": 983.8, "text": " course some of these are going to be capped because for some data sets there"}, {"start": 983.8, "end": 989.84, "text": " are just not more images available right so they're going to be capped here the"}, {"start": 989.84, "end": 992.88, "text": " ones that are training on coke on the ones that are training on image net are"}, {"start": 992.88, "end": 999.8, "text": " going to be capped here and you can already see that the vertex outperforms the"}, {"start": 999.8, "end": 1005.52, "text": " image net supervised baseline by pretty much when you only give it this many"}, {"start": 1005.52, "end": 1011.56, "text": " images okay so the way you do it is in this case you simply train these models"}, {"start": 1011.56, "end": 1017.12, "text": " now the brown one is when you take one caption per image but the data set"}, {"start": 1017.12, "end": 1021.5999999999999, "text": " actually has more more than one caption per image so when you use more than one"}, {"start": 1021.5999999999999, "end": 1028.6399999999999, "text": " you can still boost your performance a bit and that works way better than when"}, {"start": 1028.64, "end": 1034.88, "text": " you do the supervised pre training on image net which would get you here with"}, {"start": 1034.88, "end": 1039.64, "text": " about the same amount of images now when you use all of image net you can see"}, {"start": 1039.64, "end": 1045.16, "text": " here you can get to a similar performance right here but you have to use a 10"}, {"start": 1045.16, "end": 1052.3200000000002, "text": " times bigger data set to get there right so this already shows you sort of the"}, {"start": 1052.3200000000002, "end": 1058.2, "text": " advantage here now also consider the difference to the unsupervised ones so"}, {"start": 1058.2, "end": 1062.64, "text": " if you look at the same amount of images the unsupered self supervised baselines"}, {"start": 1062.64, "end": 1071.0, "text": " are even lower but if you go to more images they sort of get closer to image net"}, {"start": 1071.0, "end": 1076.28, "text": " and in their own papers there are there are some evidence that if you self"}, {"start": 1076.28, "end": 1083.1200000000001, "text": " supervised train for long enough you can actually surpass image net supervised"}, {"start": 1083.12, "end": 1089.52, "text": " pre training but I'm not so sure that that's really the case but you can see"}, {"start": 1089.52, "end": 1097.8799999999999, "text": " here the trade-off between higher quality information but smaller data sets"}, {"start": 1097.8799999999999, "end": 1108.3999999999999, "text": " versus lower quality information but more data per data set and yeah if I"}, {"start": 1108.3999999999999, "end": 1112.28, "text": " guess if you were to if you were to pre train these self supervised methods with"}, {"start": 1112.28, "end": 1118.68, "text": " lots more data in a self supervised manner they would maybe end up even higher"}, {"start": 1118.68, "end": 1125.04, "text": " than image net now this graph here is sort of the same thing where they also"}, {"start": 1125.04, "end": 1129.28, "text": " train a linear classifier and you can see right here that now the image net"}, {"start": 1129.28, "end": 1133.72, "text": " supervised baseline is outperforming vertex by a lot so what's happening here"}, {"start": 1133.72, "end": 1139.04, "text": " now this here is actually this is on image net so the task here that you"}, {"start": 1139.04, "end": 1144.28, "text": " transfer learn is image net here it was like a neutral task Pascal VOC"}, {"start": 1144.28, "end": 1149.6, "text": " none of these methods have trained on Pascal they simply have trained on"}, {"start": 1149.6, "end": 1153.32, "text": " their own data set these have trained on Coco this has trained on image net"}, {"start": 1153.32, "end": 1158.72, "text": " and then they have transfer learned to Pascal now the task is actually the"}, {"start": 1158.72, "end": 1165.92, "text": " transfer learning task is image net so naturally the thing that was pre-"}, {"start": 1165.92, "end": 1170.72, "text": " trained in a supervised fashion on image net is going to have a huge advantage"}, {"start": 1170.72, "end": 1174.5600000000002, "text": " in this task because it basically has already learned the task beforehand"}, {"start": 1174.5600000000002, "end": 1181.88, "text": " whereas the vertex it has pre-trained on Coco not on image net and you can"}, {"start": 1181.88, "end": 1186.88, "text": " see if you give it the same amount of images for pre-training it can actually"}, {"start": 1186.88, "end": 1191.8000000000002, "text": " it's it's fairly close to the image net baseline so that's pretty respectable"}, {"start": 1191.8, "end": 1196.76, "text": " right there now again of course if you use more images on the same data set that"}, {"start": 1196.76, "end": 1201.6399999999999, "text": " you then train for then of course the the image net baseline is going to outperform"}, {"start": 1201.6399999999999, "end": 1209.68, "text": " it but so pretty cool to see here that in this smaller image regime and also"}, {"start": 1209.68, "end": 1214.6, "text": " consider this down here if you go even in order of magnitude lower it's really"}, {"start": 1214.6, "end": 1220.8, "text": " shining that if you have higher quality information and you make use of it you"}, {"start": 1220.8, "end": 1226.6399999999999, "text": " don't need as many images and now we knew this for a long time but this now is"}, {"start": 1226.6399999999999, "end": 1235.12, "text": " showing the same for transfer learning for visual transfer learning so this"}, {"start": 1235.12, "end": 1242.44, "text": " was when we froze the backbone and then we trained a linear classifier on top"}, {"start": 1242.44, "end": 1249.04, "text": " they go they make a short excursion here and show how different parts of their"}, {"start": 1249.04, "end": 1255.0, "text": " model affect their final performance and they find that for example the by"}, {"start": 1255.0, "end": 1261.24, "text": " captioning which I believe is the is forward and backward captioning"}, {"start": 1261.24, "end": 1267.24, "text": " significantly helps for example compared to only forward captioning and they"}, {"start": 1267.24, "end": 1272.0, "text": " also find that it's significantly outperforms other pre-training tasks that"}, {"start": 1272.0, "end": 1277.8799999999999, "text": " they could do and they also investigate whether how big their models should be"}, {"start": 1277.88, "end": 1285.3200000000002, "text": " so here this is their baseline model I was wrong actually they it's one layer"}, {"start": 1285.3200000000002, "end": 1294.92, "text": " of with 1024 you can see as you make the layer bigger and bigger that"}, {"start": 1294.92, "end": 1299.92, "text": " generally helps but I guess they decided against it because the gains are too"}, {"start": 1299.92, "end": 1306.48, "text": " little too to afford to make it worth and also if you make the network deeper"}, {"start": 1306.48, "end": 1312.0, "text": " here you make the transformer have more layers the performance goes up but"}, {"start": 1312.0, "end": 1315.52, "text": " again the gains are marginal so I guess they're gonna leave it away so their"}, {"start": 1315.52, "end": 1321.3600000000001, "text": " baseline as you can see is these resonant 50 with the one layer of a thousand"}, {"start": 1321.3600000000001, "end": 1331.28, "text": " and 24 size so this is now the last task it's the fine-tuning task so this is"}, {"start": 1331.28, "end": 1336.44, "text": " what most people would do is they would train a backbone and then they would"}, {"start": 1336.44, "end": 1340.96, "text": " fine-tune it on a different data sets on or on a different task where they"}, {"start": 1340.96, "end": 1347.3999999999999, "text": " don't have much labels and here the situation looks a bit different so if you"}, {"start": 1347.3999999999999, "end": 1353.16, "text": " look at for example a task on Coco so there are several tasks on Coco one of"}, {"start": 1353.16, "end": 1359.6, "text": " them is image captioning which they use for pre-training if you do other tasks"}, {"start": 1359.6, "end": 1368.24, "text": " on Coco you can see right here that compared to the supervised baseline this"}, {"start": 1368.24, "end": 1375.08, "text": " vertex it performs about the same or maybe a bit worse but what you can see is"}, {"start": 1375.08, "end": 1382.52, "text": " it performs significantly better than for example moco that was only trained"}, {"start": 1382.52, "end": 1387.6799999999998, "text": " on Coco so again this shows that if you have the same data set higher quality"}, {"start": 1387.68, "end": 1393.8400000000001, "text": " information makes it worth it and it's even better as you can see on moco that"}, {"start": 1393.8400000000001, "end": 1398.72, "text": " was trained on ImageNet it's just not quite as good as the supervised baseline"}, {"start": 1398.72, "end": 1403.1200000000001, "text": " but all of them of course are better than just a randomly initialized"}, {"start": 1403.1200000000001, "end": 1406.44, "text": " network that is trained from scratch I mean that's the entire point of"}, {"start": 1406.44, "end": 1411.1200000000001, "text": " transfer learning that you are better than simply learning from scratch and"}, {"start": 1411.12, "end": 1419.32, "text": " this shows throughout this experiment except in this LVIS masking task where"}, {"start": 1419.32, "end": 1424.6399999999999, "text": " they do outperform the other the other things the other methods"}, {"start": 1424.6399999999999, "end": 1430.9599999999998, "text": " significantly now the lower numbers on this tasks task also means that the task"}, {"start": 1430.9599999999998, "end": 1436.8, "text": " is harder than these tasks right here and therefore there are more gains to be"}, {"start": 1436.8, "end": 1442.12, "text": " made and therefore you could hypothesize that the bigger the more quality"}, {"start": 1442.12, "end": 1447.3999999999999, "text": " information that you input can be used in a better way so maybe more complex"}, {"start": 1447.3999999999999, "end": 1452.76, "text": " also the more complex a task is might also have an influence on how well the"}, {"start": 1452.76, "end": 1457.68, "text": " transfer learning works if you come from a high quality transfer learning task"}, {"start": 1457.68, "end": 1468.2, "text": " versus a low quality transfer learning tasks yeah so they lastly compare here"}, {"start": 1468.2, "end": 1474.48, "text": " with the again with Pascal VOC object detection and these iNaturalist"}, {"start": 1474.48, "end": 1480.04, "text": " classification where I believe this is also a transfer learning task with fine"}, {"start": 1480.04, "end": 1487.16, "text": " tuning and as you can see they can also hold up against the supervised baseline"}, {"start": 1487.16, "end": 1491.8400000000001, "text": " or even outperform it at sometimes the green triangles mean that they out"}, {"start": 1491.8400000000001, "end": 1498.0, "text": " perform it by a significant margin but then on this task right here they again"}, {"start": 1498.0, "end": 1505.16, "text": " lag behind so I think the point of the paper isn't really to show that that"}, {"start": 1505.16, "end": 1510.4, "text": " this is the best thing ever but the point of the paper is to show that you can"}, {"start": 1510.4, "end": 1516.2, "text": " go about pre-training basically the the common assumption is that you need more"}, {"start": 1516.2, "end": 1521.0, "text": " and more and more and more data for your model to learn about the data set and"}, {"start": 1521.0, "end": 1527.24, "text": " they conclude here no actually you can do with with very few data points as"}, {"start": 1527.24, "end": 1533.3600000000001, "text": " long as they have high quality annotations okay so I think that's the point of"}, {"start": 1533.3600000000001, "end": 1537.92, "text": " the of the paper and they don't always outperform the other base lines and"}, {"start": 1537.92, "end": 1543.96, "text": " whatnot but they keep they keep the performance the same which basically"}, {"start": 1543.96, "end": 1548.8400000000001, "text": " means that this is an option here is a pretty cool result where they"}, {"start": 1548.8400000000001, "end": 1553.44, "text": " visualize the attention of their image captioning model because they train an"}, {"start": 1553.44, "end": 1557.4, "text": " image captioning model and you can really see that the image captioning model"}, {"start": 1557.4, "end": 1563.96, "text": " learns something meaningful about the image so when it's a bird flying the"}, {"start": 1563.96, "end": 1568.44, "text": " attention is mainly on the bird as you can see then over the the attention"}, {"start": 1568.44, "end": 1574.4, "text": " widened out over the image air so over the air the attention is here in the"}, {"start": 1574.4, "end": 1580.8, "text": " sky and on the on the ocean and this goes near the ocean and then the attention"}, {"start": 1580.8, "end": 1586.8400000000001, "text": " is on the ocean itself as you can see so they have a bunch of these images and"}, {"start": 1586.8400000000001, "end": 1592.52, "text": " they're they're pretty cool here a dog so focused on the dog riding on and then"}, {"start": 1592.52, "end": 1599.56, "text": " you can see the attention going down because on is riding on means probably"}, {"start": 1599.56, "end": 1605.6, "text": " there's something below the dog a surfboard now the attention is fully on the"}, {"start": 1605.6, "end": 1611.2, "text": " surfboard in so as soon as you say in the attention as you can see it widens out"}, {"start": 1611.2, "end": 1616.32, "text": " so I think that's that's fairly cool fairly cool demonstration that the"}, {"start": 1616.32, "end": 1622.84, "text": " model understands sort of the the in relation namely if it is focused on"}, {"start": 1622.84, "end": 1627.1599999999999, "text": " something and that something is in something else then it widens the attention"}, {"start": 1627.1599999999999, "end": 1633.4399999999998, "text": " how to see what it is in okay the ocean and then it focuses the attention on the"}, {"start": 1633.4399999999998, "end": 1638.52, "text": " ocean so that's that's a pretty that's a pretty cool result I guess we already"}, {"start": 1638.52, "end": 1643.04, "text": " knew this because we could train image captioning models before it's just to"}, {"start": 1643.04, "end": 1648.56, "text": " show that it actually makes sense to use them as a pre-training task for"}, {"start": 1648.56, "end": 1654.2, "text": " backbones now what's the future of this the authors here in their introduction"}, {"start": 1654.2, "end": 1660.6, "text": " they make a claim that this has a good future because they hear they only"}, {"start": 1660.6, "end": 1665.3999999999999, "text": " train on this small data set right it's smaller than image net as you can see"}, {"start": 1665.3999999999999, "end": 1669.6, "text": " here and they already get the same performance as if you train on the whole"}, {"start": 1669.6, "end": 1674.0, "text": " image net data set in a supervised fashion of course they're also supervised"}, {"start": 1674.0, "end": 1679.6799999999998, "text": " but they have ten times less images and they they say something to the effect"}, {"start": 1679.6799999999998, "end": 1685.48, "text": " of you do you know it would be pretty easy to collect more data for this task"}, {"start": 1685.48, "end": 1690.1599999999999, "text": " because the internet is full of images and mostly these images have like some"}, {"start": 1690.1599999999999, "end": 1696.48, "text": " text with them they you know they have these descriptions or they have text"}, {"start": 1696.48, "end": 1699.96, "text": " around the people write something about the images you could like mine Twitter"}, {"start": 1699.96, "end": 1704.44, "text": " and then the responses when someone posts an image might tell you something"}, {"start": 1704.44, "end": 1711.08, "text": " about the image but this definitely counteracts their this definitely counteracts"}, {"start": 1711.08, "end": 1715.72, "text": " their notion that these are very high quality labels right their entire"}, {"start": 1715.72, "end": 1721.64, "text": " point here was that these annotations these these datasets with these these"}, {"start": 1721.64, "end": 1726.5200000000002, "text": " image captioning dates sets like cocoa they have very very high quality annotations"}, {"start": 1726.5200000000002, "end": 1732.2, "text": " so this this text here is very high quality it's really a descriptive text of"}, {"start": 1732.2, "end": 1738.44, "text": " the image that tries to capture what a human can see visually in the image and"}, {"start": 1738.44, "end": 1744.0400000000002, "text": " as soon as you go out to the internet and collect a text around images"}, {"start": 1744.0400000000002, "end": 1748.3600000000001, "text": " that's not going to be the case that information is again going to be quite"}, {"start": 1748.36, "end": 1753.04, "text": " low quality and so I doubt that the performance here would hold up or that the"}, {"start": 1753.04, "end": 1759.76, "text": " claim you can easily you know you can easily create more data for this task"}, {"start": 1759.76, "end": 1764.6, "text": " holds up so that's a bit my worry about the future of this but it's definitely"}, {"start": 1764.6, "end": 1771.28, "text": " cool and definitely shows these quality quantity trade-off very well all right"}, {"start": 1771.28, "end": 1777.08, "text": " that was my two cents to the paper I invite you to read it and tell me in the"}, {"start": 1777.08, "end": 1781.0, "text": " comments what you think about it and I'll see you next time"}] |
Yannic Kilcher | 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 Lin former self-attention with linear complexity by Sinon Wang, Belinda Li, Madyan, Kapsa, Han Fang and Haoma 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 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 will 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-square 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, so 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 feet-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 queries and keys. So this 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. And 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. And this, if our sequence length here is of length n, is going to require n squared operations. 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 isn't 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, how we want to 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, like of rank 512. It 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 you know, 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 so such that you don't only have one attention mechanism, you have multiple attention mechanism 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 4. 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 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, this thing here, this matrix here is low rank. And therefore, that's what this paper sort of exploits. 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. All right. 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, 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 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. All right. Now, the first thing they're going to show is that this is in fact 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. Sorry, if you want to go look those up. But it is one of these transformer models. And they take two datasets, 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. So there is no particular dimension 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 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. So 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 5, 12, by 5, 12. 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 pretty much flat curve or slowly ascending curve like this. 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 5, 12, by 5, 12. So if we do this, this is sort of what they're doing in this, this will construct a 512 by 512 matrix, but that is only of rank 128. And you can see that at the 128 singular or eigen value, this snaps right at the at the 1. So it's sort of like what they what they have. Okay, so we've seen the difference between a, let's say, higher 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, 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 eigen values are 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 or 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'll 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. Sahaha. 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. God, I'm a dumb. Never mind, this will work as well. So you already get this sort of 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 way, 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 gousin, 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 a 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. I'm going to go through this just glanced 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 rank. 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 here, 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's 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 had I route my information using the original routing matrix. That I 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 that 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 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 matrix, but ultimately this is a matrix right here, right? 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 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 smaller than a constant time 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. 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 a low dimensional data. 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 this here should read something like the Johnson-Lindon Strauss lemma exists or something like this. I'm not sure, like convinced 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 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 allow our dimension. And that's not the case here. You actually project the n. So 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. And 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're doing it 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 this inner dimension d 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 random Gaussian matrix that assigns weights to mix these five into these two. And again, because that the jail 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 and squared, you now have o and k. If 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 to project 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 sorry 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 JL 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 already a hint to it. In the first theorem, you had to 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 here 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. 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-Littins-Rouse 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 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 under projection up. And the the lemma 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 low rank, can you make a claim that the entire softmax then is also low rank? And it's not entirely clear because, 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 Yonic 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 subslices 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 I 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. All right, back to Yonic in the past who is wholly surprised that the two that if you multiply MT by itself, that that will give you back the exact same thing. All right, 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 result in K has a dependency and sequence likes 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 have it. The decay 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 lipsticks 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 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. All right, so for given choices of delta and K, they have shown that the linear informer 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. The 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, a linear informer with K calls 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 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 in the original transformer paper the perplexity is hovered between like three points something and five points 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 in 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 and to the lower dimension you project the more these gains are, but of course the more performance you're going to lose potentially. Hello again, Janik from the future. I 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, impact 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 honestly I agree with them, right? I completely agree with them that this is sort of a good thing. You might trade off some accuracy, you might make some approximations, but you'll get a much faster model. This model has any model can be used for things. They now have to pull out of their butt some way in over five steps of intermediate layers. 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 past Yannick. All right, this was the Linformer paper. I hope this somewhat 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.12, "text": " Hi there. Today we're going to look at Lin former self-attention with linear complexity"}, {"start": 6.12, "end": 14.280000000000001, "text": " by Sinon Wang, Belinda Li, Madyan, Kapsa, Han Fang and Haoma of Facebook AI. So on a high"}, {"start": 14.280000000000001, "end": 20.64, "text": " level, this paper observes that often the way we build transformers, the self-attention"}, {"start": 20.64, "end": 28.52, "text": " matrix is low rank and can be approximated by first projecting the signal to a lower-dimensional"}, {"start": 28.52, "end": 34.84, "text": " space and then performing these inner products that are responsible for attention in there. And"}, {"start": 34.84, "end": 44.6, "text": " thereby you save a lot of the complexity of multiplying full sequence length by full sequence"}, {"start": 44.6, "end": 51.6, "text": " length matrices, but instead do these operations in the lower-dimensional space. And they achieve"}, {"start": 51.6, "end": 60.56, "text": " a linear scaling of the transformer attention and will figure out how that is. As always, if"}, {"start": 60.56, "end": 67.92, "text": " you like content like this, consider subscribing, sharing, liking and commenting if you feel"}, {"start": 67.92, "end": 75.48, "text": " like it. Okay, let's dive in. They say large transformer models have shown extraordinary"}, {"start": 75.48, "end": 80.56, "text": " success in achieving state-of-the-art results in many natural language processing applications."}, {"start": 80.56, "end": 87.64, "text": " Okay, so these, if you don't know what a transformer model is, you can watch my video on the paper"}, {"start": 87.64, "end": 94.52000000000001, "text": " attention is all you need. That was sort of the beginning of these transformers and it introduces"}, {"start": 94.52000000000001, "end": 99.52000000000001, "text": " the attention mechanism that we're going to look at today. If you don't know what an attention"}, {"start": 99.52000000000001, "end": 106.24000000000001, "text": " mechanism is, you're not going to have a fun time in this paper. They say, however, training"}, {"start": 106.24, "end": 111.72, "text": " and deploying these models can be prohibitively costly for long sequences as the standard"}, {"start": 111.72, "end": 117.75999999999999, "text": " self-attention mechanism of the transformer uses n-square time and space with respect to"}, {"start": 117.75999999999999, "end": 125.44, "text": " the sequence length. Now, why is that? So really shortly to recap, recap this, the attention"}, {"start": 125.44, "end": 131.56, "text": " mechanism, the, this attention, these transformers, they transform for basics, let's say they"}, {"start": 131.56, "end": 139.08, "text": " transform one sequence into another. So here we have five tokens and the next layer will"}, {"start": 139.08, "end": 145.52, "text": " output five tokens. Okay, so five tokens in five tokens out. And the question is, how"}, {"start": 145.52, "end": 152.24, "text": " do you route information between these five tokens from the first layer to produce the"}, {"start": 152.24, "end": 157.64000000000001, "text": " next layer? In a feet-forward network, you would simply connect everything to everything"}, {"start": 157.64, "end": 163.88, "text": " and sort of learn the weights of these, of these connections. That's not what we do here."}, {"start": 163.88, "end": 168.64, "text": " In a convolutional network, you would simply connect each node to its immediate neighbors"}, {"start": 168.64, "end": 174.79999999999998, "text": " like this. But this is also not what we do here. What we do here is we route the information"}, {"start": 174.79999999999998, "end": 180.88, "text": " according to the information itself. So according to the incoming information right here, we"}, {"start": 180.88, "end": 189.84, "text": " route the information that goes out. And we do that by expressing queries and keys. So"}, {"start": 189.84, "end": 194.96, "text": " this incoming information is transformed, first of all, into what are called keys. Now"}, {"start": 194.96, "end": 201.16, "text": " keys are simply vectors. So each node is going to expose a vector right here. And each"}, {"start": 201.16, "end": 206.56, "text": " node in the higher layer, now these are produced by the same, from the same information down"}, {"start": 206.56, "end": 211.44, "text": " here, but I'm going to draw it conceptually on the higher layer. So each node here is"}, {"start": 211.44, "end": 217.4, "text": " going to expose a query, which is sort of like calling the query is calling for what"}, {"start": 217.4, "end": 222.16, "text": " kind of information do you want from the lower layer. And the key is sort of exposing what"}, {"start": 222.16, "end": 230.08, "text": " type of information this node contains right now. And now the information is simply routed"}, {"start": 230.08, "end": 236.08, "text": " by looking at the inner products of these, of the keys and the queries. So this information"}, {"start": 236.08, "end": 242.0, "text": " right here would probably be routed to this node right here, whereas this one would probably"}, {"start": 242.0, "end": 247.48000000000002, "text": " be routed here. This one would be routed here. In fact, this is a soft assignment. So"}, {"start": 247.48000000000002, "end": 251.92000000000002, "text": " it's not like a hard routing. It's a soft routing. Everything is routed to everything"}, {"start": 251.92000000000002, "end": 257.44, "text": " with different weights, but the majority goes to the place where the inner product is"}, {"start": 257.44, "end": 263.52000000000004, "text": " high. And this one is again routed here. So you can see this is the attention mechanism."}, {"start": 263.52, "end": 270.03999999999996, "text": " In order to do this, we need to compute the inner product of every single one of these queries"}, {"start": 270.03999999999996, "end": 277.28, "text": " with every single one of these keys. And this, if our sequence length here is of length"}, {"start": 277.28, "end": 288.28, "text": " n, is going to require n squared operations. Now here is another parameter we need to pay"}, {"start": 288.28, "end": 293.96, "text": " attention. These vectors here, they have a certain dimension. And the certain dimension"}, {"start": 293.96, "end": 301.52, "text": " we're going to call d, the inner, the embedding dimension of the vectors. Now in modern"}, {"start": 301.52, "end": 309.35999999999996, "text": " transformers, you can think of n as something like maybe 512 tokens go into a transformer"}, {"start": 309.35999999999996, "end": 315.2, "text": " like this. And the hidden dimension here also isn't the same order of magnitude. So you"}, {"start": 315.2, "end": 321.47999999999996, "text": " can also imagine this to be something like 512. Now if you think of these matrices, if"}, {"start": 321.47999999999996, "end": 328.44, "text": " you multiply the keys by the queries, how we want to do it like this, then you have"}, {"start": 328.44, "end": 336.12, "text": " the keys are n by d and the queries are d by n. Okay. Now since n and d in this case"}, {"start": 336.12, "end": 341.84, "text": " are the same dimension, this matrix is of rank, like of rank 512. It doesn't have to"}, {"start": 341.84, "end": 348.28, "text": " be, but it's a pretty good bet that it's of rank 512. Maybe it's approximately lower"}, {"start": 348.28, "end": 356.84, "text": " rank, but you know, now, this isn't actually the modern way of transformers as such, because"}, {"start": 356.84, "end": 362.44, "text": " usually what we have is multi head attention, which means that we're going to split this"}, {"start": 362.44, "end": 367.59999999999997, "text": " inner dimension right here. We're going to split these vectors into many, many lower dimensional"}, {"start": 367.6, "end": 373.0, "text": " vectors and then have attention mechanism on these lower dimensional vectors. And that's"}, {"start": 373.0, "end": 379.40000000000003, "text": " so such that you don't only have one attention mechanism, you have multiple attention mechanism"}, {"start": 379.40000000000003, "end": 386.68, "text": " so you can route different kinds of information with these multiple attention heads. Now sometimes"}, {"start": 386.68, "end": 391.92, "text": " you would split this, you could split this in a modern transformer up to like 16 different"}, {"start": 391.92, "end": 397.44, "text": " heads, but here we're going to, let's say we're going to split this into four sub vectors,"}, {"start": 397.44, "end": 405.68, "text": " each of 128 dimensions. Okay. So we're going to split this up. And now if this in this"}, {"start": 405.68, "end": 411.0, "text": " product here is only computed on these lower dimensional vectors. So all of a sudden,"}, {"start": 411.0, "end": 418.88, "text": " you no longer have n by d, but you have like n by d over 4. And now this is 512 still,"}, {"start": 418.88, "end": 426.8, "text": " but this now is 128. So the rank of this matrix is going to be 128. Mind it's still the"}, {"start": 426.8, "end": 436.24, "text": " thing that comes out is still a 512 by 512 matrix, but it is of rank 128. And that means"}, {"start": 436.24, "end": 444.24, "text": " even though this matrix contains vectors that are of size 512, they could be, they could"}, {"start": 444.24, "end": 455.88, "text": " be represented accurately by a matrix that's just 128 dimensions. Okay. So these 512 dimensions"}, {"start": 455.88, "end": 464.0, "text": " actually only contain information that is 128 dimensional in nature. It's just distributed"}, {"start": 464.0, "end": 472.68, "text": " over 512 dimensions, but most of these are redundant. So in fact, in these modern transformers,"}, {"start": 472.68, "end": 478.92, "text": " this thing here, this matrix here is low rank. And therefore, that's what this paper sort"}, {"start": 478.92, "end": 490.52, "text": " of exploits. We could approximate this by 128 dimensions. Okay. This is our starting point."}, {"start": 491.88, "end": 497.88, "text": " They go on and they say in this paper, we demonstrate that the self-attention mechanism can be"}, {"start": 497.88, "end": 504.84, "text": " approximated by a low rank matrix. We further exploit this finding to propose a new self-attention"}, {"start": 504.84, "end": 512.2, "text": " mechanism, which reduces the overall self-attention complexity from n squared to n in both time and space."}, {"start": 512.76, "end": 519.16, "text": " The resulting linear transformer, the linformer performs on par with standard transformer models"}, {"start": 519.16, "end": 527.64, "text": " while being much more memory and time efficient. All right. So let's dive into their thing. This"}, {"start": 527.64, "end": 535.24, "text": " is how they formulate the attention mechanism. So right here, the attention has queries and keys,"}, {"start": 535.24, "end": 542.36, "text": " as you can see here. Now these W matrices, you can largely ignore the W simply maps the queries to,"}, {"start": 543.08, "end": 549.88, "text": " these are simply d by d matrices that are a linear transformation of the queries. You can sort of"}, {"start": 549.88, "end": 557.16, "text": " overlook them for the arguments in this paper. So these are the keys and the queries we talked about,"}, {"start": 557.16, "end": 562.76, "text": " the values here, this is the actual information that's being routed. So what we want to do is we"}, {"start": 562.76, "end": 568.92, "text": " want to compute this product between queries and keys right here and scale it appropriately."}, {"start": 568.92, "end": 574.68, "text": " But ultimately, this is this product. Then run this through a softmax operation."}, {"start": 575.48, "end": 581.24, "text": " That means we normalize it such that it sums to one, the distribution sums to one."}, {"start": 581.24, "end": 588.52, "text": " And then we want to route this information according to that distribution. Okay."}, {"start": 588.52, "end": 595.8, "text": " So that's how they formulate an attention mechanism. Now notice something. This thing in here"}, {"start": 595.8, "end": 601.32, "text": " is what they call the matrix A. And this is what I've demonstrated to be low rank."}, {"start": 601.32, "end": 609.96, "text": " Now, the actual thing that you would need to be low rank for their paper to hold is the matrix P,"}, {"start": 609.96, "end": 616.9200000000001, "text": " which is different because this is after the softmax. Right. So if the matrix P is low rank,"}, {"start": 616.9200000000001, "end": 624.6, "text": " then you have a legitimate claim of approximating this routing via a low rank matrix. However,"}, {"start": 624.6, "end": 634.0400000000001, "text": " if P is not low rank, you don't. Okay. All right. Now, the first thing they're going to show is that"}, {"start": 634.04, "end": 640.4399999999999, "text": " this is in fact low rank. So self attention is low rank. And for that, they make an empirical"}, {"start": 640.4399999999999, "end": 648.92, "text": " investigation into Roberta. So Roberta is a model that's based on Bert. And I have made videos of"}, {"start": 648.92, "end": 657.0799999999999, "text": " both Bert and Roberta, I believe. Sorry, if you want to go look those up. But it is one of these"}, {"start": 657.0799999999999, "end": 663.7199999999999, "text": " transformer models. And they take two datasets, wiki 103 and IMDB. And they run them through"}, {"start": 663.72, "end": 671.24, "text": " this model. And they look at this P matrix. So they look at how this this information routing"}, {"start": 671.24, "end": 680.6, "text": " matrix is built. And then they calculate the eigenvalues of that. So you calculate the eigenvalues."}, {"start": 680.6, "end": 687.5600000000001, "text": " And by looking at the eigenvalues, you can look at the rank of a matrix, broadly speaking."}, {"start": 687.56, "end": 696.52, "text": " So if you list the eigenvalues in order of their size, then a matrix that is sort of high"}, {"start": 696.52, "end": 703.4799999999999, "text": " dimensional has a high rank would have sort of a slope like this. And that means as you go,"}, {"start": 704.1199999999999, "end": 711.64, "text": " as you go to the next and next and next eigenvalue, they drop. Like if you order a set of"}, {"start": 711.64, "end": 718.92, "text": " uniformly distributed numbers, if you order them, then it would look like this. So there is no"}, {"start": 718.92, "end": 724.52, "text": " particular dimension that's better than any or has much more information than any other."}, {"start": 724.52, "end": 730.52, "text": " However, if the matrix is approximately low rank, you would look something like this. And that"}, {"start": 730.52, "end": 735.96, "text": " would mean that most of the information is concentrated in very few dimensions. And those are the"}, {"start": 735.96, "end": 743.0, "text": " ones with very high eigenvalues. And most of the dimensions have no information. The thing you see"}, {"start": 743.0, "end": 749.32, "text": " here is simply the cumulative sum of these things. So if you calculate the cumulative sum of this,"}, {"start": 749.32, "end": 757.08, "text": " you'll get that over here. So if this is very high rank, you would expect a curve that goes like"}, {"start": 757.08, "end": 764.36, "text": " this sort of slanted, but not very. If this is very low rank, you would expect a curve that goes"}, {"start": 764.36, "end": 771.72, "text": " very much into the corner right here. And they show that the general shape here is such that"}, {"start": 773.4, "end": 781.0, "text": " there is this kind of a kink to it as you can see here. Now also notice that the axis here"}, {"start": 781.0, "end": 786.6800000000001, "text": " starts at 0.4. So actually this comes from down here somewhere and goes up and then goes like this."}, {"start": 786.6800000000001, "end": 792.44, "text": " So they have a, I feel they have a legitimate claim here that these matrices are approximately"}, {"start": 792.44, "end": 799.0, "text": " low rank. And here they look at, I don't actually know at which layer this is or if this is in"}, {"start": 799.0, "end": 805.5600000000001, "text": " all of the layers overall or something like this, but they look at how this develops inside the"}, {"start": 805.5600000000001, "end": 815.0, "text": " layers. So they look at the always the 128th eigenvalue. And they discover that as they go deeper"}, {"start": 815.0, "end": 821.0, "text": " and deeper into the network, this cumulative eigenvalue is higher and higher. That means that"}, {"start": 821.0, "end": 828.52, "text": " network puts more and more information into fewer and fewer dimension in this routing as you go"}, {"start": 828.52, "end": 834.12, "text": " up the layers. So it gets more and more skewed. So as you go up the layers, it gets more and more"}, {"start": 834.12, "end": 841.96, "text": " into this corner right here. So their claim appears to be more and more true. Now I have sort of"}, {"start": 841.96, "end": 848.28, "text": " thought about this a little and I've tried it out a bit myself and I invite you to just follow me"}, {"start": 848.28, "end": 858.28, "text": " here shortly. So right here I have a matrix that is just a random Gaussian matrix of size 5, 12,"}, {"start": 858.28, "end": 864.36, "text": " by 5, 12. If we look at the eigen spectrum of that, so I have this function SVD, it simply gives"}, {"start": 864.36, "end": 872.04, "text": " me the eigen spectrum of that. Then you can see that it sort of falls off uniformly and that will"}, {"start": 872.04, "end": 884.68, "text": " result in a in this cumulative sum of pretty much flat curve or slowly ascending curve like this."}, {"start": 886.52, "end": 892.12, "text": " Now if we actually have a low rank matrix, this would look different. This would have this"}, {"start": 892.12, "end": 898.76, "text": " sort of typical kink in it. And we can demonstrate that by making a lower dimensional matrix. So let's"}, {"start": 898.76, "end": 910.2, "text": " just take, let's just go 512 by 128 of this lower dimensional m. And let's look at the mt."}, {"start": 910.92, "end": 918.4399999999999, "text": " Now this only goes to 128 because we only get back 128 singular values. So let's make a lower"}, {"start": 918.4399999999999, "end": 926.6, "text": " dimensional matrix that's actually 5, 12, by 5, 12. So if we do this, this is sort of what they're"}, {"start": 926.6, "end": 937.5600000000001, "text": " doing in this, this will construct a 512 by 512 matrix, but that is only of rank 128."}, {"start": 939.88, "end": 948.9200000000001, "text": " And you can see that at the 128 singular or eigen value, this snaps right at the at the 1. So it's"}, {"start": 948.92, "end": 956.36, "text": " sort of like what they what they have. Okay, so we've seen the difference between a, let's say,"}, {"start": 956.36, "end": 963.56, "text": " higher rank matrix and the low rank matrix in this cumulative sum plot. Now I want to go back to"}, {"start": 963.56, "end": 969.7199999999999, "text": " the original matrix right here. Of course, the matrices they look at, these routing matrices,"}, {"start": 969.7199999999999, "end": 976.8399999999999, "text": " they're not Gaussian, they're not sort of distributed with mean zero and the nice variance. They"}, {"start": 976.84, "end": 982.52, "text": " are the result of a softmax operation. And in particular, that means they're all positive."}, {"start": 982.52, "end": 989.08, "text": " And that means that their mean is not zero. So if you look at a data set and it's mean, it's not"}, {"start": 989.08, "end": 993.8000000000001, "text": " zero. And you calculate like the eigen values are in this case, the principal component."}, {"start": 995.88, "end": 1002.36, "text": " You will find that the first one will be very strong because that must account for the fact that"}, {"start": 1002.36, "end": 1012.28, "text": " the mean is not at the center or the first few will be like this. So it is sort of maybe we can"}, {"start": 1012.28, "end": 1019.48, "text": " replicate this right here. So let's say we'll put m through, let's first go with the absolute value"}, {"start": 1019.48, "end": 1030.3600000000001, "text": " of m. Okay, not much of a change, but you'll already see that this axis doesn't start at zero."}, {"start": 1030.36, "end": 1035.0, "text": " So let's go, let's actually, how do we do this?"}, {"start": 1036.6799999999998, "end": 1042.4399999999998, "text": " Xlim, right? Xlim zero. None."}, {"start": 1045.0, "end": 1051.7199999999998, "text": " Sahaha. Okay. So the first one you simply have to imagine or I can do even something,"}, {"start": 1051.72, "end": 1062.2, "text": " something more. We can just put a zero in front here. And that should do the trick. No, yes."}, {"start": 1063.08, "end": 1070.52, "text": " Oh, that's X. I meant Y. God, I'm a dumb. Never mind, this will work as well. So you already get"}, {"start": 1070.52, "end": 1079.4, "text": " this sort of of kink. And let's put it into the softmax. So we put a softmax."}, {"start": 1079.4, "end": 1086.68, "text": " And that gives you also this kink. Now you might think that way, this is that this kink looks"}, {"start": 1086.68, "end": 1094.3600000000001, "text": " a lot smaller than the other kink. So, but if we simply modify, let's modify the standard deviation"}, {"start": 1094.3600000000001, "end": 1100.1200000000001, "text": " of this random matrix. And you can see that the spectrum immediately changes, right? Because of"}, {"start": 1100.1200000000001, "end": 1106.0400000000002, "text": " the interaction now between the softmax and the standard deviation. If I only were to change the"}, {"start": 1106.04, "end": 1112.52, "text": " standard deviation on the normal M matrix. And we can actually try this right here."}, {"start": 1114.28, "end": 1118.92, "text": " That wouldn't do much. That would still look pretty much the same. It's just differently scaled."}, {"start": 1118.92, "end": 1126.12, "text": " But in the interaction with the softmax now, this changes the spectrum dramatically. And here,"}, {"start": 1126.12, "end": 1131.3999999999999, "text": " as you know, these these transformers have always sort of like layer normalization and so on. So"}, {"start": 1131.4, "end": 1138.68, "text": " probably the standard deviation if we if if these are sort of gousin, the standard deviation"}, {"start": 1138.68, "end": 1143.96, "text": " before the softmax would be a lot smaller. So let's go something like this."}, {"start": 1146.44, "end": 1155.0800000000002, "text": " So smaller than one. And can we run this, please? And you can see that this kink immediately"}, {"start": 1155.08, "end": 1163.0, "text": " appears. Now, it's not it's it's not the same thing as this other as this here because this is"}, {"start": 1163.0, "end": 1170.9199999999998, "text": " a lot smoother as you can see right here. But still, I feel that this might not actually be a result"}, {"start": 1170.9199999999998, "end": 1176.9199999999998, "text": " of the you know, the fact that this is an attention mechanism, but it simply might be the result of"}, {"start": 1176.9199999999998, "end": 1183.96, "text": " that you apply a softmax. Now, still that doesn't change the fact that it is a"}, {"start": 1183.96, "end": 1192.44, "text": " approximately a low rank matrix. So everything they say holds, but yeah, maybe maybe one should"}, {"start": 1192.44, "end": 1199.32, "text": " also look into why exactly that happens. But in fact, it is low rank. Okay, it is approximately"}, {"start": 1199.32, "end": 1206.8400000000001, "text": " low rank. They've demonstrated this. And now they go to their first first theory below. We provide"}, {"start": 1206.84, "end": 1214.52, "text": " a theoretical answer, a theoretical analysis of the above spectrum results. Okay, so the theoretical"}, {"start": 1214.52, "end": 1223.8799999999999, "text": " analysis theorem one is self attention is low rank. I'm going to go through this just glanced at"}, {"start": 1223.8799999999999, "end": 1230.6799999999998, "text": " it for now. They say for any of these query key values and these matrices, which of course you"}, {"start": 1230.68, "end": 1239.16, "text": " can ignore for now for any column vector, w of matrix V, w and w here, that's the information that"}, {"start": 1239.16, "end": 1247.64, "text": " needs to be routed. There exists a low rank matrix P tilde. So this P tilde here is going to be"}, {"start": 1247.64, "end": 1255.64, "text": " their low rank approximation of the P matrix. You can see it's still n by n, but it's going to be"}, {"start": 1255.64, "end": 1262.3600000000001, "text": " low rank. In fact, it's going to be of the order of the logarithm of the rank of the full matrix."}, {"start": 1263.72, "end": 1270.2800000000002, "text": " Or well, the full matrix of the rank that the full matrix could have, as we have already seen,"}, {"start": 1270.2800000000002, "end": 1279.0, "text": " the full matrix doesn't have full rank, but yeah, okay. So if you use, and this is the type of"}, {"start": 1279.0, "end": 1286.12, "text": " guarantee you get. So what do we see here? It basically means that this distance here is smaller"}, {"start": 1286.84, "end": 1293.88, "text": " than this. And this here, this is just the norm of one of these vectors projected times this error"}, {"start": 1293.88, "end": 1300.84, "text": " coefficient epsilon. So all it says is that the distance on the left is smaller than something."}, {"start": 1300.84, "end": 1307.08, "text": " And that's occurs with high probability. Okay. So the entire guarantee here, the entire formula"}, {"start": 1307.08, "end": 1313.96, "text": " just basically means that this thing is small. This norm is small. What's this norm? This norm"}, {"start": 1313.96, "end": 1320.9199999999998, "text": " is the distance between these two things. Now, what are these two things? This is the information"}, {"start": 1320.9199999999998, "end": 1327.8, "text": " that we want to route. And this is the routing matrix. And that simply means that if I route my"}, {"start": 1327.8, "end": 1337.32, "text": " information using the p tilde, this approximation, then I won't be too far away as if I had routed my"}, {"start": 1337.32, "end": 1344.44, "text": " information using the original p matrix. Okay. That's, that's it. That's what the theorem says. The"}, {"start": 1344.44, "end": 1351.1599999999999, "text": " theorem says if I route my information using this approximation, then I am not too far away as"}, {"start": 1351.1599999999999, "end": 1357.3999999999999, "text": " had I route my information using the original routing matrix. That I don't say how they're going"}, {"start": 1357.4, "end": 1366.1200000000001, "text": " to construct. They simply say there exists a low rank matrix like this. And the proof of this,"}, {"start": 1366.1200000000001, "end": 1372.44, "text": " and it's sort of worth looking at the proof of it, it uses the Johnson-Lindenstrauss lemma."}, {"start": 1372.44, "end": 1382.52, "text": " This thing here or the JL for short. And they're going to get this out of the JL. Now the Johnson-Linden"}, {"start": 1382.52, "end": 1388.92, "text": "strauss lemma in a classic sense says something like this. If I have data in a high-dimensional space,"}, {"start": 1388.92, "end": 1397.32, "text": " here in a three-dimensional space, okay, I've data distributed. And I use a certain kind of projection"}, {"start": 1397.32, "end": 1404.12, "text": " matrix. And there are a number so that the JL gives conditions on what these projections can be."}, {"start": 1404.12, "end": 1411.8, "text": " But for example, a randomly sampled matrix with zero mean Gaussian entries and one over"}, {"start": 1411.8, "end": 1419.56, "text": " K standard deviation where K is the dimension you project into can do the trick. So if I project"}, {"start": 1419.56, "end": 1428.36, "text": " my data in a certain way into a lower dimension, here dimension two, then the projected data"}, {"start": 1428.36, "end": 1435.96, "text": " is related to the original data by the fact that the distances between the points in the original"}, {"start": 1435.96, "end": 1443.0, "text": " space will not be distorted too much. So the distances between these points are approximately"}, {"start": 1443.0, "end": 1452.6000000000001, "text": " preserved through this projection. Okay, so that's the Johnson-Lindenstrauss lemma. Now you'll"}, {"start": 1452.6000000000001, "end": 1460.92, "text": " notice here there is no reference to the fact that this data is or isn't low rank. It's simply"}, {"start": 1460.92, "end": 1467.16, "text": " high-dimensional data projected to lower dimension and the distances are approximately preserved."}, {"start": 1467.16, "end": 1474.28, "text": " And this theory here, and I've looked at it for a while now, they simply define, okay, they define"}, {"start": 1474.28, "end": 1480.3600000000001, "text": " this p matrix as this attention mechanism. And here you can see the a matrix we've discussed before,"}, {"start": 1480.3600000000001, "end": 1486.92, "text": " which is actually low rank, but we don't know yet if the softmax is. They write it as this form"}, {"start": 1486.92, "end": 1495.96, "text": " right here of the exponential of each entry of a divided by this diagonal right here. So in the"}, {"start": 1495.96, "end": 1500.8400000000001, "text": " softmax, of course, you have the exponential of each entry divided by the sum of the entries,"}, {"start": 1500.8400000000001, "end": 1505.96, "text": " and they write this simply as two matrix, but ultimately this is a matrix right here, right?"}, {"start": 1505.96, "end": 1513.4, "text": " And all they do is they take this p matrix and they apply the Johnson-Lindenstrauss lemma by"}, {"start": 1513.4, "end": 1522.2, "text": " having this projection matrix R. And R is entries from this Gaussian as I said. So this is the"}, {"start": 1522.2, "end": 1527.8000000000002, "text": " special type of projection that the JL addresses and then it simply says if you pull, if you,"}, {"start": 1528.52, "end": 1536.6000000000001, "text": " this here is going to be your p tilde. So if you project R in this manner and obtain p tilde,"}, {"start": 1536.6, "end": 1545.0, "text": " and then you use p tilde instead of p, then this is going to be very close. In fact, you can"}, {"start": 1545.0, "end": 1549.9599999999998, "text": " reformulate the JL into different variants such that it gives you things like this, things like"}, {"start": 1549.9599999999998, "end": 1556.36, "text": " saying that the distance between this projected version and this unprojected version is going to be"}, {"start": 1556.36, "end": 1562.6, "text": " a smaller than a constant time the norms of the unprojected version. That is equivalent to"}, {"start": 1562.6, "end": 1569.08, "text": " saying that the distances are preserved. Now you can see right here, nowhere in this theorem is the"}, {"start": 1569.08, "end": 1577.6399999999999, "text": " fact that this is self-attention and nowhere in the theorem appears the fact that this inner matrix"}, {"start": 1577.6399999999999, "end": 1584.76, "text": " A is low rank or even that this matrix A exists. You can do this with any matrix p, right? The JL"}, {"start": 1584.76, "end": 1591.08, "text": " doesn't concern itself with the nature of this matrix p. It says any matrix, any sort of high"}, {"start": 1591.08, "end": 1596.6799999999998, "text": " dimensional data you can project to a low dimensional data. This holds if you choose the projection"}, {"start": 1596.6799999999998, "end": 1604.76, "text": " correctly, which they do right here. So to claim that this theorem proves that self-attention is"}, {"start": 1604.76, "end": 1616.28, "text": " low rank to me is a bit, it's a bit of a statement that is not warranted. Like this here should read"}, {"start": 1616.28, "end": 1626.36, "text": " something like the Johnson-Lindon Strauss lemma exists or something like this. I'm not sure,"}, {"start": 1626.36, "end": 1635.08, "text": " like convinced me otherwise, but yeah. So they go with this, so they say given the low rank"}, {"start": 1635.08, "end": 1642.28, "text": " property of the context mapping matrix p. Now again, I disagree that this has been shown,"}, {"start": 1642.28, "end": 1648.52, "text": " except empirically. One straightforward idea is to use singular value decomposition to approximate"}, {"start": 1648.52, "end": 1654.04, "text": " p with a low rank matrix p, low as follows. So what you could do is you could simply learn these"}, {"start": 1654.04, "end": 1661.24, "text": " low rank matrices and approximate p through it, or you can decompose p as such and then have"}, {"start": 1661.24, "end": 1671.72, "text": " these easier inner products in dimension k. But they say however, this approach requires performing"}, {"start": 1671.72, "end": 1677.88, "text": " an SVD decomposition in each self-attention matrix, which adds additional complexity. Therefore,"}, {"start": 1677.88, "end": 1683.32, "text": " we propose another approach for a low rank approximation that avoids this added complexity."}, {"start": 1685.24, "end": 1691.56, "text": " Okay. So they now come up with their model and their model goes as follows. So here on the left,"}, {"start": 1691.56, "end": 1697.48, "text": " you see a classic attention mechanism with their projections built in. What they're proposing is"}, {"start": 1697.48, "end": 1705.08, "text": " they say, let's project the matrix k using one of these random projections."}, {"start": 1706.28, "end": 1713.96, "text": " And then this attention routing, if you now multiply, so you multiply k and q right here,"}, {"start": 1714.6, "end": 1720.28, "text": " k times q, and then you put it into the softmax and then you use it to route this w."}, {"start": 1720.84, "end": 1727.24, "text": " So they say if we build in this projection matrix, that will project k to a lower dimension,"}, {"start": 1727.24, "end": 1733.56, "text": " and then we won't have as expensive of inner products. Now the important part to see here is that"}, {"start": 1733.56, "end": 1739.16, "text": " if you think of this lower projection, the first thing you think is that you project this inner,"}, {"start": 1739.16, "end": 1745.24, "text": " this hidden dimension d, right, to allow our dimension. And that's not the case here. You actually"}, {"start": 1745.24, "end": 1752.76, "text": " project the n. So in a conceptual framework, so you can see right here, forget about this,"}, {"start": 1752.76, "end": 1758.6, "text": " this is this w matrix. In a conceptual framework, you see here is this n by d matrix, which are"}, {"start": 1758.6, "end": 1765.96, "text": " the keys. So n is the sequence length, and d is the dimensions. And what you want to do is you want"}, {"start": 1765.96, "end": 1772.52, "text": " to project that by this matrix, which is k by n. So you want to reduce the sequence length."}, {"start": 1772.52, "end": 1777.72, "text": " And you can see in this matrix right here, why that might work, because n is much larger than d."}, {"start": 1777.72, "end": 1786.76, "text": " And that means this matrix can be at most rank d, right? So you should not lose too much. You"}, {"start": 1786.76, "end": 1794.52, "text": " should sort of be able to preserve the information. If you project this n to a k, where the k, if the"}, {"start": 1794.52, "end": 1799.8, "text": " k is still larger than the d or approximately in the same order of magnitude, you should be able"}, {"start": 1799.8, "end": 1804.52, "text": " to preserve that information if you're doing it a smart way. So conceptually, if we have our"}, {"start": 1804.52, "end": 1813.08, "text": " five token sequence like here, and the next layer produces five tokens again, what we first do is"}, {"start": 1813.08, "end": 1819.8, "text": " we say, we know we know that the information we want is not five dimensional. It's actually two"}, {"start": 1819.8, "end": 1831.0, "text": " dimensional. Because, okay, let's say this inner dimension d is two as well. So we have two"}, {"start": 1831.0, "end": 1837.64, "text": " dimensional vectors. Each thing exposes two dimensional vectors. So we first project the sequence"}, {"start": 1837.64, "end": 1844.36, "text": " of length five to a sequence of length two. And we simply do that in a random manner. So we have"}, {"start": 1844.36, "end": 1852.28, "text": " random Gaussian matrix that assigns weights to mix these five into these two. And again, because"}, {"start": 1853.16, "end": 1859.56, "text": " that the jail works for any sort of data, but in my argumentation, if you, you know, think that"}, {"start": 1859.56, "end": 1866.28, "text": " this here is low rank. It's of rank two. Then you shouldn't lose too much information by projecting"}, {"start": 1866.28, "end": 1873.32, "text": " it to a sequence length two. And now we do this attention mechanism. So now we expose the keys."}, {"start": 1874.12, "end": 1881.8799999999999, "text": " And now we expose the queries up here. And now you can see instead of routing five things with"}, {"start": 1881.88, "end": 1889.8000000000002, "text": " five things, you only have to route five things with two things. And so instead of having o and squared,"}, {"start": 1889.8000000000002, "end": 1900.2, "text": " you now have o and k. If k is the number right here, okay. So this is the idea. You project the sequence"}, {"start": 1900.2, "end": 1908.68, "text": " length. And it comes from the fact that the sequence length is much larger than the dimensionality."}, {"start": 1908.68, "end": 1914.28, "text": " And therefore, you can sort of preserve the information if you project in a smart way."}, {"start": 1916.2, "end": 1924.2, "text": " They build this in this fashion right here. So the attention mechanism now, before we saw it was"}, {"start": 1924.2, "end": 1931.4, "text": " between the queries and the keys right here. They built now this projection matrix here"}, {"start": 1931.4, "end": 1938.2800000000002, "text": " to project the keys into a lower dimensional sequence. And the now such that"}, {"start": 1940.0400000000002, "end": 1947.0, "text": " this will result in an n by k attention matrix. We saw over here, you don't need to route n by n"}, {"start": 1947.0, "end": 1954.0400000000002, "text": " things. You need to route n by k. So this, this routing table in here is now n by k."}, {"start": 1955.8000000000002, "end": 1960.8400000000001, "text": " Now the next layer, as you can see here, it actually needs to produce a sequence of length five"}, {"start": 1960.84, "end": 1965.8799999999999, "text": " again. Right. So we always transform sequence of length five into sequence of length five."}, {"start": 1967.6399999999999, "end": 1975.48, "text": " But now we have we have this n corresponds to the sorry corresponds to the next layer. And this"}, {"start": 1975.48, "end": 1982.36, "text": " k corresponds to the down projected sequence of the last layer. And in order for that to fit,"}, {"start": 1983.0, "end": 1988.52, "text": " we of course also need to down project the information that we're routing. So if we down project"}, {"start": 1988.52, "end": 1994.04, "text": " the routing table, we also need to down project the information that we're routing. That's"}, {"start": 1994.04, "end": 1999.96, "text": " we do this by a similar matrix F that is also sampled in this way, in this special way."}, {"start": 2000.68, "end": 2010.76, "text": " And that gives us a k by d. So we have projected the sequence to size k. And if we multiply these two"}, {"start": 2010.76, "end": 2018.68, "text": " things again, of course, we'll get out an n by d matrix, which is the signal for the next layer."}, {"start": 2019.48, "end": 2028.36, "text": " Okay. So an n by d signal comes in down here. It's projected down to k sequence length. It's"}, {"start": 2028.36, "end": 2035.24, "text": " and it's routed up again to n sequence length. And you have again an n by d matrix here. Cool."}, {"start": 2035.24, "end": 2043.64, "text": " So that's how they do it. And they build this into the transformer. Now as I understand it,"}, {"start": 2043.64, "end": 2050.84, "text": " these projection matrices again, they're not learned. They are do they are built up in this JL"}, {"start": 2052.2, "end": 2061.16, "text": " conscribed way. They are not learned. They are fixed once. And then that's that's that at least"}, {"start": 2061.16, "end": 2070.52, "text": " that's how I understand it. So there are no more learnable parameters. Okay. So here they have a"}, {"start": 2070.52, "end": 2077.3199999999997, "text": " demonstration where they up the sequence length. And you can see the batch size decreases, but that's"}, {"start": 2077.3199999999997, "end": 2083.16, "text": " just to sort of keep the total amount of flops to be done the same. You up the sequence length"}, {"start": 2083.16, "end": 2087.8799999999997, "text": " and down the batch size. As the sequence length increases, the standard transformers"}, {"start": 2087.88, "end": 2095.0, "text": " requirement in inference time goes up. And this here, as you can see, this is not a linear scale."}, {"start": 2095.0, "end": 2104.04, "text": " It's a log scale log two. So this goes up with the sequence length. And it should go up quadratically,"}, {"start": 2104.04, "end": 2112.28, "text": " right? And you can also see that the linformer keeps fairly constant for the same k. Now of course,"}, {"start": 2112.28, "end": 2120.0400000000004, "text": " as you increase the k of the linformer, the inference time will go up because now it's dependent on"}, {"start": 2120.0400000000004, "end": 2130.76, "text": " 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."}, {"start": 2130.76, "end": 2137.88, "text": " Up here in the first theorem, we there was already a hint to it. In the first theorem, you had to"}, {"start": 2137.88, "end": 2149.2400000000002, "text": " to choose k by five log n. And this is a problem. So here you have log n. That means it's not so"}, {"start": 2149.2400000000002, "end": 2157.7200000000003, "text": " 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"}, {"start": 2157.7200000000003, "end": 2166.36, "text": " reformer. But they want to get to a linear place. And theorem two explains goes now to a linear"}, {"start": 2166.36, "end": 2177.7200000000003, "text": " here shows how you can make self attention linear. Okay. They show again blah blah blah blah."}, {"start": 2178.36, "end": 2185.88, "text": " Now you have to choose k at the minimum of these two things. And you can see right here that one"}, {"start": 2185.88, "end": 2192.52, "text": " of them is independent of n. So that means as n grows, of course, the minimum is no longer going"}, {"start": 2192.52, "end": 2198.44, "text": " to be this here. The minimum is actually going to be the thing on the left. And that is dependent"}, {"start": 2198.44, "end": 2207.16, "text": " on just d. Okay. So you have d log d in here. And that makes sense because in the very beginning,"}, {"start": 2207.16, "end": 2216.68, "text": " we said, hey, d is actually much smaller than n. And that means the information that is contained"}, {"start": 2216.68, "end": 2225.72, "text": " in these matrices is at most rank d. So if we down project to k, we should adjust k to what d is."}, {"start": 2226.2799999999997, "end": 2231.96, "text": " If we adjust k to about the same thing as d, we're guaranteed to not lose too much information."}, {"start": 2235.7999999999997, "end": 2241.8799999999997, "text": " So now we choose k according to d instead of according to n. And therefore, the computation is"}, {"start": 2241.88, "end": 2251.32, "text": " 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."}, {"start": 2253.2400000000002, "end": 2260.36, "text": " How do we get there? So the first thing they do is they make the sort of Johnson-Littins-Rouse"}, {"start": 2260.36, "end": 2268.6, "text": " statements again. But now instead of the general statement, they plug in their actual modified"}, {"start": 2268.6, "end": 2275.88, "text": " attention mechanism. So here they have a bound on the distance between if I route my, this is the"}, {"start": 2275.88, "end": 2283.08, "text": " information to be routed. Right. If I route my information using the original softmax and this"}, {"start": 2283.08, "end": 2291.96, "text": " in here is the matrix A, if the original attention mechanism, I won't be too far away as if I were to"}, {"start": 2291.96, "end": 2302.04, "text": " route my information using this modified attention mechanism. Now the tricky part here mathematically,"}, {"start": 2302.04, "end": 2312.76, "text": " I believe, is that is exactly the softmax. What I alluded to. Right. So this softmax is the tricky"}, {"start": 2312.76, "end": 2318.6, "text": " part because if this weren't a softmax, so if the softmax weren't here, this would simply be"}, {"start": 2318.6, "end": 2324.7599999999998, "text": " a projection down under projection up. And the the lemma would almost apply as it is written."}, {"start": 2324.7599999999998, "end": 2331.7999999999997, "text": " Right. You wouldn't have to actually do anything. But the question is if this inside the softmax"}, {"start": 2331.7999999999997, "end": 2339.88, "text": " is low rank, can you make a claim that the entire softmax then is also low rank? And it's not"}, {"start": 2339.88, "end": 2349.8, "text": " entirely clear because, yes, we've done this. So you can see right here that the softmax,"}, {"start": 2351.32, "end": 2355.7200000000003, "text": " we have actually done the softmax of a low rank matrix. So we have already seen the low rank"}, {"start": 2355.7200000000003, "end": 2364.76, "text": " matrix itself and how it immediately snaps to the to the upper axis after 128. Now if we do the"}, {"start": 2364.76, "end": 2376.0400000000004, "text": " same thing for the softmax of that. And we probably have to take away some of these dimensions,"}, {"start": 2376.0400000000004, "end": 2383.4, "text": " the first few. Let's go with let's go to dimension 100 and look from there."}, {"start": 2383.4, "end": 2391.0, "text": " Okay, same thing. Okay, that's pretty good. I did not expect that."}, {"start": 2396.6800000000003, "end": 2401.7200000000003, "text": " Hi there. So this is Yonic from the future. I've realized I've been an idiot in how I"}, {"start": 2401.7200000000003, "end": 2407.4, "text": " constructed these low rank matrices right here by multiplying MT by itself. Of course,"}, {"start": 2407.4, "end": 2415.08, "text": " what's a better way to do it is to construct two independent 128 dimensional matrices,"}, {"start": 2415.08, "end": 2421.56, "text": " like these two subslices of M right here. And then multiplying those together and looking at"}, {"start": 2421.56, "end": 2431.0, "text": " the SVD. And you, as you can see right here. So the softmax of this is now not of this super"}, {"start": 2431.0, "end": 2438.44, "text": " low rank anymore. It's still low rank, but it's not not very, it's not like hard low rank. So if I"}, {"start": 2438.44, "end": 2447.48, "text": " just look at the matrix without the softmax, then you can see it has a very peak that I at 128,"}, {"start": 2447.48, "end": 2455.16, "text": " which gives us the indication it's actually 128 rank, which we already knew. But if we now introduce"}, {"start": 2455.16, "end": 2463.72, "text": " the softmax, then you can see that this vanishes and it's no longer 128 dimensional. And it's only"}, {"start": 2463.72, "end": 2471.3199999999997, "text": " approximately low rank as you can see. All right, back to Yonic in the past who is wholly surprised"}, {"start": 2471.3199999999997, "end": 2479.7999999999997, "text": " that the two that if you multiply MT by itself, that that will give you back the exact same thing."}, {"start": 2479.8, "end": 2489.4, "text": " All right, so did we try this before? Maybe we did. Okay, but the mathematical difficulty still"}, {"start": 2489.4, "end": 2495.7200000000003, "text": " remains and their main thing here is. So they have a first first version where they pretty much"}, {"start": 2495.7200000000003, "end": 2505.0, "text": " 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"}, {"start": 2505.0, "end": 2511.0, "text": " this result does not utilize the low rank property of matrix a. And the result in K has a dependency"}, {"start": 2511.0, "end": 2522.6, "text": " and sequence likes n. And then in the appendix, they finally go through the math to show that now"}, {"start": 2522.6, "end": 2534.12, "text": " if they choose E and F like this, they can actually pull out this and show that the K is"}, {"start": 2537.16, "end": 2544.68, "text": " where we have it. The decay is independent of n like this. And I think the main the main step in"}, {"start": 2544.68, "end": 2554.44, "text": " this proof is the step B here where they say uses the fact that the exponential function is"}, {"start": 2554.44, "end": 2561.3999999999996, "text": " lipsticks continuous in a compact region. Then we can choose a small enough delta such that the"}, {"start": 2561.3999999999996, "end": 2568.2799999999997, "text": " as you can see here, this now directly relates to this projection matrix within the exponential"}, {"start": 2568.2799999999997, "end": 2574.2799999999997, "text": " function to the projection matrix out of the exponential function. So you can basically say that"}, {"start": 2574.28, "end": 2580.44, "text": " if I project first and then use the exponential function, that's not too different than if I"}, {"start": 2580.44, "end": 2587.7200000000003, "text": " first use the exponential function and then project. Okay, so that's the that's the sort of"}, {"start": 2589.6400000000003, "end": 2595.8, "text": " of catch here. Now they only do this for the exponential function, not the actual softmax as you"}, {"start": 2595.8, "end": 2601.7200000000003, "text": " can see here throughout they do it to the exponential function and also here in their statements."}, {"start": 2601.72, "end": 2608.68, "text": " The softmax isn't the exponential function. The softmax is the exponential function divided by"}, {"start": 2608.68, "end": 2615.56, "text": " the sum of the exponential functions, but I believe that this generalizes straightforwardly."}, {"start": 2616.9199999999996, "end": 2623.7999999999997, "text": " All right, so for given choices of delta and K, they have shown that the linear"}, {"start": 2623.8, "end": 2631.4, "text": " informer in fact can do in a linear fashion what a transformer can do in a quadratic fashion and"}, {"start": 2631.4, "end": 2637.96, "text": " they are not too far off. Okay, that's that's their point right here. The results on"}, {"start": 2639.4, "end": 2645.32, "text": " these benchmarks, oh sorry, let's first go to the perplexities in language modeling. So they show"}, {"start": 2645.32, "end": 2650.6000000000004, "text": " right here that they pretty much can keep up with the standard transformer as you can see here."}, {"start": 2650.6, "end": 2658.92, "text": " So with the standard transformer they can keep up here. Now think that this the the computation is"}, {"start": 2658.92, "end": 2667.88, "text": " n times K. Okay, so something like this, a linear informer with K calls 256 will only so instead of"}, {"start": 2667.88, "end": 2678.44, "text": " 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"}, {"start": 2678.44, "end": 2685.0, "text": " in fact you have the same performance because probably the standard transformer is distributed"}, {"start": 2685.0, "end": 2690.92, "text": " over more heads than two. So the information necessarily has a lower dimensionality 10 to 56."}, {"start": 2691.48, "end": 2697.96, "text": " One thing I want to draw attention to though here is that you can see that here it's not really"}, {"start": 2697.96, "end": 2706.04, "text": " done learning yet. And as you can see the standard transformer sort of surpasses all of these"}, {"start": 2706.04, "end": 2714.04, "text": " models towards the end. I wonder I wonder what happens. I wouldn't be surprised if they end up"}, {"start": 2714.04, "end": 2720.04, "text": " sort of at the same place, but I wonder if these diverge even more right here after that."}, {"start": 2722.52, "end": 2729.08, "text": " They also compare with a higher sequence length and the standard transformer outperforms the"}, {"start": 2729.08, "end": 2735.96, "text": " linformer. But of course the point here is that the linformer is much much faster and can keep up. Now"}, {"start": 2737.4, "end": 2744.92, "text": " also the scale here of the perplexity. You see these are percentage points in perplexity, but"}, {"start": 2745.72, "end": 2753.0, "text": " I can't actually tell if that matters or not. I think I think in the original transformer paper the"}, {"start": 2753.0, "end": 2760.52, "text": " perplexity is hovered between like three points something and five points something. So this might"}, {"start": 2760.52, "end": 2767.96, "text": " actually be sort of significant differences. And I'm not sure. They investigate different methods"}, {"start": 2767.96, "end": 2773.96, "text": " of sharing these weights of these of these projections and they seems like they don't find real"}, {"start": 2773.96, "end": 2777.4, "text": " differences, but I don't want to go into that because this video is already really long."}, {"start": 2777.4, "end": 2785.08, "text": " And then they look at what happens if they up the sequence length that they put into the linformer."}, {"start": 2785.08, "end": 2793.08, "text": " And you can see that the linformer can deal with higher sequence lengths and arrive at the same"}, {"start": 2793.08, "end": 2800.12, "text": " perplexities. Though again I don't know how much different that is and the scale here is larger"}, {"start": 2800.12, "end": 2809.72, "text": " than before. But yeah. So how does this fare on these benchmarks where you first train a transformer"}, {"start": 2809.72, "end": 2816.92, "text": " with pre-training with language modeling and then you use it to do certain NLP tasks. And here"}, {"start": 2816.92, "end": 2823.88, "text": " you can see that the linformer is on par in some of these tasks with the original transformer,"}, {"start": 2823.88, "end": 2832.84, "text": " but also you can see like a pattern where you can see pretty wild results in that you know sometimes"}, {"start": 2833.4, "end": 2839.7200000000003, "text": " the the linformer here will be better than this, but then also variants of the linformer will be"}, {"start": 2839.7200000000003, "end": 2845.7200000000003, "text": " worse and they'll even be worse than this and sometimes they'll be better. Sometimes this"}, {"start": 2845.72, "end": 2854.2, "text": " linformer is good and sometimes the original model is the best. So this sort of points to you can"}, {"start": 2854.2, "end": 2862.52, "text": " make the general claim that the linformer doesn't destroy your gains, but also it's not like"}, {"start": 2863.16, "end": 2870.3599999999997, "text": " a better model. It's simply a faster model that in some tasks can keep up with the original model."}, {"start": 2870.36, "end": 2878.36, "text": " And they show that of course this is the real deal here that as you go up in length the performance gains"}, {"start": 2878.92, "end": 2887.08, "text": " and also sorry in this this way the performance gains and the memory gains that you get by the"}, {"start": 2887.08, "end": 2893.6400000000003, "text": " linformer are dramatic. Of course the longer and you go and to the lower dimension you project"}, {"start": 2893.6400000000003, "end": 2898.6800000000003, "text": " the more these gains are, but of course the more performance you're going to lose potentially."}, {"start": 2898.68, "end": 2904.7599999999998, "text": " Hello again, Janik from the future. I just wanted to draw your attention on this beautiful broader"}, {"start": 2904.7599999999998, "end": 2912.12, "text": " impact statement in this paper saying our work focuses on making transformers more efficient,"}, {"start": 2912.12, "end": 2917.64, "text": " everything cool, potential positive, impact impacts of efficient transformers. That's pretty cool."}, {"start": 2917.64, "end": 2922.9199999999996, "text": " It also has potential impact on training transformers on images since we can support very long"}, {"start": 2922.92, "end": 2929.32, "text": " sequences. Very cool. Furthermore, there are positive environmental benefits. Very cool. I mean,"}, {"start": 2929.32, "end": 2936.76, "text": " these are all very cool things. They say as such we see no immediate negative ethical or societal"}, {"start": 2936.76, "end": 2941.16, "text": " impacts of our work beyond what applies to the core building blocks of deep learning."}, {"start": 2943.16, "end": 2951.4, "text": " Do better. Now this honestly I agree with them, right? I completely agree with them that this"}, {"start": 2951.4, "end": 2957.1600000000003, "text": " is sort of a good thing. You might trade off some accuracy, you might make some approximations,"}, {"start": 2957.1600000000003, "end": 2964.52, "text": " but you'll get a much faster model. This model has any model can be used for things."}, {"start": 2966.04, "end": 2977.7200000000003, "text": " They now have to pull out of their butt some way in over five steps of intermediate layers."}, {"start": 2977.72, "end": 2986.7599999999998, "text": " This could be used for bad. It just seems ridiculous. So good on them for defying the"}, {"start": 2987.3199999999997, "end": 2994.4399999999996, "text": " please also think about negative impacts right here. All right, back to past Yannick."}, {"start": 2995.9599999999996, "end": 3002.04, "text": " All right, this was the Linformer paper. I hope this somewhat made sense to you."}, {"start": 3002.04, "end": 3009.8, "text": " I had to read it multiple times for it to make sense to me, but ultimately it's all about the fact"}, {"start": 3009.8, "end": 3015.48, "text": " that you have these multiple heads and therefore your information is probably lower dimensional"}, {"start": 3015.48, "end": 3022.44, "text": " and you can abuse that to just calculate in this lower dimension. All right, I'll see you next time."}, {"start": 3022.44, "end": 3032.44, "text": " Bye bye."}] |
Yannic Kilcher | 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 I'll just have 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 Donoway, Sander Dielmann, Mikolai Binkowski, Eric Ellsson and Karen Simone of, I believe, of mostly deep mind. 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. It does so without any intermediate supervised representations and that's a challenging task. 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 can modern text to speech and so on. Now you 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 these sound waves, they are typically in the order of something like 24 kilohertz sampled. So that's the 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 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 supervised loss. Simply in a GAN you do not have the corresponding samples right. 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. 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 whatever they would call features like textual features. So 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 sound wave and there is nothing in between that the, I mean, of course there are latent representations but you train it end to end in one go. 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 GAN TTS paper. Now as we already said the discriminator try 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 GAN 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 it 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're drawing to 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, the 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 Ganttts 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 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 for each one or for this joint sequence, one hidden two, it would output the sound wave. And this has been a paper before this Ganttts. 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 them. 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 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 example. 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 part of the entire sound wave of this paragraph. This this subsequent corresponds to a good guess would be to go like well this is about 50% in. So maybe here to here. Maybe who knows? 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 to you compute these alignments. How do you compute this thing if you don't have it 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 hidden 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 token 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 embed the tokens in hidden space and then predict its length. See that? Right here. So first we use f 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 a. So they give some silence buffer here, but roughly you can assume that the beginning of the speech corresponds to the first token, right? You can simply trace the waveform and whenever it goes up, that's where the first token starts. So then, 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 words start. So if we want to know where on starts, we simply go from the beginning and go 200 plus 100 milliseconds or data points, 200 plus 100. Here is where on starts. And if we want to figure out the middle of on, we simply add 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 sequences. And now we do this, we said we take random two second audio, but we do this procedure for the entire text, okay, for every single token in the text that we look at. So in the 22nd 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 22nd 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, 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. Let's, 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 0.5 seconds. So this is one second, the middle is 0.5 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 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 here, they say, well, 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 the weights and then you simply sum up the weights with these embeddings. So for each token out of this style at a 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 hyperparameter to be a little bit fuzzy with respect to these lengths right here. So to be differentiable basically and that will ultimately train this loss, this model right here that computes the token length. All 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 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 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 temporarily 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 which tokens you should produce the discriminators are unconditional they don't know which text is produced right 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 like a traditional again 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 sub sequence 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 is 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 other serially 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 scale 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 spectrogram of the generator output and the corresponding ground truth training window and they simply calculate the L1 difference of the 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. This is different from that. This is even in addition to that so here somewhere we had yeah this was the discriminator on the spectrograms and I think this is even different. So what they're doing is they also the discriminators simply decides do the spectrograms look real or fake does the spectrogram look real or fake. Now they also take the 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 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 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 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 going to say. 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 or counting on sort of a 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 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 length. So that's how you at the beginning of training is 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 align 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 good trick to introduce here 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 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 two 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 b a c a d and an e slot and this also has an a b a c a d and an e slot and you know that you assume so here's something you assume you assume that the beginning and the ends match this is not true of course because we have completely unaligned but they say in practice this works so you assume that sort of at least a little bit these are aligned. Alright 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 lose must add up to the total length of the sound which in our case I guess is 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 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 dynamic time working to assume that the beginnings and the endings align. Alright 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 aligns 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 wrong at the beginning you don't have a b c d e 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 the 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 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 the sequences are they always follow one after another in both of these spectrograms in 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 this phonemizer that's the very beginning but they also update 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 and 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 the 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 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 out 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 token 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 these spectrograms and you also have an L1 loss on these spectrograms which helps especially at the beginning of training for the L1 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 shared out subscribe and have a good day bye bye | [{"start": 0.0, "end": 5.94, "text": " In this work, we take on the challenging task of learning to synthesize speech from"}, {"start": 5.94, "end": 11.040000000000001, "text": " normalized text or phonemes in an end-to-end manner, resulting in models which operate directly"}, {"start": 11.040000000000001, "end": 16.080000000000002, "text": " on character or phoneme input sequences and produce raw speech audio outputs."}, {"start": 16.080000000000002, "end": 19.76, "text": " Okay, that wasn't the real model."}, {"start": 19.76, "end": 22.56, "text": " I just thought it sounded really funny."}, {"start": 22.56, "end": 29.32, "text": " This is a text-to-speech model and it actually sounds like this."}, {"start": 29.32, "end": 33.16, "text": " In this work, we take on the challenging task of learning to synthesize speech from"}, {"start": 33.16, "end": 37.84, "text": " normalized text or phonemes in an end-to-end manner, resulting in models which operate"}, {"start": 37.84, "end": 43.64, "text": " directly on character or phoneme input sequences and produce raw speech audio outputs."}, {"start": 43.64, "end": 50.64, "text": " Okay, now you've probably, if you have listened to the text and I'll just have the text"}, {"start": 50.64, "end": 54.88, "text": " sounds, you have gotten what this paper is about."}, {"start": 54.88, "end": 60.92, "text": " So the paper is called End-to-End Adversarial Text to Speech by Jeff Donoway, Sander"}, {"start": 60.92, "end": 68.96000000000001, "text": " Dielmann, Mikolai Binkowski, Eric Ellsson and Karen Simone of, I believe, of mostly"}, {"start": 68.96000000000001, "end": 71.56, "text": " deep mind."}, {"start": 71.56, "end": 78.84, "text": " And this paper on a high level, it produces speech, so sound, the sound waves of speech"}, {"start": 78.84, "end": 84.36, "text": " directly from text or from what they call normalized text or phoneme text."}, {"start": 84.36, "end": 91.28, "text": " It does so without any intermediate supervised representations and that's a challenging"}, {"start": 91.28, "end": 92.28, "text": " task."}, {"start": 92.28, "end": 98.8, "text": " The main problems here are the alignment problem that they have to solve and actually making"}, {"start": 98.8, "end": 102.03999999999999, "text": " this work in an adversarial manner."}, {"start": 102.03999999999999, "end": 107.96000000000001, "text": " So we're going to look at this paper as always if you like work like this, consider subscribing"}, {"start": 107.96000000000001, "end": 112.68, "text": " and sharing it out and if you have any comments, leave them in the comment section."}, {"start": 112.68, "end": 115.80000000000001, "text": " Okay, so what's the problem with text to speech?"}, {"start": 115.80000000000001, "end": 120.92, "text": " Text to speech is basically you take a piece of text like this one, modern text to speech"}, {"start": 120.92, "end": 124.60000000000001, "text": " synthesis, pipelines typically involve blah, blah, blah."}, {"start": 124.60000000000001, "end": 132.24, "text": " And you want to make a model that takes this and outputs sound waves as if a human would"}, {"start": 132.24, "end": 133.24, "text": " say it, right?"}, {"start": 133.24, "end": 138.56, "text": " So you can modern text to speech and so on."}, {"start": 138.56, "end": 142.64000000000001, "text": " Now you have multiple problems when doing this."}, {"start": 142.64, "end": 145.95999999999998, "text": " First of all, the text here is words."}, {"start": 145.95999999999998, "end": 148.79999999999998, "text": " Let's say we can tokenize the text into words."}, {"start": 148.79999999999998, "end": 151.88, "text": " So you have modern text to speech."}, {"start": 151.88, "end": 153.11999999999998, "text": " Those are four tokens."}, {"start": 153.11999999999998, "end": 158.35999999999999, "text": " However, sound waves are of course much, much densely sampled."}, {"start": 158.35999999999999, "end": 163.27999999999997, "text": " So these sound waves, they are typically in the order of something like 24 kilohertz"}, {"start": 163.27999999999997, "end": 165.6, "text": " sampled."}, {"start": 165.6, "end": 173.12, "text": " So that's the the ratio of one token to output samples is super high."}, {"start": 173.12, "end": 180.0, "text": " So one token will produce many, many thousand samples in the speech."}, {"start": 180.0, "end": 181.68, "text": " So that's the first problem."}, {"start": 181.68, "end": 188.84, "text": " The second problem is that if you have training data, so you have data that has a piece of"}, {"start": 188.84, "end": 193.56, "text": " text and you have the sound wave that a human, you know the human read that particular"}, {"start": 193.56, "end": 195.2, "text": " piece of text."}, {"start": 195.2, "end": 200.83999999999997, "text": " You still don't know which word exactly corresponds to which portion of that text."}, {"start": 200.83999999999997, "end": 204.64, "text": " You simply know the entire text corresponds to the entire sound wave."}, {"start": 204.64, "end": 207.2, "text": " You don't know this word text right here."}, {"start": 207.2, "end": 213.44, "text": " You don't know where it starts and where it ends in this sound wave."}, {"start": 213.44, "end": 219.48, "text": " And the last problem you obviously have is that you want to make this in a way that it"}, {"start": 219.48, "end": 226.16, "text": " generalizes that it sounds like a human, but also generalizes to some other text."}, {"start": 226.16, "end": 232.83999999999997, "text": " And this paper here solves all of these problems jointly by doing an adversarial approach"}, {"start": 232.83999999999997, "end": 235.12, "text": " to learning."}, {"start": 235.12, "end": 237.51999999999998, "text": " And it does it end to end."}, {"start": 237.51999999999998, "end": 243.48, "text": " Now adversarial simply means that you have a generator that takes in the piece of text"}, {"start": 243.48, "end": 246.64, "text": " right here and generates this sound wave."}, {"start": 246.64, "end": 252.27999999999997, "text": " And then you have a discriminator that looks at this sound wave and it looks at the real"}, {"start": 252.27999999999997, "end": 253.35999999999999, "text": " sound wave."}, {"start": 253.35999999999999, "end": 259.84, "text": " So the real, okay, the real says let's say this over here is real and this is what the"}, {"start": 259.84, "end": 261.71999999999997, "text": " generator has produced."}, {"start": 261.71999999999997, "end": 265.68, "text": " The discriminator tries to discriminate between the two."}, {"start": 265.68, "end": 272.0, "text": " Now this is not entirely the same thing as a supervised loss."}, {"start": 272.0, "end": 276.96, "text": " Simply in a GAN you do not have the corresponding samples right."}, {"start": 276.96, "end": 283.88, "text": " You simply input a real sample here and the generator produces a generated sample here."}, {"start": 283.88, "end": 288.84, "text": " You do not necessarily have in a classic GAN the corresponding sample here."}, {"start": 288.84, "end": 293.96, "text": " You assume that you have the corresponding real sample, but it's still different than"}, {"start": 293.96, "end": 299.6, "text": " supervised learning in that both go through a discriminator and the discriminator tries"}, {"start": 299.6, "end": 304.76000000000005, "text": " to tell the discriminator is a neural network, tries to tell which one is real and which"}, {"start": 304.76000000000005, "end": 306.08000000000004, "text": " one is generated."}, {"start": 306.08000000000004, "end": 310.28000000000003, "text": " In fact the discriminator is a set of neural networks."}, {"start": 310.28000000000003, "end": 315.08000000000004, "text": " We're going to go into that shortly."}, {"start": 315.08000000000004, "end": 320.36, "text": " So it's adversarial in the sense that there is a generator and a discriminator."}, {"start": 320.36, "end": 326.40000000000003, "text": " And it is end to end in the sense that usually what these pipelines do is they take the"}, {"start": 326.4, "end": 331.64, "text": " text and we've looked at this for example in the video about this Facebook's text to"}, {"start": 331.64, "end": 333.12, "text": " speech system."}, {"start": 333.12, "end": 342.71999999999997, "text": " So they take the text and the first thing they do is they would produce a set of whatever"}, {"start": 342.71999999999997, "end": 351.47999999999996, "text": " they would call features like textual features."}, {"start": 351.48, "end": 357.04, "text": " So these are sort of intermediate features for the text to be produced."}, {"start": 357.04, "end": 364.32, "text": " And then another model would take these and it would produce something like spectrograms,"}, {"start": 364.32, "end": 366.8, "text": " spectrograms."}, {"start": 366.8, "end": 374.20000000000005, "text": " And then another model would take the spectrograms and finally produce sound or speech."}, {"start": 374.20000000000005, "end": 379.92, "text": " So you have usually in these systems you have intermediate representation and each of these"}, {"start": 379.92, "end": 383.24, "text": " models right here can be trained by itself."}, {"start": 383.24, "end": 385.64000000000004, "text": " So that's an advantage that you can train."}, {"start": 385.64000000000004, "end": 391.16, "text": " For example you can train a model that goes from a spectrogram to a sound wave by itself."}, {"start": 391.16, "end": 393.64000000000004, "text": " And you don't need, you simply need sound for that."}, {"start": 393.64000000000004, "end": 397.88, "text": " The computation from sound to spectrogram is super easy."}, {"start": 397.88, "end": 400.16, "text": " So you can generate your own training data."}, {"start": 400.16, "end": 402.8, "text": " So you can go from spectrogram to sound."}, {"start": 402.8, "end": 404.76, "text": " You can train a model like this."}, {"start": 404.76, "end": 409.68, "text": " So in these pipelines usually there are multiple stages and each of these models has to"}, {"start": 409.68, "end": 412.56, "text": " be trained by itself."}, {"start": 412.56, "end": 415.44, "text": " This paper tries to do this end to end."}, {"start": 415.44, "end": 426.44, "text": " That means you input the text and you get out the sound wave and there is nothing in between"}, {"start": 426.44, "end": 432.48, "text": " that the, I mean, of course there are latent representations but you train it end to end"}, {"start": 432.48, "end": 434.48, "text": " in one go."}, {"start": 434.48, "end": 439.48, "text": " So let's look at the different systems they employ."}, {"start": 439.48, "end": 444.52000000000004, "text": " First of all, let's look at the discriminators because that's the easiest."}, {"start": 444.52000000000004, "end": 451.20000000000005, "text": " So they have these discriminators and these are adopted from this GAN TTS paper."}, {"start": 451.20000000000005, "end": 458.6, "text": " Now as we already said the discriminator try to differentiate between real and fake sound"}, {"start": 458.6, "end": 465.72, "text": " and they do it in a sort of, so if they were to just look at the entire sound wave then"}, {"start": 465.72, "end": 470.20000000000005, "text": " it would just basically reduce to comparing the two."}, {"start": 470.20000000000005, "end": 474.24, "text": " But instead the discriminators they operate on very small windows."}, {"start": 474.24, "end": 479.40000000000003, "text": " So in specific they have five different discriminators and each of the five different discriminators"}, {"start": 479.40000000000003, "end": 482.36, "text": " take a different size window length."}, {"start": 482.36, "end": 484.40000000000003, "text": " But all of these windows are super short."}, {"start": 484.40000000000003, "end": 490.92, "text": " So one discriminator might take this long windows, another discriminator might take a bit"}, {"start": 490.92, "end": 495.28000000000003, "text": " longer windows and another discriminator might take a bit shorter windows."}, {"start": 495.28, "end": 498.03999999999996, "text": " And that of course from the real end from the fake."}, {"start": 498.03999999999996, "end": 503.15999999999997, "text": " And the discriminators simply try to discriminate only in these windows, whether it's a real"}, {"start": 503.15999999999997, "end": 504.32, "text": " or fake."}, {"start": 504.32, "end": 509.91999999999996, "text": " And now we're a bit more into the GAN setting where you know you simply have one data"}, {"start": 509.91999999999996, "end": 514.24, "text": " point of the real and one data point of the fake and you have to compare them."}, {"start": 514.24, "end": 519.8399999999999, "text": " And this here I believe is one of the keys why this model generalizes because the discriminators"}, {"start": 519.84, "end": 527.0, "text": " basically they try to assess whether a short sequence sounds like real or sounds like fake."}, {"start": 527.0, "end": 533.6800000000001, "text": " And whether the two samples sound alike in different scales of time."}, {"start": 533.6800000000001, "end": 538.8000000000001, "text": " And by only doing this on these short scales you can, you can, the loss sort of generalizes."}, {"start": 538.8000000000001, "end": 545.32, "text": " Otherwise if you compare it on the entire sound wave it would just reduce to comparing"}, {"start": 545.32, "end": 548.72, "text": " point like point by point right here."}, {"start": 548.72, "end": 554.72, "text": " And if the generator produces something that's not exactly aligned then of course every"}, {"start": 554.72, "end": 558.32, "text": " point would be wrong and you're drawing to all sorts of questions."}, {"start": 558.32, "end": 564.8000000000001, "text": " So this is a set of five discriminators that all try to take each, takes a different"}, {"start": 564.8000000000001, "end": 570.5600000000001, "text": " length of sub sound of this wave tries to discriminate real from fake."}, {"start": 570.5600000000001, "end": 571.72, "text": " That's the discriminator loss."}, {"start": 571.72, "end": 578.6, "text": " They have an additional discriminator loss where they compute spectrograms of these things."}, {"start": 578.6, "end": 588.64, "text": " So spectrograms and compute spectrogram of this and they have a discriminator, another"}, {"start": 588.64, "end": 592.9200000000001, "text": " neural network here that it tries to distinguish which one is real and which one is fake."}, {"start": 592.9200000000001, "end": 599.8000000000001, "text": " Note that this is not the same as down here where the spectrogram is an intermediate representation."}, {"start": 599.8000000000001, "end": 604.96, "text": " Here the sound is the output and from the sound you compute the spectrogram and then you"}, {"start": 604.96, "end": 606.52, "text": " compare the two."}, {"start": 606.52, "end": 611.84, "text": " So this is simply a different, the spectrogram is a different feature space for the discriminator"}, {"start": 611.84, "end": 613.3199999999999, "text": " to compute the loss."}, {"start": 613.3199999999999, "end": 619.12, "text": " It is not an intermediate representation on the way to produce the sound itself."}, {"start": 619.12, "end": 626.16, "text": " So that the difference, that's the difference here between the classic approach and this"}, {"start": 626.16, "end": 627.36, "text": " approach."}, {"start": 627.36, "end": 629.12, "text": " So it's end to end adversarial."}, {"start": 629.12, "end": 630.4399999999999, "text": " So we got the discriminator."}, {"start": 630.4399999999999, "end": 635.4399999999999, "text": " The discriminators simply try to differentiate the sound waves and short scales as well"}, {"start": 635.44, "end": 637.8800000000001, "text": " as the spectrograms."}, {"start": 637.8800000000001, "end": 640.6800000000001, "text": " Now the second part is of course the generator."}, {"start": 640.6800000000001, "end": 643.9200000000001, "text": " How do we even produce sound?"}, {"start": 643.9200000000001, "end": 647.08, "text": " And that's this diagram right here."}, {"start": 647.08, "end": 650.08, "text": " So you have this Ganttts generator."}, {"start": 650.08, "end": 656.0400000000001, "text": " This is a generator that takes in a, it takes in a hidden representation."}, {"start": 656.0400000000001, "end": 661.08, "text": " So it takes in tokens, let's say token one, token two."}, {"start": 661.08, "end": 668.72, "text": " Let's go from the one before, think of a sentence, hello there."}, {"start": 668.72, "end": 671.0, "text": " Okay."}, {"start": 671.0, "end": 677.5600000000001, "text": " So it takes these tokens and of course it takes like hidden representations of the tokens"}, {"start": 677.5600000000001, "end": 685.84, "text": " and it will output for each one or for this joint sequence, one hidden two, it would"}, {"start": 685.84, "end": 690.96, "text": " output the sound wave."}, {"start": 690.96, "end": 694.6, "text": " And this has been a paper before this Ganttts."}, {"start": 694.6, "end": 699.24, "text": " And you also, you condition it on the speaker and on latent variables like how you want"}, {"start": 699.24, "end": 701.96, "text": " the pitch to be and so on."}, {"start": 701.96, "end": 704.72, "text": " That's not really important for us right here."}, {"start": 704.72, "end": 709.0, "text": " The generator can simply take these token embeddings and produce sound."}, {"start": 709.0, "end": 713.6800000000001, "text": " The problem is in the original paper, you had an alignment."}, {"start": 713.6800000000001, "end": 720.76, "text": " You knew which token corresponded to which piece of sound and therefore you sort of knew"}, {"start": 720.76, "end": 721.76, "text": " them."}, {"start": 721.76, "end": 726.0, "text": " So after that you need to compare this to the generator thing."}, {"start": 726.0, "end": 731.68, "text": " And you knew which token corresponded to which piece of sound right here."}, {"start": 731.68, "end": 736.6, "text": " So the generator knew what it had to produce from each token, how long it should be and"}, {"start": 736.6, "end": 737.88, "text": " so on."}, {"start": 737.88, "end": 742.64, "text": " So this is the generally the alignment problem or what I call the alignment problem."}, {"start": 742.64, "end": 749.28, "text": " So if you take a piece of text like this entire paragraph right here, let's look at this"}, {"start": 749.28, "end": 750.6, "text": " paragraph."}, {"start": 750.6, "end": 754.88, "text": " This paragraph to read it out takes like 30 to 60 seconds."}, {"start": 754.88, "end": 760.08, "text": " You can't train really models that output this long of sound."}, {"start": 760.08, "end": 762.48, "text": " It would be too big of a sample."}, {"start": 762.48, "end": 764.64, "text": " You want to train ideally on segments."}, {"start": 764.64, "end": 768.6800000000001, "text": " They train segments that are I believe here."}, {"start": 768.6800000000001, "end": 772.08, "text": " Two second windows from each example."}, {"start": 772.08, "end": 777.52, "text": " So because they say if we train on 20 seconds that would just be wasteful and prohibitively"}, {"start": 777.52, "end": 779.64, "text": " expensive."}, {"start": 779.64, "end": 787.0, "text": " Now the problem of course is if I simply take a window here like this one of two seconds"}, {"start": 787.0, "end": 794.24, "text": " and I have my human that has read this entire paragraph in one go, I have no clue again"}, {"start": 794.24, "end": 799.16, "text": " which part of the entire sound wave of this paragraph."}, {"start": 799.16, "end": 805.6, "text": " This this subsequent corresponds to a good guess would be to go like well this is about"}, {"start": 805.6, "end": 806.6, "text": " 50% in."}, {"start": 806.6, "end": 809.08, "text": " So maybe here to here."}, {"start": 809.08, "end": 811.0, "text": " Maybe who knows?"}, {"start": 811.0, "end": 813.6800000000001, "text": " And even within that and that's what we discussed before."}, {"start": 813.6800000000001, "end": 821.0, "text": " You have no clue how long this word here is going to take up within this piece of sound."}, {"start": 821.0, "end": 824.12, "text": " And that's the general alignment problem right here."}, {"start": 824.12, "end": 832.12, "text": " So in this entire sound wave where is the piece and how do these words distribute across"}, {"start": 832.12, "end": 834.1600000000001, "text": " the wave of sound."}, {"start": 834.1600000000001, "end": 838.08, "text": " The original model had as I understand it such alignments."}, {"start": 838.08, "end": 843.12, "text": " And therefore this generator could work really well because you had these alignments without"}, {"start": 843.12, "end": 846.24, "text": " these alignments it doesn't work as well."}, {"start": 846.24, "end": 850.12, "text": " And you can on their website that I've shown you initially you can listen to samples"}, {"start": 850.12, "end": 853.6800000000001, "text": " where they disable each of these things."}, {"start": 853.6800000000001, "end": 860.32, "text": " So this generator is really good at producing sound when it has these alignments."}, {"start": 860.32, "end": 865.4000000000001, "text": " So the challenging task here is how to you compute these alignments."}, {"start": 865.4, "end": 871.48, "text": " How do you compute this thing if you don't have it if you don't have it in your training"}, {"start": 871.48, "end": 873.04, "text": " data."}, {"start": 873.04, "end": 875.24, "text": " So it needs to be part of the loss."}, {"start": 875.24, "end": 878.6, "text": " So that's what this entire architecture down here is."}, {"start": 878.6, "end": 879.6, "text": " All right."}, {"start": 879.6, "end": 882.0799999999999, "text": " So the text is down here."}, {"start": 882.0799999999999, "end": 887.3199999999999, "text": " It goes in and the first thing they do is they normalize the text and they transform it"}, {"start": 887.3199999999999, "end": 891.72, "text": " into phonemes which is you can do this in a deterministic fashion."}, {"start": 891.72, "end": 894.1999999999999, "text": " There are scripts that do this."}, {"start": 894.2, "end": 897.76, "text": " This is the only pre-processing they do."}, {"start": 897.76, "end": 901.44, "text": " And they can also leave it away in the hidden ablation on their website."}, {"start": 901.44, "end": 903.8000000000001, "text": " So this is like phoneme text."}, {"start": 903.8000000000001, "end": 905.88, "text": " Cat sat on the mat."}, {"start": 905.88, "end": 914.0, "text": " Now this phoneme text goes through these big block of convolutions and of dilated convolutions."}, {"start": 914.0, "end": 920.48, "text": " And this outputs a 200 hertz representation token length alignment."}, {"start": 920.48, "end": 921.48, "text": " Okay."}, {"start": 921.48, "end": 923.24, "text": " I should specify this."}, {"start": 923.24, "end": 929.08, "text": " So for each token here, it outputs a length."}, {"start": 929.08, "end": 933.64, "text": " So this thing predicts the length of each of the tokens."}, {"start": 933.64, "end": 940.2, "text": " These all of this all of this thing here is to embed the tokens in hidden space and then"}, {"start": 940.2, "end": 942.0, "text": " predict its length."}, {"start": 942.0, "end": 945.88, "text": " See that?"}, {"start": 945.88, "end": 948.8, "text": " Right here."}, {"start": 948.8, "end": 956.4399999999999, "text": " So first we use f to take x."}, {"start": 956.4399999999999, "end": 963.4399999999999, "text": " So f is a stack of dilated convolutions and it takes x and outputs a hidden representation."}, {"start": 963.4399999999999, "end": 965.04, "text": " So h."}, {"start": 965.04, "end": 976.0799999999999, "text": " So first x goes to h and then h is used to predict l and l is the length of that token."}, {"start": 976.08, "end": 981.36, "text": " So we embed this into a hidden representation with this right here."}, {"start": 981.36, "end": 985.64, "text": " And then we use this stack to predict the length of each token."}, {"start": 985.64, "end": 993.48, "text": " So this could be this could say something like this cat token right here is 20 milliseconds"}, {"start": 993.48, "end": 999.6800000000001, "text": " long or instead of milliseconds, you would use something like frames or data points."}, {"start": 999.6800000000001, "end": 1005.6400000000001, "text": " Maybe this is 200 data points long."}, {"start": 1005.64, "end": 1007.1999999999999, "text": " And then sat is a bit shorter."}, {"start": 1007.1999999999999, "end": 1010.4399999999999, "text": " So this is 100 long and on is really short."}, {"start": 1010.4399999999999, "end": 1012.1999999999999, "text": " So this is 50 long."}, {"start": 1012.1999999999999, "end": 1014.8, "text": " So for each token, it predicts the length."}, {"start": 1014.8, "end": 1015.8, "text": " All right."}, {"start": 1015.8, "end": 1021.4399999999999, "text": " So now if we have the length of each, we can sort of calculate where the starting point"}, {"start": 1021.4399999999999, "end": 1022.4399999999999, "text": " is."}, {"start": 1022.4399999999999, "end": 1026.28, "text": " So if we want to know if we know that here is the beginning and the beginning of the"}, {"start": 1026.28, "end": 1032.0, "text": " sentence, we we conservatively assume that there is a."}, {"start": 1032.0, "end": 1035.96, "text": " So they give some silence buffer here, but roughly you can assume that the beginning"}, {"start": 1035.96, "end": 1041.36, "text": " of the speech corresponds to the first token, right?"}, {"start": 1041.36, "end": 1046.76, "text": " You can simply trace the waveform and whenever it goes up, that's where the first token"}, {"start": 1046.76, "end": 1047.84, "text": " starts."}, {"start": 1047.84, "end": 1052.44, "text": " So then, since we know that's where the first token starts."}, {"start": 1052.44, "end": 1057.32, "text": " And if we could predict the length of each one correctly, we could simply sum those"}, {"start": 1057.32, "end": 1059.56, "text": " up to figure out where our words start."}, {"start": 1059.56, "end": 1065.24, "text": " So if we want to know where on starts, we simply go from the beginning and go 200 plus 100"}, {"start": 1065.24, "end": 1070.72, "text": " milliseconds or data points, 200 plus 100."}, {"start": 1070.72, "end": 1074.3999999999999, "text": " Here is where on starts."}, {"start": 1074.3999999999999, "end": 1081.36, "text": " And if we want to figure out the middle of on, we simply add the half of this number."}, {"start": 1081.36, "end": 1084.72, "text": " So plus 25 gets you to the middle."}, {"start": 1084.72, "end": 1092.56, "text": " So this is this here is the center of the token on."}, {"start": 1092.56, "end": 1097.92, "text": " So for each token, we predict the length like this and thereby we can just calculate for"}, {"start": 1097.92, "end": 1103.68, "text": " each one by summing up from the beginning and then adding half of its own length where"}, {"start": 1103.68, "end": 1108.3600000000001, "text": " the center of that token in the entire sequences."}, {"start": 1108.36, "end": 1114.84, "text": " And now we do this, we said we take random two second audio, but we do this procedure for"}, {"start": 1114.84, "end": 1122.9599999999998, "text": " the entire text, okay, for every single token in the text that we look at."}, {"start": 1122.9599999999998, "end": 1134.04, "text": " So in the 22nd text, we do this because then for each token, we'll get a token center."}, {"start": 1134.04, "end": 1141.6399999999999, "text": " And now the aligners job here is to align that to the actual sound."}, {"start": 1141.6399999999999, "end": 1145.04, "text": " So what we also give the generators here, the offset."}, {"start": 1145.04, "end": 1152.44, "text": " So let's say we have this 22nd of speech and we randomly sample these two seconds and"}, {"start": 1152.44, "end": 1155.76, "text": " that's maybe five seconds from the beginning."}, {"start": 1155.76, "end": 1160.32, "text": " We also tell it this is five seconds right here."}, {"start": 1160.32, "end": 1171.2, "text": " So what we can now do is we can calculate back sort of and say, okay, here I have, I first"}, {"start": 1171.2, "end": 1176.04, "text": " need to discard five seconds of my signal and I have a prediction how long each token"}, {"start": 1176.04, "end": 1177.04, "text": " is."}, {"start": 1177.04, "end": 1182.72, "text": " So I can just cross out tokens until I have basically wasted five seconds."}, {"start": 1182.72, "end": 1189.76, "text": " And then I know, okay, from here to wherever these things sum up to two seconds, from here"}, {"start": 1189.76, "end": 1194.24, "text": " to that, those are my two seconds that I want to look at."}, {"start": 1194.24, "end": 1201.72, "text": " Now this is how I figure out where in the big sound wave my fragment is, right, because"}, {"start": 1201.72, "end": 1207.84, "text": " I have this offset where I sampled it and I simply add use this and the predicted lengths"}, {"start": 1207.84, "end": 1208.84, "text": " to figure it out."}, {"start": 1208.84, "end": 1213.8799999999999, "text": " Now, still need to figure out these tokens that are actually in the span, how do they"}, {"start": 1213.8799999999999, "end": 1215.56, "text": " distribute?"}, {"start": 1215.56, "end": 1218.64, "text": " And that's what this aligner here does."}, {"start": 1218.64, "end": 1221.5600000000002, "text": " Let's, we've already predicted the token centers."}, {"start": 1221.5600000000002, "end": 1227.72, "text": " We simply assume that if these are correct, right, then if this is, let's say, if this"}, {"start": 1227.72, "end": 1233.96, "text": " is one second long, I assume that the middle is after 0.5 seconds."}, {"start": 1233.96, "end": 1237.2, "text": " So this is one second, the middle is 0.5 seconds."}, {"start": 1237.2, "end": 1241.64, "text": " So I think that this token is aligned right here."}, {"start": 1241.64, "end": 1243.8000000000002, "text": " This is the center of the token."}, {"start": 1243.8, "end": 1251.8, "text": " Now we want to be a little bit fuzzy with respect to that."}, {"start": 1251.8, "end": 1256.9199999999998, "text": " So what they do is they sort of use a Gaussian kernel right here."}, {"start": 1256.9199999999998, "end": 1263.24, "text": " So for each token, as you can see here, each token has a center which is here."}, {"start": 1263.24, "end": 1268.12, "text": " So the y axis is the time in sound and the x axis is the token."}, {"start": 1268.12, "end": 1272.12, "text": " And for each token we say, well, it doesn't have to be exactly there."}, {"start": 1272.12, "end": 1276.76, "text": " It can be, so they put a Gaussian kernel like this."}, {"start": 1276.76, "end": 1282.36, "text": " Okay, if you imagine this kernel popping out of the frame, they say this is about where"}, {"start": 1282.36, "end": 1283.6799999999998, "text": " the center is."}, {"start": 1283.6799999999998, "end": 1290.12, "text": " And for this token right here, they say, well, it's probably here in the middle, but it"}, {"start": 1290.12, "end": 1293.6, "text": " could also be here or here or here or here."}, {"start": 1293.6, "end": 1297.32, "text": " And we wait this like this."}, {"start": 1297.32, "end": 1305.04, "text": " So these are the weights and then you simply sum up the weights with these embeddings."}, {"start": 1305.04, "end": 1310.52, "text": " So for each token out of this style at a convolution block, you get a hidden embedding."}, {"start": 1310.52, "end": 1317.04, "text": " And by using this alignment matrix that you computed by predicting the lengths and therefore"}, {"start": 1317.04, "end": 1322.1599999999999, "text": " predicting the centers of the tokens, you can then sort of shift."}, {"start": 1322.16, "end": 1329.2, "text": " So first you assume that h1, h2, h3, if you were to do nothing, these would just all take"}, {"start": 1329.2, "end": 1332.16, "text": " up like a third of the time."}, {"start": 1332.16, "end": 1337.28, "text": " And now by multiplying with this matrix, you have the opportunity because you predicted"}, {"start": 1337.28, "end": 1343.3600000000001, "text": " a longer length for the first token, you have the opportunity to shift that a bit to the"}, {"start": 1343.3600000000001, "end": 1349.5600000000002, "text": " right and maybe shorten the second token a bit and then the third token goes until the"}, {"start": 1349.5600000000002, "end": 1350.5600000000002, "text": " end."}, {"start": 1350.56, "end": 1353.2, "text": " Okay, that's what this aligner thing is."}, {"start": 1353.2, "end": 1355.28, "text": " This is not a model by itself."}, {"start": 1355.28, "end": 1360.32, "text": " All that this takes in is the computation right here of the token lengths."}, {"start": 1360.32, "end": 1365.8799999999999, "text": " This estimates these token lengths for each of the tokens and the rest is deterministic."}, {"start": 1365.8799999999999, "end": 1369.48, "text": " It's simply saying, okay, how much is the offset?"}, {"start": 1369.48, "end": 1370.48, "text": " Cool."}, {"start": 1370.48, "end": 1375.1599999999999, "text": " That's how we know where in the sound wave we are and then where is each of the centers"}, {"start": 1375.1599999999999, "end": 1379.32, "text": " and we simply do that by summing up the predicted token lengths."}, {"start": 1379.32, "end": 1384.96, "text": " And then we use a Gaussian kernel with like a set hyperparameter to be a little bit fuzzy"}, {"start": 1384.96, "end": 1387.72, "text": " with respect to these lengths right here."}, {"start": 1387.72, "end": 1394.3999999999999, "text": " So to be differentiable basically and that will ultimately train this loss, this model"}, {"start": 1394.3999999999999, "end": 1397.6, "text": " right here that computes the token length."}, {"start": 1397.6, "end": 1404.28, "text": " All right, so we sum up in a weighted fashion these embeddings right here and that's what"}, {"start": 1404.28, "end": 1405.9199999999998, "text": " goes into the generator."}, {"start": 1405.92, "end": 1412.3200000000002, "text": " So now we have embeddings and we have the alignments for the embeddings which are these pieces"}, {"start": 1412.3200000000002, "end": 1416.44, "text": " of where in the sound wave these are."}, {"start": 1416.44, "end": 1421.3200000000002, "text": " And from that the generator can produce the sound wave itself."}, {"start": 1421.3200000000002, "end": 1422.3200000000002, "text": " Okay."}, {"start": 1422.3200000000002, "end": 1424.68, "text": " And that's basically that's just an up sampling here."}, {"start": 1424.68, "end": 1432.92, "text": " I think that's just an up convolution up sampling from 200 hertz signal to a 24 kilohertz"}, {"start": 1432.92, "end": 1436.44, "text": " signal."}, {"start": 1436.44, "end": 1438.44, "text": " Cool."}, {"start": 1438.44, "end": 1441.16, "text": " So that's that."}, {"start": 1441.16, "end": 1446.1200000000001, "text": " Now they discover this doesn't work and why doesn't it work?"}, {"start": 1446.1200000000001, "end": 1451.64, "text": " It's because at the beginning of training these token length predictions here are pretty"}, {"start": 1451.64, "end": 1453.16, "text": " crappy."}, {"start": 1453.16, "end": 1460.44, "text": " And so that means that I guess especially this part even where you say well where where"}, {"start": 1460.44, "end": 1467.92, "text": " in the sound wave of my 20 seconds do I even need to cut out to compare with the discriminator"}, {"start": 1467.92, "end": 1469.28, "text": " right."}, {"start": 1469.28, "end": 1474.3600000000001, "text": " If you give if you sample this piece here and that's what you give to the discriminator"}, {"start": 1474.3600000000001, "end": 1479.48, "text": " but your length predictions are so far off that the generator is trying to produce this"}, {"start": 1479.48, "end": 1485.88, "text": " particular piece because it thinks it thinks oh instead of producing this tokens here"}, {"start": 1485.88, "end": 1491.68, "text": " which is what the discriminator looks at it produces these tokens here."}, {"start": 1491.68, "end": 1497.68, "text": " Of course you have no no chance no matter how good your adversarial loss is."}, {"start": 1497.68, "end": 1504.88, "text": " Remember the this is these length predictions are used to see basically to see which of these"}, {"start": 1504.88, "end": 1510.88, "text": " tokens the generator needs to produce the sound for and how they're aligned."}, {"start": 1510.88, "end": 1515.2800000000002, "text": " So they have an additional loss right here."}, {"start": 1515.28, "end": 1523.6, "text": " What they do is they produce from the again they go via the spectrograms within this spectrogram"}, {"start": 1523.6, "end": 1526.0, "text": " prediction loss."}, {"start": 1526.0, "end": 1531.84, "text": " So they say we discovered that adversarial feedback is insufficient to learn alignment."}, {"start": 1531.84, "end": 1536.08, "text": " At the start of training the aligner does not produce an accurate alignment so the information"}, {"start": 1536.08, "end": 1540.3999999999999, "text": " in the input tokens is incorrectly temporarily distributed."}, {"start": 1540.4, "end": 1545.8400000000001, "text": " This encourages the decoder to ignore the aligner output."}, {"start": 1545.8400000000001, "end": 1549.3200000000002, "text": " The unconditional discriminators provide no useful signal to correct this."}, {"start": 1549.3200000000002, "end": 1555.44, "text": " Oh yeah I should have mentioned this the discriminators here since you don't know which tokens"}, {"start": 1555.44, "end": 1560.68, "text": " you should produce the discriminators are unconditional they don't know which text is"}, {"start": 1560.68, "end": 1565.3200000000002, "text": " produced right you don't give them the tokens you simply give them the sound waves."}, {"start": 1565.3200000000002, "end": 1568.0, "text": " That's something I find particularly interesting here."}, {"start": 1568.0, "end": 1573.24, "text": " Now you of course this wouldn't work in like a traditional again because you simply have"}, {"start": 1573.24, "end": 1577.84, "text": " a data sample here and a data sample right here."}, {"start": 1577.84, "end": 1583.8, "text": " But in this case you of course have the corresponding sound samples but still they are you know"}, {"start": 1583.8, "end": 1588.4, "text": " they are cut down to a sub sequence so you don't know which text you're producing so you"}, {"start": 1588.4, "end": 1594.24, "text": " have to make the discriminators unconditional and therefore they are going to discriminate"}, {"start": 1594.24, "end": 1601.08, "text": " as we said between potentially between two completely non overlapping pieces of the sound"}, {"start": 1601.08, "end": 1605.92, "text": " wave which of course doesn't help you and then the aligner can also not learn anything"}, {"start": 1605.92, "end": 1611.88, "text": " because there is no learning signal because everything just says this is not the same."}, {"start": 1611.88, "end": 1619.04, "text": " Okay and that's what they say here we face a different problem we do not have aligned ground"}, {"start": 1619.04, "end": 1625.44, "text": " truth conditional discriminators which they don't have need an aligner module which cannot"}, {"start": 1625.44, "end": 1630.0, "text": " function correctly at the start of training effectively turning them into unconditional"}, {"start": 1630.0, "end": 1634.52, "text": " discriminators so even if they were to input the text it would still be the wrong text"}, {"start": 1634.52, "end": 1638.84, "text": " because their aligner is wrong at the beginning."}, {"start": 1638.84, "end": 1642.68, "text": " Although it should be possible in theory to train the discriminators aligner module"}, {"start": 1642.68, "end": 1647.92, "text": " other serially we find that this does not work in practice and training gets stuck."}, {"start": 1647.92, "end": 1654.5600000000002, "text": " So what do they do they say instead we propose to guide learning by using an explicit prediction"}, {"start": 1654.5600000000002, "end": 1660.76, "text": " loss in the spectrogram domain we minimize the L1 loss between the log scale male spectrograms"}, {"start": 1660.76, "end": 1667.4, "text": " of the generator output and the corresponding ground truth training window."}, {"start": 1667.4, "end": 1673.52, "text": " This helps learning to take off and renders conditional discriminators unnecessary simplifying"}, {"start": 1673.52, "end": 1674.72, "text": " the model."}, {"start": 1674.72, "end": 1683.08, "text": " So they take the spectrogram of the generator output and the corresponding ground truth"}, {"start": 1683.08, "end": 1689.04, "text": " training window and they simply calculate the L1 difference of the spectrograms."}, {"start": 1689.04, "end": 1696.88, "text": " Now this as I understand it this is different from this is different from because we said"}, {"start": 1696.88, "end": 1700.88, "text": " they also have a discriminator on the spectrograms."}, {"start": 1700.88, "end": 1703.56, "text": " This is different from that."}, {"start": 1703.56, "end": 1709.48, "text": " This is even in addition to that so here somewhere we had yeah this was the discriminator on"}, {"start": 1709.48, "end": 1714.04, "text": " the spectrograms and I think this is even different."}, {"start": 1714.04, "end": 1722.32, "text": " So what they're doing is they also the discriminators simply decides do the spectrograms look real"}, {"start": 1722.32, "end": 1725.8, "text": " or fake does the spectrogram look real or fake."}, {"start": 1725.8, "end": 1733.52, "text": " Now they also take the spectrograms and compare them with the L1 loss."}, {"start": 1733.52, "end": 1738.84, "text": " So this is exactly what they said they wouldn't do right here."}, {"start": 1738.84, "end": 1744.96, "text": " Now it's still the case right it's still the case that they don't use spectrograms as"}, {"start": 1744.96, "end": 1751.16, "text": " intermediate representations but they now do have a supervised loss on the spectrograms"}, {"start": 1751.16, "end": 1756.6, "text": " and one of the motivations to do this end to end is saying you know maybe these auxiliary"}, {"start": 1756.6, "end": 1761.56, "text": " losses and supervised losses they sort of distract they're good to guide the training"}, {"start": 1761.56, "end": 1766.8, "text": " but they sort of distract and now they see okay maybe we have to introduce this one"}, {"start": 1766.8, "end": 1774.44, "text": " right here in order to make the training start because this is a real signal but again"}, {"start": 1774.44, "end": 1783.12, "text": " you run into a problem namely if you produce something with the generator and so first"}, {"start": 1783.12, "end": 1788.6, "text": " of all this is not a discriminator anymore this is a true L1 loss."}, {"start": 1788.6, "end": 1797.1999999999998, "text": " So we potentially run into this problem right of the generator simply copying the input"}, {"start": 1797.1999999999998, "end": 1801.28, "text": " because you always tell it what the correct input is this is now a supervised loss that"}, {"start": 1801.28, "end": 1809.52, "text": " we guide the training with and what was I going to say."}, {"start": 1809.52, "end": 1813.9199999999998, "text": " So you take the generator output you transform it into a spectrogram you take the real output"}, {"start": 1813.9199999999998, "end": 1816.3999999999999, "text": " transform it into a spectrum compare the L1 loss."}, {"start": 1816.4, "end": 1821.76, "text": " Now you sort of run into the same problem in that if these are completely not aligned"}, {"start": 1821.76, "end": 1829.2, "text": " then this is not going to work but since you have a supervised loss this it can it gives"}, {"start": 1829.2, "end": 1833.5600000000002, "text": " you a much stronger learning signal of what the generator should produce."}, {"start": 1833.5600000000002, "end": 1838.8400000000001, "text": " So you're kind of counting at the beginning of training or counting on sort of a reverse"}, {"start": 1838.84, "end": 1847.0, "text": " learning process in that the real the real sound will go into a spectrogram and the generator"}, {"start": 1847.0, "end": 1853.8, "text": " will go here and then that learning signal will sort of travel to make the generator produce"}, {"start": 1853.8, "end": 1861.6799999999998, "text": " more of whatever the real sound is and that almost like if you think that the aligner is"}, {"start": 1861.6799999999998, "end": 1868.04, "text": " so bad that we have even non overlapping fragments basically you teach the generator to"}, {"start": 1868.04, "end": 1875.12, "text": " ignore the input that it gets from down here that it gets from its entire backbone."}, {"start": 1875.12, "end": 1884.1599999999999, "text": " You teach it to sort of ignore all of that if that makes any sense it simply produces"}, {"start": 1884.1599999999999, "end": 1886.8, "text": " the sound according to this supervised loss."}, {"start": 1886.8, "end": 1891.24, "text": " Now of course it doesn't ignore it it still takes the features but it ignores the this"}, {"start": 1891.24, "end": 1897.6, "text": " whole alignment thing and now once the generator gets a better signal of what it should produce"}, {"start": 1897.6, "end": 1905.6, "text": " that signal can travel back to the aligner module to this length estimation module and guide"}, {"start": 1905.6, "end": 1910.32, "text": " that one to make better predictions about the length."}, {"start": 1910.32, "end": 1914.9599999999998, "text": " So that's how you at the beginning of training is sort of rely on this path of learning to"}, {"start": 1914.9599999999998, "end": 1921.08, "text": " make to initialize this module of the aligner and then once these length predictors are"}, {"start": 1921.08, "end": 1929.3999999999999, "text": " better then the the loss can travel in its intended path where you forward produce these"}, {"start": 1929.3999999999999, "end": 1933.28, "text": " align sound waves and then these discriminators take over."}, {"start": 1933.28, "end": 1937.04, "text": " I don't exactly know if they trade this off during training or they simply set it to"}, {"start": 1937.04, "end": 1945.0, "text": " a number such that it helps them at the beginning but it's a it's a good idea and it's a good"}, {"start": 1945.0, "end": 1954.0, "text": " trick to introduce here a supervised portion to make the beginning easier."}, {"start": 1954.0, "end": 1961.2, "text": " But of course you'd run into the same problem as I said and that the fact that if you have"}, {"start": 1961.2, "end": 1969.64, "text": " two spectrograms they don't necessarily align again and here they use this dynamic time"}, {"start": 1969.64, "end": 1978.0400000000002, "text": " warping loss. Now this looks very very similar to the aligner but it is something different"}, {"start": 1978.0400000000002, "end": 1984.2800000000002, "text": " because now you have two the difference here is you have two things that you know should"}, {"start": 1984.2800000000002, "end": 1989.0800000000002, "text": " match right you have this thing and you have this thing and they both have the same amount"}, {"start": 1989.0800000000002, "end": 1998.76, "text": " of entries so they both have a b c d e this has an a b a c a d and an e slot and this also"}, {"start": 1998.76, "end": 2007.0, "text": " has an a b a c a d and an e slot and you know that you assume so here's something you assume"}, {"start": 2007.0, "end": 2012.44, "text": " you assume that the beginning and the ends match this is not true of course because we"}, {"start": 2012.44, "end": 2018.36, "text": " have completely unaligned but they say in practice this works so you assume that sort"}, {"start": 2018.36, "end": 2028.84, "text": " of at least a little bit these are aligned. Alright so they have by the way there's so much"}, {"start": 2028.84, "end": 2036.28, "text": " to this paper by the way they have an auxiliary loss where the produced lengths all the lengths"}, {"start": 2036.28, "end": 2043.8, "text": " that the this length prediction module produces they I don't remember where that is but they have"}, {"start": 2043.8, "end": 2049.96, "text": " an auxiliary loss where all the lengths must add up right here all the lengths that these length"}, {"start": 2049.96, "end": 2055.32, "text": " predictors lose must add up to the total length of the sound which in our case I guess is the two"}, {"start": 2055.32, "end": 2062.68, "text": " seconds. Okay so that's how they if so really quickly these length predictions will sort of"}, {"start": 2063.56, "end": 2072.36, "text": " at least the least thing they can do is they can all predict like L over N and that will give you"}, {"start": 2072.36, "end": 2079.8, "text": " a sort of a rough alignment such that it it kind of makes sense to to do this dynamic time"}, {"start": 2079.8, "end": 2084.6, "text": " working to assume that the beginnings and the endings align. Alright so we have two things"}, {"start": 2084.6, "end": 2091.48, "text": " we they have the same amount of of slots we know the beginnings and ends align or we assume that"}, {"start": 2091.48, "end": 2101.4, "text": " how do we make it how do we find out which slots align to which and this is a dynamic programming"}, {"start": 2101.4, "end": 2107.96, "text": " they formulate this as a dynamic programming problem that you might you know from you might know"}, {"start": 2107.96, "end": 2115.56, "text": " from from like these are often taught in algorithms and data structure courses and so on where"}, {"start": 2115.56, "end": 2122.12, "text": " you you can figure out which of these aligns so if you go a step here that means that you go one"}, {"start": 2122.12, "end": 2129.88, "text": " step in each in each of the sequences and then if you go a step here that means only this one"}, {"start": 2129.88, "end": 2137.6400000000003, "text": " advances and this one still corresponds to this one right here and um okay I formulated wrong"}, {"start": 2137.6400000000003, "end": 2143.6400000000003, "text": " at the beginning you don't have a b c d e I guess you would actually have all of these slots and you"}, {"start": 2143.6400000000003, "end": 2149.88, "text": " would figure out which ones correspond to which and yeah but I hope you recognize these sort of"}, {"start": 2149.88, "end": 2156.84, "text": " problems where and the here you align them again so these are classic dynamic programming alignment"}, {"start": 2156.84, "end": 2165.48, "text": " problems and they align it like this and they simply say the more that this path deviates from"}, {"start": 2165.48, "end": 2173.88, "text": " the straight path the larger penalty we give so they give a penalty with respect to how much"}, {"start": 2173.88, "end": 2181.2400000000002, "text": " this path deviates so here you can see how much the spectrogram of the generated the generated"}, {"start": 2181.24, "end": 2188.6, "text": " sound aligns with the spectrogram of the ground truth and here is a penalty for each time that the"}, {"start": 2189.24, "end": 2196.12, "text": " two spectrograms don't align correctly they do this in a soft way so they do every single possible"}, {"start": 2196.12, "end": 2203.0, "text": " path right here and you can again do this using dynamic programming and the entire catch here"}, {"start": 2203.0, "end": 2210.68, "text": " is that the alignment must be monotonic because no matter how long you know or short the sequences"}, {"start": 2210.68, "end": 2216.8399999999997, "text": " are they always follow one after another in both of these spectrograms in both of these sounds so"}, {"start": 2216.8399999999997, "end": 2222.2799999999997, "text": " that's why you can optimize it in a way so over all the possible paths that you can align them"}, {"start": 2224.04, "end": 2233.08, "text": " you weigh these paths by their score that you give them here and then you calculate the loss"}, {"start": 2233.08, "end": 2240.2799999999997, "text": " across all these different paths and that will give you that is sort of a fuzzy loss so you don't"}, {"start": 2240.28, "end": 2246.36, "text": " compare the spectrograms directly but you compare them and you sort of forgive them for not aligning"}, {"start": 2246.36, "end": 2252.92, "text": " too well but the more they don't align you give a penalty and that's how you sort of force the"}, {"start": 2252.92, "end": 2259.5600000000004, "text": " generator again you force the generator to produce things that are aligned you produce produce"}, {"start": 2259.5600000000004, "end": 2266.44, "text": " these length predictions that make these spectrograms closer to each other so that's how you calculate"}, {"start": 2266.44, "end": 2273.56, "text": " the spectrogram loss this is entirely deterministic there's no learned weights right here okay"}, {"start": 2275.16, "end": 2283.4, "text": " cool last thing they say is that they use this phonemizer that's the very beginning but they also"}, {"start": 2283.4, "end": 2291.64, "text": " update that so in the results they do a lot lot of ablation studies which I don't want to go into"}, {"start": 2291.64, "end": 2297.56, "text": " right now I've already shown you some and they do a even I think they do a human evaluation"}, {"start": 2298.6, "end": 2304.8399999999997, "text": " do they do a human evaluation I know this might have been in another paper but as you have heard"}, {"start": 2304.8399999999997, "end": 2311.24, "text": " from the examples this sounds extremely realistic I'll link the website to the samples in the"}, {"start": 2312.6, "end": 2319.3199999999997, "text": " in in the video description for sure so I think we've gone over everything the generator starts"}, {"start": 2319.32, "end": 2325.88, "text": " off with text puts that into normalized text calculates hidden features right here these hidden"}, {"start": 2325.88, "end": 2333.8, "text": " features on one hand are used to predict lengths of each of the tokens in the sound and are also used"}, {"start": 2333.8, "end": 2340.6800000000003, "text": " to as an input to the generator here now they can only be used as an input to the generator if the"}, {"start": 2340.6800000000003, "end": 2348.04, "text": " generator knows how to align them in time and how to align them in time is predicted from these"}, {"start": 2348.04, "end": 2354.68, "text": " predicted lengths right here via this aligner algorithm this is an out the lengths are the only"}, {"start": 2354.68, "end": 2361.56, "text": " thing that is predicted everything then is deterministic the aligner is simply a Gaussian kernel"}, {"start": 2361.56, "end": 2371.16, "text": " over the predicted locations on the on the time axis it is so the Gaussian kernel is to make it"}, {"start": 2371.16, "end": 2376.7599999999998, "text": " to make this alignment a bit fuzzy to make this prediction fuzzy you perform a weighted sum with"}, {"start": 2376.76, "end": 2382.6000000000004, "text": " these features and then the generator knows where to put the feet where to put the tokens finally"}, {"start": 2382.6000000000004, "end": 2390.44, "text": " the generator can up sample the token now aligned tokens into sound this goes into the discriminator"}, {"start": 2390.44, "end": 2396.76, "text": " the discriminator is actually five different discriminators which try each try to discriminate"}, {"start": 2396.76, "end": 2403.48, "text": " the original from the real sorry the generated from the real at different time scales in addition to"}, {"start": 2403.48, "end": 2411.4, "text": " that you have a discriminator on these spectrograms and you also have an L1 loss on these spectrograms"}, {"start": 2411.4, "end": 2417.72, "text": " which helps especially at the beginning of training for the L1 loss of the spectrograms you have"}, {"start": 2417.72, "end": 2423.88, "text": " to again compute an alignment but you do this in a deterministic way by this thing down here"}, {"start": 2423.88, "end": 2429.8, "text": " this dynamic time-warping where you simply assume that they are aligned and forgive them for not"}, {"start": 2429.8, "end": 2441.4, "text": " being aligned with a with a a soft penalty and not a hard hard zero score all right this was the"}, {"start": 2441.4, "end": 2471.32, "text": " paper again if you like this leave a like a comment shared out subscribe and have a good day bye bye"}] |
Yannic Kilcher | 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 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 Marie-Anne Lacheau, Baptiste Rosier, Lowiq Shanusso, and Jean-Lomple 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 Kobol or Python 2 to a modern one. So for Python 2, you might know this tool that's called 2 to 3. So 2 to 3 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 2 to 3 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 many fold. 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 you can write these rules oftentimes whatever comes out is sort of a bit of cryptic source code because you can 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 obsolete it with Python 3. On the other hand if there's something like cobalt so a lot of this old banking code or insurance code or government agency code what not 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 cobalt 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 cobalt to something like Java where you have a lot of programmers that can develop and further develop your code this is much harder cobalt and Java are much more away from each other than our 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 cobalt 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 counter parts 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 we 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 sentence 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 basis in 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 that sometimes let's say in the case of torch it started as Lua and then it went to pi torch and the developers had to translate the code from torch to Python. But in the same 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 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 they're all in English. Okay, 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, the 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. 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. 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 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 know how you go this and then your output is going to be auto regressive, 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 in. So you feed that back into the model and so on. This is an auto regressive 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 it's it's thing. And by conditioning on this token right here, it knows it should now produce German. So 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. 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 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 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, 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 word pieces are in a word piece tokenization, 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. Now usually there's like some kind of indicator here that this is the end of a word and so on, but we'll simplify. And hello right here would be a HA for the first token and then LLO for the second token. And these kind of word piece and coatings 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 if the same input token in different languages. Now as you can see this comes from the same word the LLO at the end in English and the LLO 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 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 there is the 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 significant overlap in their words as such. So the word hello and the word hello they are almost the same word as letters as word pieces and these shared embedding techniques abuse sort of the fact that these languages are close. They'll say 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 end up in the same place and 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 hay appear in front of this low thing so I should probably map the ha and the hay 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 there's statistical relation to the things that are the same is the same. It is it is sort of like these ha and the hay are like synonyms in this shared language. So if you jumble all the English and German text together the model things ha and hay 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. Alright 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 languages for example the word if is the same right so if you tokenize Java or Python or C++ the word if is the same. 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 this can be in higher layers this can induce the same effect and they'll use that to map the and sorry they'll use that the result will be that the 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 in the same way. 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. 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 understand it you can do these things in parallel but there are three different objectives that achieve three different things in this models the first objective is the cross lingual mask 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 mask language model pre training however is from the bird paper so bird if you don't know 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 mask 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 the maybe the entire word there you would scrap that you would put it through your encoder which is this transformer model like bird and then bird is supposed to reconstruct hair low there. Bird 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 bird 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 the object. And which constructs often appear together and therefore learn something about 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 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 code is not going to be. So the input comes from different languages it is mapped similar things are mapped to similar places in the embedding space. 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. 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 in 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. Then that pretty clearly you know you could you could guess that that is an if of course it's not 100% 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 right 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 it 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 ask the encoder to reconstruct tokens so the encoder is this box right here this 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 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 auto regressive way one token after another right so you would output a you'd 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 you 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 involved a 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 scrambles some of the tokens right this was it was this over here you just jumble some of them around a bit and then you hear you also drop a token as you can see 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 decoder 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 task for the decoder decoder for the entire model here is if you see this here is corrupt the code I have corrupted it in various ways please tell me what I originally had now I 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 going to rewrite this to that okay and it does this one token at a time so it first goes in the the the the and it needs to output the correct thing this is I hope the difference is clear to the mask language modeling which involves the involves the decoder and here also is the first time wearing 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 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 all 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 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 can that could be unstable 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 or it could be that your back translation model made a mistake and you have to find a loss function the kind of punishes both equally or you simply keep one sort of constant 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 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 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 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 is 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 blue just aren't going to be very good because they look at ngram overlap and you can write this function with very different ngrams and still be very very valid and correct and also exact match is not going to be really 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 this of course this isn't super duper gold standard especially with random inputs because usually what you want to do is test 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 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 translate code into other languages now the if you do what they have here is transcoder beam one which means a beam size of one so if you don't know a beam searches very shortly beam searches 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 in hypotheses of what the 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 based claim 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 cheating 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 you could keep 10 hypotheses during decoding and that 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 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 languages 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 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 print statement in C++ or in Java no actually the print statement in Python is print and in Java print LN and so on but it will still like 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 Z++ 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-SNE plot 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 print LN and see out 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 rule based translation in this function right here you have a C++ function that takes a character pointer to that is called 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 to you input a pointer to the array and that would define the string so if you translate this again this the type of this is simply character array if you translate this with this trans coder system that they've built into Java in Java there is a type called string 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 at least there is a type called string so it would map that it would recognize 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 so here 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 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 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 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 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 because if they read R 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 over rule based systems is that in rule based systems you can almost 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.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 alright so this was this paper I 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": 12.0, "text": " 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++."}, {"start": 12.0, "end": 20.0, "text": " 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."}, {"start": 20.0, "end": 34.0, "text": " 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."}, {"start": 34.0, "end": 49.0, "text": " And that's 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."}, {"start": 49.0, "end": 66.0, "text": " So we're going to look at this paper. It's called unsupervised translation of programming languages by Marie-Anne Lacheau, Baptiste Rosier, Lowiq Shanusso, and Jean-Lomple at Facebook AI Research."}, {"start": 66.0, "end": 77.0, "text": " 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."}, {"start": 77.0, "end": 90.0, "text": " 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."}, {"start": 90.0, "end": 104.0, "text": " They say trans compilers are primarily used for interoperability and to port code bases written in an obsolete or deprecated language such as Kobol or Python 2 to a modern one."}, {"start": 104.0, "end": 120.0, "text": " So for Python 2, you might know this tool that's called 2 to 3. So 2 to 3 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."}, {"start": 120.0, "end": 128.0, "text": " And that is to kind of push people to convert their old code bases of Python 2 to put to the modern Python 3."}, {"start": 128.0, "end": 140.0, "text": " Now 2 to 3 is handwritten program. It has specific rules built in that the programmers know if we modify Python 2 like this, Python 3 gets out."}, {"start": 140.0, "end": 151.0, "text": " 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."}, {"start": 151.0, "end": 166.0, "text": " 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."}, {"start": 166.0, "end": 181.0, "text": " Now the problem here is many fold. 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."}, {"start": 181.0, "end": 194.0, "text": " 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."}, {"start": 194.0, "end": 209.0, "text": " And oftentimes this doesn't even though it you can write these rules oftentimes whatever comes out is sort of a bit of cryptic source code because you can have to make sure that your rules cover all the possible things."}, {"start": 209.0, "end": 223.0, "text": " 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."}, {"start": 223.0, "end": 244.0, "text": " 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 obsolete it with Python 3."}, {"start": 244.0, "end": 269.0, "text": " On the other hand if there's something like cobalt so a lot of this old banking code or insurance code or government agency code what not 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."}, {"start": 269.0, "end": 298.0, "text": " And the languages themselves aren't really updated that much anymore so you would like to transform cobalt 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 cobalt to something like Java"}, {"start": 298.0, "end": 311.0, "text": " where you have a lot of programmers that can develop and further develop your code this is much harder cobalt and Java are much more away from each other than our Python 2 and Python 3."}, {"start": 311.0, "end": 329.0, "text": " 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 cobalt and Java in order to write a tool like this and you need lots of them and they need to invest lots of time."}, {"start": 329.0, "end": 338.0, "text": " 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."}, {"start": 338.0, "end": 344.0, "text": " And this of course is exactly the domain of natural language machine translation except its source code."}, {"start": 344.0, "end": 354.0, "text": " So we all know that we've all realized in the last years that things like Google Translate have become extremely good at translating."}, {"start": 354.0, "end": 368.0, "text": " So they say right here although neural models significantly outperform their rule based counter parts in the context of natural language translation which is Google Translate is all learned right now."}, {"start": 368.0, "end": 376.0, "text": " They say their applications to trans compilation have been limited due to the scarcity of parallel data in this domain."}, {"start": 376.0, "end": 384.0, "text": " So what's the problem with just going and saying oh we you know we can build really good neural machine translation models."}, {"start": 384.0, "end": 386.0, "text": " Let's just apply them to source code."}, {"start": 386.0, "end": 392.0, "text": " The problem is if you build a neural machine translation model say something that transforms English to German."}, {"start": 392.0, "end": 398.0, "text": " So you have the word hello and you output hello."}, {"start": 398.0, "end": 419.0, "text": " You can do it not with just one word but with entire sentence 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."}, {"start": 419.0, "end": 439.0, "text": " 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."}, {"start": 439.0, "end": 454.0, "text": " 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."}, {"start": 454.0, "end": 473.0, "text": " 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 basis in in great numbers where the exact same thing is implemented in one language and in the other language."}, {"start": 473.0, "end": 493.0, "text": " There's just not that much data available. It is the case that sometimes that sometimes let's say in the case of torch it started as Lua and then it went to pi torch and the developers had to translate the code from torch to Python."}, {"start": 493.0, "end": 505.0, "text": " But in the same 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."}, {"start": 505.0, "end": 518.0, "text": " 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 for the source code translation."}, {"start": 518.0, "end": 540.0, "text": " 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 they're all in English."}, {"start": 540.0, "end": 555.0, "text": " Okay, 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."}, {"start": 555.0, "end": 581.0, "text": " I don't say that these two here are somehow the same. No, I just have a bunch of German, the 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."}, {"start": 581.0, "end": 599.0, "text": " 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."}, {"start": 599.0, "end": 623.0, "text": " 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."}, {"start": 623.0, "end": 642.0, "text": " 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."}, {"start": 642.0, "end": 669.0, "text": " 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 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."}, {"start": 669.0, "end": 698.0, "text": " 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 know how you go this and then your output is going to be auto regressive, 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 in."}, {"start": 698.0, "end": 722.0, "text": " So you feed that back into the model and so on. This is an auto regressive 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 it's it's thing. And by conditioning on this token right here, it knows it should now produce German."}, {"start": 722.0, "end": 735.0, "text": " So 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."}, {"start": 735.0, "end": 760.0, "text": " 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?"}, {"start": 760.0, "end": 772.0, "text": " If we have a shared vocabulary between the languages and we always put this token, we can the decoder is not a problem. You can just learn the decoder in a straightforward way."}, {"start": 772.0, "end": 784.0, "text": " 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."}, {"start": 784.0, "end": 796.0, "text": " 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."}, {"start": 796.0, "end": 807.0, "text": " Since we are in a shared space right here, what you need is a shared vocabulary. So you tokenize all of the text with a shared vocabulary."}, {"start": 807.0, "end": 821.0, "text": " And this vocabulary is going to consist of sort of word pieces. Now if you don't know what word pieces are in a word piece tokenization, what you would do is you would split words into so-called word pieces."}, {"start": 821.0, "end": 834.0, "text": " 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."}, {"start": 834.0, "end": 847.0, "text": " Now usually there's like some kind of indicator here that this is the end of a word and so on, but we'll simplify. And hello right here would be a HA for the first token and then LLO for the second token."}, {"start": 847.0, "end": 860.0, "text": " And these kind of word piece and coatings 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."}, {"start": 860.0, "end": 873.0, "text": " 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."}, {"start": 873.0, "end": 885.0, "text": " That means that to the model this and this looks like the same thing. It is the same thing right if the same input token in different languages."}, {"start": 885.0, "end": 896.0, "text": " Now as you can see this comes from the same word the LLO at the end in English and the LLO at the end in German. It comes from the same word."}, {"start": 896.0, "end": 905.0, "text": " 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."}, {"start": 905.0, "end": 918.0, "text": " Or since these things are usually context dependent we can say in a similar embedding space or a close embedding space. But certainly the initial vectors are the same."}, {"start": 918.0, "end": 931.0, "text": " That is already half the task right so by by tokenizing in this way we have already mapped part of our languages even though there is the different languages."}, {"start": 931.0, "end": 946.0, "text": " 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 significant overlap in their words as such."}, {"start": 946.0, "end": 960.0, "text": " So the word hello and the word hello they are almost the same word as letters as word pieces and these shared embedding techniques abuse sort of the fact that these languages are close."}, {"start": 960.0, "end": 971.0, "text": " They'll say 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 end up in the same place and embedding space."}, {"start": 971.0, "end": 983.0, "text": " 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."}, {"start": 983.0, "end": 990.0, "text": " So if two things appear together often in the same context they'll be mapped into the same space as well."}, {"start": 990.0, "end": 1004.0, "text": " So it would realize there is a lot of times where ha and hay appear in front of this low thing so I should probably map the ha and the hay to the same location in embedding space."}, {"start": 1004.0, "end": 1018.0, "text": " 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"}, {"start": 1018.0, "end": 1028.0, "text": " 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."}, {"start": 1028.0, "end": 1047.0, "text": " 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."}, {"start": 1047.0, "end": 1061.0, "text": " 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 there's statistical relation to the things that are the same is the same."}, {"start": 1061.0, "end": 1068.0, "text": " It is it is sort of like these ha and the hay are like synonyms in this shared language."}, {"start": 1068.0, "end": 1082.0, "text": " So if you jumble all the English and German text together the model things ha and hay 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."}, {"start": 1082.0, "end": 1086.0, "text": " So true this would exactly be the same thing in this case."}, {"start": 1086.0, "end": 1106.0, "text": " Alright 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."}, {"start": 1106.0, "end": 1134.0, "text": " 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 languages for example the word if is the same right so if you tokenize Java or Python or C++ the word if is the same."}, {"start": 1134.0, "end": 1159.0, "text": " 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"}, {"start": 1159.0, "end": 1175.0, "text": " this can be in higher layers this can induce the same effect and they'll use that to map the and sorry they'll use that the result will be that the the similar things in the same in these languages will be mapped to the similar spaces in embedding space."}, {"start": 1175.0, "end": 1204.0, "text": " 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 in the same way."}, {"start": 1204.0, "end": 1227.0, "text": " 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."}, {"start": 1227.0, "end": 1245.0, "text": " 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."}, {"start": 1245.0, "end": 1274.0, "text": " So the first thing you do and as understand it you can do these things in parallel but there are three different objectives that achieve three different things in this models the first objective is the cross lingual mask 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."}, {"start": 1274.0, "end": 1302.0, "text": " This mask language model pre training however is from the bird paper so bird if you don't know 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 mask language model if you train the encoder you input code with tokens like hello there."}, {"start": 1302.0, "end": 1328.0, "text": " You would then so this is your input you would then mask some of the tokens for example here the low and the maybe the entire word there you would scrap that you would put it through your encoder which is this transformer model like bird and then bird is supposed to reconstruct hair low there."}, {"start": 1328.0, "end": 1357.0, "text": " Bird 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 bird 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 the object."}, {"start": 1357.0, "end": 1386.0, "text": " And which constructs often appear together and therefore learn something about 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."}, {"start": 1386.0, "end": 1415.0, "text": " Throw it in there right Java goes in there by tokenizing it and 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 code is not going to be."}, {"start": 1415.0, "end": 1424.0, "text": " So the input comes from different languages it is mapped similar things are mapped to similar places in the embedding space."}, {"start": 1424.0, "end": 1441.0, "text": " 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."}, {"start": 1441.0, "end": 1470.0, "text": " 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 in 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."}, {"start": 1470.0, "end": 1499.0, "text": " Then that pretty clearly you know you could you could guess that that is an if of course it's not 100% 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 right and then in the last thing this is even more complicated if you don't see that the I is here"}, {"start": 1499.0, "end": 1528.0, "text": " 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 it integers index arrays so on okay so this is what the model does first"}, {"start": 1528.0, "end": 1551.0, "text": " 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 ask the encoder to reconstruct tokens so the encoder is this box right here this"}, {"start": 1551.0, "end": 1567.0, "text": " 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"}, {"start": 1567.0, "end": 1586.0, "text": " now 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 auto regressive way one token after another right"}, {"start": 1586.0, "end": 1603.0, "text": " so you would output a you'd 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 you would produce the next token and so on so it would produce token after token the output"}, {"start": 1603.0, "end": 1624.0, "text": " 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"}, {"start": 1624.0, "end": 1649.0, "text": " I mean you train it jointly with the encoder but you also involved a 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 scrambles some of the tokens right this was it was this over here"}, {"start": 1649.0, "end": 1669.0, "text": " you just jumble some of them around a bit and then you hear you also drop a token as you can see 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 decoder into the first the encoder"}, {"start": 1669.0, "end": 1693.0, "text": " and then you ask the decoder to give you back the original code without showing it the original code so the task for the decoder decoder for the entire model here is if you see this here is corrupt the code I have corrupted it in various ways please tell me what I originally had"}, {"start": 1693.0, "end": 1720.0, "text": " now I 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 going to rewrite this to that"}, {"start": 1720.0, "end": 1737.0, "text": " okay and it does this one token at a time so it first goes in the the the the and it needs to output the correct thing this is I hope the difference is clear to the mask language modeling which involves the involves the decoder"}, {"start": 1737.0, "end": 1766.0, "text": " and here also is the first time wearing 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 it"}, {"start": 1766.0, "end": 1785.0, "text": " 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"}, {"start": 1785.0, "end": 1804.0, "text": " 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 all 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"}, {"start": 1804.0, "end": 1833.0, "text": " 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"}, {"start": 1833.0, "end": 1854.0, "text": " 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"}, {"start": 1854.0, "end": 1869.0, "text": " 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"}, {"start": 1869.0, "end": 1895.0, "text": " I believe in this case they could use the same model but you can that could be unstable 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"}, {"start": 1895.0, "end": 1924.0, "text": " 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 or it could be that your back translation model made a mistake and you have to find a loss function the kind of punishes both equally or you simply keep one sort of constant"}, {"start": 1924.0, "end": 1943.0, "text": " 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"}, {"start": 1943.0, "end": 1957.0, "text": " but I hope 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"}, {"start": 1957.0, "end": 1975.0, "text": " 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 language and that is attuned to translating from one language to another language"}, {"start": 1975.0, "end": 1982.0, "text": " so that's that's it how this is all how does this work"}, {"start": 1982.0, "end": 2005.0, "text": " 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"}, {"start": 2005.0, "end": 2020.0, "text": " 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 they have an example"}, {"start": 2020.0, "end": 2033.0, "text": " 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"}, {"start": 2033.0, "end": 2050.0, "text": " 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"}, {"start": 2050.0, "end": 2062.0, "text": " 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 is this if construct is everywhere the else if is everywhere"}, {"start": 2062.0, "end": 2078.0, "text": " 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"}, {"start": 2078.0, "end": 2086.0, "text": " 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"}, {"start": 2086.0, "end": 2096.0, "text": " 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"}, {"start": 2096.0, "end": 2109.0, "text": " 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"}, {"start": 2109.0, "end": 2117.0, "text": " so metrics from natural language processing like blue just aren't going to be very good because they look at ngram overlap"}, {"start": 2117.0, "end": 2124.0, "text": " and you can write this function with very different ngrams and still be very very valid and correct"}, {"start": 2124.0, "end": 2137.0, "text": " and also exact match is not going to be really the gold standard here so what they do is they create a set of unit tests where for each of these functions they go"}, {"start": 2137.0, "end": 2154.0, "text": " 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"}, {"start": 2154.0, "end": 2165.0, "text": " 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"}, {"start": 2165.0, "end": 2180.0, "text": " 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"}, {"start": 2180.0, "end": 2196.0, "text": " this of course this isn't super duper gold standard especially with random inputs because usually what you want to do is test corner cases but it's better than anything else so far"}, {"start": 2196.0, "end": 2209.0, "text": " 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"}, {"start": 2209.0, "end": 2222.0, "text": " 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"}, {"start": 2222.0, "end": 2245.0, "text": " 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 trans compiler do the heavy lifting and you simply check whether or not the output is good"}, {"start": 2245.0, "end": 2266.0, "text": " 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 translate code into other languages"}, {"start": 2266.0, "end": 2288.0, "text": " now the if you do what they have here is transcoder beam one which means a beam size of one so if you don't know a beam searches very shortly beam searches 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"}, {"start": 2288.0, "end": 2312.0, "text": " or you can sort of always keep the top in hypotheses of what the 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"}, {"start": 2312.0, "end": 2337.0, "text": " 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"}, {"start": 2337.0, "end": 2349.0, "text": " 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"}, {"start": 2349.0, "end": 2358.0, "text": " so more beam size based claim means you can keep more hypotheses of the output in memory until the end"}, {"start": 2358.0, "end": 2376.0, "text": " 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"}, {"start": 2376.0, "end": 2400.0, "text": " let's call it a bit cheating 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"}, {"start": 2400.0, "end": 2409.0, "text": " and of course that's not really a match to the commercial or to the baseline system because it can output one thing"}, {"start": 2409.0, "end": 2425.0, "text": " 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"}, {"start": 2425.0, "end": 2441.0, "text": " 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 you could keep 10 hypotheses during decoding and that the end output the top one the top likely one"}, {"start": 2441.0, "end": 2450.0, "text": " and as you can see that is better than greedy but it is worse than where you know give yourself the freedom to output multiple ones of course"}, {"start": 2450.0, "end": 2460.0, "text": " though they say that most of the errors that this top one makes come from compilation errors when the target languages Java or C++"}, {"start": 2460.0, "end": 2475.0, "text": " 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 hypotheses until the end"}, {"start": 2475.0, "end": 2487.0, "text": " 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"}, {"start": 2487.0, "end": 2495.0, "text": " yeah so in that way I can I can understand what they're saying right here"}, {"start": 2495.0, "end": 2512.0, "text": " 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"}, {"start": 2512.0, "end": 2524.0, "text": " 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"}, {"start": 2524.0, "end": 2542.0, "text": " print statement in C++ or in Java no actually the print statement in Python is print and in Java print LN and so on but it will still like all the if statements it will still tokenize into the same into the same word"}, {"start": 2542.0, "end": 2559.0, "text": " but it's simply not viable to to parse Python with a Z++ parser okay so we have looked at this the results this is one of the results"}, {"start": 2559.0, "end": 2568.0, "text": " they look at their shared embedding space and this is a T-SNE plot a 2D projection of this shared embedding space and you can see that this is actually happening"}, {"start": 2568.0, "end": 2581.0, "text": " so the different so null null and none are mapped to similar locations print LN and see out are mapped to similar locations in this space so this is exactly what we want"}, {"start": 2581.0, "end": 2594.0, "text": " 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"}, {"start": 2594.0, "end": 2606.0, "text": " 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"}, {"start": 2606.0, "end": 2617.0, "text": " one of these examples here is quite impressive and kind of shows the difference between this and rule based translation"}, {"start": 2617.0, "end": 2627.0, "text": " in this function right here you have a C++ function that takes a character pointer to that is called STR in as an input"}, {"start": 2627.0, "end": 2638.0, "text": " 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"}, {"start": 2638.0, "end": 2654.0, "text": " 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 to you input a pointer to the array and that would define the string"}, {"start": 2654.0, "end": 2670.0, "text": " so if you translate this again this the type of this is simply character array if you translate this with this trans coder system that they've built into Java in Java there is a type called string"}, {"start": 2670.0, "end": 2680.0, "text": " 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"}, {"start": 2680.0, "end": 2697.0, "text": " so there is at least there is a type called string so it would map that it would recognize 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"}, {"start": 2697.0, "end": 2714.0, "text": " so here 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"}, {"start": 2714.0, "end": 2743.0, "text": " 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 rule based systems can this can be an advantage over rule based system"}, {"start": 2743.0, "end": 2764.0, "text": " 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 variable name and that usually means that the constructs here are like the constructs in Java where people use strings"}, {"start": 2764.0, "end": 2792.0, "text": " 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 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"}, {"start": 2792.0, "end": 2816.0, "text": " because if they read R 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"}, {"start": 2816.0, "end": 2832.0, "text": " 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"}, {"start": 2832.0, "end": 2854.0, "text": " of course the disadvantage over rule based systems is that in rule based systems you can almost 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"}, {"start": 2854.0, "end": 2872.0, "text": " 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.min is not overloaded in Java it only gives you the minimum of two things and not the minimum of an array"}, {"start": 2872.0, "end": 2886.0, "text": " 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"}, {"start": 2886.0, "end": 2907.0, "text": " alright so this was this paper I 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"}, {"start": 2907.0, "end": 2917.0, "text": " 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"}] |
Yannic Kilcher | 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 write the trains every day So when I heard that there is a new rips 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 Insolving 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 how far 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 basically have to specify for every single agent what their next action at each time step is Now this 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 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 NURRIPS 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 NURRIPS 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 you know 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 then basically people can discuss solutions to this problem I'll make a git GitHub repository in public and where people can submit poll requests to and I'll be sort of the merger and what not of 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 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 also as I already said I'm not going to be super active in this discord It's meant as as a method for the community among itself to 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 mine or L 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 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": 6.5600000000000005, "text": " 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"}, {"start": 7.08, "end": 13.44, "text": " Environment now the flatland environment is a train simulator that has been developed by the Swiss train company"}, {"start": 13.44, "end": 15.76, "text": " And I write the trains every day"}, {"start": 15.76, "end": 23.52, "text": " So when I heard that there is a new rips challenge to use the flatland environment to make the train system in my country better"}, {"start": 23.52, "end": 27.68, "text": " I of course was very excited to do that so out of purely"}, {"start": 27.68, "end": 34.519999999999996, "text": " Egotistical reasons I'm going to present to you the flatland environment and I invite you to join me"}, {"start": 35.12, "end": 37.12, "text": " Insolving this as a group together"}, {"start": 37.84, "end": 45.120000000000005, "text": " So the plan is basically that we as a community sort of do this challenge and completely in the open"}, {"start": 45.84, "end": 53.120000000000005, "text": " With absolutely no aspirations of winning or doing well or getting any of the prizes just for the fun of it"}, {"start": 53.12, "end": 56.879999999999995, "text": " And we'll see how how far will come together?"}, {"start": 57.559999999999995, "end": 60.48, "text": " Okay, so let me demonstrate the environment itself"}, {"start": 60.64, "end": 61.78, "text": " So as you can see here"}, {"start": 61.78, "end": 67.47999999999999, "text": " This is a visualization of the environments there are these agents in the environments and they have to reach certain goals"}, {"start": 67.47999999999999, "end": 71.12, "text": " And of course they can't crash if you look here to the left"}, {"start": 71.12, "end": 79.4, "text": " 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"}, {"start": 79.4, "end": 87.4, "text": " all of these agents have to reach their goal and as fast as possible without any collisions along these tracks right here"}, {"start": 87.4, "end": 95.32000000000001, "text": " So you have basically have to specify for every single agent what their next action at each time step is"}, {"start": 95.84, "end": 98.16000000000001, "text": " Now this simulator is completely"}, {"start": 98.72, "end": 104.60000000000001, "text": " Given to you this is you can you can use it and basically it's a planning problem for multiple agents"}, {"start": 104.6, "end": 112.03999999999999, "text": " So 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"}, {"start": 112.16, "end": 119.39999999999999, "text": " Whether something is in their way or is not in their way and you know every agent should reach their goal at the"}, {"start": 120.0, "end": 123.39999999999999, "text": " closest possible or at the shortest possible time of course"}, {"start": 124.08, "end": 129.0, "text": " Now there is this NURRIPS 2020 flatland challenge and"}, {"start": 129.0, "end": 138.8, "text": " Basically you can submit your solutions to their evaluator and there's a leaderboard and everything and I thought it would be fun to"}, {"start": 139.2, "end": 142.76, "text": " Participate in this now. I don't exactly know what the"}, {"start": 143.96, "end": 150.4, "text": " What's the exact connection to NURRIPS and so on but I don't care honestly and this hasn't started yet"}, {"start": 150.92000000000002, "end": 156.52, "text": " The timeline isn't really open yet, but it will start soon, but I think"}, {"start": 156.52, "end": 165.28, "text": " We can already start working on it. So the plan here is basically to just you know kind of I have no idea of traffic scheduling"}, {"start": 165.28, "end": 167.28, "text": " No idea absolutely"}, {"start": 167.68, "end": 168.8, "text": " clueless"}, {"start": 168.8, "end": 175.72, "text": " But I know a lot about reinforcement learning and even though they say the challenge has already existed last year"}, {"start": 175.96, "end": 181.36, "text": " In a very in a slightly different form. I think it was just one agent instead of multi-agent and they said"}, {"start": 181.36, "end": 189.44000000000003, "text": " Usually you have to combine the reinforcement learning with like some traditional stuff in order to perform really well like screw that"}, {"start": 190.32000000000002, "end": 196.52, "text": " No, I'm totally up for that, but it would be fun to just blast it off with RL and go there"}, {"start": 197.8, "end": 199.8, "text": " So here's my"}, {"start": 199.8, "end": 201.8, "text": " Proposition I have"}, {"start": 202.24, "end": 209.4, "text": " Opened a discord server for you to join where you can join and then basically people can discuss solutions to this problem"}, {"start": 209.4, "end": 217.4, "text": " I'll make a git GitHub repository in public and where people can submit poll requests to and I'll be sort of the"}, {"start": 217.68, "end": 226.08, "text": " merger and what not of of these and we together sort of develop solutions now my idea is that"}, {"start": 226.56, "end": 228.56, "text": " people would sort of independently"}, {"start": 229.0, "end": 235.32, "text": " 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"}, {"start": 235.32, "end": 241.6, "text": " Discussion in the discord server. I myself will not be like super active on the server"}, {"start": 241.6, "end": 251.6, "text": " It's meant for the community basically together to discuss things whoever wants to do that. So I just want to make some things clear"}, {"start": 251.64, "end": 253.64, "text": " from the beginning"}, {"start": 253.64, "end": 257.8, "text": " I will be the dictator of this project the 100%"}, {"start": 258.84, "end": 260.6, "text": " authoritarian"}, {"start": 260.6, "end": 266.36, "text": " No compromises dictator if anything is supposed to make it be decided"}, {"start": 266.36, "end": 272.28000000000003, "text": " I may elect to hold a vote and I may not if we win something I'll decide what to do with it"}, {"start": 273.64000000000004, "end": 277.52000000000004, "text": " So just this because otherwise there's just trouble right"}, {"start": 278.48, "end": 284.64000000000004, "text": " 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"}, {"start": 285.16, "end": 287.16, "text": " right, so"}, {"start": 287.16, "end": 293.16, "text": " I have no aspirations of winning right here also as I already said I'm not going to be"}, {"start": 293.72, "end": 295.32000000000005, "text": " super active in this discord"}, {"start": 295.32000000000005, "end": 301.12, "text": " It's meant as as a method for the community among itself to to communicate"}, {"start": 301.6, "end": 308.6, "text": " Third if you decide to put in work don't expect others to do so expect nothing if the project doesn't work out"}, {"start": 308.6, "end": 315.52000000000004, "text": " We scrap it if people get tired of it. We scrap it if there's some other problem. We scrap it. No expectations"}, {"start": 315.52, "end": 322.47999999999996, "text": " Never get mad at anyone else for not doing as much work or anything like this"}, {"start": 322.47999999999996, "end": 330.76, "text": " This is purely you participate because you yourself want to learn something want to have fun and if someone else does the same thing"}, {"start": 330.76, "end": 333.84, "text": " That's all the better. Okay, I will have a mainly"}, {"start": 334.52, "end": 339.52, "text": " supervisory role in this in that I will look at things that are happening and"}, {"start": 339.52, "end": 347.88, "text": " Advise and occasionally I of course will participate myself. So I hope the framing of this is clear"}, {"start": 347.91999999999996, "end": 353.12, "text": " This is not me throwing a hundred percent at this. I just thought it would be cool to"}, {"start": 353.88, "end": 357.79999999999995, "text": " Do something as a community together and this challenge"}, {"start": 357.79999999999995, "end": 365.64, "text": " It seems like you know there are other challenges like mine or L where everyone needs like a billion GPUs to even get competitive"}, {"start": 365.64, "end": 370.64, "text": " This seems like small enough that we could actually make a difference here and"}, {"start": 371.36, "end": 379.2, "text": " 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"}, {"start": 379.32, "end": 384.91999999999996, "text": " Right now. I will leave a link to the discord somewhere in the description and"}, {"start": 386.08, "end": 391.2, "text": " link to the Git repo as well and I hope that some of you will be motivated enough"}, {"start": 392.0, "end": 394.8, "text": " to come join and have some fun"}, {"start": 394.8, "end": 398.08, "text": " Alright, I'll see you there. Bye. Bye"}] |
Yannic Kilcher | 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 T-Balt Salam, T-Panjan Das and Ankur P-Parik. 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 thisribution and they advocate that this could be used in the future to assess text generation systems. All right, as always, if you like content like this consider subscribing and sharing it out and leaving a like tell YouTube that it's a good content. Of course only if you agree. So what's the problem 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 okay, ishly 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 let this run on your evaluation data set. And you give the results to a bunch of human raiders. 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 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, 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 sentence. And otherwise, it wouldn't, you know, be fair. But you basically compare n grams of output and gold and some gold standard. You kind of multiple gold standards and so on. So this blow 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 system to use LSTM's with attention. These systems have become extremely, extremely good. I don't know if you notice, but Google Translate has been getting better and better really fast. I remember 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 blur. Can we just stop with the variance on bird? We get a used bird for everything, but you know, yeah. So they say it's a learned evaluation metric based on bird that can model human judgments with a few thousand possibly biased training examples. Okay. So what you what you would do in these cases is now 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'll 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 top thing like to match the top thing or the human assesses the quality of the sample. And now you have a training data set right. You have a Z they call I think this Z and Z tilde or something or why. Yes, this is it. They call this why which is the gold standard label. This is why tilde whatever the machine produced and or X X X tilde. And then why 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 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 years, this years 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 maybe use 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 these systems? And they're saying that they found the method to do this. This blurred as they said, not only have they found the method, but their method only uses a few thousand 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 thousand training examples because these are generated by humans, right? And humans are expensive. So and it's not like like like image net you do it once you have it for 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 blurred, 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 dataset in contrast to even nila 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 do we need to do to fine tune bird for quality evaluation. Now if you don't know what bird is bird is this is 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 a 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 birth take the model so birds really good at language right take the model and train it on this data set. They say however fine tuning bird requires a sizeable amount of IID data. Okay. We don't have that in these tasks which is less than ideal for metric that should generalize to a variety of tasks and model drift. So this problem with just applying bird 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 you 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 used to warm up bird before fine tuning on the rating data. And you might know bird bird 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 bird to reconstruct it like a denoising auto encoder. And that way bird learn 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 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 too 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 would 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. Because otherwise you always have to say like okay I want a pre train bird 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 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 Z and then they're going to kind of model with them a bit they're going to disturb them a bit 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 feeling with Bert so what they're doing is they take a Bert that can do language modeling right they 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 perturbed 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 them 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 with 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 and they just found this to help okay so now they have a giant dataset of sentences and perturbed versions of sentences so what are they going to do with that giant dataset and the answer is they're going to take this Z and Z tilde and you're going to put that into birth 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 a 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 blur or rouge or this birth 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 is all the things six six different tasks okay so six different tasks and the catch here is so what would happen for example with blur is you would take a model and you would calculate the blur score between those two things but you wouldn't input that into birth you would ask bird to predict the blur score okay so bird would be outputting be hat and B would be the actual blur score so you would train bird to predict the blur score of this particular pair of input and so one you want to take as like the input and the other one you take as the reference okay and you would ask bird to predict the blur 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 blur 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 it 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 verb 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 verb 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 verb would learn something useful okay so that's that's 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 a tune 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 all right 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 distribution shift so what they're saying is okay this has 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 score still hold so they try to simulate this by splitting the data and they introduce 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 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 the dotted lines right here or so so you can see the overlap between the test and the train data 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 we evaluate it 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 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 um 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 there's a bunch of other metrics right here where they are blade 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 is a big number but who knows if three is a big number right who like we can't assess that what we need to see is really the where the crossover point between the models 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 everything everyone's using bird for everything right and bird 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 a 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 these skill via just dividing up the data into bad and good ratings I don't think that covers these distributions 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 2017 2018 and 2019 and there we would have a much better assessment of a distribution shift over the years right 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 burnt score right there is entailment which is also a burnt 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 doing 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 a week 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 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 all right this was it for me for blurred 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 T-Balt"}, {"start": 6.640000000000001, "end": 13.64, "text": " Salam, T-Panjan Das and Ankur P-Parik. So this paper on a high level proposes a new"}, {"start": 13.64, "end": 20.68, "text": " metric for text generation tasks such as machine translation by leveraging a BERT model"}, {"start": 20.68, "end": 26.88, "text": " to produce like an automated metric, an automated quality metric. And they make this BERT model"}, {"start": 26.88, "end": 34.44, "text": " robust by pre-training it on a very wide array of tasks that they can use synthetic data"}, {"start": 34.44, "end": 41.56, "text": " to train it. And therefore the model and this resulting score is very robust to shifts in"}, {"start": 41.56, "end": 47.64, "text": " thisribution and they advocate that this could be used in the future to assess text generation"}, {"start": 47.64, "end": 54.04, "text": " systems. All right, as always, if you like content like this consider subscribing and sharing"}, {"start": 54.04, "end": 61.0, "text": " it out and leaving a like tell YouTube that it's a good content. Of course only if you agree."}, {"start": 61.0, "end": 69.92, "text": " So what's the problem with evaluation for text generation? So if you know the machine translation"}, {"start": 69.92, "end": 75.03999999999999, "text": " community, basically what they do is they have these data sets where they translate from one"}, {"start": 75.03999999999999, "end": 82.6, "text": " language into another, let's say English to French. And they have a training data set that is"}, {"start": 82.6, "end": 90.28, "text": " fairly okay, ishly large. And then they somehow need to evaluate this. Okay, so you have"}, {"start": 90.28, "end": 95.91999999999999, "text": " like a test data set, but all you can really do is sort of calculate the perplexity of a"}, {"start": 95.91999999999999, "end": 101.0, "text": " language model that you produce or of a translation model that you produce. There's not really"}, {"start": 101.0, "end": 105.91999999999999, "text": " a metric for translation. So the gold standard is to get it to humans. So you train on this"}, {"start": 105.91999999999999, "end": 111.63999999999999, "text": " data set, you produce a program, let's, this is your machine translation program that you"}, {"start": 111.64, "end": 118.08, "text": " produce from the data. And you let this run on your evaluation data set. And you give the"}, {"start": 118.08, "end": 123.4, "text": " results to a bunch of human raiders. These could be regular people. These could be linguists"}, {"start": 123.4, "end": 130.96, "text": " that are experts in translation in both languages. And they will score the each of the outputs"}, {"start": 130.96, "end": 136.76, "text": " of the machine translation systems. And at the end, you will get like a number like eight."}, {"start": 136.76, "end": 142.72, "text": " Your system is eight good. The problem of course is this process is very, very slow. So the"}, {"start": 142.72, "end": 147.39999999999998, "text": " machine translation community does this every year. And it's, it's quite slow and it's quite"}, {"start": 147.39999999999998, "end": 153.07999999999998, "text": " expensive as you know, it requires these humans here to assess all of these systems output."}, {"start": 153.07999999999998, "end": 158.07999999999998, "text": " And you want a sort of a sizable output, right? Because you want sort of a, a good sample"}, {"start": 158.07999999999998, "end": 166.0, "text": " of the machine translation system. So this is not really satisfactory, but like an automated"}, {"start": 166.0, "end": 171.04, "text": " score like perplexity is also not satisfactory. What people have done is they've come up with"}, {"start": 171.04, "end": 177.88, "text": " proxy scores for the humans. And two of those scores are called Rouge and blue. And specifically"}, {"start": 177.88, "end": 186.08, "text": " blue is one of these metrics that people use. And it, it kind of, it takes n grams in the"}, {"start": 186.08, "end": 192.64, "text": " sentences. So n grams would be like snippets of like, let's say four words after one another."}, {"start": 192.64, "end": 196.92, "text": " And there would be these snippets and that the machine translation system produces. And"}, {"start": 196.92, "end": 202.88, "text": " then it would go into the validation data set and look at the gold standard translation"}, {"start": 202.88, "end": 208.07999999999998, "text": " that was also produced by humans. And it would also look at these snippets of size four."}, {"start": 208.07999999999998, "end": 213.39999999999998, "text": " And it would just kind of assess how many of the snippets overlap. Of course, the machine"}, {"start": 213.39999999999998, "end": 218.64, "text": " translation system has never seen the label like the gold standard for that particular"}, {"start": 218.64, "end": 224.44, "text": " sentence. And otherwise, it wouldn't, you know, be fair. But you basically compare n grams"}, {"start": 224.44, "end": 230.6, "text": " of output and gold and some gold standard. You kind of multiple gold standards and so on."}, {"start": 230.6, "end": 236.72, "text": " So this blow metric is more of like a heuristic. And it has been found to correlate fairly"}, {"start": 236.72, "end": 242.07999999999998, "text": " well with the humans up until recently, of course, with the explosion of neural machine"}, {"start": 242.07999999999998, "end": 247.79999999999998, "text": " translation and especially transformer based machine translation, I guess. And but also"}, {"start": 247.8, "end": 254.32000000000002, "text": " the their system to use LSTM's with attention. These systems have become extremely, extremely"}, {"start": 254.32000000000002, "end": 259.68, "text": " good. I don't know if you notice, but Google Translate has been getting better and better"}, {"start": 259.68, "end": 265.52, "text": " really fast. I remember the first years of Google Translate when people still made"}, {"start": 265.52, "end": 272.2, "text": " fun of it. I don't think many people make fun of it now. At least it's not a meme anymore."}, {"start": 272.2, "end": 279.56, "text": " So this the more the better and better these systems were, the more these metrics like"}, {"start": 279.56, "end": 287.03999999999996, "text": " blue and rouge have diverged from the humans. And they're not really reliable anymore,"}, {"start": 287.03999999999996, "end": 293.52, "text": " especially if you compare really high skill systems to each other, blue tends to not correlate"}, {"start": 293.52, "end": 300.2, "text": " well with humans. And therefore, we're looking for a new metric, a new metric that correlates"}, {"start": 300.2, "end": 310.15999999999997, "text": " well with humans, but can be evaluated automatically. And this this paper here proposes this"}, {"start": 310.15999999999997, "end": 316.4, "text": " blur. Can we just stop with the variance on bird? We get a used bird for everything,"}, {"start": 316.4, "end": 324.76, "text": " but you know, yeah. So they say it's a learned evaluation metric based on bird that can model"}, {"start": 324.76, "end": 333.52, "text": " human judgments with a few thousand possibly biased training examples. Okay. So what you"}, {"start": 333.52, "end": 342.8, "text": " what you would do in these cases is now the creation of a metric becomes a machine learning"}, {"start": 342.8, "end": 352.96, "text": " task itself. So what you'll have is you'll have a data set of things that are gold standard"}, {"start": 352.96, "end": 360.2, "text": " translations by humans. You'll have the output of the machine translation system. Okay."}, {"start": 360.2, "end": 364.47999999999996, "text": " You put them together. So you have the gold standard sentence. This is this would be the"}, {"start": 364.47999999999996, "end": 368.84, "text": " optimal translation. You'll have whatever the machine translation produced. And then"}, {"start": 368.84, "end": 375.47999999999996, "text": " you'll have a human look at it and create a score like this eight right here. It says"}, {"start": 375.48, "end": 383.36, "text": " this these two sentences they match eight good. Okay. So eight maybe it's out of 10. So this"}, {"start": 383.36, "end": 388.76, "text": " this bottom thing is a very good translation for the top thing like to match the top"}, {"start": 388.76, "end": 395.24, "text": " thing or the human assesses the quality of the sample. And now you have a training data set"}, {"start": 395.24, "end": 404.28000000000003, "text": " right. You have a Z they call I think this Z and Z tilde or something or why. Yes, this"}, {"start": 404.28, "end": 411.35999999999996, "text": " is it. They call this why which is the gold standard label. This is why tilde whatever the"}, {"start": 411.35999999999996, "end": 420.52, "text": " machine produced and or X X X tilde. And then why is the label. So your task is now given"}, {"start": 420.52, "end": 428.08, "text": " X and X tilde predict whatever the human would say about this. Okay. So if you can collect"}, {"start": 428.08, "end": 435.47999999999996, "text": " a few of these samples right here of different machine translation systems, then you can"}, {"start": 435.47999999999996, "end": 442.12, "text": " formulate you can make a data set out of this right and formulate a machine learning task."}, {"start": 442.12, "end": 447.2, "text": " And that's exactly what these competitions have done. So it's like a meta meta competition."}, {"start": 447.2, "end": 454.68, "text": " Now can it's a competition for designing the best metrics of the other competitions. Basically."}, {"start": 454.68, "end": 460.36, "text": " And of course the difficulty here is that the data set isn't static because if you come"}, {"start": 460.36, "end": 465.44, "text": " up with a metric such as blue, let's say you come up with a better blue, you would want"}, {"start": 465.44, "end": 471.6, "text": " these these other tasks to use it in the next years as well because the thing about metrics"}, {"start": 471.6, "end": 475.96000000000004, "text": " is you need to be able to compare to like previous years and so on. So you would want a"}, {"start": 475.96000000000004, "end": 482.8, "text": " metric that is still valid for other years and other sort of other slightly different tasks."}, {"start": 482.8, "end": 489.28000000000003, "text": " And also for other machine translation systems. So if you just learn on data from now from"}, {"start": 489.28000000000003, "end": 496.8, "text": " this years, this years competitions and in five years, all of these models will have become"}, {"start": 496.8, "end": 502.16, "text": " so much better and they'll produce different output. And that's the difficulty. Your metric"}, {"start": 502.16, "end": 509.28000000000003, "text": " should still be valid at that point. And this paper basically deals with the, deals with"}, {"start": 509.28, "end": 516.68, "text": " the fact that can you learn such a metric from data that exists at one point in time that"}, {"start": 516.68, "end": 523.16, "text": " will be robust to shifts in distribution. So in five years, the machine translation systems"}, {"start": 523.16, "end": 527.9599999999999, "text": " they're better. They maybe use different language constructs to translate certain things"}, {"start": 527.9599999999999, "end": 533.36, "text": " because that's they assess that better. Can you still make a good judgment about which"}, {"start": 533.36, "end": 539.1999999999999, "text": " one which of these systems is better than the other system? Can you still assess how humans"}, {"start": 539.2, "end": 548.24, "text": " would rate these systems? And they're saying that they found the method to do this. This"}, {"start": 548.24, "end": 555.36, "text": " blurred as they said, not only have they found the method, but their method only uses a few"}, {"start": 555.36, "end": 562.96, "text": " thousand possibly biased training examples. And they do this via a new pre-training scheme."}, {"start": 562.96, "end": 568.32, "text": " So they say a key aspect of our approach is a novel pre-training scheme that uses millions"}, {"start": 568.32, "end": 573.72, "text": " of synthetic examples to help the model generalize. Now, why is it important that it only"}, {"start": 573.72, "end": 580.48, "text": " uses a few thousand training examples because these are generated by humans, right? And humans"}, {"start": 580.48, "end": 588.44, "text": " are expensive. So and it's not like like like image net you do it once you have it for"}, {"start": 588.44, "end": 594.48, "text": " for 20 years. This is done year after year. And you need real experts like translation"}, {"start": 594.48, "end": 600.9200000000001, "text": " experts. So this is expensive. So the fewer of these actual training examples that the"}, {"start": 600.9200000000001, "end": 609.8000000000001, "text": " thing can can be efficient on the better. So they circumvent this by using they say millions"}, {"start": 609.8000000000001, "end": 615.96, "text": " of synthetic examples to help the model generalize. They do this in a pre-training step. They"}, {"start": 615.96, "end": 622.16, "text": " stay blurred, provides state of the art results on the last three years of the WMT metrics"}, {"start": 622.16, "end": 627.64, "text": " shared tasks. Now this is this this is this meta task where you're asked to come up with"}, {"start": 627.64, "end": 635.24, "text": " a metric for the other tasks. And the web NLG competition dataset in contrast to even nila"}, {"start": 635.24, "end": 640.04, "text": " bird-based approach yield superior results even when the training data scares and out of"}, {"start": 640.04, "end": 651.1999999999999, "text": " distribution. Right. So let's have a look at what they do. Okay. So they say what do we"}, {"start": 651.2, "end": 657.2, "text": " need to do to fine tune bird for quality evaluation. Now if you don't know what bird is bird"}, {"start": 657.2, "end": 665.88, "text": " is this is basically a model that takes in a bunch of text. So you have a bunch of text."}, {"start": 665.88, "end": 670.76, "text": " And then it's a model that is a transformer. I've made a video on it if you if you want"}, {"start": 670.76, "end": 678.08, "text": " to check that out. And then you get as outputs you get like a sequence of vectors. But important"}, {"start": 678.08, "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": 690.5200000000001, "text": " if you want to do classification you would output you would put a classification layer"}, {"start": 690.5200000000001, "end": 696.9200000000001, "text": " on top to classify it into certain classes. If you want to do regression you do that."}, {"start": 696.9200000000001, "end": 702.6800000000001, "text": " You can do other things with these outputs right here. But for this particular paper only"}, {"start": 702.68, "end": 713.12, "text": " this CLS output is relevant. Okay. So you would input this pair of gold standard and output"}, {"start": 713.12, "end": 721.3199999999999, "text": " of the machine and the output would be a output Y which is either a number or a class label."}, {"start": 721.3199999999999, "end": 731.12, "text": " And in this case it's a number. Okay. So you input right here you input these these two"}, {"start": 731.12, "end": 739.0, "text": " things and outcomes this whole sequence. And you only you take the CLS output vector and"}, {"start": 739.0, "end": 743.88, "text": " you put it through a linear layer right here. Weights and bias. And that would output a"}, {"start": 743.88, "end": 750.68, "text": " number Y. And the number Y you train to be as close as possible to the human to what the"}, {"start": 750.68, "end": 758.64, "text": " human would say about this pair X the gold standard and X tilde the output of the system."}, {"start": 758.64, "end": 765.64, "text": " Okay. So this is what you would do if you were simply going about it just take birth take"}, {"start": 765.64, "end": 771.3199999999999, "text": " the model so birds really good at language right take the model and train it on this data"}, {"start": 771.3199999999999, "end": 780.24, "text": " set. They say however fine tuning bird requires a sizeable amount of IID data. Okay. We don't"}, {"start": 780.24, "end": 785.88, "text": " have that in these tasks which is less than ideal for metric that should generalize to"}, {"start": 785.88, "end": 793.08, "text": " a variety of tasks and model drift. So this problem with just applying bird here is that"}, {"start": 793.08, "end": 798.12, "text": " way they say it you don't have enough data and it's it won't be a robust solution. It"}, {"start": 798.12, "end": 803.92, "text": " will only work for this particular data set that you train it on. The solution they say"}, {"start": 803.92, "end": 815.04, "text": " is you pre train on synthetic data. So what does that mean? They say the key aspect"}, {"start": 815.04, "end": 819.8, "text": " of our approach is a pre training technique that we used to warm up bird before fine tuning"}, {"start": 819.8, "end": 827.8, "text": " on the rating data. And you might know bird bird training which is where you do this"}, {"start": 827.8, "end": 832.04, "text": " masked language model pre training right. So if you are given a piece of text let's"}, {"start": 832.04, "end": 837.36, "text": " say you're given this piece of text right here. What you would do is you would drop out"}, {"start": 837.36, "end": 843.24, "text": " a couple of words like this one and this one and ask bird to reconstruct it like a denoising"}, {"start": 843.24, "end": 851.44, "text": " auto encoder. And that way bird learn sort of about language in this particular way. Now"}, {"start": 851.44, "end": 857.48, "text": " they they're not saying you should replace that what they're saying is first first you"}, {"start": 857.48, "end": 862.76, "text": " should do this masked language model pre training. Second you should do their synthetic"}, {"start": 862.76, "end": 874.8, "text": " pre training. And third you should do the fine tuning tuning. Now if in the in the naive"}, {"start": 874.8, "end": 879.28, "text": " approach you would skip this step too right. So their claim is that by introduction of"}, {"start": 879.28, "end": 885.28, "text": " this step too that you could be a lot better and a lot more robust because you've already"}, {"start": 885.28, "end": 891.4399999999999, "text": " had like so you're already exposed to information in this step that would make you more robust"}, {"start": 891.44, "end": 901.1600000000001, "text": " to distribution shifts in this fine tuning data later. Okay now I've short inter interlude"}, {"start": 901.1600000000001, "end": 908.6400000000001, "text": " right here I've advocated for this step to be called priming. Because otherwise you"}, {"start": 908.6400000000001, "end": 914.9200000000001, "text": " always have to say like okay I want a pre train bird but I don't mean like pre pre training"}, {"start": 914.9200000000001, "end": 920.6800000000001, "text": " like I don't mean this this this is already called pre training. I want to pre train after"}, {"start": 920.68, "end": 930.12, "text": " pre train so I just vote for this to be called priming. I have no idea like if you come up"}, {"start": 930.12, "end": 935.4, "text": " with stuff like this probably you've heard it somewhere so I'm I guess I might not be"}, {"start": 935.4, "end": 943.28, "text": " the inventor of this but it is a good sounding word and it sort of fits right. Okay so they"}, {"start": 943.28, "end": 948.3199999999999, "text": " say we generate a large number of synthetic reference candidate pairs. So what they're"}, {"start": 948.32, "end": 953.9200000000001, "text": " going to do is they're going to take a bunch of text and in their case I think it's Wikipedia"}, {"start": 953.9200000000001, "end": 962.72, "text": " and for each Wikipedia article they're going to so they they take Wikipedia they're going"}, {"start": 962.72, "end": 970.48, "text": " to draw sentences or samples or paragraphs from Wikipedia and these are going to be Z and"}, {"start": 970.48, "end": 978.64, "text": " then they're going to kind of model with them a bit they're going to disturb them a bit"}, {"start": 978.64, "end": 985.6, "text": " make them a bit different to make them go Z tilde and this simulates that the difference"}, {"start": 985.6, "end": 990.4, "text": " between what the machine translation outputs and the gold standard sentence they're usually"}, {"start": 990.4, "end": 994.64, "text": " not exactly the same right if you translate a sentence there are many ways you can do it"}, {"start": 994.64, "end": 1000.92, "text": " and their goal is to sort of produce a data set that has sentences and sort of perturbed"}, {"start": 1000.92, "end": 1007.6, "text": " versions of the sentence but not perturbed like randomly but perturbed in a sort of"}, {"start": 1007.6, "end": 1015.6, "text": " language knowledgeable way okay so how do they how do they do this they have three different"}, {"start": 1015.6, "end": 1022.92, "text": " ways first of all mask feeling with Bert so what they're doing is they take a Bert that"}, {"start": 1022.92, "end": 1027.96, "text": " can do language modeling right they pre-trained Bert and let's again say we have this text right"}, {"start": 1027.96, "end": 1035.24, "text": " here and they simply drop out two words or so and fill them in again with Bert now Bert might"}, {"start": 1035.24, "end": 1040.68, "text": " produce the same words or it might produce slightly different words depending on how many you drop"}, {"start": 1040.68, "end": 1048.52, "text": " out you can choose the kind of amount that you perturbed these sentences okay so the second is"}, {"start": 1048.52, "end": 1058.76, "text": " they back translate so what they do with back translation is they use a machine translation"}, {"start": 1058.76, "end": 1066.12, "text": " model now it doesn't matter which one you take at them they use any machine translation model"}, {"start": 1066.12, "end": 1073.48, "text": " to take a sentence Z and then they map it to another language say from English to French"}, {"start": 1073.48, "end": 1084.76, "text": " so this is Z French and then they map it back again with the Z tilde is now the French to English"}, {"start": 1084.76, "end": 1089.8, "text": " translation so you need to translation model first you translate it to French and then you translate"}, {"start": 1089.8, "end": 1095.24, "text": " it back again and that would sometimes give you the same sentence but often it will give you sort"}, {"start": 1095.24, "end": 1102.1200000000001, "text": " of a paraphrase of the sentence that you had at the beginning okay so that would be the second"}, {"start": 1102.12, "end": 1109.9599999999998, "text": " version that you could make pairs of sentences that are sort of similar and the third way is just"}, {"start": 1109.9599999999998, "end": 1118.6, "text": " to drop out words and they just found this to help okay so now they have a giant dataset of sentences"}, {"start": 1118.6, "end": 1124.9199999999998, "text": " and perturbed versions of sentences so what are they going to do with that giant dataset and the"}, {"start": 1124.92, "end": 1131.24, "text": " answer is they're going to take this Z and Z tilde and you're going to put that into birth"}, {"start": 1133.24, "end": 1139.64, "text": " into their thing that they prime now this is the priming stage right this was pre-trained on"}, {"start": 1139.64, "end": 1143.48, "text": " mask language modeling now they want to prime a what are they going to do they're going to take this"}, {"start": 1143.48, "end": 1150.3600000000001, "text": " CLS vector and now of course this is not the final task and we don't have final labels for these"}, {"start": 1150.36, "end": 1158.04, "text": " two things so we need to somehow come up with our own late tasks and labels for them and they"}, {"start": 1158.04, "end": 1167.3999999999999, "text": " decide to go a whole bunch of tasks so they go like they go like I think I don't even know they go"}, {"start": 1168.6, "end": 1174.9199999999998, "text": " eight or so or five or so different tasks they construct different tasks to perform with these"}, {"start": 1174.92, "end": 1183.24, "text": " two things and this could be metrics like blur or rouge or this birth score right here so you simply"}, {"start": 1183.24, "end": 1191.0800000000002, "text": " calculate the n-gram overlap between Z and Z prime that would be one of the scores it could be the"}, {"start": 1191.0800000000002, "end": 1197.64, "text": " back translation likelihood which is how likely does a back translation model assess this sentence"}, {"start": 1197.64, "end": 1206.76, "text": " oh here is all the things six six different tasks okay so six different tasks and the catch here is"}, {"start": 1208.44, "end": 1215.88, "text": " so what would happen for example with blur is you would take a model and you would calculate the"}, {"start": 1215.88, "end": 1221.3200000000002, "text": " blur score between those two things but you wouldn't input that into birth you would ask"}, {"start": 1221.32, "end": 1230.52, "text": " bird to predict the blur score okay so bird would be outputting be hat and B would be the actual"}, {"start": 1230.52, "end": 1239.8799999999999, "text": " blur score so you would train bird to predict the blur score of this particular pair of input and"}, {"start": 1239.8799999999999, "end": 1243.8, "text": " so one you want to take as like the input and the other one you take as the reference"}, {"start": 1245.48, "end": 1250.9199999999998, "text": " okay and you would ask bird to predict the blur score of this to predict the rouge score"}, {"start": 1250.92, "end": 1257.0800000000002, "text": " you would ask it all of these signals you ask this one the same model you ask to predict all of"}, {"start": 1257.0800000000002, "end": 1263.5600000000002, "text": " these scores for these two things okay so you can calculate all of these scores by either blur"}, {"start": 1263.5600000000002, "end": 1271.4, "text": " is like a script you run or you have some other model like a pre-trained translation model that you"}, {"start": 1271.4, "end": 1280.8400000000001, "text": " use to assess the that you ask how good is this in terms of this particular task back translation and"}, {"start": 1280.8400000000001, "end": 1287.3200000000002, "text": " then you try to predict that score where it is important you're not training the model to perform"}, {"start": 1287.3200000000002, "end": 1294.52, "text": " these tasks these tasks you already have another model that's specialized to these particular"}, {"start": 1294.52, "end": 1301.96, "text": " tasks and you simply ask them to score the input okay you have an entailment model that outputs"}, {"start": 1301.96, "end": 1307.6399999999999, "text": " how much by how much does the second sentence entail the first that basically means does the second"}, {"start": 1307.6399999999999, "end": 1314.52, "text": " sentence follow from the first and of course this is not you know it's not actually proper input"}, {"start": 1314.52, "end": 1320.36, "text": " data for that task but you can still ask the model and if these are good translations of each"}, {"start": 1320.36, "end": 1325.8799999999999, "text": " other if these sentences match then the second one should probably follow fairly well for the first"}, {"start": 1325.8799999999999, "end": 1333.24, "text": " but at least you can if you make verb predict that it will learn something useful about the relation"}, {"start": 1333.24, "end": 1340.6799999999998, "text": " between the two sentences so the entire game name of the game here is to come up with tasks that if"}, {"start": 1340.6799999999998, "end": 1349.4799999999998, "text": " verb learns to predict the score of these tasks on those inputs sorry on pretending one is the input"}, {"start": 1349.48, "end": 1354.2, "text": " and the other one is the output or on the two inputs and then trying to predict the score"}, {"start": 1355.56, "end": 1364.6, "text": " then verb would learn something useful okay so that's that's the the trick here is to come up with"}, {"start": 1364.6, "end": 1370.3600000000001, "text": " these pre-training tasks and you train them all at the same time and by doing it all at the same"}, {"start": 1370.3600000000001, "end": 1376.2, "text": " time and by doing it on many many different perturbations on these different tasks you hope"}, {"start": 1376.2, "end": 1383.96, "text": " that your model learns something some it's kind of becoming a tune to the variations that language"}, {"start": 1383.96, "end": 1390.52, "text": " can have and what it needs to pay attention to and then you hope that if you then have done this"}, {"start": 1390.52, "end": 1396.8400000000001, "text": " then take this model and then do step three which is fine tuning on the actual data you have"}, {"start": 1396.8400000000001, "end": 1402.76, "text": " you would guess that it becomes very good at that data but also it retains all of these abilities"}, {"start": 1402.76, "end": 1411.72, "text": " and and generalizes better to other sort of distribution shifts all right so that is"}, {"start": 1414.6, "end": 1422.6, "text": " that is the thing here and they on this task on this metric learning tasks they do outperform"}, {"start": 1422.6, "end": 1431.7199999999998, "text": " all other models right here and what I find interesting is down here where they now test for the"}, {"start": 1433.7199999999998, "end": 1445.6399999999999, "text": " distribution shift so what they're saying is okay this has all on data basically where"}, {"start": 1446.1999999999998, "end": 1450.6, "text": " you know we train on training data and evaluate on testing data and they're sort of the same they"}, {"start": 1450.6, "end": 1456.36, "text": " come from the same year from the same machine turn translation models and we don't really know"}, {"start": 1456.9199999999998, "end": 1462.28, "text": " how you know next year the machine translation models might be different does our score still hold"}, {"start": 1462.76, "end": 1470.84, "text": " so they try to simulate this by splitting the data and they introduce this skew factor so what they'll"}, {"start": 1470.84, "end": 1476.9199999999998, "text": " do is they'll split the data so usually as you can see right here the training date the ratings"}, {"start": 1476.92, "end": 1484.04, "text": " these are the human ratings the training data is sort of distributed like this would be"}, {"start": 1485.24, "end": 1492.3600000000001, "text": " the test data and the training data would almost be overlapping that if you can see like the"}, {"start": 1492.3600000000001, "end": 1499.24, "text": " the dotted lines right here or so so you can see the overlap between the test and the"}, {"start": 1499.24, "end": 1505.0800000000002, "text": " train data of the human ratings is very close now they say we can we can skew that we can sort of"}, {"start": 1505.08, "end": 1514.76, "text": " filter the data such that in the training data only very bad sentences are and in the test data"}, {"start": 1514.76, "end": 1521.24, "text": " there are only very good sentences okay and this simulates the fact that you know we this might be"}, {"start": 1521.24, "end": 1527.1599999999999, "text": " the previous year's data that we train our metric on and then we we evaluate it on the next year's"}, {"start": 1527.16, "end": 1535.72, "text": " data where all the systems have become better and what this does is you can see right here the"}, {"start": 1535.72, "end": 1545.96, "text": " bottom axis is the test skew and the color here is the training skew okay so what interests what"}, {"start": 1545.96, "end": 1555.5600000000002, "text": " what we're interested in is to the right and down the colors so as these skew increases you can see"}, {"start": 1555.56, "end": 1562.84, "text": " right here that the the quality of the metric decreases okay the correlation with the human ratings"}, {"start": 1562.84, "end": 1571.96, "text": " decreases but it it still remains fairly well but especially the training skew if you update the"}, {"start": 1571.96, "end": 1577.96, "text": " train so if you make the training examples really bad so to say it the score just drops down"}, {"start": 1578.6, "end": 1583.72, "text": " and they can show pretty well here that if you add this pre-training then the score"}, {"start": 1583.72, "end": 1590.3600000000001, "text": " um except in this extreme case so the score for all of these it remains relatively high and"}, {"start": 1590.3600000000001, "end": 1598.6000000000001, "text": " especially remains above the blue score which is always sort of worse right so this is is pretty"}, {"start": 1599.08, "end": 1609.0, "text": " as pretty neat and shows this power of this pre-training basically that's that's the the robustness"}, {"start": 1609.0, "end": 1614.12, "text": " to quality drift metric and there's a bunch of other metrics right here where they"}, {"start": 1614.12, "end": 1622.12, "text": " are blade and so on but I don't want to go too much into that I more want to make some comments"}, {"start": 1622.12, "end": 1629.0, "text": " on on this work so what what I think so first of all in a paper like this what what I would like"}, {"start": 1629.0, "end": 1638.6, "text": " to see is like the extrapolation right here to if and where this ever crosses the the blue score"}, {"start": 1638.6, "end": 1644.84, "text": " right because I mean okay it seems like yeah this skew of three is a is a big number but who knows"}, {"start": 1644.84, "end": 1650.9199999999998, "text": " if three is a big number right who like we can't assess that what we need to see is really the"}, {"start": 1650.9199999999998, "end": 1657.7199999999998, "text": " where the crossover point between the models to assess where does it where is it no longer valid"}, {"start": 1657.7199999999998, "end": 1664.28, "text": " and so on the second part here is that my problem with this method of splitting the data I mean"}, {"start": 1664.28, "end": 1670.52, "text": " yes okay you split the bad from the good but it's not it's not only that these things are getting"}, {"start": 1670.52, "end": 1675.72, "text": " better so right now everyone's using transformers for everything everyone's using bird for"}, {"start": 1675.72, "end": 1681.3999999999999, "text": " everything right and bird is a specific architecture that is going to be good at specific things"}, {"start": 1681.3999999999999, "end": 1687.96, "text": " at specific grammatical constructs in specific languages right so it's the mistakes it makes are"}, {"start": 1687.96, "end": 1694.68, "text": " very systematic now if in one year or two years all of a sudden the a new model pops up I don't"}, {"start": 1694.68, "end": 1700.6000000000001, "text": " know like someone discovers that graph neural networks are really good at machine translation"}, {"start": 1700.6000000000001, "end": 1705.96, "text": " these models are going to be attuned to a very very different set of construct they might be"}, {"start": 1705.96, "end": 1712.92, "text": " better overall but they're going to make a different sort of mistake and so I think just assessing"}, {"start": 1712.92, "end": 1720.68, "text": " these skill via just dividing up the data into bad and good ratings I don't think that covers"}, {"start": 1720.68, "end": 1726.52, "text": " these distributions shifts that they set out to cover right what I would have expected is something"}, {"start": 1726.52, "end": 1734.1200000000001, "text": " like them because these tasks are repeated year after year and I would have expected them to for"}, {"start": 1734.12, "end": 1743.3999999999999, "text": " example train on 2017 and then evaluate on 2019 or something like or show like evaluate on 2017 2018"}, {"start": 1743.3999999999999, "end": 1751.1599999999999, "text": " and 2019 and there we would have a much better assessment of a distribution shift over the years"}, {"start": 1751.1599999999999, "end": 1759.3999999999999, "text": " right so it is not super convincing to me and what is most worrisome is if you look at their"}, {"start": 1759.4, "end": 1767.8000000000002, "text": " pre-training tasks I mean okay there is a there's blue and rouge but there is burnt score right there"}, {"start": 1767.8000000000002, "end": 1773.5600000000002, "text": " is entailment which is also a burnt model and the back translation I mean who knows that's"}, {"start": 1773.5600000000002, "end": 1781.24, "text": " probably either going to be a transformer or a LSTM with an attention mechanism which is the"}, {"start": 1781.24, "end": 1786.76, "text": " attention mechanism is the basis for transformers so all of these things are basically going to make"}, {"start": 1786.76, "end": 1795.24, "text": " the same sort of bias mistakes right they're doing to it's not it's not like there is Gaussian noise"}, {"start": 1795.24, "end": 1801.72, "text": " on top of these things all of these things are going to be a week in the same sort of assessments"}, {"start": 1802.12, "end": 1808.12, "text": " and not agree with like they're going to have systematic errors in them with respect to them"}, {"start": 1808.12, "end": 1816.44, "text": " predicting the human scores and if we evaluate our systems that some are also using exactly that"}, {"start": 1816.44, "end": 1823.72, "text": " thing right so these the systems we evaluate they are using the same type of models as here"}, {"start": 1823.72, "end": 1829.24, "text": " they're going to fall prey to the same type of mistakes and then if we switch over to systems that"}, {"start": 1829.24, "end": 1836.1200000000001, "text": " use some different right so next year we have some systems that use different techniques they're"}, {"start": 1836.1200000000001, "end": 1843.96, "text": " going to be like exactly maybe not bad in these particular things but bad in other things and"}, {"start": 1843.96, "end": 1850.92, "text": " then this thing will output a systematically biased assessment so it's sort of a house of like"}, {"start": 1850.92, "end": 1857.16, "text": " if you've seen these images of plugging in the power strip into itself and you have infinite power"}, {"start": 1857.16, "end": 1865.64, "text": " it's like it's very to me it seems very dangerous to have a such an overlap of architectures and"}, {"start": 1865.64, "end": 1875.0800000000002, "text": " methods to evaluate systems as you have in the systems themselves but I hope this will be"}, {"start": 1875.0800000000002, "end": 1882.44, "text": " regularly checked with human scores and assessed as to how much these systems are out of sync or"}, {"start": 1882.44, "end": 1888.0400000000002, "text": " in sync with humans all right this was it for me for blurred check out they have the code"}, {"start": 1888.04, "end": 1898.44, "text": " available the metric is available evaluate your stuff with it and bye bye"}] |
Yannic Kilcher | 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 Tarawol, Joel Lehman, Philippe Petrovsky, Such, Jeff Kloon 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. Alright, 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 feed forward weights what not. 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 c x. So in one case you can set c such that the sigmoid has a shape like this and then if you put c to a different value you can make this slope you can make it like a shape. So this is terrible like this. You know what I mean, okay, so 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 c and n 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 input here is like dot multiplied here and then there is like a gate with an onlinearity and then it's kind of like multiplied by the carry but then there's also a like a forget gate and what not 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 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 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 validated and then this is like a nine and you can say oh cool that's a nine so this is the 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 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 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 this cells I'm going to do the full training equivalents 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 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 I'm going to gradient descent on the model that gives me this space 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 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 p3dish is a or synthetic p3dish 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 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 RNNs they have multiple layers of these things so they'd 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 p3d ish 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 pre-condition 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 p3d 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 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 p3d ish paper these little data sets they have nothing to do 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 aval 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 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 um so they give this example right here at the beginning that if you have a a two layer um 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 um this 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 usually you would just do a grid search but this isn't 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 wide 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 variant train the big network on the entire data set took convergence and then you evolve 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 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 girdle machines or or touring touring machines you would it's basically say well that looks to me like a line so I'm going to 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 you're going to predict that'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's 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 add best interpolate their training data but they can't really extrapolate now here since the synthetic p-tri 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-hit layer but just with one unit instead of 100 and of course you can't feed in M-ness 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 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 emnist thing and here is the entire algorithm all right so you take emnist training and validation data and you instantiate a bunch of really big networks this is ground truth okay 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 nonlinearity 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 p3dish method what the p3dish 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 100 wide 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 we have that here it 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 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 going to take that I'm going to 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 with to a single neuron wide MLP and they sort of guess 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 go 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 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 metal learning right so because what you're doing they 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 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 is your training data S train and here are your initial parameters you at randomize initialize them randomly in the first step you use the training data to produce theta one then in the second step you use your training you're 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 better prediction right so the gradient 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 backprop 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 backprop for more than a couple of steps doing this now that the model the fact that the model in or model is small helps but also this introduces very very much like these things are very brittle if you backprop 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 dish 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 10 candidates to evaluate on the full test set and that way you don't have to evaluate all the like thousand candidates all right all right cool they do this for this emnest and they also do it for finding a RNN cell for the petri bank 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 data I believe the NIO 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 task they focus on so you know good good good good paper writing right here yeah um that's basically it to the paper uh there's a lot of things to be said here um I think this works in very very limited settings it it seems to me that it's sort of brittle with respect to how you abstract and also um it it's always the case like how many how how large is this synthetic training data in their case 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 um gradient descent what you would mainly find or 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 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 the result is going to match the worse 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 two convergence now 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 and 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 you're 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 p-tree 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 think this is 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": 5.32, "text": " Hi there! Today we're looking at synthetic petri dish, a novel surrogate model for rapid"}, {"start": 5.32, "end": 12.0, "text": " architecture search by Adi Tarawol, Joel Lehman, Philippe Petrovsky, Such, Jeff Kloon and"}, {"start": 12.0, "end": 19.1, "text": " Kenneth O. Stanley. This paper on a high level, it basically says if you want to do neural"}, {"start": 19.1, "end": 26.080000000000002, "text": " architecture search, if you for example search for a better non-linearity, you should be able"}, {"start": 26.08, "end": 31.959999999999997, "text": " to extract that non-linearity instantiated in a very small network and then evaluate"}, {"start": 31.959999999999997, "end": 37.68, "text": " that very small network in order to predict the performance of a large network. And therefore"}, {"start": 37.68, "end": 44.64, "text": " you can find a better non-linearity in much less time. Now the exact procedure, how you"}, {"start": 44.64, "end": 50.56, "text": " do this in the small network is the topic of this paper. As always if you like content like"}, {"start": 50.56, "end": 56.6, "text": " this I encourage you to subscribe if you are not already and to share out the video so other"}, {"start": 56.6, "end": 64.60000000000001, "text": " people can experience the joy themselves. Alright, let's dive in. So they say in the abstract"}, {"start": 64.60000000000001, "end": 72.0, "text": " neural architecture search explores a large space of architectural motives which basically"}, {"start": 72.0, "end": 78.64, "text": " so it basically means you want to find a neural architecture. Let's say you have a multi-layer"}, {"start": 78.64, "end": 86.44, "text": " perceptron right here, a couple of layers, okay, and they're all connected by you know"}, {"start": 86.44, "end": 92.36, "text": " feed forward weights what not. And each of these weights basically is a multiplication."}, {"start": 92.36, "end": 99.68, "text": " So each one of these is a multiplication of x by your weight w and then there is a non-linearity."}, {"start": 99.68, "end": 106.32, "text": " So the non-linearity could be a sigmoid. So the sigmoid would be something like 1 over"}, {"start": 106.32, "end": 112.32, "text": " 1 plus e to the negative x. Now there's a bit of an extension in a sigmoid where you can"}, {"start": 112.32, "end": 117.96, "text": " do a sigmoid that has like a temperature parameter attached or a slope parameter where you"}, {"start": 117.96, "end": 126.88, "text": " go c x. So in one case you can set c such that the sigmoid has a shape like this and then"}, {"start": 126.88, "end": 132.51999999999998, "text": " if you put c to a different value you can make this slope you can make it like a shape."}, {"start": 132.52, "end": 139.76000000000002, "text": " So this is terrible like this. You know what I mean, okay, so this c right here can potentially"}, {"start": 139.76000000000002, "end": 145.92000000000002, "text": " change the behavior of your network and you want to find a good parameter c and this is"}, {"start": 145.92000000000002, "end": 151.64000000000001, "text": " a hyper parameter. Now there are many hyper parameters like this for example how many units"}, {"start": 151.64000000000001, "end": 157.52, "text": " you have in a particular layer in a c and n it could be your filter size in a transformer"}, {"start": 157.52, "end": 163.32000000000002, "text": " could be the number of heads and so on. It could actually be not only the slope of the"}, {"start": 163.32000000000002, "end": 169.24, "text": " non-linearity but the actual non-linearity itself or famously in recurrent neural networks"}, {"start": 169.24, "end": 174.56, "text": " you have these recurrent cells and they're like okay we have an input signal and a carry"}, {"start": 174.56, "end": 180.92000000000002, "text": " signal and then the input here is like dot multiplied here and then there is like a gate"}, {"start": 180.92000000000002, "end": 184.88, "text": " with an onlinearity and then it's kind of like multiplied by the carry but then there's"}, {"start": 184.88, "end": 191.84, "text": " also a like a forget gate and what not there's a minus right here. It's very complicated"}, {"start": 191.84, "end": 198.07999999999998, "text": " and so people do architecture search over these kind of problems to find better architectures"}, {"start": 198.07999999999998, "end": 204.96, "text": " for particular problems. Now the problem is of course that how do you know if a given"}, {"start": 204.96, "end": 211.35999999999999, "text": " architecture is good. What you have to do is you'll have to go take that cell that you"}, {"start": 211.36, "end": 216.72000000000003, "text": " have dreamed up you think well I think that's a good cell and you have to train it on the"}, {"start": 216.72000000000003, "end": 222.92000000000002, "text": " full training data set this is a data set database right this is a full training data set"}, {"start": 222.92000000000002, "end": 228.84, "text": " then you need to evaluate it on your validation data set and then you have like a number you"}, {"start": 228.84, "end": 234.52, "text": " have like okay this is eight good and then you go back and you say okay what if I change"}, {"start": 234.52, "end": 240.4, "text": " this cell here what if I change it to a plus instead of a minus and you do the entire"}, {"start": 240.4, "end": 246.56, "text": " thing again train it for I don't know how much validated and then this is like a nine and"}, {"start": 246.56, "end": 251.88, "text": " you can say oh cool that's a nine so this is the very basic architecture search and there"}, {"start": 251.88, "end": 259.0, "text": " has been a lot of development in this space so like evolutionary search and so on but they"}, {"start": 259.0, "end": 264.08, "text": " most of the time they require pretty much evaluating the entire thing on the full data"}, {"start": 264.08, "end": 270.0, "text": " so you get a good you get a good estimate of what your final performance back here is going to be."}, {"start": 270.96, "end": 278.0, "text": " Now people have come up with methods to counter that and they say well if we can sort of encode"}, {"start": 278.0, "end": 284.08, "text": " the cell structure let's go with the let's go with the RNN cell if we could encode the cell"}, {"start": 284.08, "end": 291.68, "text": " structure in a sort of a continuous way so you know we can encode text in a continuous way let"}, {"start": 291.68, "end": 297.28000000000003, "text": " we could also encode a cell structure because the cell structure I can write it down as an"}, {"start": 297.28000000000003, "end": 305.6, "text": " equation I can say like okay it's the forget gate of the carry times the sigmoid output of x"}, {"start": 305.6, "end": 316.16, "text": " plus the so this is the plus here and plus the sigmoid output of x multiplied by the input"}, {"start": 316.16, "end": 322.32000000000005, "text": " let's call that I something like this right this is text I can like write it down and then I can"}, {"start": 322.32000000000005, "end": 330.56, "text": " encode that into a vector much I can for example build another RNN ironically or or something to"}, {"start": 332.56, "end": 337.36, "text": " to encode that or I can represent it as a computation graph like it is here and use a graph"}, {"start": 337.36, "end": 343.6, "text": " neural network to encode that into a single vector and then I have sort of an embedding space where each"}, {"start": 343.6, "end": 351.36, "text": " cell that I could build is a point in that embedding space and then I can evaluate a couple of them I"}, {"start": 351.36, "end": 356.88, "text": " can for example say okay this one here this one here this one here this one here I'm going to train"}, {"start": 356.88, "end": 363.84000000000003, "text": " them this cells I'm going to do the full training equivalents on get their scores and then I can learn"}, {"start": 364.72, "end": 371.52000000000004, "text": " basically in this latent space I can learn a predictor I can say okay here I get I got an eight I"}, {"start": 371.52, "end": 379.59999999999997, "text": " got a nine I got a two and I got a four so it appears to be that in this direction the good"}, {"start": 379.59999999999997, "end": 385.03999999999996, "text": " cells are in this direction and then I can do it again I can sample or I can do gradient descent"}, {"start": 385.03999999999996, "end": 391.76, "text": " in this space since this is now a continuous space I'm going to gradient descent on the model that"}, {"start": 391.76, "end": 399.03999999999996, "text": " gives me this space right so this this method basically tries to take in the building plan of a cell"}, {"start": 399.04, "end": 406.88, "text": " and learn to predict the performance just by looking at it if if you're thinking of the"}, {"start": 406.88, "end": 413.52000000000004, "text": " touring machine right now then you like I immediately thought of like this this halting problem"}, {"start": 413.52000000000004, "end": 418.0, "text": " because it appears to be exactly what it is so you're trying to build a machine that takes the"}, {"start": 418.0, "end": 426.0, "text": " building plan of another machine and tries to predict its performance now in a general sense we can"}, {"start": 426.0, "end": 434.16, "text": " already state that this problem is sort of the difficulty of this problem is equivalent"}, {"start": 434.64, "end": 440.96, "text": " to the difficulty of the original problem so I'm not sure but it appears to you know it appears"}, {"start": 440.96, "end": 445.36, "text": " to work if you throw lots of compute at it but of course that's a problem you need lots of compute"}, {"start": 446.08, "end": 453.12, "text": " right so either your your option one is to run all of these things and kind of iterate them"}, {"start": 453.12, "end": 461.52, "text": " in a neural sorry in an evolutionary way or your second option is to take the building plan and"}, {"start": 461.52, "end": 468.32, "text": " predict the performance from that both are not satisfactory and both use lots of compute now"}, {"start": 468.32, "end": 475.92, "text": " neural p3dish is a or synthetic p3dish is a way to combine the two together it says can we"}, {"start": 475.92, "end": 483.84000000000003, "text": " take the building plan here but actually run on the data on data to predict the performance"}, {"start": 484.64000000000004, "end": 492.32, "text": " so what they're saying is basically if I have this cell right here and usually this cell you know"}, {"start": 492.32, "end": 499.28000000000003, "text": " it deals with vectors of let's say size 512 and so on it will say it since this is"}, {"start": 499.28, "end": 506.32, "text": " let me draw it again up here so here you have the cell and here you have somehow the connections"}, {"start": 506.32, "end": 512.88, "text": " in there you carry and the input and the input here okay and this is the output or the carry"}, {"start": 515.04, "end": 523.12, "text": " I have 512 embedding like size of this so this is a giant cell there's 512 the vector has 512"}, {"start": 523.12, "end": 530.8, "text": " dimensions going in basically can't I take the exact same thing but and keep the connection pattern"}, {"start": 530.8, "end": 538.64, "text": " so I would keep the entire pattern of connection right here but I only do it for one or two so this"}, {"start": 538.64, "end": 548.24, "text": " is 512 and this is just two right just the I just reduce the dimensionality but I sort of keep"}, {"start": 548.24, "end": 555.84, "text": " the connection pattern alive if I only do that I have like a very small network right now"}, {"start": 555.84, "end": 562.32, "text": " and the same goes for if this is so a lot of times these RNNs they have multiple layers of these"}, {"start": 562.32, "end": 569.36, "text": " things so they'd have another exactly equal box up here and then another up here I can just"}, {"start": 569.36, "end": 577.2, "text": " reduce this to one layer and out of the regularity of these neural network things it is known that"}, {"start": 577.2, "end": 584.0, "text": " or one can make the assumption that the performance on this thing will sort of kind of be correlated"}, {"start": 584.0, "end": 590.96, "text": " to the performance of the entire thing and that's one of the things that this p3d ish paper does"}, {"start": 592.6400000000001, "end": 599.9200000000001, "text": " so we try to take out what we are trying to search over namely the connection pattern we keep"}, {"start": 599.92, "end": 607.52, "text": " that as it is up here but we reduce everything else we reduce the dimensionality we reduce the"}, {"start": 607.52, "end": 612.0799999999999, "text": " number of layers and so on now they don't actually reduce the number of layers here but you can"}, {"start": 612.0799999999999, "end": 619.04, "text": " reduce the number of units and so on okay so this in essence this works whenever you can do that"}, {"start": 619.04, "end": 626.0, "text": " whenever you can keep the structure you're searching over but can reduce the rest"}, {"start": 626.0, "end": 633.28, "text": " so that's one pre-condition doesn't work for everything the second part here is that you don't"}, {"start": 633.28, "end": 638.64, "text": " want to use this particular training data and then this particular validation data because first"}, {"start": 638.64, "end": 645.36, "text": " of all it's a lot of training data and second of all it won't give you that good of a prediction"}, {"start": 645.36, "end": 652.32, "text": " instead of what you're trying to do and this is the second part of the idea of p3d is you're trying"}, {"start": 652.32, "end": 661.7600000000001, "text": " to abstract the training data to get you a very small data set such that and the validation"}, {"start": 661.7600000000001, "end": 670.88, "text": " data as well such that if you train on this data and evaluate on this data the performance that"}, {"start": 670.88, "end": 678.6400000000001, "text": " you get will be very predictive of the performance had you trained the big model on the big data set"}, {"start": 678.64, "end": 687.1999999999999, "text": " okay in fact in this p3d ish paper these little data sets they have nothing to do with the original"}, {"start": 687.1999999999999, "end": 693.4399999999999, "text": " train and validation data and that's I think that's one of the cool things here these things"}, {"start": 694.08, "end": 699.6, "text": " this training data and this validation data they are optimized as well by the procedure"}, {"start": 699.6, "end": 707.4399999999999, "text": " they're optimized special data points that are trained these are trained parameters such that if"}, {"start": 707.44, "end": 712.1600000000001, "text": " you train on the training on the small training data and evaluate on the small aval data"}, {"start": 712.72, "end": 719.6800000000001, "text": " the you will be able to predict this performance back here with high accuracy okay and this I think"}, {"start": 719.6800000000001, "end": 726.24, "text": " is where previous approaches have or might have failed because it's you know the idea of scaling"}, {"start": 726.24, "end": 731.84, "text": " down your network in order to do the architecture search is probably has it has appeared to many"}, {"start": 731.84, "end": 738.32, "text": " people before that's not you know that's not really genius idea but probably they have all found"}, {"start": 738.32, "end": 743.84, "text": " that now we can't really do it it doesn't really give us accurate enough numbers but in this case the"}, {"start": 743.84, "end": 752.0, "text": " addition of adding these synthetic data sets that are much smaller but can still if you train and"}, {"start": 752.0, "end": 760.0, "text": " evaluate on them can still predict with high accuracy the full score of the full model that I think"}, {"start": 760.0, "end": 766.8, "text": " makes this idea work all right so I guess we're already through the idea and problem setting and"}, {"start": 766.8, "end": 775.04, "text": " everything without actually reading the paper um so they give this example right here at the beginning"}, {"start": 775.04, "end": 784.0, "text": " that if you have a a two layer um 100 wide so 100 dimensional MNIST networks it's two layers it's"}, {"start": 784.0, "end": 793.44, "text": " I think it's an MLP two layer MLP with a non-linearity that is this um this sigmoid right here this"}, {"start": 795.12, "end": 803.04, "text": " okay now you can see it has this temperature parameter here it has this slope parameter and you"}, {"start": 803.04, "end": 808.56, "text": " you want to do neural architecture search to find the best slope parameter usually you would just"}, {"start": 808.56, "end": 815.1999999999999, "text": " do a grid search but this isn't this is an example because this can be of course much higher dimensional"}, {"start": 815.1999999999999, "end": 824.8, "text": " things and then you don't want to do grid search anymore okay so what do we do if you look at how"}, {"start": 824.8, "end": 833.3599999999999, "text": " the 100 wide MNIST network so we can draw it right here so this is a 100 dimensional MNIST network"}, {"start": 833.36, "end": 840.08, "text": " so this is 100 and each cell each connection here first has a weight and then has the sigmoid"}, {"start": 840.08, "end": 847.12, "text": " non-linearity and the sigmoid non-linearity is parameterized by the parameter c okay and you have"}, {"start": 848.08, "end": 854.88, "text": " you have many of them right you have one here and so on and each one has a different c and each"}, {"start": 854.88, "end": 861.6800000000001, "text": " of these networks represents one blue dot here so if you let c vary so this sigmoid slope value"}, {"start": 861.68, "end": 866.9599999999999, "text": " right here that's your parameter c if you let this variant train the big network on the entire"}, {"start": 866.9599999999999, "end": 872.8, "text": " data set took convergence and then you evolve on the validation data set you get the slope like"}, {"start": 872.8, "end": 878.7199999999999, "text": " the blue curve so if you see the blue curve the blue curve is if you start over here if you reduce"}, {"start": 878.7199999999999, "end": 884.56, "text": " this slope you'll gain in performance but if you reduce it too much you drop drastically okay"}, {"start": 884.56, "end": 892.9599999999999, "text": " until it's if it's if it's zero it's basically you know the x is not the signal doesn't propagate"}, {"start": 892.9599999999999, "end": 900.7199999999999, "text": " anymore and you you have no learning occurring okay so that's the original performance now what if"}, {"start": 900.7199999999999, "end": 907.1999999999999, "text": " I only give you training data in this range right here I only showed you this particular range I"}, {"start": 907.2, "end": 914.5600000000001, "text": " can can't actually zoom in that much but if if I give you this and I ask you to build one of these"}, {"start": 914.5600000000001, "end": 918.88, "text": " please take the architecture and predict the performance that we saw at the beginning like one of"}, {"start": 918.88, "end": 928.88, "text": " these girdle machines or or touring touring machines you would it's basically say well that looks"}, {"start": 928.88, "end": 935.44, "text": " to me like a line so I'm going to predict the red thing here and even if you can you know evaluate"}, {"start": 935.44, "end": 940.4000000000001, "text": " a bunch of these it just looks like a line and you're you're going to predict that's probably a"}, {"start": 940.4000000000001, "end": 947.6, "text": " slope like this right this happens almost independently of which model you choose to predict right"}, {"start": 947.6, "end": 954.48, "text": " here the the data of training is simply doesn't give away that the fact that there is a there is this"}, {"start": 954.48, "end": 960.1600000000001, "text": " break down here which happens in the real world so if you just give this as training data there's no"}, {"start": 960.16, "end": 969.92, "text": " way so so the the criticism about these models is valid that they will only work where you give them"}, {"start": 969.92, "end": 975.12, "text": " training data they can add best interpolate their training data but they can't really extrapolate"}, {"start": 976.0, "end": 982.88, "text": " now here since the synthetic p-tri dish method which is the green thing here uses the actual"}, {"start": 982.88, "end": 991.36, "text": " not the actual non-linearity that this thing characterizes so it it instantiates the sigmoid with"}, {"start": 991.36, "end": 996.32, "text": " the parameter c that you give it just not on the large network but on a small network in fact"}, {"start": 996.32, "end": 1004.48, "text": " their network is just one unit sorry one unit and then another unit so it's just a two-hit layer"}, {"start": 1004.48, "end": 1011.2, "text": " but just with one unit instead of 100 and of course you can't feed in M-ness right here right but"}, {"start": 1011.2, "end": 1016.48, "text": " we said they don't feed in the data they actually feed in their synthetic data that they learn"}, {"start": 1017.36, "end": 1025.44, "text": " so you give them the points here and they learn the synthetic data to evaluate to evaluate the"}, {"start": 1025.44, "end": 1032.32, "text": " others and then once you ask them well if if my c is right here what's the performance going to be"}, {"start": 1032.32, "end": 1039.1200000000001, "text": " it's going to instantiate that in its small network it is going to use the training data that it"}, {"start": 1039.12, "end": 1045.12, "text": " has learned from this region right here in order to train this and then it's going to evaluate this"}, {"start": 1045.12, "end": 1051.4399999999998, "text": " on the synthetic validation data that is also learned on the training data and it is going to come"}, {"start": 1051.4399999999998, "end": 1058.9599999999998, "text": " up with a performance metric it says okay this is how good it's going to be and since it is an"}, {"start": 1058.96, "end": 1068.96, "text": " approximation in its building plan to the entire network it will react similarly so it will get"}, {"start": 1068.96, "end": 1074.32, "text": " that there is this performance dip right here okay so it you can see how this sort of makes sense"}, {"start": 1074.32, "end": 1079.3600000000001, "text": " you are actually running an approximation to the actual program instead of just looking at the"}, {"start": 1079.3600000000001, "end": 1086.24, "text": " plan of the program and trying to predict it which you know halting problem says hello"}, {"start": 1086.24, "end": 1096.8, "text": " okay so that is the motivating example of their emnist thing and here is the entire algorithm"}, {"start": 1098.48, "end": 1106.48, "text": " all right so you take emnist training and validation data and you instantiate a bunch of"}, {"start": 1106.48, "end": 1111.84, "text": " really big networks this is ground truth okay you need this you need this to learn from you"}, {"start": 1111.84, "end": 1118.32, "text": " instantiate a bunch of really big networks now if I draw the graph from before right we had"}, {"start": 1119.1999999999998, "end": 1129.1999999999998, "text": " this was the performance of the actual networks you want you this comes from here from this region"}, {"start": 1129.1999999999998, "end": 1135.04, "text": " right here this is the training data okay so you instantiate a bunch of these networks each one"}, {"start": 1135.04, "end": 1139.6799999999998, "text": " you instantiate in one of them right each one gives rise to a different nonlinearity"}, {"start": 1139.68, "end": 1145.2, "text": " and you do the full training ground truth training and evaluation on the full training set and"}, {"start": 1145.2, "end": 1151.1200000000001, "text": " the full validation set and you get validation losses right for each of these and these are the"}, {"start": 1151.1200000000001, "end": 1158.3200000000002, "text": " points right here now you that's the training data for your neural for your neural architecture search"}, {"start": 1158.3200000000002, "end": 1166.96, "text": " so for your p3dish method what the p3dish does is it says it extracts the motive and the motive is"}, {"start": 1166.96, "end": 1174.24, "text": " the thing that you optimize over so as I said you want to keep that thing in its essence but you"}, {"start": 1174.24, "end": 1180.96, "text": " want to reduce everything else so it reduces it instead of from a two layer on 100 wide MLP"}, {"start": 1181.68, "end": 1190.72, "text": " it reduces that to a two layer single neuron wide MLP okay and it now this over here"}, {"start": 1190.72, "end": 1197.68, "text": " is the training data for the procedure that we're going to do now so what it would take is it would take"}, {"start": 1197.68, "end": 1203.76, "text": " it would take one of these values it would instantiate we have that here it would instantiate the"}, {"start": 1203.76, "end": 1213.04, "text": " neural network in the small form of that and now we know that if I train the full data and evaluate"}, {"start": 1213.04, "end": 1218.56, "text": " if I train on the full training data and evaluate on the full validation data I should get"}, {"start": 1218.56, "end": 1228.48, "text": " this accuracy all right so I will create and we're going to look at in a second I will create"}, {"start": 1229.04, "end": 1236.3999999999999, "text": " training and validation data such that if I train on this training data and then validate on this"}, {"start": 1236.3999999999999, "end": 1244.24, "text": " validation data I get the same validation loss as if I had trained the big network with the same"}, {"start": 1244.24, "end": 1249.44, "text": " you know the same C parameter on the full training data and evaluate on the full validation data"}, {"start": 1249.44, "end": 1254.96, "text": " okay so in this step I'm optimizing the data here the training and validation data"}, {"start": 1255.68, "end": 1262.72, "text": " all right and now in the second step once I have this training and validation data such that I can"}, {"start": 1263.04, "end": 1272.8, "text": " basically reproduce this this graph right here then I can go and actually ask my model okay now"}, {"start": 1272.8, "end": 1278.32, "text": " please tell me what happens over here so what am I going to do I'm going to take that I'm going to"}, {"start": 1278.32, "end": 1284.1599999999999, "text": " instantiate it I'm going to use my training data that I learned to train it I'm going to use my"}, {"start": 1284.1599999999999, "end": 1289.36, "text": " validation data that I learned to evaluate it and it's going to give me a number and that number"}, {"start": 1289.36, "end": 1297.04, "text": " is going to be like close to hopefully close to do this so this is how we can extrapolate using"}, {"start": 1297.04, "end": 1303.6, "text": " that method okay now there are a number of assumptions right here and you can imagine this doesn't"}, {"start": 1303.6, "end": 1311.36, "text": " work in any situation this works if if you you know if you basically you have to get lucky in that"}, {"start": 1312.56, "end": 1319.04, "text": " you have to abstract the correct things right I said you need to reduce everything else so they"}, {"start": 1319.04, "end": 1327.04, "text": " reduce notably you see they reduce the 100 the 100 layer with to a single neuron wide MLP and"}, {"start": 1327.04, "end": 1334.0, "text": " they sort of guess that doesn't change the fundamental thing but you can also see they leave the"}, {"start": 1334.0, "end": 1341.6, "text": " two layer right they leave the two the two layer neural network and I'm can almost guarantee you"}, {"start": 1341.6, "end": 1348.32, "text": " that they tried this reducing this to a one layer neural network and it did not work and so you"}, {"start": 1348.32, "end": 1355.12, "text": " have to be sort of very careful of what quantities you abstract and what quantities you don't because"}, {"start": 1356.08, "end": 1360.6399999999999, "text": " okay now you might always think go I can reduce the you know number of dimensions or channels"}, {"start": 1360.6399999999999, "end": 1366.8, "text": " that's also not always the case so I think that's kind of the crux of the method you have to"}, {"start": 1366.8, "end": 1373.84, "text": " actually engineer this down compressing of the architecture such that its properties are still"}, {"start": 1373.84, "end": 1383.04, "text": " kept and yeah but yeah in other things how do you how do you actually produce training and validation"}, {"start": 1383.04, "end": 1390.32, "text": " data to match these and there are a number of ways but what comes to mind is metal learning right so"}, {"start": 1391.36, "end": 1396.3999999999999, "text": " because what you're doing they they initialize the training and validation data at random points"}, {"start": 1396.4, "end": 1403.92, "text": " so these are just random at the beginning and then they optimize the data itself using gradient descent"}, {"start": 1404.5600000000002, "end": 1414.5600000000002, "text": " okay now see synthetic training data and they are randomly initialized okay and they use gradient"}, {"start": 1414.5600000000002, "end": 1421.3600000000001, "text": " descent they have it somewhere yes so they have this inner training loop okay which is many steps"}, {"start": 1421.36, "end": 1429.28, "text": " of inner training and then they have the outer loss which is the it's the validation loss"}, {"start": 1429.28, "end": 1434.3999999999999, "text": " after the inner training loop and the difference for that to the true validation loss and then they"}, {"start": 1434.3999999999999, "end": 1440.4799999999998, "text": " do gradient descent on this outer loss now this outer loss is a result of the inner loss and the"}, {"start": 1440.4799999999998, "end": 1446.9599999999998, "text": " inner loss is a result of the inner training procedure and the inner training procedure is n steps"}, {"start": 1446.96, "end": 1452.32, "text": " of feeding in the training data every step you feed in the training data so your computational"}, {"start": 1452.32, "end": 1458.88, "text": " graph is going to look like so here is your training data S train and here are your initial parameters"}, {"start": 1459.52, "end": 1464.64, "text": " you at randomize initialize them randomly in the first step you use the training data to produce"}, {"start": 1464.64, "end": 1472.56, "text": " theta one then in the second step you use your training you're training data again to produce"}, {"start": 1472.56, "end": 1478.6399999999999, "text": " theta two and then you use it again to use theta three and so on each time you feed the training"}, {"start": 1478.6399999999999, "end": 1484.1599999999999, "text": " data in order to evolve your parameters to give you better prediction right so the gradient"}, {"start": 1484.8, "end": 1491.9199999999998, "text": " somewhere back here there's a loss the gradient here will have to flow back through all of these"}, {"start": 1491.9199999999998, "end": 1496.48, "text": " paths and through all of these connections to the training data this is kind of you back"}, {"start": 1496.48, "end": 1501.6799999999998, "text": " propagate through an optimization procedure and we have this a bunch of times here and I've looked"}, {"start": 1501.68, "end": 1509.52, "text": " at the code and the code is like really crazy and it looks like proper research code but it appears"}, {"start": 1509.52, "end": 1515.1200000000001, "text": " to be that that's actually what's happening they backprop through the optimization procedure to find"}, {"start": 1515.1200000000001, "end": 1523.6000000000001, "text": " this synthetic training and validation data now that's I mean that's crazy but it also kind of"}, {"start": 1523.6000000000001, "end": 1528.4, "text": " limits how far you can go with this because usually you can't backprop for more than a couple of"}, {"start": 1528.4, "end": 1535.0400000000002, "text": " steps doing this now that the model the fact that the model in or model is small helps but also"}, {"start": 1535.0400000000002, "end": 1540.5600000000002, "text": " this introduces very very much like these things are very brittle if you backprop through an"}, {"start": 1540.5600000000002, "end": 1548.0, "text": " optimization procedure like this these things tend to be very brittle and so I think there's"}, {"start": 1548.0, "end": 1557.52, "text": " another thing there where you have to pay careful attention all right that's it's basically it the"}, {"start": 1557.52, "end": 1563.84, "text": " last thing they say is that they can combine this with architecture search in that so not only"}, {"start": 1563.84, "end": 1572.16, "text": " can you predict good architectures what you can do is you can actually predict the which architectures"}, {"start": 1572.16, "end": 1578.96, "text": " are good and then you can use that prediction to get new to basically input this into your neural"}, {"start": 1578.96, "end": 1584.48, "text": " architecture search to inform it so instead of the neural architecture search having to evaluate"}, {"start": 1584.48, "end": 1590.32, "text": " all of the candidates that it produces it only has to now evaluate the very small subset of"}, {"start": 1590.32, "end": 1596.4, "text": " candidates that the synthetic petri dish training deems most worthy of being evaluated in this"}, {"start": 1596.4, "end": 1604.96, "text": " case here instead of evaluating all of the things here it would limit itself to whatever the synthetic"}, {"start": 1604.96, "end": 1612.08, "text": " petri dish says are the highest performing ones because if the synthetic petri dish is any good"}, {"start": 1612.08, "end": 1616.8799999999999, "text": " then it will you know give accurate predictions of how they're performing and then that can go"}, {"start": 1616.8799999999999, "end": 1624.08, "text": " in multiple rounds so the architecture search can find new come up with new things that it"}, {"start": 1624.08, "end": 1629.36, "text": " thinks are better through like an evolutionary mutation algorithm the petri dish can evaluate"}, {"start": 1629.36, "end": 1637.6, "text": " them in the synthetic way and then suggest the like 10 candidates to evaluate on the full test set"}, {"start": 1637.6, "end": 1644.32, "text": " and that way you don't have to evaluate all the like thousand candidates all right all right"}, {"start": 1645.12, "end": 1655.36, "text": " cool they do this for this emnest and they also do it for finding a RNN cell for the petri bank"}, {"start": 1657.04, "end": 1664.08, "text": " this is a language modeling task and the this is a benchmark for neural architecture search where"}, {"start": 1664.08, "end": 1672.24, "text": " you're trying to find a good RNN cell to get the perplexity really low and here you can see if they"}, {"start": 1672.24, "end": 1679.04, "text": " give the same amount of data to all the methods then the benchmark neural architecture search"}, {"start": 1679.04, "end": 1686.8799999999999, "text": " is worse than the synthetic petri dish informed architecture search now one has to say on the"}, {"start": 1686.88, "end": 1695.2800000000002, "text": " full data I believe the NIO gets to about here but of course if you give all of them the same data"}, {"start": 1695.2800000000002, "end": 1703.3600000000001, "text": " the neural the petri dish beats this method and I think still this method here uses way more compute"}, {"start": 1703.3600000000001, "end": 1710.72, "text": " because it always has to evaluate all the candidates and that's exactly one of these where I learn"}, {"start": 1711.44, "end": 1716.8000000000002, "text": " an architecture to predict the other architecture by just looking at it so it works but it doesn't"}, {"start": 1716.8, "end": 1723.04, "text": " work as well as actually running the architecture in an abstract fashion this also shows you the"}, {"start": 1723.52, "end": 1730.32, "text": " importance of selecting your experimental evaluation in a smart way like they argue they argue for"}, {"start": 1730.32, "end": 1737.12, "text": " very long why it makes sense to evaluate everything on reduced data such that their method here"}, {"start": 1737.12, "end": 1744.24, "text": " can be better and they don't have to compare to the full thing it's easier for them to work on"}, {"start": 1744.24, "end": 1750.08, "text": " reduced data and they argue you know it's it's it's what people usually do in practice and that's"}, {"start": 1750.08, "end": 1760.32, "text": " the task they focus on so you know good good good good paper writing right here yeah um that's"}, {"start": 1760.32, "end": 1769.04, "text": " basically it to the paper uh there's a lot of things to be said here um I think this works in very"}, {"start": 1769.04, "end": 1776.08, "text": " very limited settings it it seems to me that it's sort of brittle with respect to how you abstract and"}, {"start": 1776.08, "end": 1783.92, "text": " also um it it's always the case like how many how how large is this synthetic training data in their"}, {"start": 1783.92, "end": 1790.72, "text": " case they like abstract this to 20 or 30 data points or something like this so it seems to me"}, {"start": 1790.72, "end": 1796.96, "text": " since you're optimizing this training data with um gradient descent what you would mainly find"}, {"start": 1796.96, "end": 1804.16, "text": " or adversarial sort of adversarial examples to this architecture here so I'm going to guess that"}, {"start": 1804.16, "end": 1811.52, "text": " the inner optimization is very noisy and that's because if you really let your optimizer run"}, {"start": 1812.24, "end": 1818.32, "text": " then it will abuse every single thing it can to match that validation loss and that will usually"}, {"start": 1818.32, "end": 1825.04, "text": " lead to an adversarial example since you're optimizing the data itself okay so I think"}, {"start": 1825.04, "end": 1832.24, "text": " this suffers from that and this is we had this in the in the planning you know planning in in"}, {"start": 1832.24, "end": 1837.6, "text": " learned world models and reinforcement learning where if you have a really really good planner it"}, {"start": 1837.6, "end": 1843.12, "text": " will just abuse the mistakes that you make in approximating the true world and the same here"}, {"start": 1843.12, "end": 1848.96, "text": " you're going to make mistakes approximating this architecture here and the better your your"}, {"start": 1848.96, "end": 1856.56, "text": " optimizer is for producing this synthetic data the probably the worse the worse the the result is"}, {"start": 1856.56, "end": 1862.8, "text": " going to match the worse that these losses are going to actually match now okay these losses will"}, {"start": 1862.8, "end": 1868.24, "text": " match because they're that's what you train for but the worse these two curves will match each"}, {"start": 1868.24, "end": 1873.76, "text": " other because now you're just finding adversarial examples for your particular training data"}, {"start": 1873.76, "end": 1880.0, "text": " another concern I have here is with respect to the double descent phenomenon so if you know the"}, {"start": 1880.0, "end": 1887.44, "text": " double descent phenomenon if here you have your number of parameters and here you have your validation"}, {"start": 1887.44, "end": 1895.04, "text": " loss let's say and you know that if I add parameters I can make my validation loss go down so this"}, {"start": 1895.04, "end": 1900.8, "text": " is assuming I have a model with p parameters and I always train it on the train data to like two"}, {"start": 1900.8, "end": 1907.12, "text": " convergence now if I add parameters I can generalize better until a point where I add too many"}, {"start": 1907.12, "end": 1912.32, "text": " parameters and I start overfitting and my validation loss goes up again but the double descent"}, {"start": 1912.32, "end": 1920.56, "text": " phenomenon and I think I've done a video on this shows that after a certain threshold you get"}, {"start": 1920.56, "end": 1926.3999999999999, "text": " the interpolation threshold the validation loss goes actually down again and goes down even further"}, {"start": 1926.4, "end": 1933.6000000000001, "text": " here now I'm so this is a very strange phenomenon by itself but I'm sort of concerned that if you do"}, {"start": 1933.6000000000001, "end": 1939.68, "text": " this abstraction that this paper proposes so you read you're let's say your full model is here"}, {"start": 1939.68, "end": 1946.48, "text": " with a large number of parameters so it is past this interpolation threshold if you now seriously"}, {"start": 1946.48, "end": 1953.76, "text": " reduce the number of parameters because you want to go into this p-tree dish you will get maybe"}, {"start": 1953.76, "end": 1958.72, "text": " you will cross this interpolation threshold and actually be on this side of the curve right here"}, {"start": 1958.72, "end": 1965.52, "text": " now of course at the same time you reduce the amount of data which would push you over here again"}, {"start": 1966.24, "end": 1971.68, "text": " but it is different data so I'm not sure how all of this is going to play out it appears to work"}, {"start": 1971.68, "end": 1982.0, "text": " in these settings right here but I think this is it's sort of it's sort of applicable in some"}, {"start": 1982.0, "end": 1988.32, "text": " situations and it's it'd be very cool if we develop this further such that we understand when it"}, {"start": 1988.32, "end": 1995.68, "text": " applies and when we can use it because I feel this can be a very cool thing if we understand it"}, {"start": 1995.68, "end": 2002.8, "text": " better and if we can apply it throughout all right that's the end if you like this paper leave"}, {"start": 2002.8, "end": 2017.76, "text": " a comment if you didn't like it leave a comment and bye bye see you next time"}] |
Yannic Kilcher | 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 corner net detecting objects as paired key points by high law and jihadeng. So on a high level, this paper detects objects in images. Let's say this is an image and here's a chair. 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 high end 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 digests 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 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. I, someone made that point at me to this paper. It's a bit older as you can see, but I still think it's pretty cool. So we've already seen the problem. Like the problem isn't hard and it's detecting bounding boxes in images. And in these data sets, the problems, the difficult parts are that you sometimes have multiple objects. Like here, if two humans, they can be overlapping. There can be of different sizes. There 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 corner net 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 convent, 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 convent. Now they, in this case, use in this hourglass architecture that described 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 upsamples the image again. It downsamples it again. And it upsamples 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 fairly standard architecture right here. But then after this hourglass CNN, you get to these prediction modules. Now let me switch back to the top drawing. Ultimately, 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. OK? 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. OK? 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, you 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 same image. So now you have, in this case, particular case, you are 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 these 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 objects. So this orange thing here would have a large inner product with this green bottom right corner embedding. 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 has 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'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 this objective, I still think that these embeddings would pick up something about the object, something about the visual characteristics of the objects. We'll 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 goal right here. You want to get these heat maps in 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 by downsampling you have to round certain pixels to certain locations. And then the offsets, 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 are exactly two locations in the class human where the top left corner is correct. And that's right here and that's right here, okay? So two locations. So I make my matrix, my target matrix with a one here and the one here, and zeroes everywhere else. All right, zero, zero, zero, zero, zero, zero, zero, zero. And I train my network to give me this particular thing as an output for this heat map in the channel human. 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 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, the closer you are, basically the more reward you get. So you train it to predict in this general location. Now, of course, the 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 Gaussian's. But for the understanding is 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 embeddings is pretty, pretty straightforward. So remember these embeddings, you have two embeddings per, you have the top left embedding, that's the ETK, the top embedding, 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 wanna do is you want to minimize the distances of these two things to this thing right here. And this thing is simply, so EK is simply the mean. So it's ETK plus EBK 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 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 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 margin loss which means that you cap it at some point. So 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 don't give any bonus for them being super for a part. You don't simply don't want them to be closer together than one. All right. In their case, I think they have the dimension of these vectors is actually one, which basically means they just output the single number which I find astonishing that works. Yes, they use embeddings of one dimension. So they just use numbers. Estonishing that it works, but okay. So that's how you train 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 an example right here. The problem when you want to predict a corner of an object is that in a CNN, what CNN 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'm sort of, I'm like, wait, wait, where is it? Because in this particular receptive field of this resolution, I have no clue if the moon is close. 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 itself, so it's own location, but actually to extend its field of view over to the right and down to the bottom. It asks you 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 side here, where it also says, oh, there is the side of the moon. That's probably the correct up down. So there's probably a corner right here. Okay, whereas a location right here 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. Right, 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 is actually fairly efficiently by doing 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 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 directions. I think that's a 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 actually get confused. Because so the trouble of course comes when there are multiple different objects that have the same top. And then there is also a person right here. So it gets another signal that there is the left side of a person right here, or maybe not like this. So it will predict a corner maybe here, where there is none. 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 sorry, from the heat maps, there is the pull and the push losses for the embeddings. And there's this offset loss that you train to compensate for the down sampling 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. 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 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 gousians and so on. And there are some qualitative examples. You can see that without the corner pooling, what you'll get is so the top here and the left and the right are detected correctly. But you can see that probably the network things that there is an extension of the object right here and therefore doesn't do a good job because this position right here, it has no access to sort of it has to use like a long range access. You 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 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 you can't really go and look in very detailed fashion at this border right here. So it misses it. The 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 sometimes where their method fails. For example, here it matches the top left and bottom right corners of two different objects because their embeddings were close enough. And yeah, that's what I'm saying. 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 predict each pixel and use the differences between the points as scores for bounding boxes. I don't know if you see what I mean. You could basically tell the, 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 have this attention between each pair of points and so on. I'm not entirely sure, but this might just be crap. Yeah, here are some more examples. This appears to work really nicely, but of course, in the 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 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.0, "text": " Hello there, today we're looking at corner net detecting objects as paired key points"}, {"start": 6.0, "end": 9.120000000000001, "text": " by high law and jihadeng."}, {"start": 9.120000000000001, "end": 13.92, "text": " So on a high level, this paper detects objects in images."}, {"start": 13.92, "end": 17.52, "text": " Let's say this is an image and here's a chair."}, {"start": 17.52, "end": 20.16, "text": " You have your chair."}, {"start": 20.16, "end": 26.48, "text": " And the way you detect the chair for this paper is going to be you detect the bottom right"}, {"start": 26.48, "end": 30.72, "text": " and the top left corners of the bounding box of the image."}, {"start": 30.72, "end": 34.88, "text": " So rather than detecting the middle and then specifying high end width,"}, {"start": 34.88, "end": 39.6, "text": " like we saw in the Facebook DTR paper, you detect the two corners."}, {"start": 39.6, "end": 43.120000000000005, "text": " And this paper goes through what they have to do to get this to work,"}, {"start": 43.120000000000005, "end": 47.760000000000005, "text": " including a new pooling method called corner pooling."}, {"start": 47.760000000000005, "end": 51.28, "text": " So that's the digests of the paper."}, {"start": 51.28, "end": 55.519999999999996, "text": " As always, if you like content like this, consider subscribing and"}, {"start": 55.52, "end": 59.760000000000005, "text": " sharing it out to other people, that would be very helpful."}, {"start": 59.760000000000005, "end": 65.12, "text": " So a commenter actually recommended this paper to me"}, {"start": 65.12, "end": 70.0, "text": " after I made a video on Facebook's DETR object detection pipeline."}, {"start": 70.0, "end": 75.52000000000001, "text": " I said something like, okay, since that paper always would detect the middle of the object"}, {"start": 75.52000000000001, "end": 82.48, "text": " and the height and width, couldn't you make something that detects the corners here"}, {"start": 82.48, "end": 87.52000000000001, "text": " and the corner here, and then that would define a bounding box just as well."}, {"start": 87.52000000000001, "end": 91.44, "text": " And in the comments and thank you very much for that."}, {"start": 91.44, "end": 95.68, "text": " I, someone made that point at me to this paper."}, {"start": 95.68, "end": 101.60000000000001, "text": " It's a bit older as you can see, but I still think it's pretty cool."}, {"start": 101.60000000000001, "end": 104.56, "text": " So we've already seen the problem."}, {"start": 104.56, "end": 110.08000000000001, "text": " Like the problem isn't hard and it's detecting bounding boxes in images."}, {"start": 110.08, "end": 114.56, "text": " And in these data sets, the problems, the difficult parts are"}, {"start": 114.56, "end": 117.2, "text": " that you sometimes have multiple objects."}, {"start": 117.2, "end": 121.36, "text": " Like here, if two humans, they can be overlapping."}, {"start": 121.36, "end": 122.8, "text": " There can be of different sizes."}, {"start": 122.8, "end": 126.47999999999999, "text": " There could be like a third human like small back here."}, {"start": 126.47999999999999, "end": 127.75999999999999, "text": " There can be other objects."}, {"start": 127.75999999999999, "end": 129.12, "text": " You don't know how many there are."}, {"start": 129.12, "end": 129.6, "text": " And so on."}, {"start": 129.6, "end": 134.24, "text": " So it is, it is a fairly complicated problem."}, {"start": 134.24, "end": 138.64, "text": " But as I already said, the way that corner net here does this"}, {"start": 138.64, "end": 143.35999999999999, "text": " is by predicting the locations of the top left and bottom right corner"}, {"start": 143.35999999999999, "end": 145.76, "text": " thereby defining a bounding box."}, {"start": 145.76, "end": 147.35999999999999, "text": " And it does this independently."}, {"start": 147.35999999999999, "end": 154.23999999999998, "text": " So there's one network basically that does the top left and one that does the"}, {"start": 154.23999999999998, "end": 157.27999999999997, "text": " bottom right and they are then combined."}, {"start": 157.27999999999997, "end": 162.48, "text": " And at the end, they're sort of refined, I think."}, {"start": 162.48, "end": 165.6, "text": " So the architecture is pretty simple."}, {"start": 165.6, "end": 170.88, "text": " First, you put the image through a convent, which is like a feature extractor."}, {"start": 170.88, "end": 174.24, "text": " So this is the basic part."}, {"start": 174.24, "end": 178.64, "text": " It was even the basic part of Facebook's DETR pipeline."}, {"start": 178.64, "end": 180.56, "text": " First, you have some sort of convent."}, {"start": 180.56, "end": 185.04, "text": " Now they, in this case, use in this hourglass architecture"}, {"start": 185.04, "end": 189.76, "text": " that described down here somewhere."}, {"start": 189.76, "end": 196.39999999999998, "text": " And this basically compresses the image into a smaller"}, {"start": 196.39999999999998, "end": 197.2, "text": " resolutions."}, {"start": 197.2, "end": 200.72, "text": " I would take that image and compress it down to very small resolution,"}, {"start": 200.72, "end": 202.48, "text": " but many, many channels."}, {"start": 202.48, "end": 206.95999999999998, "text": " So it's sort of forced to learn a global semantic representation."}, {"start": 206.95999999999998, "end": 209.04, "text": " And then it upsamples the image again."}, {"start": 209.04, "end": 210.32, "text": " It downsamples it again."}, {"start": 210.32, "end": 212.0, "text": " And it upsamples it again through."}, {"start": 212.0, "end": 217.04, "text": " So at each of these steps, there are many convolutional layers right here."}, {"start": 217.04, "end": 221.84, "text": " And because that would lose you too much space like local information,"}, {"start": 221.84, "end": 225.51999999999998, "text": " there are skip connections built in between pairs of layers,"}, {"start": 225.51999999999998, "end": 229.68, "text": " where information can travel without computation, basically."}, {"start": 229.68, "end": 233.6, "text": " So this is a fairly standard architecture right here."}, {"start": 233.6, "end": 239.44, "text": " But then after this hourglass CNN, you get to these prediction modules."}, {"start": 239.44, "end": 243.28, "text": " Now let me switch back to the top drawing."}, {"start": 243.28, "end": 247.68, "text": " Ultimately, what you want as an output of these prediction modules"}, {"start": 247.68, "end": 249.12, "text": " is two things."}, {"start": 249.12, "end": 252.24, "text": " So first of all, you want these heat maps."}, {"start": 252.24, "end": 253.2, "text": " Sorry about that."}, {"start": 253.2, "end": 257.44, "text": " And these heat maps will simply tell you where are the corners."}, {"start": 257.44, "end": 258.8, "text": " OK?"}, {"start": 258.8, "end": 264.88, "text": " Now the heat maps, their dimensions, are the height of the image."}, {"start": 264.88, "end": 267.28, "text": " Sorry, the height here."}, {"start": 267.28, "end": 270.08, "text": " H. Come on."}, {"start": 270.08, "end": 272.48, "text": " And the width of the image."}, {"start": 272.48, "end": 277.20000000000005, "text": " And this here would be the number of classes C. OK?"}, {"start": 277.20000000000005, "end": 281.52000000000004, "text": " So you have one channel for each of the classes that you predict."}, {"start": 281.52000000000004, "end": 285.28000000000003, "text": " And the heat map will basically be very high"}, {"start": 285.28000000000003, "end": 290.24, "text": " at the location and channel where there is a corner of that."}, {"start": 290.24, "end": 294.16, "text": " So you see, you have one heat map for the top left corners"}, {"start": 294.16, "end": 297.52000000000004, "text": " and one heat map for the bottom right corners."}, {"start": 297.52000000000004, "end": 301.44, "text": " And then also what you want to predict are these embeddings."}, {"start": 301.44, "end": 304.64, "text": " Now, simply because you have, you know, I"}, {"start": 304.64, "end": 308.88, "text": " said there can be multiple instances of the same class"}, {"start": 308.88, "end": 310.96, "text": " in the same image."}, {"start": 310.96, "end": 314.72, "text": " So now you have, in this case, particular case,"}, {"start": 314.72, "end": 318.32, "text": " you are going to, even if you predict absolutely correctly,"}, {"start": 318.32, "end": 323.04, "text": " you predict two top left corners and two bottom right corners."}, {"start": 323.04, "end": 326.15999999999997, "text": " Now, this isn't particularly hard because there's only one"}, {"start": 326.15999999999997, "end": 328.8, "text": " configuration that can possibly be."}, {"start": 328.8, "end": 332.08, "text": " But there could be situations where there are multiple."}, {"start": 332.08, "end": 335.36, "text": " And that's why you need to somehow match these corners."}, {"start": 335.36, "end": 336.8, "text": " You have to match."}, {"start": 336.8, "end": 340.48, "text": " You have to know which ones of those are the same objects."}, {"start": 340.48, "end": 344.40000000000003, "text": " And they do this by a second output in their heads"}, {"start": 344.40000000000003, "end": 346.0, "text": " called these embeddings."}, {"start": 346.0, "end": 349.76, "text": " Now, these embeddings, they're simply vectors."}, {"start": 349.76, "end": 352.8, "text": " And the only thing that they're asked to do"}, {"start": 352.8, "end": 357.92, "text": " is they're asked to have a large inner product."}, {"start": 357.92, "end": 361.12, "text": " Whenever they belong to the same object,"}, {"start": 361.12, "end": 365.84000000000003, "text": " and they are asked to have a small inner product, sorry,"}, {"start": 365.84000000000003, "end": 372.40000000000003, "text": " when they're, when they belong to the different objects."}, {"start": 372.40000000000003, "end": 375.16, "text": " So this orange thing here would have a large inner product"}, {"start": 375.16, "end": 378.16, "text": " with this green bottom right corner embedding."}, {"start": 378.16, "end": 379.8, "text": " So you train these embeddings."}, {"start": 379.8, "end": 381.72, "text": " They don't need to mean anything."}, {"start": 381.72, "end": 384.24, "text": " You simply train them to predict the same thing"}, {"start": 384.24, "end": 388.72, "text": " for the same objects and different things for different objects."}, {"start": 388.72, "end": 392.48, "text": " So after that, when you match the corners,"}, {"start": 392.48, "end": 394.44, "text": " you can simply go over, you can say,"}, {"start": 394.44, "end": 398.24, "text": " ah, this, which one of these two right here"}, {"start": 398.24, "end": 400.36, "text": " has the larger inner product?"}, {"start": 400.36, "end": 402.64, "text": " Or you can do like some Hungarian matching"}, {"start": 402.64, "end": 405.08, "text": " and maximize the total inner product"}, {"start": 405.08, "end": 407.36, "text": " or something like this."}, {"start": 407.36, "end": 410.0, "text": " This was quite surprising to me that it works,"}, {"start": 410.0, "end": 412.64, "text": " but it's based on a line of research that"}, {"start": 412.64, "end": 417.0, "text": " has already, has already established that this can work."}, {"start": 417.0, "end": 419.91999999999996, "text": " Because ultimately these things,"}, {"start": 419.91999999999996, "end": 422.91999999999996, "text": " these two pipelines do not really communicate, right?"}, {"start": 422.91999999999996, "end": 426.44, "text": " So I'm going to guess what they learn"}, {"start": 426.44, "end": 431.44, "text": " is sort of a, sort of a descriptor of the actual object"}, {"start": 432.24, "end": 433.56, "text": " that's there."}, {"start": 433.56, "end": 436.88, "text": " Because if both describe the objects that's there"}, {"start": 437.88, "end": 439.71999999999997, "text": " with their embeddings, their embeddings are going"}, {"start": 439.71999999999997, "end": 441.88, "text": " to have a large inner product."}, {"start": 441.88, "end": 443.68, "text": " And if they describe different objects,"}, {"start": 443.68, "end": 445.71999999999997, "text": " then their embeddings are not going to match, right?"}, {"start": 445.71999999999997, "end": 449.2, "text": " So even though you train this objective,"}, {"start": 449.2, "end": 451.04, "text": " I still think that these embeddings"}, {"start": 451.04, "end": 454.44, "text": " would pick up something about the object,"}, {"start": 454.44, "end": 457.48, "text": " something about the visual characteristics of the objects."}, {"start": 457.48, "end": 459.48, "text": " We'll be very interesting to see"}, {"start": 459.48, "end": 463.44, "text": " whether someone could actually parse out what they,"}, {"start": 463.44, "end": 464.48, "text": " what they do."}, {"start": 464.48, "end": 468.84, "text": " Because it's almost impossible otherwise"}, {"start": 468.84, "end": 471.4, "text": " for these things to be learnable."}, {"start": 472.91999999999996, "end": 476.47999999999996, "text": " All right, so that's the goal right here."}, {"start": 476.47999999999996, "end": 478.67999999999995, "text": " You want to get these heat maps in these embeddings."}, {"start": 478.67999999999995, "end": 482.23999999999995, "text": " And the way you do it is fairly easy architecturally."}, {"start": 482.23999999999995, "end": 484.32, "text": " You have these two prediction modules,"}, {"start": 484.32, "end": 486.76, "text": " one for top left and one for bottom right."}, {"start": 486.76, "end": 489.59999999999997, "text": " And each of them have three outputs,"}, {"start": 489.59999999999997, "end": 491.12, "text": " the heat maps, the embeddings."}, {"start": 491.12, "end": 495.47999999999996, "text": " And here the offsets are simply a way for you to deal"}, {"start": 495.47999999999996, "end": 497.12, "text": " with the fact that you downsample"}, {"start": 497.12, "end": 501.44, "text": " by downsampling you have to round certain pixels"}, {"start": 501.44, "end": 503.08, "text": " to certain locations."}, {"start": 503.08, "end": 507.0, "text": " And then the offsets, they compensate for this."}, {"start": 507.0, "end": 510.28000000000003, "text": " But I don't want to focus on these right now."}, {"start": 511.36, "end": 514.5600000000001, "text": " So you simply have these two outputs right here."}, {"start": 514.5600000000001, "end": 516.6, "text": " Now we'll look at corner pooling in a second."}, {"start": 516.6, "end": 519.68, "text": " But how do you train this?"}, {"start": 519.68, "end": 524.2, "text": " So you can now say, okay, if I have a picture like this,"}, {"start": 524.2, "end": 529.2, "text": " there are exactly two locations in the class human"}, {"start": 529.6, "end": 534.2, "text": " where the top left corner is correct."}, {"start": 534.2, "end": 537.5600000000001, "text": " And that's right here and that's right here, okay?"}, {"start": 537.5600000000001, "end": 538.6800000000001, "text": " So two locations."}, {"start": 538.6800000000001, "end": 542.5200000000001, "text": " So I make my matrix, my target matrix"}, {"start": 542.5200000000001, "end": 544.8000000000001, "text": " with a one here and the one here,"}, {"start": 544.8000000000001, "end": 547.48, "text": " and zeroes everywhere else."}, {"start": 547.48, "end": 549.72, "text": " All right, zero, zero, zero, zero, zero, zero, zero, zero."}, {"start": 549.72, "end": 553.5600000000001, "text": " And I train my network to give me this particular thing"}, {"start": 553.56, "end": 557.4, "text": " as an output for this heat map in the channel human."}, {"start": 558.5999999999999, "end": 563.5999999999999, "text": " This might work, but it is more profitable,"}, {"start": 565.56, "end": 569.4399999999999, "text": " let's say, if you allow for some slack."}, {"start": 569.4399999999999, "end": 571.1199999999999, "text": " So what they say is, you know,"}, {"start": 571.1199999999999, "end": 574.4799999999999, "text": " since if I'm anywhere within this orange circle"}, {"start": 574.4799999999999, "end": 576.3199999999999, "text": " right here with my prediction,"}, {"start": 576.3199999999999, "end": 579.56, "text": " my resulting bounding box is still going to overlap"}, {"start": 579.56, "end": 582.52, "text": " fairly well with the ground truth bounding box."}, {"start": 582.52, "end": 585.04, "text": " And the accuracy measures for these things,"}, {"start": 585.04, "end": 587.88, "text": " I think, are based on how much you overlap"}, {"start": 587.88, "end": 590.24, "text": " with the ground truth bounding boxes."}, {"start": 590.24, "end": 595.24, "text": " So what they do basically is they give,"}, {"start": 596.72, "end": 601.72, "text": " they put a one in the spot where the actual corner is"}, {"start": 601.8, "end": 606.8, "text": " and then they put like a 0.9 around it, 0.9, 0.9,"}, {"start": 607.68, "end": 609.6, "text": " and so on and they kind of flatten out."}, {"start": 609.6, "end": 614.6, "text": " So this is sort of a Gaussian right here in multiple dimensions"}, {"start": 614.96, "end": 617.0, "text": " if that drawing makes any sense."}, {"start": 620.08, "end": 622.64, "text": " And they say, well, the closer you are,"}, {"start": 622.64, "end": 624.4, "text": " basically the more reward you get."}, {"start": 624.4, "end": 628.88, "text": " So you train it to predict in this general location."}, {"start": 628.88, "end": 632.96, "text": " Now, of course, the exact size of this Gaussian"}, {"start": 632.96, "end": 637.72, "text": " has to be dependent on the actual size of the box itself."}, {"start": 637.72, "end": 641.72, "text": " And they have, they, they regard that"}, {"start": 641.72, "end": 644.64, "text": " and say exactly how they calculate these Gaussian's."}, {"start": 644.64, "end": 647.8000000000001, "text": " But for the understanding is just important"}, {"start": 647.8000000000001, "end": 649.84, "text": " that they do give some slack here"}, {"start": 649.84, "end": 654.84, "text": " in how they compute the loss with respect to the heat map."}, {"start": 654.84, "end": 659.84, "text": " Now, the loss with respect to the embeddings"}, {"start": 661.1600000000001, "end": 665.08, "text": " is pretty, pretty straightforward."}, {"start": 665.08, "end": 667.0400000000001, "text": " So remember these embeddings,"}, {"start": 667.04, "end": 670.0, "text": " you have two embeddings per,"}, {"start": 670.0, "end": 674.52, "text": " you have the top left embedding, that's the ETK,"}, {"start": 674.52, "end": 677.4, "text": " the top embedding, the top corner embedding,"}, {"start": 677.4, "end": 679.64, "text": " and you have the bottom right embedding."}, {"start": 679.64, "end": 683.64, "text": " And what you want is for them to be close together"}, {"start": 683.64, "end": 686.04, "text": " when they describe the same object, right?"}, {"start": 687.04, "end": 690.04, "text": " So this is this push and pull losses."}, {"start": 690.04, "end": 692.4, "text": " So in the pull loss, what you wanna do"}, {"start": 692.4, "end": 696.4, "text": " is you want to minimize the distances of these two things"}, {"start": 696.4, "end": 698.72, "text": " to this thing right here."}, {"start": 698.72, "end": 703.04, "text": " And this thing is simply, so EK is simply the mean."}, {"start": 703.04, "end": 708.04, "text": " So it's ETK plus EBK divided by two."}, {"start": 708.24, "end": 711.1999999999999, "text": " That's simply, if your top left corner is here"}, {"start": 711.1999999999999, "end": 713.3199999999999, "text": " and your bottom right corner is here"}, {"start": 713.3199999999999, "end": 716.0799999999999, "text": " and they have embeddings, this one has this embedding"}, {"start": 716.0799999999999, "end": 718.16, "text": " and this one has that embedding,"}, {"start": 718.16, "end": 720.28, "text": " then the mean of the two embeddings,"}, {"start": 720.28, "end": 722.84, "text": " which I guess is whatever this right here."}, {"start": 724.24, "end": 726.16, "text": " Yeah, that's about the mean."}, {"start": 726.16, "end": 728.76, "text": " So the location is not important actually."}, {"start": 728.76, "end": 730.8, "text": " So it's about the embedding vectors."}, {"start": 730.8, "end": 733.0799999999999, "text": " It's not about where the corners are."}, {"start": 733.0799999999999, "end": 736.48, "text": " The two embedding vectors must be close together"}, {"start": 736.48, "end": 738.28, "text": " and you model that not directly"}, {"start": 738.28, "end": 739.8399999999999, "text": " by making them close to each other"}, {"start": 739.8399999999999, "end": 742.64, "text": " but by making both close to their mean."}, {"start": 742.64, "end": 747.56, "text": " And that probably saves you some back propagation troubles"}, {"start": 747.56, "end": 752.04, "text": " where you, if you have two moving parts in a loss function"}, {"start": 752.04, "end": 754.6, "text": " and you optimize both, then you tend to."}, {"start": 754.6, "end": 757.8000000000001, "text": " So you have two things you want to bring them closer together."}, {"start": 757.8000000000001, "end": 760.96, "text": " They might tend to overshoot or something like this."}, {"start": 761.96, "end": 765.08, "text": " Okay, so this brings those two closer together"}, {"start": 765.08, "end": 769.24, "text": " and in the push loss, what you want to do is you want to"}, {"start": 770.28, "end": 775.28, "text": " simply make the mean between the two."}, {"start": 775.28, "end": 780.28, "text": " Remember this is the mean embedding of this object"}, {"start": 780.28, "end": 785.28, "text": " far away from the mean embedding of any other object"}, {"start": 786.0, "end": 787.0799999999999, "text": " in the picture."}, {"start": 787.0799999999999, "end": 790.48, "text": " Okay, so this here is a margin loss"}, {"start": 790.48, "end": 793.36, "text": " which means that you cap it at some point."}, {"start": 793.36, "end": 796.76, "text": " So if they're close together,"}, {"start": 797.8, "end": 801.56, "text": " you, if two different, if the embeddings"}, {"start": 801.56, "end": 804.24, "text": " of two different objects are close together"}, {"start": 804.24, "end": 806.8, "text": " and see here this quantity will be small"}, {"start": 806.8, "end": 811.52, "text": " and therefore it will lead to this delta."}, {"start": 811.52, "end": 813.0799999999999, "text": " You give a loss of one."}, {"start": 813.0799999999999, "end": 815.3599999999999, "text": " The delta here is one in this case."}, {"start": 815.3599999999999, "end": 819.8399999999999, "text": " But as they get further apart, you're more and more happy"}, {"start": 819.8399999999999, "end": 824.8399999999999, "text": " and you reduce your loss until you don't give,"}, {"start": 825.3199999999999, "end": 828.4799999999999, "text": " you don't give any bonus for them being super for a part."}, {"start": 828.4799999999999, "end": 830.8399999999999, "text": " You don't simply don't want them to be closer together"}, {"start": 830.8399999999999, "end": 831.68, "text": " than one."}, {"start": 833.92, "end": 835.4399999999999, "text": " All right."}, {"start": 835.44, "end": 838.48, "text": " In their case, I think they have the dimension"}, {"start": 838.48, "end": 840.6, "text": " of these vectors is actually one,"}, {"start": 840.6, "end": 844.0400000000001, "text": " which basically means they just output the single number"}, {"start": 844.0400000000001, "end": 847.48, "text": " which I find astonishing that works."}, {"start": 847.48, "end": 850.4000000000001, "text": " Yes, they use embeddings of one dimension."}, {"start": 850.4000000000001, "end": 851.9200000000001, "text": " So they just use numbers."}, {"start": 854.08, "end": 856.2, "text": " Estonishing that it works, but okay."}, {"start": 856.2, "end": 865.2, "text": " So that's how you train the embedding output."}, {"start": 865.2, "end": 867.96, "text": " Embeddings close together of the same objects"}, {"start": 867.96, "end": 870.0400000000001, "text": " of the two corners and embeddings"}, {"start": 870.0400000000001, "end": 872.6800000000001, "text": " far apart for different objects."}, {"start": 872.6800000000001, "end": 874.08, "text": " All right."}, {"start": 874.08, "end": 876.2800000000001, "text": " So we can now predict where the corners are"}, {"start": 876.2800000000001, "end": 877.6800000000001, "text": " and we can match them."}, {"start": 877.6800000000001, "end": 881.76, "text": " Now, one center part of this is the corner pooling"}, {"start": 881.76, "end": 884.6800000000001, "text": " and why is the corner pooling necessary?"}, {"start": 884.68, "end": 888.68, "text": " So what's the problem with this sort of approach?"}, {"start": 888.68, "end": 893.12, "text": " The problem and they have an example right here."}, {"start": 893.12, "end": 897.16, "text": " The problem when you want to predict a corner of an object"}, {"start": 897.16, "end": 901.8399999999999, "text": " is that in a CNN, what CNN is good at"}, {"start": 901.8399999999999, "end": 905.2399999999999, "text": " is like local neighborhood information, right?"}, {"start": 905.2399999999999, "end": 908.52, "text": " So if you have to predict, let's go for the moon actually here."}, {"start": 908.52, "end": 910.4399999999999, "text": " Let's predict the location of the moon."}, {"start": 910.4399999999999, "end": 912.12, "text": " If I have to predict the location of the moon"}, {"start": 912.12, "end": 914.88, "text": " and I'm a CNN and I have this receptive field,"}, {"start": 914.88, "end": 916.6, "text": " I'm like, oh yes, it's like in here"}, {"start": 916.6, "end": 918.88, "text": " and then I have this receptive field."}, {"start": 918.88, "end": 920.2, "text": " And I'm like, yes, it's in here."}, {"start": 920.2, "end": 923.64, "text": " And then I zoom in on the corner, not on the moon itself,"}, {"start": 923.64, "end": 926.12, "text": " but on the corner where I need to predict, right?"}, {"start": 926.12, "end": 929.08, "text": " At some point, I'm sort of,"}, {"start": 930.08, "end": 932.4, "text": " I'm like, wait, wait, where is it?"}, {"start": 932.4, "end": 935.8, "text": " Because in this particular receptive field"}, {"start": 935.8, "end": 940.8, "text": " of this resolution, I have no clue if the moon is close."}, {"start": 940.8, "end": 941.8, "text": " Close, right?"}, {"start": 941.8, "end": 946.04, "text": " So at the location where the actual bounding box is,"}, {"start": 946.04, "end": 949.12, "text": " I have no local information of the object"}, {"start": 949.12, "end": 954.12, "text": " because usually objects are not squares."}, {"start": 954.12, "end": 958.24, "text": " They're sort of round like the moon or like here, the plane."}, {"start": 958.24, "end": 960.4799999999999, "text": " These corners, they have no local information"}, {"start": 960.4799999999999, "end": 961.88, "text": " about where the plane is."}, {"start": 961.88, "end": 964.4, "text": " And corner pooling is a method"}, {"start": 964.4, "end": 968.7199999999999, "text": " to propagate that information along the axis."}, {"start": 968.72, "end": 971.1600000000001, "text": " So what corner in corner pooling,"}, {"start": 971.1600000000001, "end": 975.88, "text": " what you would allow the location here in the CNN to do"}, {"start": 975.88, "end": 978.88, "text": " is to not only look at itself,"}, {"start": 978.88, "end": 983.52, "text": " so it's own location, but actually to extend its field"}, {"start": 983.52, "end": 988.52, "text": " of view over to the right and down to the bottom."}, {"start": 988.72, "end": 991.6800000000001, "text": " It asks you predict a top left corner."}, {"start": 991.6800000000001, "end": 996.2, "text": " So what you do is you max pool everything from here"}, {"start": 996.2, "end": 1000.6400000000001, "text": " to this corner detector."}, {"start": 1000.6400000000001, "end": 1004.0400000000001, "text": " So the corner detector will basically be able to detect"}, {"start": 1004.0400000000001, "end": 1007.6400000000001, "text": " whenever in either this band right here."}, {"start": 1007.6400000000001, "end": 1011.1600000000001, "text": " So whenever in this band right here,"}, {"start": 1011.1600000000001, "end": 1014.72, "text": " there is the top, like the top of an object,"}, {"start": 1014.72, "end": 1016.8000000000001, "text": " like the top of the moon here."}, {"start": 1016.8000000000001, "end": 1018.4000000000001, "text": " This corner detector can say,"}, {"start": 1018.4000000000001, "end": 1023.1600000000001, "text": " ah, that's probably the right height right here for a corner."}, {"start": 1023.16, "end": 1028.1599999999999, "text": " And it combines this with the information of this side here,"}, {"start": 1029.44, "end": 1032.48, "text": " where it also says, oh, there is the side of the moon."}, {"start": 1032.48, "end": 1036.04, "text": " That's probably the correct up down."}, {"start": 1036.04, "end": 1039.2, "text": " So there's probably a corner right here."}, {"start": 1039.2, "end": 1042.8799999999999, "text": " Okay, whereas a location right here"}, {"start": 1042.8799999999999, "end": 1046.56, "text": " would get the same signal from the right,"}, {"start": 1046.56, "end": 1048.36, "text": " or like almost the same signal,"}, {"start": 1048.36, "end": 1050.36, "text": " plus this signal right here."}, {"start": 1050.36, "end": 1053.6, "text": " But in essence, it would also detect the top of the moon,"}, {"start": 1053.6, "end": 1056.24, "text": " but it would not get the same signal from down here."}, {"start": 1056.24, "end": 1059.8, "text": " And therefore it says, ah, even though to the right,"}, {"start": 1059.8, "end": 1062.04, "text": " I see some the top of an object."}, {"start": 1062.04, "end": 1065.0, "text": " I don't see the left of an object to my bottom."}, {"start": 1065.0, "end": 1068.9599999999998, "text": " So I'm not going to predict a corner right here."}, {"start": 1068.9599999999998, "end": 1071.4399999999998, "text": " Right, so this corner pooling goes for the top left"}, {"start": 1071.4399999999998, "end": 1074.0, "text": " and of course equivalently goes for the bottom right"}, {"start": 1074.0, "end": 1079.0, "text": " that can always max pools to up and to the left of itself."}, {"start": 1079.0, "end": 1082.2, "text": " And that's exactly what you see here."}, {"start": 1082.2, "end": 1084.92, "text": " So in this corner pooling, what you can do is"}, {"start": 1084.92, "end": 1089.8, "text": " you can propagate signal to the left and to up."}, {"start": 1089.8, "end": 1092.44, "text": " And then you add the two informations,"}, {"start": 1092.44, "end": 1095.32, "text": " and that will give you your output feature."}, {"start": 1095.32, "end": 1097.96, "text": " And you can calculate this is actually fairly efficiently"}, {"start": 1097.96, "end": 1100.84, "text": " by doing like, you do a cumulative sum."}, {"start": 1100.84, "end": 1103.56, "text": " You do like a cumulative maximum"}, {"start": 1103.56, "end": 1105.84, "text": " across the different axes."}, {"start": 1105.84, "end": 1109.3999999999999, "text": " And then you simply add two arrays."}, {"start": 1109.3999999999999, "end": 1110.24, "text": " And that's it."}, {"start": 1110.24, "end": 1112.72, "text": " So you simply put the corner pooling"}, {"start": 1112.72, "end": 1117.28, "text": " before you predict the different outputs"}, {"start": 1117.28, "end": 1119.56, "text": " right here, the heat maps and the embeddings,"}, {"start": 1119.56, "end": 1121.8, "text": " which means that this hourglass network"}, {"start": 1121.8, "end": 1124.56, "text": " is not affected by this."}, {"start": 1124.56, "end": 1127.3999999999999, "text": " Just the predictors of heat maps and embeddings,"}, {"start": 1127.3999999999999, "end": 1132.1599999999999, "text": " they then get the information from this hourglass network"}, {"start": 1132.16, "end": 1136.24, "text": " into these directions."}, {"start": 1136.24, "end": 1139.92, "text": " I think that's a pretty neat method of solving this."}, {"start": 1139.92, "end": 1143.0400000000002, "text": " And here they show how you can calculate this."}, {"start": 1143.0400000000002, "end": 1146.64, "text": " And then the corner pooling is right here."}, {"start": 1146.64, "end": 1149.88, "text": " They do add a skip connection here,"}, {"start": 1149.88, "end": 1154.72, "text": " because sometimes if you just aggregate this information,"}, {"start": 1154.72, "end": 1157.5600000000002, "text": " you might actually get confused."}, {"start": 1157.5600000000002, "end": 1160.1200000000001, "text": " Because so the trouble of course"}, {"start": 1160.12, "end": 1165.12, "text": " comes when there are multiple different objects"}, {"start": 1165.12, "end": 1168.8, "text": " that have the same top."}, {"start": 1168.8, "end": 1173.6399999999999, "text": " And then there is also a person right here."}, {"start": 1173.6399999999999, "end": 1178.1599999999999, "text": " So it gets another signal that there"}, {"start": 1178.1599999999999, "end": 1185.6, "text": " is the left side of a person right here, or maybe not like this."}, {"start": 1185.6, "end": 1189.7199999999998, "text": " So it will predict a corner maybe here,"}, {"start": 1189.72, "end": 1191.52, "text": " where there is none."}, {"start": 1191.52, "end": 1196.52, "text": " It's sometimes it is important to have local information still."}, {"start": 1196.52, "end": 1199.68, "text": " And that's exactly what this skip connection is supposed"}, {"start": 1199.68, "end": 1200.2, "text": " to address."}, {"start": 1200.2, "end": 1202.28, "text": " I guess the situation up here would be resolved"}, {"start": 1202.28, "end": 1206.68, "text": " by the different embeddings, but still."}, {"start": 1206.68, "end": 1209.52, "text": " So you have that, you add and you put another bunch"}, {"start": 1209.52, "end": 1212.16, "text": " of convolutional layers on top of that,"}, {"start": 1212.16, "end": 1215.16, "text": " and then you'll get your predictions."}, {"start": 1215.16, "end": 1216.48, "text": " And that's it."}, {"start": 1216.48, "end": 1218.0, "text": " You mix all the losses."}, {"start": 1218.0, "end": 1221.08, "text": " So there is a detection loss from the embeddings."}, {"start": 1221.08, "end": 1224.48, "text": " There's sorry, from the heat maps,"}, {"start": 1224.48, "end": 1227.96, "text": " there is the pull and the push losses for the embeddings."}, {"start": 1227.96, "end": 1232.16, "text": " And there's this offset loss that you train to compensate"}, {"start": 1232.16, "end": 1236.72, "text": " for the down sampling errors."}, {"start": 1236.72, "end": 1237.76, "text": " And that's it."}, {"start": 1237.76, "end": 1241.28, "text": " And they ablate the various things here."}, {"start": 1241.28, "end": 1243.08, "text": " Basically they show that they're better"}, {"start": 1243.08, "end": 1247.76, "text": " than other one shot or one stage predictors."}, {"start": 1247.76, "end": 1250.28, "text": " So apparently there's one stage predictors"}, {"start": 1250.28, "end": 1252.8, "text": " where you have a single pass through a neural network."}, {"start": 1252.8, "end": 1255.36, "text": " And there's two stage predictors where you have multiple"}, {"start": 1255.36, "end": 1258.12, "text": " or two passes through different neural networks."}, {"start": 1258.12, "end": 1263.6, "text": " And they compete in the one stage neural network category,"}, {"start": 1263.6, "end": 1265.32, "text": " if so to say."}, {"start": 1265.32, "end": 1268.36, "text": " And they show that they get significant improvements"}, {"start": 1268.36, "end": 1272.64, "text": " with and due to this corner pooling, which is pretty cool"}, {"start": 1272.64, "end": 1276.2, "text": " to see because it makes sense."}, {"start": 1276.2, "end": 1280.4, "text": " It sort of makes sense how you would like to think about it"}, {"start": 1280.4, "end": 1281.32, "text": " like this."}, {"start": 1281.32, "end": 1284.6000000000001, "text": " And to see that it helps is pretty neat."}, {"start": 1288.0, "end": 1290.6000000000001, "text": " Yeah, they also investigate how large they"}, {"start": 1290.6000000000001, "end": 1295.1200000000001, "text": " have to make these gousians and so on."}, {"start": 1295.1200000000001, "end": 1296.8, "text": " And there are some qualitative examples."}, {"start": 1296.8, "end": 1302.1200000000001, "text": " You can see that without the corner pooling, what you'll get"}, {"start": 1302.1200000000001, "end": 1305.3600000000001, "text": " is so the top here and the left and the right"}, {"start": 1305.36, "end": 1307.9199999999998, "text": " are detected correctly."}, {"start": 1307.9199999999998, "end": 1311.7199999999998, "text": " But you can see that probably the network things"}, {"start": 1311.7199999999998, "end": 1314.9199999999998, "text": " that there is an extension of the object right here"}, {"start": 1314.9199999999998, "end": 1319.6399999999999, "text": " and therefore doesn't do a good job"}, {"start": 1319.6399999999999, "end": 1327.4399999999998, "text": " because this position right here, it has no access to sort"}, {"start": 1327.4399999999998, "end": 1329.9599999999998, "text": " of it has to use like a long range access."}, {"start": 1329.96, "end": 1335.96, "text": " You can't really look in detail at the features here or here."}, {"start": 1335.96, "end": 1338.52, "text": " So when it scans up and down the side,"}, {"start": 1338.52, "end": 1342.28, "text": " where the bottom corner, where the bottom break is,"}, {"start": 1342.28, "end": 1344.96, "text": " it can only look at very coarse features"}, {"start": 1344.96, "end": 1347.32, "text": " because it has to basically transmit information"}, {"start": 1347.32, "end": 1349.32, "text": " in the CNN of a higher layer."}, {"start": 1349.32, "end": 1352.0, "text": " And the higher layer has a higher receptive field,"}, {"start": 1352.0, "end": 1354.16, "text": " which means it has a lower resolution."}, {"start": 1354.16, "end": 1358.3600000000001, "text": " So you can't really go and look in very detailed fashion"}, {"start": 1358.36, "end": 1359.9199999999998, "text": " at this border right here."}, {"start": 1359.9199999999998, "end": 1362.9599999999998, "text": " So it misses it."}, {"start": 1362.9599999999998, "end": 1366.9199999999998, "text": " The same right here, as you can see."}, {"start": 1366.9199999999998, "end": 1369.0, "text": " So there are a number of failure cases"}, {"start": 1369.0, "end": 1373.1999999999998, "text": " that they can now solve using this method"}, {"start": 1373.1999999999998, "end": 1377.4399999999998, "text": " compared to if they didn't use the corner pooling."}, {"start": 1377.4399999999998, "end": 1381.7199999999998, "text": " They show some, also sometimes where their method fails."}, {"start": 1381.7199999999998, "end": 1388.0, "text": " For example, here it matches the top left and bottom right"}, {"start": 1388.0, "end": 1390.88, "text": " corners of two different objects"}, {"start": 1390.88, "end": 1394.68, "text": " because their embeddings were close enough."}, {"start": 1394.68, "end": 1396.48, "text": " And yeah, that's what I'm saying."}, {"start": 1396.48, "end": 1401.96, "text": " I'm wondering what these embeddings actually learn"}, {"start": 1401.96, "end": 1404.68, "text": " because they are generated independently."}, {"start": 1404.68, "end": 1408.76, "text": " So not entirely sure."}, {"start": 1408.76, "end": 1411.8, "text": " It's also not exactly what I had in mind"}, {"start": 1411.8, "end": 1415.0, "text": " when I formulated this idea in the last video."}, {"start": 1415.0, "end": 1419.96, "text": " But I'm actually not sure what I had in mind myself,"}, {"start": 1419.96, "end": 1420.48, "text": " to be honest."}, {"start": 1420.48, "end": 1423.08, "text": " But in my mind, it seemed to be like you"}, {"start": 1423.08, "end": 1427.12, "text": " should be able to train a network if there is an object right"}, {"start": 1427.12, "end": 1428.12, "text": " here."}, {"start": 1428.12, "end": 1432.44, "text": " You could train a network to predict for any given location."}, {"start": 1432.44, "end": 1436.56, "text": " Let's say how many pixels to its bottom right,"}, {"start": 1436.56, "end": 1440.52, "text": " or maybe you want to normalize by the area that's there,"}, {"start": 1440.52, "end": 1442.8, "text": " are part of a particular object."}, {"start": 1442.8, "end": 1445.8, "text": " And then you could predict each pixel"}, {"start": 1445.8, "end": 1451.12, "text": " and use the differences between the points"}, {"start": 1451.12, "end": 1455.12, "text": " as scores for bounding boxes."}, {"start": 1455.12, "end": 1458.12, "text": " I don't know if you see what I mean."}, {"start": 1458.12, "end": 1460.08, "text": " You could basically tell the, you'd"}, {"start": 1460.08, "end": 1466.28, "text": " have one network predict everything to the bottom right,"}, {"start": 1466.28, "end": 1468.68, "text": " and then you'd use the differences."}, {"start": 1468.68, "end": 1471.6399999999999, "text": " And the transformers would be very good at that"}, {"start": 1471.64, "end": 1474.24, "text": " because they can have this attention"}, {"start": 1474.24, "end": 1477.0400000000002, "text": " between each pair of points and so on."}, {"start": 1477.0400000000002, "end": 1482.4, "text": " I'm not entirely sure, but this might just be crap."}, {"start": 1482.4, "end": 1483.76, "text": " Yeah, here are some more examples."}, {"start": 1483.76, "end": 1486.5200000000002, "text": " This appears to work really nicely,"}, {"start": 1486.5200000000002, "end": 1490.96, "text": " but of course, in the qualitative examples,"}, {"start": 1490.96, "end": 1493.8400000000001, "text": " it always works nicely, but they also demonstrated."}, {"start": 1493.8400000000001, "end": 1496.8000000000002, "text": " All right, I found this paper all in all pretty cool,"}, {"start": 1496.8000000000002, "end": 1497.92, "text": " pretty neat."}, {"start": 1497.92, "end": 1498.92, "text": " It's a simple idea."}, {"start": 1498.92, "end": 1500.76, "text": " It's executed well."}, {"start": 1500.76, "end": 1503.68, "text": " I don't have the feeling that there are like too many tricks"}, {"start": 1503.68, "end": 1507.44, "text": " in here, and they show really that the improvement seems"}, {"start": 1507.44, "end": 1511.76, "text": " to be due to their corner pooling method."}, {"start": 1511.76, "end": 1514.32, "text": " And that's pretty neat."}, {"start": 1514.32, "end": 1518.48, "text": " So if you like this paper, make sure to check it out,"}, {"start": 1518.48, "end": 1519.72, "text": " and I'll see you next time."}, {"start": 1519.72, "end": 1530.68, "text": " Bye-bye."}] |
Yannic Kilcher | 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 Wolf, 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 result 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, it's 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 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 prune 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 way you look at the weights and the weights, they'll have some distribution. There'll be there'll 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 there, 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, 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 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 cat versus dogs. And then what we do is we transfer learning. So we transfer all the weights right here and here we have a different task now, sick or not sick. 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 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 learn the, basically the specifics of what makes these two data sets different. And we don'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 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 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 networks. And 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 adapted or transfer learning and so on, the weights, they won't move that much. So 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, if we're running when we transfer learning, because what will basically go by, what we'll basically say is, will assign the importance based on, based on the original neural network task on the cat versus dog. 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 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. So that's, that's a high level now. How do you measure how it moves? And what exactly, 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-train 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, each network layer basically as a matrix multiplication by a weight. You can express pretty much any neural network as such a multiplication with a weight. So you have x 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 zero or one 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. And then the top V simply means that you take the whoever are the most important, the most magnitude, those are going to be one in the mask and everything else is going to be zero in the mask. That's how this S, the W determines the S and the S determines the M. So what you ultimately uses 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 a kind of dynamic way? And this paper says you should do it by gradient. So you should observe the gradient of your loss function with respect to this S matrix, to this importance matrix. What does it mean? 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 connection moves a lot. Like the loss pulls it into a particular direction. So we're not talking about yet which direction. Actually the gradient has a sign inside the 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 this is a direct measure of how much basically the loss function pulls on that importance score. How much? And now you can simply decide if they have these, they have, I think they have a diagram. Yes. So 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 if the negative gradient is positive and the weight is already positive in this case, that means 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 optimization procedure says this thing should become even more negative. And also we say, that's probably a good way. 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. 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 is of course discreet 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. 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 math behind this here gives sort of more evidence that this 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 quirks here. Actually let's first go to 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. This 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, that was the importance 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 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 are here below connect to this weight. I think that's what is meant. I'm 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 gumbels 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, important 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 if they are not happy with how many weights they from the simply increase or decrease this lambda such that they get to their desired sparse. And of course, you see there's the direct trade off with the loss function. So the more you put weight on this lambda, the less weight you put basically on the loss function itself. So you have 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 score function is the same. Oh well, the score function here, the score function is the same. Okay. Now there are quite a number of tricks here like there's this sparsity scheduling function and so on. And as always, in NLP and with any big models, there are a 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 actual technique. But if you know, you can sort of assess whether or not this, 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 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. How a 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 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 tests, quad and NMI and QQP. And these are quite hard tasks from an NLP perspective. Like squad is question answering, MNLIs like language inference. These would be on the, I would guess these are on the, for an NLP system on the harder side of tasks. That'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 purple one, the SMVP, 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 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 percent 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. So they do discover that, so this happens in all of these tasks, as you can see right here. And 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 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 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, 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. 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 out perform the red, the yellow one can outperform the red one. It is almost warranted to say that the magnitude pruning wasn't the best choice. It's actually a better choice to leave some of those weights in and actually cut the sum 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 first place. And since, since this thing removes anything that moves towards zero, any points 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 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 analyze this then in terms of where the model cuts the weights out. Now they experiment on a bird base thing, which is a transformer with 12 layers. And if you don't know what bird is, you can go look at my video on bird. But you can see that the magnitude pruning will sort of cut all the weights in 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 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 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.16, "text": " by Victor Sun, Thomas Wolf, and Alexander M. Rush of hugging face and Cornell University."}, {"start": 13.16, "end": 17.92, "text": " On a high level, this paper proposes that you should, if you have a transfer learning"}, {"start": 17.92, "end": 24.04, "text": " objective and you want to do pruning, you should not do pruning by weight magnitude, you"}, {"start": 24.04, "end": 28.76, "text": " should do pruning by how much the weights move during the transfer learning."}, {"start": 28.76, "end": 35.760000000000005, "text": " This yields better result in the very sparse model regimes and is specifically relevant"}, {"start": 35.760000000000005, "end": 41.68, "text": " to current NLP transfer learning tasks such as BERT models."}, {"start": 41.68, "end": 47.400000000000006, "text": " So if you like content like this, consider subscribing and sharing it to your friends,"}, {"start": 47.400000000000006, "end": 51.760000000000005, "text": " and as always leave a comment if you have anything to say on this."}, {"start": 51.760000000000005, "end": 54.0, "text": " Alright, let's dive in."}, {"start": 54.0, "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.519999999999996, "text": " supervised learning."}, {"start": 62.519999999999996, "end": 64.96000000000001, "text": " So what is magnitude pruning?"}, {"start": 64.96000000000001, "end": 70.44, "text": " Now if I have a neural network, let's say I have a convolutional neural network and"}, {"start": 70.44, "end": 75.76, "text": " I input my little cat right here and I have a bunch of layers, right?"}, {"start": 75.76, "end": 79.76, "text": " And now if we look at these layers, each of these layers is going to be made up of these"}, {"start": 79.76, "end": 85.56, "text": " units of the neurons and the next layer is also made up of these neurons."}, {"start": 85.56, "end": 90.96000000000001, "text": " Now what kind of neural network that is, it's not that important, but what is important"}, {"start": 90.96000000000001, "end": 94.60000000000001, "text": " is that you have these connections from neuron to neuron."}, {"start": 94.60000000000001, "end": 100.32000000000001, "text": " And in let's say a fully connected network, every neuron is connected to every other neuron"}, {"start": 100.32000000000001, "end": 105.24000000000001, "text": " in a CNN that would be slightly different, but in essence you have a lot of connections"}, {"start": 105.24000000000001, "end": 106.24000000000001, "text": " here."}, {"start": 106.24000000000001, "end": 108.72, "text": " And these are usually called weights."}, {"start": 108.72, "end": 110.64, "text": " So these are the weights."}, {"start": 110.64, "end": 117.36, "text": " Now the problem is if I train like this giant neural networks and I want to ship them,"}, {"start": 117.36, "end": 124.56, "text": " for example, to mobile devices to my customers, then they won't be able to download gigabytes"}, {"start": 124.56, "end": 129.2, "text": " of models or even like hundreds of megabytes of models, just not possible."}, {"start": 129.2, "end": 133.84, "text": " So what we want to do is we want to prune this model, which means we want to remove parts"}, {"start": 133.84, "end": 137.12, "text": " of these weights, a lot of these weights."}, {"start": 137.12, "end": 140.36, "text": " But we don't want to lose accuracy of the network."}, {"start": 140.36, "end": 142.64000000000001, "text": " So imagine I have a network and that's trained."}, {"start": 142.64000000000001, "end": 143.64000000000001, "text": " It's an image classifier."}, {"start": 143.64000000000001, "end": 144.64000000000001, "text": " It's here."}, {"start": 144.64000000000001, "end": 147.0, "text": " It's cats or dogs."}, {"start": 147.0, "end": 149.0, "text": " And I have it trained to a good accuracy."}, {"start": 149.0, "end": 155.96, "text": " I want to delete these weights, but I want to retain the performance."}, {"start": 155.96, "end": 158.48000000000002, "text": " And these methods are called pruning."}, {"start": 158.48000000000002, "end": 162.36, "text": " Now what people do is usually they sort of go in in a stepwise fashion."}, {"start": 162.36, "end": 166.88, "text": " They say, well, first of all, I don't need some of these."}, {"start": 166.88, "end": 172.44, "text": " And then they delete some and then they sort of retrain the prune network."}, {"start": 172.44, "end": 176.24, "text": " And after that, they go again and they say, well, I don't really need that one and they"}, {"start": 176.24, "end": 177.4, "text": " don't really need that one."}, {"start": 177.4, "end": 184.48, "text": " So they do it in this stepwise fashion until the network is of the size that they want."}, {"start": 184.48, "end": 187.16, "text": " And the hope is that you don't lose too much accuracy."}, {"start": 187.16, "end": 192.12, "text": " So the current, the question is, how do you select which weights you need and which ones"}, {"start": 192.12, "end": 193.51999999999998, "text": " you don't need?"}, {"start": 193.52, "end": 200.96, "text": " And usually this is done by so called magnitude pruning, which means that look at the way"}, {"start": 200.96, "end": 206.08, "text": " you look at the weights and the weights, they'll have some distribution."}, {"start": 206.08, "end": 210.52, "text": " There'll be there'll be very negative."}, {"start": 210.52, "end": 215.08, "text": " So here is very negative weights and here is very large positive weights."}, {"start": 215.08, "end": 220.12, "text": " And what you'll say is that, okay, probably the weights that are very large, they contribute"}, {"start": 220.12, "end": 225.12, "text": " a lot to the signal of the network within the network and the weights that are quite small"}, {"start": 225.12, "end": 228.84, "text": " there, you know, since there's all this noise and stuff, they're probably not that important."}, {"start": 228.84, "end": 234.76, "text": " So I'm going to cut off basically right here and everything that's in here, I'm going"}, {"start": 234.76, "end": 239.64000000000001, "text": " to delete those are the non-important weights, whereas on the outside, those are the important"}, {"start": 239.64000000000001, "end": 240.64000000000001, "text": " weights."}, {"start": 240.64000000000001, "end": 244.72, "text": " This is called magnitude pruning because it goes by the magnitude of the weight, absolute"}, {"start": 244.72, "end": 247.56, "text": " value of the weight."}, {"start": 247.56, "end": 253.32, "text": " So you don't actually need, so there's not one threshold here, you don't need a threshold,"}, {"start": 253.32, "end": 256.08, "text": " you simply need a method to order the weights, right?"}, {"start": 256.08, "end": 260.88, "text": " And then you keep removing them until you're satisfied with the size."}, {"start": 260.88, "end": 263.48, "text": " So this is magnitude pruning."}, {"start": 263.48, "end": 268.64, "text": " Now what's the problem with the magnitude pruning in these kinds of tasks?"}, {"start": 268.64, "end": 273.4, "text": " They say however, it is less effective in the transfer learning regime that has become"}, {"start": 273.4, "end": 278.56, "text": " 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?"}, {"start": 282.56, "end": 287.35999999999996, "text": " And actually, let's go with the image example right here, even though it's mostly used"}, {"start": 287.35999999999996, "end": 289.91999999999996, "text": " in NLP, we can do the same thing."}, {"start": 289.91999999999996, "end": 295.08, "text": " So let's say we have a classifier here for cats and dogs, our classifier, and we had"}, {"start": 295.08, "end": 298.35999999999996, "text": " a big, big database of cats and dogs images, right?"}, {"start": 298.35999999999996, "end": 302.44, "text": " So we were able to train that fairly well and we don't prune it yet, we have this full"}, {"start": 302.44, "end": 303.44, "text": " network."}, {"start": 303.44, "end": 312.12, "text": " Now we want to adapt this to a task where we want to recognize whether or not the animal"}, {"start": 312.12, "end": 313.88, "text": " is sick."}, {"start": 313.88, "end": 319.4, "text": " So we developed this app for a veterinarian and it's like a short screening for a particular"}, {"start": 319.4, "end": 322.0, "text": " disease that a cat might have."}, {"start": 322.0, "end": 324.2, "text": " And we already have this cats and dogs classifier."}, {"start": 324.2, "end": 331.4, "text": " So it's reasonable to assume that this classifier has some good features to work with cats"}, {"start": 331.4, "end": 332.79999999999995, "text": " and dog images."}, {"start": 332.79999999999995, "end": 337.56, "text": " So what we can do instead of, because let's assume for this other task, we just have this"}, {"start": 337.56, "end": 342.96, "text": " tiny little data set, which is not enough to train a neural network of this size, right?"}, {"start": 342.96, "end": 348.59999999999997, "text": " But so in a first step, we'll train this big neural network on the cat versus dogs."}, {"start": 348.59999999999997, "end": 351.4, "text": " And then what we do is we transfer learning."}, {"start": 351.4, "end": 356.96, "text": " So we transfer all the weights right here and here we have a different task now, sick or"}, {"start": 356.96, "end": 358.35999999999996, "text": " not sick."}, {"start": 358.35999999999996, "end": 359.47999999999996, "text": " This is cat."}, {"start": 359.48, "end": 363.28000000000003, "text": " This is dog and here is sick or not sick."}, {"start": 363.28000000000003, "end": 366.32, "text": " Not sick."}, {"start": 366.32, "end": 373.32, "text": " And of course we can't transfer these particular weights, but we hope that the features here"}, {"start": 373.32, "end": 374.76, "text": " will sort of be the same."}, {"start": 374.76, "end": 380.76, "text": " So we transfer them and then we train these weights, including the head right here, this"}, {"start": 380.76, "end": 384.6, "text": " part, we train it on this little data set."}, {"start": 384.6, "end": 387.16, "text": " And we hope that we already have this good starting point."}, {"start": 387.16, "end": 393.64000000000004, "text": " We only need to learn the, basically the specifics of what makes these two data sets different."}, {"start": 393.64000000000004, "end": 400.92, "text": " And we don't have to learn entire task of dealing with cat and dog images from the get go."}, {"start": 400.92, "end": 403.6, "text": " Okay, so this is called transfer learning."}, {"start": 403.6, "end": 407.20000000000005, "text": " Now in this case, we combine the two."}, {"start": 407.20000000000005, "end": 412.0, "text": " So first we want to transfer learn, like if we build this app for vets."}, {"start": 412.0, "end": 415.72, "text": " And then we might say, oh, this is not, you know, this is not only for vets, this is"}, {"start": 415.72, "end": 420.20000000000005, "text": " actually for anyone, you know, who has a cat or a dog at home."}, {"start": 420.20000000000005, "end": 426.20000000000005, "text": " So what we could do is build an app where anyone at home could scan their cat and it would"}, {"start": 426.20000000000005, "end": 429.92, "text": " output like a probability of the cat having that disease."}, {"start": 429.92, "end": 434.0, "text": " So we want this neural network is still the same size as this neural networks."}, {"start": 434.0, "end": 436.48, "text": " And now we want to do the pruning."}, {"start": 436.48, "end": 442.12, "text": " We want this neural network to become sparse to only have a couple of connections left"}, {"start": 442.12, "end": 445.20000000000005, "text": " such that it's a few kilobytes large."}, {"start": 445.2, "end": 446.59999999999997, "text": " But retain performance."}, {"start": 446.59999999999997, "end": 455.0, "text": " Now they say, when you do this step, you can't just do the magnitude pruning, like you did"}, {"start": 455.0, "end": 456.08, "text": " right here."}, {"start": 456.08, "end": 457.59999999999997, "text": " And why not?"}, {"start": 457.59999999999997, "end": 464.4, "text": " Because this is not this model right here is not the result of a training step, like of"}, {"start": 464.4, "end": 470.68, "text": " a regular training process, but is the result of a transfer learning process where first"}, {"start": 470.68, "end": 475.2, "text": " you do the big training and then second, you adapt it."}, {"start": 475.2, "end": 476.96, "text": " And why is that the case?"}, {"start": 476.96, "end": 482.8, "text": " Well, ultimately, what you want to do is you want to prove the non-important weights."}, {"start": 482.8, "end": 488.24, "text": " Now there could be a weight right here, this one, that is very important for the cat versus"}, {"start": 488.24, "end": 494.88, "text": " dog task, but that is not important for the sick versus non-sick task."}, {"start": 494.88, "end": 499.68, "text": " And we also, we know that in these transfer learning settings, the weights, they don't"}, {"start": 499.68, "end": 501.36, "text": " tend to move that much."}, {"start": 501.36, "end": 508.36, "text": " In general, the research shows that once you've trained a neural network, basically the beginning"}, {"start": 508.36, "end": 513.16, "text": " is important, but then once you did it, like if you adapted or transfer learning and so"}, {"start": 513.16, "end": 516.52, "text": " on, the weights, they won't move that much."}, {"start": 516.52, "end": 522.4, "text": " So in essence, this weight maybe starts out right here."}, {"start": 522.4, "end": 526.0, "text": " And it will sort of stay around this place."}, {"start": 526.0, "end": 530.12, "text": " It will maybe go a little bit down because it's not important, but it won't move much"}, {"start": 530.12, "end": 531.32, "text": " during transfer learning."}, {"start": 531.32, "end": 533.52, "text": " That's just a property of transfer learning."}, {"start": 533.52, "end": 538.08, "text": " So this paper here says, we can't just use magnitude, if we're running when we transfer"}, {"start": 538.08, "end": 543.88, "text": " learning, because what will basically go by, what we'll basically say is, will assign"}, {"start": 543.88, "end": 550.52, "text": " the importance based on, based on the original neural network task on the cat versus dog."}, {"start": 550.52, "end": 554.16, "text": " We will misspecify the importance of the weights."}, {"start": 554.16, "end": 558.4399999999999, "text": " What we should do is actually measure the importance with respect to this task."}, {"start": 558.4399999999999, "end": 560.24, "text": " And how do they achieve it?"}, {"start": 560.24, "end": 567.8399999999999, "text": " So on a high level, they're basically saying, okay, if we start out, well, this was fatal."}, {"start": 567.8399999999999, "end": 574.0799999999999, "text": " If we start out with a point over here, let's make that red, red."}, {"start": 574.0799999999999, "end": 577.48, "text": " I want the color red."}, {"start": 577.48, "end": 578.9599999999999, "text": " Well it's blue now."}, {"start": 578.9599999999999, "end": 584.12, "text": " So if we start out with a point over here, what we should do, what we should do is,"}, {"start": 584.12, "end": 587.76, "text": " we should observe how it moves during transfer learning."}, {"start": 587.76, "end": 593.36, "text": " If it moves towards zero, then it's probably not that important for the new task."}, {"start": 593.36, "end": 601.12, "text": " And if it moves to the, to be even larger, then it's probably important for that new task."}, {"start": 601.12, "end": 603.0, "text": " So that's, that's a high level now."}, {"start": 603.0, "end": 605.6, "text": " How do you measure how it moves?"}, {"start": 605.6, "end": 609.92, "text": " And what exactly, how exactly do you do all of this during training such that you don't"}, {"start": 609.92, "end": 610.92, "text": " make mistakes?"}, {"start": 610.92, "end": 613.6, "text": " That's the point of this paper."}, {"start": 613.6, "end": 620.2, "text": " They say we propose movement pruning, a simple deterministic first order weight pruning method"}, {"start": 620.2, "end": 624.16, "text": " that is more adaptive to pre-train model fine tuning."}, {"start": 624.16, "end": 628.9200000000001, "text": " We give mathematical foundations to the method and compare it to existing zero and first"}, {"start": 628.9200000000001, "end": 631.84, "text": " order pruning methods."}, {"start": 631.84, "end": 632.84, "text": " Okay."}, {"start": 632.84, "end": 638.1600000000001, "text": " So, yeah, we said, so that's basically on a high level."}, {"start": 638.1600000000001, "end": 640.1600000000001, "text": " That's that."}, {"start": 640.16, "end": 644.4, "text": " Now how do they actually do it?"}, {"start": 644.4, "end": 647.24, "text": " What they do right here is the following."}, {"start": 647.24, "end": 658.3199999999999, "text": " They say what we can define, we can define each, each network layer basically as a matrix"}, {"start": 658.3199999999999, "end": 660.48, "text": " multiplication by a weight."}, {"start": 660.48, "end": 665.56, "text": " You can express pretty much any neural network as such a multiplication with a weight."}, {"start": 665.56, "end": 671.1199999999999, "text": " So you have x in the signal in each layer and you multiply that by the weight matrix"}, {"start": 671.1199999999999, "end": 677.4799999999999, "text": " at W. Now if you prune the neural network, you can see that right here."}, {"start": 677.4799999999999, "end": 682.56, "text": " What you're saying is I basically in here, I have the matrix M, which is a mask."}, {"start": 682.56, "end": 689.4, "text": " So the mask is either zero or one for if a weight is active or if a weight is not active."}, {"start": 689.4, "end": 691.0799999999999, "text": " Now this is not a matrix multiply."}, {"start": 691.0799999999999, "end": 694.1199999999999, "text": " Actually this is like a Hadamard product."}, {"start": 694.12, "end": 700.28, "text": " But you have this mask matrix and what decides on this mask?"}, {"start": 700.28, "end": 710.68, "text": " This mask is decided as you can see right here by this S. So S, S is a matrix that for"}, {"start": 710.68, "end": 716.04, "text": " each entry in W, it will decide how important it is."}, {"start": 716.04, "end": 721.52, "text": " Now in the classic sense in the magnitude pruning you already saw that this is just going"}, {"start": 721.52, "end": 726.16, "text": " to be the absolute value of W ij."}, {"start": 726.16, "end": 732.28, "text": " And then the top V simply means that you take the whoever are the most important, the most"}, {"start": 732.28, "end": 737.96, "text": " magnitude, those are going to be one in the mask and everything else is going to be zero"}, {"start": 737.96, "end": 739.28, "text": " in the mask."}, {"start": 739.28, "end": 747.0, "text": " That's how this S, the W determines the S and the S determines the M. So what you ultimately"}, {"start": 747.0, "end": 755.64, "text": " uses the M right here. But in now what we want to do is we want to actually make the S based"}, {"start": 755.64, "end": 756.96, "text": " on the movement."}, {"start": 756.96, "end": 760.96, "text": " And the movement is not really a defined concept because it goes over steps and so on."}, {"start": 760.96, "end": 766.84, "text": " So how do you do the movement in a kind of dynamic way?"}, {"start": 766.84, "end": 771.16, "text": " And this paper says you should do it by gradient."}, {"start": 771.16, "end": 779.4, "text": " So you should observe the gradient of your loss function with respect to this S matrix,"}, {"start": 779.4, "end": 782.36, "text": " to this importance matrix."}, {"start": 782.36, "end": 785.36, "text": " What does it mean?"}, {"start": 785.36, "end": 786.1999999999999, "text": " What does it mean?"}, {"start": 786.1999999999999, "end": 792.9599999999999, "text": " It means."}, {"start": 792.9599999999999, "end": 795.28, "text": " Let's consider this quantity right here."}, {"start": 795.28, "end": 805.92, "text": " If S is the importance of a particular connection and if the gradient is large, that means this"}, {"start": 805.92, "end": 808.92, "text": " connection moves a lot."}, {"start": 808.92, "end": 813.3199999999999, "text": " Like the loss pulls it into a particular direction."}, {"start": 813.3199999999999, "end": 816.6, "text": " So we're not talking about yet which direction."}, {"start": 816.6, "end": 819.8399999999999, "text": " Actually the gradient has a sign inside the positive or negative, right?"}, {"start": 819.84, "end": 827.24, "text": " So by this quantity you can decide how much does this new task want this particular importance"}, {"start": 827.24, "end": 828.9200000000001, "text": " score to move."}, {"start": 828.9200000000001, "end": 835.6800000000001, "text": " So this is a direct measure of how much basically the loss function pulls on that importance"}, {"start": 835.6800000000001, "end": 836.6800000000001, "text": " score."}, {"start": 836.6800000000001, "end": 837.6800000000001, "text": " How much?"}, {"start": 837.6800000000001, "end": 846.2800000000001, "text": " And now you can simply decide if they have these, they have, I think they have a diagram."}, {"start": 846.2800000000001, "end": 848.2, "text": " Yes."}, {"start": 848.2, "end": 851.88, "text": " So I don't like that."}, {"start": 851.88, "end": 852.88, "text": " Let's go."}, {"start": 852.88, "end": 859.9200000000001, "text": " So we have right here, we have what's the value of this gradient of L with respect to S."}, {"start": 859.9200000000001, "end": 861.88, "text": " And here is W."}, {"start": 861.88, "end": 870.6, "text": " So if the gradient is positive and W is already positive, that means the gradient goes"}, {"start": 870.6, "end": 875.36, "text": " into the positive direction."}, {"start": 875.36, "end": 881.0, "text": " So you increase the loss function in that, let's put the negative gradient here because"}, {"start": 881.0, "end": 884.16, "text": " you do gradient descent, right?"}, {"start": 884.16, "end": 891.32, "text": " So if the negative gradient is positive and the weight is already positive in this case,"}, {"start": 891.32, "end": 896.5600000000001, "text": " that means the weight is already high, but now the loss function wants to push it even"}, {"start": 896.5600000000001, "end": 897.5600000000001, "text": " higher."}, {"start": 897.5600000000001, "end": 900.44, "text": " So that must be a very, very important weight, right?"}, {"start": 900.44, "end": 903.0, "text": " Like it's like very good."}, {"start": 903.0, "end": 909.44, "text": " The same goes if the gradient, the negative gradient is negative and the weight is already"}, {"start": 909.44, "end": 910.44, "text": " negative."}, {"start": 910.44, "end": 915.08, "text": " The weight being negative already means the weight, you know, it has a negative sign."}, {"start": 915.08, "end": 919.16, "text": " And then the gradient wants it to go even more negative."}, {"start": 919.16, "end": 923.12, "text": " The optimization procedure says this thing should become even more negative."}, {"start": 923.12, "end": 926.64, "text": " And also we say, that's probably a good way."}, {"start": 926.64, "end": 931.48, "text": " Now the other two cases means basically the weights already positive, but the gradient wants"}, {"start": 931.48, "end": 935.16, "text": " it to go negative, which means it's pulled towards zero."}, {"start": 935.16, "end": 940.36, "text": " Now it's entirely possible that it's going across zero and going like if you're here,"}, {"start": 940.36, "end": 946.4, "text": " going from over here, going to here, cross zero and become like super large, but that"}, {"start": 946.4, "end": 951.12, "text": " violates our basic assumptions that the transfer learning doesn't move the weights too"}, {"start": 951.12, "end": 952.12, "text": " much, right?"}, {"start": 952.12, "end": 956.96, "text": " What you're caring for is basically this local neighborhood right here."}, {"start": 956.96, "end": 962.08, "text": " So you can make the fair assumption that these weights are not that important in the case"}, {"start": 962.08, "end": 966.76, "text": " where the negative gradient goes against the sign of the weight."}, {"start": 966.76, "end": 972.08, "text": " So this is of course discreet right now, but we can actually assign a number by how large"}, {"start": 972.08, "end": 975.76, "text": " the gradient is and by how large the weight already is."}, {"start": 975.76, "end": 978.84, "text": " And therefore we can make a score."}, {"start": 978.84, "end": 986.76, "text": " So the important score right here, as you can see, is the weight multiplied by the gradient"}, {"start": 986.76, "end": 988.16, "text": " of the weight."}, {"start": 988.16, "end": 993.16, "text": " And they can actually show mathematically that if you do this over multiple steps, so you"}, {"start": 993.16, "end": 997.96, "text": " optimize while you do this pruning and they do some sort of a soft pruning so you can"}, {"start": 997.96, "end": 1001.0, "text": " kind of correct your mistakes later on."}, {"start": 1001.0, "end": 1005.96, "text": " I mean, they have hard and soft pruning, but in any case, they can correct their mistakes"}, {"start": 1005.96, "end": 1006.96, "text": " later on."}, {"start": 1006.96, "end": 1012.04, "text": " This will actually result in these important scores being an accumulation over the training"}, {"start": 1012.04, "end": 1015.68, "text": " over the entire training of this quantity."}, {"start": 1015.68, "end": 1022.92, "text": " And that's pretty cool because that means eventually you sort of have a consistent estimator"}, {"start": 1022.92, "end": 1027.2, "text": " of these important scores across your training procedure."}, {"start": 1027.2, "end": 1031.36, "text": " Because the main fear with something like this of course is that it's very brittle and"}, {"start": 1031.36, "end": 1036.36, "text": " very much depends on the training dynamics and who knows if in step one something bad"}, {"start": 1036.36, "end": 1037.9199999999998, "text": " happens and so on."}, {"start": 1037.9199999999998, "end": 1045.32, "text": " But the math behind this here gives sort of more evidence that this can be like a self-correcting"}, {"start": 1045.32, "end": 1052.0, "text": " mechanism and is actually not too dependent on the particular training dynamics."}, {"start": 1052.0, "end": 1054.1599999999999, "text": " So they do this experimental setup."}, {"start": 1054.1599999999999, "end": 1057.3999999999999, "text": " Now they have some quirks here."}, {"start": 1057.3999999999999, "end": 1062.08, "text": " Actually let's first go to the actual different methods they compare different methods right"}, {"start": 1062.08, "end": 1063.08, "text": " here."}, {"start": 1063.08, "end": 1065.24, "text": " Where they say, okay, there's magnitude pruning."}, {"start": 1065.24, "end": 1069.3999999999999, "text": " It's a zero with order, which basically just means you just look at the weight magnitude"}, {"start": 1069.3999999999999, "end": 1071.4399999999998, "text": " that that's it."}, {"start": 1071.44, "end": 1077.0, "text": " This top V, which means you just pick the top whatever and the objective is just the"}, {"start": 1077.0, "end": 1080.04, "text": " loss and the scores are just the absolute value."}, {"start": 1080.04, "end": 1081.04, "text": " We've seen this."}, {"start": 1081.04, "end": 1085.16, "text": " Now movement pruning on the other hand is first order, which means you look at the movement"}, {"start": 1085.16, "end": 1086.68, "text": " in our case of the gradient."}, {"start": 1086.68, "end": 1089.96, "text": " As you can see here, that was the importance scores."}, {"start": 1089.96, "end": 1095.04, "text": " And you use this straight through estimator, which is basically just a way of saying that"}, {"start": 1095.04, "end": 1100.04, "text": " even though you're masking some things in the forward step, you shouldn't mask them in"}, {"start": 1100.04, "end": 1103.8799999999999, "text": " the gradient backward step because you still want gradient signal to reach."}, {"start": 1103.8799999999999, "end": 1108.52, "text": " So if you have layers and you have a weight right here, at least that's how I understand"}, {"start": 1108.52, "end": 1109.52, "text": " it."}, {"start": 1109.52, "end": 1111.12, "text": " I have not read that paper."}, {"start": 1111.12, "end": 1116.28, "text": " But if you mask this one here, you still want the gradient to sort of flow backwards"}, {"start": 1116.28, "end": 1121.52, "text": " because you still need the actual important scores for the weights that are here below"}, {"start": 1121.52, "end": 1124.8, "text": " connect to this weight."}, {"start": 1124.8, "end": 1127.6399999999999, "text": " I think that's what is meant."}, {"start": 1127.64, "end": 1130.4, "text": " I'm not entirely sure in this though."}, {"start": 1130.4, "end": 1134.8400000000001, "text": " So but you can see that the objective function is also the actual loss function."}, {"start": 1134.8400000000001, "end": 1141.5200000000002, "text": " Now this is contrasted to a baseline called L0 regularization, which is quite similar,"}, {"start": 1141.5200000000002, "end": 1147.42, "text": " but is also first order, but has this sort of regularizer right here and uses the gumbels"}, {"start": 1147.42, "end": 1150.96, "text": " softmax in order to determine the scores."}, {"start": 1150.96, "end": 1154.2800000000002, "text": " And as you can see, it also has a different score function."}, {"start": 1154.28, "end": 1163.2, "text": " And it has this continuous hard concrete, important masking function, sorry, masking function."}, {"start": 1163.2, "end": 1167.84, "text": " And they have a variant of movement pruning that tends to perform a little bit better,"}, {"start": 1167.84, "end": 1173.08, "text": " which is soft movement pruning where instead of just going by the loss function, optimizing"}, {"start": 1173.08, "end": 1177.36, "text": " the loss function, they optimize the loss function plus something."}, {"start": 1177.36, "end": 1182.6, "text": " Now they have, as you can see here, they have a thresholding masking function."}, {"start": 1182.6, "end": 1190.6799999999998, "text": " And the threshold is actually dynamic or it's determined by the important scores and they"}, {"start": 1190.6799999999998, "end": 1194.6, "text": " have then a regularizer that make the important scores sparse."}, {"start": 1194.6, "end": 1201.6399999999999, "text": " So instead of saying we just want the top 5% of weights, they now just put a lot of mass"}, {"start": 1201.6399999999999, "end": 1206.76, "text": " on this lambda right here, which will cause the S to be sparse."}, {"start": 1206.76, "end": 1212.3999999999999, "text": " And if they are not happy with how many weights they from the simply increase or decrease"}, {"start": 1212.4, "end": 1217.72, "text": " this lambda such that they get to their desired sparse."}, {"start": 1217.72, "end": 1222.44, "text": " And of course, you see there's the direct trade off with the loss function."}, {"start": 1222.44, "end": 1229.72, "text": " So the more you put weight on this lambda, the less weight you put basically on the"}, {"start": 1229.72, "end": 1230.92, "text": " loss function itself."}, {"start": 1230.92, "end": 1233.8400000000001, "text": " So you have the trade off here is very explicit."}, {"start": 1233.8400000000001, "end": 1240.68, "text": " Whereas in basic movement pruning, it's just given by you masking away completely the"}, {"start": 1240.68, "end": 1245.04, "text": " bottom 1 minus v of percent of the weights."}, {"start": 1245.04, "end": 1248.3200000000002, "text": " But you see the score function is the same."}, {"start": 1248.3200000000002, "end": 1256.48, "text": " Oh well, the score function here, the score function is the same."}, {"start": 1256.48, "end": 1257.48, "text": " Okay."}, {"start": 1257.48, "end": 1265.76, "text": " Now there are quite a number of tricks here like there's this sparsity scheduling function"}, {"start": 1265.76, "end": 1266.8400000000001, "text": " and so on."}, {"start": 1266.84, "end": 1272.72, "text": " And as always, in NLP and with any big models, there are a bunch of engineering tricks that"}, {"start": 1272.72, "end": 1276.36, "text": " make everything work better."}, {"start": 1276.36, "end": 1281.3999999999999, "text": " And you can never exactly tell how much is due to that and how much is due to the actual"}, {"start": 1281.3999999999999, "end": 1282.3999999999999, "text": " technique."}, {"start": 1282.3999999999999, "end": 1287.76, "text": " But if you know, you can sort of assess whether or not this, it's done well."}, {"start": 1287.76, "end": 1290.72, "text": " And this here actually the rationale makes sense."}, {"start": 1290.72, "end": 1296.6399999999999, "text": " And that's why I tend to think that it is actually a better method."}, {"start": 1296.64, "end": 1300.24, "text": " And the experiments are very, very convincing."}, {"start": 1300.24, "end": 1306.92, "text": " Let's say, okay, this is just a pictorial comparison where you can see movement pruning,"}, {"start": 1306.92, "end": 1308.8000000000002, "text": " sorry, magnitude pruning."}, {"start": 1308.8000000000002, "end": 1313.8000000000002, "text": " All it does is it looks at after you fine tune, what are the weights and it just cuts away"}, {"start": 1313.8000000000002, "end": 1315.24, "text": " everything in the middle."}, {"start": 1315.24, "end": 1319.1200000000001, "text": " Doesn't care about how the weights were when before."}, {"start": 1319.1200000000001, "end": 1324.44, "text": " How a movement pruning looks at the combination of what were the weights before and what are"}, {"start": 1324.44, "end": 1331.4, "text": " the weights now and it cuts away everything where the weights moved towards zero, which"}, {"start": 1331.4, "end": 1333.04, "text": " are these quadrants right here."}, {"start": 1333.04, "end": 1336.88, "text": " And it leaves in everything where it moved away from zero."}, {"start": 1336.88, "end": 1343.24, "text": " Or that's the ordering, let's say, that how much it moved."}, {"start": 1343.24, "end": 1346.2, "text": " Okay, experiments."}, {"start": 1346.2, "end": 1351.68, "text": " Now as you might already have figured out by now in the machine learning and especially"}, {"start": 1351.68, "end": 1359.0800000000002, "text": " the NLP community, the methods presented always outperform the previous methods."}, {"start": 1359.0800000000002, "end": 1360.4, "text": " In this case, it's pretty special."}, {"start": 1360.4, "end": 1366.5600000000002, "text": " So they test this on these number of tests, quad and NMI and QQP."}, {"start": 1366.5600000000002, "end": 1370.0, "text": " And these are quite hard tasks from an NLP perspective."}, {"start": 1370.0, "end": 1374.3600000000001, "text": " Like squad is question answering, MNLIs like language inference."}, {"start": 1374.36, "end": 1381.56, "text": " These would be on the, I would guess these are on the, for an NLP system on the harder side"}, {"start": 1381.56, "end": 1382.56, "text": " of tasks."}, {"start": 1382.56, "end": 1384.28, "text": " That's fairly cool."}, {"start": 1384.28, "end": 1391.3999999999999, "text": " And as you can see here, now just focus on first of all, focus on this MAP, which is the"}, {"start": 1391.3999999999999, "end": 1392.3999999999999, "text": " magnitude pruning."}, {"start": 1392.3999999999999, "end": 1395.08, "text": " So that's the baseline, if you will."}, {"start": 1395.08, "end": 1402.56, "text": " And the purple one, the SMVP, which is the soft movement pruning."}, {"start": 1402.56, "end": 1407.6799999999998, "text": " Okay, now you can also focus on the MVP right here, but they're approximately the same."}, {"start": 1407.6799999999998, "end": 1414.1599999999999, "text": " Now the RPP, you can maybe see in the graph, is performing fairly well, even compared"}, {"start": 1414.1599999999999, "end": 1417.8799999999999, "text": " to the full model."}, {"start": 1417.8799999999999, "end": 1422.0, "text": " It's another baseline basically, but we just want to compare those two."}, {"start": 1422.0, "end": 1429.24, "text": " And you can see that in this regime, that the magnitude pruning outperforms the movement"}, {"start": 1429.24, "end": 1430.72, "text": " pruning."}, {"start": 1430.72, "end": 1434.04, "text": " But however, in this regime, the movement pruning is much better."}, {"start": 1434.04, "end": 1439.6000000000001, "text": " And that's the percent where the percent of remaining weights is very, very low."}, {"start": 1439.6000000000001, "end": 1443.24, "text": " So this is kind of the extreme sparse case where you only have 10 percent or you only"}, {"start": 1443.24, "end": 1446.44, "text": " have 3 percent of the weights left."}, {"start": 1446.44, "end": 1452.44, "text": " And you can see that the movement pruning is outperforming the magnitude pruning by"}, {"start": 1452.44, "end": 1454.1200000000001, "text": " a lot."}, {"start": 1454.1200000000001, "end": 1455.1200000000001, "text": " Okay."}, {"start": 1455.12, "end": 1464.6, "text": " So they do discover that, so this happens in all of these tasks, as you can see right here."}, {"start": 1464.6, "end": 1471.12, "text": " And they do discover that if you then distill the model further."}, {"start": 1471.12, "end": 1476.8, "text": " So in distillation, this is yet another technique that you can use to boost the performance"}, {"start": 1476.8, "end": 1479.2399999999998, "text": " of the transfer learned model."}, {"start": 1479.24, "end": 1487.64, "text": " So in distillation, you would not only train the model on you."}, {"start": 1487.64, "end": 1495.32, "text": " So you have, you now you have your this model that you transfer learn and you have the prune"}, {"start": 1495.32, "end": 1496.76, "text": " version."}, {"start": 1496.76, "end": 1500.92, "text": " And in the prune version, what you would do is you would simply also train it on this"}, {"start": 1500.92, "end": 1502.08, "text": " data set."}, {"start": 1502.08, "end": 1507.08, "text": " But what you can also do is you can distill this model right here, the one that you train"}, {"start": 1507.08, "end": 1512.12, "text": " on the same task, right, that's presumably better because it still has all the weights."}, {"start": 1512.12, "end": 1513.12, "text": " Okay."}, {"start": 1513.12, "end": 1516.6, "text": " You can run a data point through both."}, {"start": 1516.6, "end": 1520.96, "text": " So the same data point goes through this and you get an output which are logits, which"}, {"start": 1520.96, "end": 1525.4399999999998, "text": " is like representing a distribution saying, yeah, it's about this high."}, {"start": 1525.4399999999998, "end": 1529.32, "text": " Now instead of assigning the hard labels."}, {"start": 1529.32, "end": 1533.48, "text": " So here we also get the label, right, it's a supervised learning task like one and zero."}, {"start": 1533.48, "end": 1539.0, "text": " You also put the data point through this model right here, obtain whatever that model would"}, {"start": 1539.0, "end": 1541.3600000000001, "text": " have said."}, {"start": 1541.3600000000001, "end": 1546.0, "text": " And let's say it's about this."}, {"start": 1546.0, "end": 1552.08, "text": " And now presumably this model is better already."}, {"start": 1552.08, "end": 1558.84, "text": " So you say, well, the label here says that it's this class, but the model that's really"}, {"start": 1558.84, "end": 1561.52, "text": " good says you shouldn't be too sure about it."}, {"start": 1561.52, "end": 1567.16, "text": " So you can sort of mix the two losses and this process of transferring the knowledge of"}, {"start": 1567.16, "end": 1574.12, "text": " this model to here is called distillation with the lower model being the teacher model."}, {"start": 1574.12, "end": 1580.0, "text": " Now if you do distillation, you can actually improve your performance even more."}, {"start": 1580.0, "end": 1587.76, "text": " And they show that in the experiments here, especially again in the low, in the low parameter"}, {"start": 1587.76, "end": 1593.64, "text": " regime, but you can see, for example, in squad here, that the distilled movement pruned"}, {"start": 1593.64, "end": 1600.84, "text": " method now catches up with the magnitude pruned method in the, also in the high, not so"}, {"start": 1600.84, "end": 1602.6, "text": " sparse regime."}, {"start": 1602.6, "end": 1604.16, "text": " Okay."}, {"start": 1604.16, "end": 1606.16, "text": " And they analyze these weights."}, {"start": 1606.16, "end": 1614.36, "text": " And as you can see that expected the magnitude pruned method, it will simply cut out anything"}, {"start": 1614.36, "end": 1615.8799999999999, "text": " right here."}, {"start": 1615.88, "end": 1621.1200000000001, "text": " That's not not a surprise, whereas the movement pruned method, it will leave a lot of these"}, {"start": 1621.1200000000001, "end": 1622.3600000000001, "text": " weights alive."}, {"start": 1622.3600000000001, "end": 1631.0800000000002, "text": " So as you can, as you can see, basically, it's, it's very much the case since you can out"}, {"start": 1631.0800000000002, "end": 1635.3600000000001, "text": " perform the red, the yellow one can outperform the red one."}, {"start": 1635.3600000000001, "end": 1641.8000000000002, "text": " It is almost warranted to say that the magnitude pruning wasn't the best choice."}, {"start": 1641.8000000000002, "end": 1645.8400000000001, "text": " It's actually a better choice to leave some of those weights in and actually cut the"}, {"start": 1645.84, "end": 1650.1999999999998, "text": " sum of the weights that are large out just based on their movement."}, {"start": 1650.1999999999998, "end": 1657.24, "text": " Now the V here in the middle is, of course, due to the fact that if a weight is here,"}, {"start": 1657.24, "end": 1660.1599999999999, "text": " it was probably not super important in first place."}, {"start": 1660.1599999999999, "end": 1668.3999999999999, "text": " And since, since this thing removes anything that moves towards zero, any points starting,"}, {"start": 1668.3999999999999, "end": 1671.3999999999999, "text": " let's say, around here, moving towards zero would end up here."}, {"start": 1671.4, "end": 1677.52, "text": " So all the points that end up in this region probably moved towards zero during training"}, {"start": 1677.52, "end": 1680.3600000000001, "text": " and therefore are cut away."}, {"start": 1680.3600000000001, "end": 1686.2, "text": " So there's not just, like for there to be points, there would have been points that started"}, {"start": 1686.2, "end": 1689.16, "text": " even more in the middle and then moved out to here, right?"}, {"start": 1689.16, "end": 1690.64, "text": " And there's just not as many."}, {"start": 1690.64, "end": 1697.52, "text": " So that's why you have the V shape is very natural to expect right here."}, {"start": 1697.52, "end": 1707.6399999999999, "text": " So they analyze this then in terms of where the model cuts the weights out."}, {"start": 1707.6399999999999, "end": 1714.08, "text": " Now they experiment on a bird base thing, which is a transformer with 12 layers."}, {"start": 1714.08, "end": 1719.04, "text": " And if you don't know what bird is, you can go look at my video on bird."}, {"start": 1719.04, "end": 1728.6399999999999, "text": " But you can see that the magnitude pruning will sort of cut all the weights in the layers"}, {"start": 1728.6399999999999, "end": 1729.6399999999999, "text": " equally."}, {"start": 1729.6399999999999, "end": 1734.8, "text": " So it will sort of go through the layers and take away, let's say, 90% of each here,"}, {"start": 1734.8, "end": 1737.8, "text": " you can see 10% of weights remaining."}, {"start": 1737.8, "end": 1742.76, "text": " Whereas the movement pruning, especially the soft movement pruning will actually make"}, {"start": 1742.76, "end": 1743.76, "text": " a large difference."}, {"start": 1743.76, "end": 1751.12, "text": " It will remove much, much more of the later layers weights and keep the lower layer weights,"}, {"start": 1751.12, "end": 1756.2, "text": " which I think if you do transfer learning from these language models, it tends to be that"}, {"start": 1756.2, "end": 1762.12, "text": " the lower layers maybe pick up, if you think of a CNN, the lower layers might pick up,"}, {"start": 1762.12, "end": 1766.08, "text": " you know, on these essential image features, like corners and so on."}, {"start": 1766.08, "end": 1769.32, "text": " And the higher layers will pick up on the task specific things."}, {"start": 1769.32, "end": 1773.24, "text": " Now if you do like a big pre training tasks, you might have a lot of information that"}, {"start": 1773.24, "end": 1774.24, "text": " you need there."}, {"start": 1774.24, "end": 1779.4, "text": " But then if you distill it and transfer it down to like a small set, small task, where"}, {"start": 1779.4, "end": 1783.52, "text": " only a single thing is important, like in squad, it's only important."}, {"start": 1783.52, "end": 1785.4, "text": " What's the answer to the question?"}, {"start": 1785.4, "end": 1790.32, "text": " Then you can probably remove a lot of that superfluous information that was there, like high"}, {"start": 1790.32, "end": 1792.36, "text": " level features from the pre training task."}, {"start": 1792.36, "end": 1796.04, "text": " I mean, that's my guess here."}, {"start": 1796.04, "end": 1799.1200000000001, "text": " But they also have explained that."}, {"start": 1799.1200000000001, "end": 1803.04, "text": " So yeah, that was this paper."}, {"start": 1803.04, "end": 1806.96, "text": " If you're still here and you enjoyed it, leave a like, tell me in the comments what"}, {"start": 1806.96, "end": 1807.96, "text": " you think."}, {"start": 1807.96, "end": 1809.12, "text": " And I'll see you next time."}, {"start": 1809.12, "end": 1839.08, "text": " Bye bye."}] |
Yannic Kilcher | 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 objects. 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 von Gans Becke, Simon Wandenhende, Stamatius Georg Goulis, Mark Prozdemons and Luke von Goul. 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 canier's 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 think that this is outrageous. How can you classify one? You don't even know what the classes are and so on. So the way you have to imagine it going forward, and they're sort of they don't explicitly explain it, but it's sort of assumed that if you have a data set, data set, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah. And you learn to classify it. Well, basically, that means as you cluster it, right? You put some of the data points in the same clusters, okay? And then, of course, the data set, I'm going to draw the same data set right here. 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, basically going to find, you're going to be as generous as possible 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 carry over the labels, what would my accuracy be under that labeling? So 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 think it's a good algorithm. OK, so they claim they have a, OK, in this paper, we deviate from recent works and advocate a two step approach. And it's actually a three step approach, but we're feature learning and clustering are decoupled. OK, 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 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 the Euclidean distance between the pixels is really not a good thing. But also, so you might think we could actually, we could, you lose the 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 this last state right here. So it goes through and through and through. We could take either of the hidden states, or we could just take the last state, that is the sort of hidden representation right here, and do the clustering with that. But then of course, the question is, what do you, 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, you send a bunch of images through, to get you in embedding space, you get your 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 head, 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, alternate, 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, way over simplifying that technique right here. But you have these 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 they have 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 feature. So if the pixel on the bottom right here is blue, right? Then you can, and 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, 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 kind of convolve it with some things. It's like a very squiggly cat. OK, I'm terrible. This is, you can rotate it, for example, so it's like this. So 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, that should be red. You send your original image and the transformed image through a neural network, each one by themselves. OK, and then after this, you say, the hidden representation here should be close to each other. OK, this is basically the self-supervised training task. It's been shown to work very, very well as a pre-training method for classification neural networks. You have an image and it's 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, 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. So basically, what you're looking to do with the self-supervised methods is you are looking to destroy this low-level information. 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. OK, so this here, as you can see, is the neural network that you train. 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. OK, 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 you're embedding minimize this task. Now, this is nothing new. This has been used for a couple of years now to get better representation, self-supervised learning is the 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 focus on these low-level features. OK, and notice you don't need any labels for this procedure. That's what's called self-supervised. OK? So the 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 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. OK, this thing right here. This is a new neural network. So first, you already have the neural network, which was called, what was it even called? The one that gives you the embedding with the theta. OK, 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 gives you a representation of x. Let's call it hidden x. So that's the 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 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. 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. 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? 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 you'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. OK? This is the latent space where you have done the 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 5 as a benchmark. So you're going to find its nearest neighbors. It's 5 nearest neighbors. And you do that for each image. So this image has these 5 nearest neighbors. That's all. 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 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 nx 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. OK? So 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 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 a C dimensional vector in 0.1. Now, C is the number of classes. You can either know that, so you don't know which classes, 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 over-guess, you can still like build superclusters later. So they simply say it's in 0.1, but they also say it performs a soft assignment. So we're also going to assume that this is normalized. So for each data point x here, you're going to have an image. You're going to put it through this new neural network. 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 1, 2, or 3. We guess there are three classes. 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 a 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 were saying, since they were nearest neighbor in task 1, 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 the light of this neural network right here. So this is also going to give you an assignment, like maybe like this. And now you train this network right here to basically match these two distributions. So 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. 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, but the entropy is a negative quantity. So they maximize the entropy, because here's a plus. And they minimize the entropy. Let's see what they say. By minimizing the following objective, now entropy is the negative sum of p log p. And 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 2, which spreads the predictions uniformly across clusters C. OK. So what we want is a uniform assignment over cluster, which means we should maximize the entropy. Oh, yes. OK. They minimize this thing. And this here is the negative entropy. OK. So they want over the whole data set that not all of the images are going to be in the same cluster. Well, excuse me. This is cluster 1, and then this is cluster 2, and then this is cluster 3. So that term counteracts that. Basically, the more evenly spread the entire data set distribution is, the higher the entropy, the lower the negative entropy, and that's the goal right here. I'm sorry. This was, I was confused by the too many negative signs, and then you minimize the entire thing. All right. Now 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 2 imposes this neural network to make consistent predictions for a sample Xi and its neighboring samples, the neighbors of Xi. And here is an interesting thing. Note that the dot product will be maximal when the predictions are one hot, and 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 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 these histograms, of course, they look the same, because these are ultimately vectors. These are three-dimensional vectors. Let's call them two-dimensional vectors. So here is class 1. Here's class 2. If you make the inner product small or high, they will agree on their predictions. But I disagree that this encourages anything to be one hot. In my mind, if you have two vectors, they're both 0, 1 times 0, 1. The inner product is going to be 1, and if you have two assignments that are 0.5 and 0.5, then it is also going to result in an inner product of 0.5. It's also going to be no. So what's the inner product here? The inner product is 0.5 times 0.5 plus 0.5 times 0.5, which is 0.5. Am I dumb? I'm embarrassingly long time later. Oh, it's because the L1 norm. OK. We got it. We got it. I am OK. I am too dumb. Yes. Of course, I was thinking of these vectors being normalized in L2 space, where their inner products would always be 1. But of course, if you have assignments between classes and it's a probability distribution, a histogram, then all of the possible assignments lie 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 OK, I see. That's where they get this. That's where they get this must be one hot from. So OK, I'll give that to them. It is actually encouraging one hot predictions, as long as these things are normalized in L1 space, which they probably are, because they're histograms, right? Yes, 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. OK, so yeah, 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 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 features. Actually, crazy, crazy good, right? This flute here is in different sizes. As you can see, the fishes aren't all exactly the same. The birds. So you can see it really focuses on higher level features. But I guess it's really dependent on this higher level task. And they, well, 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 could already evaluate it 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 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 it just going to come out the same? And the answer is no. If you have a data set, because your classifier doesn't give you just, first of all, if your classifier is something like this, just happens to be. And you label and you learn a new classifier, it is going to be more like this. Because it sort of maximizes, or 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, OK, 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 knighted of 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 the new classifier. Or basically, 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. The entire algorithm. There we go. All right. So semantic clustering by adopting nearest neighbors. They're scan algorithm. So in the first step, you do this pretext task. This is the self-supervision, the representation learning. For your entire data set, no, sorry. This is this here. Optimize the neural network with task T. That's just self-supervised representation learning. OK. 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 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 you're 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. 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. Or it's not labels. You have the cross-entropy loss between the assignments of this and the assignments of your data set. So you basically do the same task, but you filter by confidence. And they use a threshold, I think, of 0.7 or something like this. Now, let's go into the experiments, or look as follows. So they do some ablations to find out where in their methods, kind of 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 c410, 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, it doesn't work. I wouldn't pay too much attention that the numbers are 20 or 30. It just, it's 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, 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 RodNet, FeatureD coupling, 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. And this has been, like, these methods have been very successful in the last few years. Yeah, so 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 these 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 back 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, 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. And 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. 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. OK, so they do investigate how much they improve. And they improve by quite a lot of the kind of previous methods. So they have a lot of previous methods. But they mean that 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 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 1,000 classes compared to C410's 10 classes. So if you think clustering 10 classes might, and they're fairly apart from each other, might work with various techniques, ImageNet, 1,000 classes. That's way more difficult. But they do sub-sample this to 50, 100, and 200 classes. And they get OK accuracy. As you can see, they get 81% in for 50 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 fairly, 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 really only have the 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 1,000 classes. And in 1,000 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 superclusters right here. So you can see the dogs, the network confuses the dogs. Fairly often, and then 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, 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 validated losing the whole 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. So now they build just 20 classes for C410 instead of 10 classes. And we'll look at table three real quick. Where's table three? This is table three. 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 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 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? 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. So in one of these over cluster approach, I would sort of expect that you actually get a better score, because 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 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 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. 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 to interpret this as, oh, look, we can classify without knowing the labels. It is, 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 objects."}, {"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": 26.0, "text": " And you can see that these clusters are pretty much the object classes themselves."}, {"start": 26.0, "end": 27.96, "text": " So there's all the frogs right here."}, {"start": 27.96, "end": 33.08, "text": " All the people that have caught fish."}, {"start": 33.08, "end": 40.32, "text": " So the astonishing thing about this is that these clusters have been obtained without any labels"}, {"start": 40.32, "end": 41.8, "text": " of the ImageNet data set."}, {"start": 41.8, "end": 46.24, "text": " Of course, the data set has labels, but this method doesn't use the labels."}, {"start": 46.24, "end": 50.2, "text": " It learns to classify images without labels."}, {"start": 50.2, "end": 57.36, "text": " So today we're looking at this paper learning to classify images without labels by Wouter von"}, {"start": 57.36, "end": 69.32, "text": " Gans Becke, Simon Wandenhende, Stamatius Georg Goulis, Mark Prozdemons and Luke von Goul."}, {"start": 69.32, "end": 73.75999999999999, "text": " And on a high level overview, they have a three step procedure."}, {"start": 73.75999999999999, "end": 83.64, "text": " Basically, first, they use self supervised learning in order to get good representations."}, {"start": 83.64, "end": 86.12, "text": " Second, they do a clustering."}, {"start": 86.12, "end": 95.92, "text": " So they do a sort of canier's neighbor clustering, but they do clustering on top of those things."}, {"start": 95.92, "end": 97.88000000000001, "text": " But they do it in a kind of special way."}, {"start": 97.88000000000001, "end": 105.24000000000001, "text": " And then third, they do a refinement through self labeling."}, {"start": 105.24000000000001, "end": 110.60000000000001, "text": " So if you know what all of these are, you basically understand the paper already."}, {"start": 110.60000000000001, "end": 113.56, "text": " But there's a bit of tricky steps in there."}, {"start": 113.56, "end": 118.76, "text": " And it's pretty cool that at the end, it works out like you just saw."}, {"start": 118.76, "end": 125.16, "text": " So before we dive in, as always, if you're here and not subscribed, then please do."}, {"start": 125.16, "end": 132.6, "text": " And if you like the video, share it out and leave a comment if you feel like commenting."}, {"start": 132.6, "end": 133.6, "text": " Cool."}, {"start": 133.6, "end": 141.04, "text": " So as we already stated, the problem, they ask, is it possible to automatically classify"}, {"start": 141.04, "end": 144.76, "text": " images without the use of ground truth annotations?"}, {"start": 144.76, "end": 149.56, "text": " Or even when the classes themselves are not known a priori?"}, {"start": 149.56, "end": 153.48, "text": " Now you might think that this is outrageous."}, {"start": 153.48, "end": 154.64, "text": " How can you classify one?"}, {"start": 154.64, "end": 158.04, "text": " You don't even know what the classes are and so on."}, {"start": 158.04, "end": 162.72, "text": " So the way you have to imagine it going forward, and they're sort of they don't explicitly"}, {"start": 162.72, "end": 170.6, "text": " explain it, but it's sort of assumed that if you have a data set, data set, blah, blah,"}, {"start": 170.6, "end": 175.72, "text": " blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah,"}, {"start": 175.72, "end": 178.72, "text": " blah, blah, blah, blah, blah, blah, blah, blah."}, {"start": 178.72, "end": 180.62, "text": " And you learn to classify it."}, {"start": 180.62, "end": 184.88, "text": " Well, basically, that means as you cluster it, right?"}, {"start": 184.88, "end": 189.72, "text": " You put some of the data points in the same clusters, okay?"}, {"start": 189.72, "end": 197.4, "text": " And then, of course, the data set, I'm going to draw the same data set right here."}, {"start": 197.4, "end": 198.84, "text": " here might be class two."}, {"start": 198.84, "end": 202.76000000000002, "text": " Now, you can't possibly know how the classes are like called"}, {"start": 202.76000000000002, "end": 204.24, "text": " or something, which one is the first,"}, {"start": 204.24, "end": 205.32, "text": " which one is the second."}, {"start": 205.32, "end": 208.72, "text": " So at test time, basically, if you have a method like this"}, {"start": 208.72, "end": 211.68, "text": " that doesn't use labels, what you're going to do is you,"}, {"start": 211.68, "end": 215.12, "text": " basically going to find, you're going to be as generous"}, {"start": 215.12, "end": 218.56, "text": " as possible in the assignment of these and say,"}, {"start": 218.56, "end": 222.68, "text": " oh, look, if I assign this here to cluster zero"}, {"start": 222.68, "end": 226.04000000000002, "text": " and this here to cluster two and this here to cluster one,"}, {"start": 226.04, "end": 228.44, "text": " and I just carry over the labels,"}, {"start": 228.44, "end": 232.44, "text": " what would my accuracy be under that labeling?"}, {"start": 232.44, "end": 236.92, "text": " So you're as generous as possible with the assignments"}, {"start": 236.92, "end": 238.88, "text": " of the labels."}, {"start": 238.88, "end": 241.28, "text": " So that's how it's going to work, right?"}, {"start": 241.28, "end": 242.51999999999998, "text": " That's what you have to keep in mind."}, {"start": 242.51999999999998, "end": 244.88, "text": " We're basically developing an algorithm that gives us"}, {"start": 244.88, "end": 247.72, "text": " this kind of clustering of the data."}, {"start": 247.72, "end": 250.88, "text": " And then if that clustering partitions the data"}, {"start": 250.88, "end": 254.23999999999998, "text": " in the same way as the actual labeling"}, {"start": 254.24, "end": 258.04, "text": " would the actual labeling with the test labels,"}, {"start": 258.04, "end": 262.16, "text": " then we think it's a good algorithm."}, {"start": 262.16, "end": 268.68, "text": " OK, so they claim they have a, OK, in this paper,"}, {"start": 268.68, "end": 272.12, "text": " we deviate from recent works and advocate a two step approach."}, {"start": 272.12, "end": 273.96000000000004, "text": " And it's actually a three step approach,"}, {"start": 273.96000000000004, "end": 279.44, "text": " but we're feature learning and clustering are decoupled."}, {"start": 279.44, "end": 280.72, "text": " OK, why is that?"}, {"start": 280.72, "end": 283.96000000000004, "text": " So they argue what you could do, what people"}, {"start": 283.96, "end": 291.0, "text": " have done is, and I'm going to, well, this is just a wall of text."}, {"start": 291.0, "end": 294.56, "text": " So what you could do is you could just basically cluster"}, {"start": 294.56, "end": 297.79999999999995, "text": " the data, like who says you can't use clustering algorithms."}, {"start": 297.79999999999995, "end": 302.2, "text": " But then the question is, what do you cluster them by?"}, {"start": 302.2, "end": 303.35999999999996, "text": " Like you need a distance."}, {"start": 303.35999999999996, "end": 306.71999999999997, "text": " So if I have points in 2D, it sort of makes sense"}, {"start": 306.71999999999997, "end": 309.24, "text": " to use the Euclidean distance here."}, {"start": 309.24, "end": 312.12, "text": " But if I have images of cats and dogs and whatnot,"}, {"start": 312.12, "end": 314.68, "text": " then the Euclidean distance between the pixels"}, {"start": 314.68, "end": 317.16, "text": " is really not a good thing."}, {"start": 317.16, "end": 322.48, "text": " But also, so you might think we could actually,"}, {"start": 322.48, "end": 324.72, "text": " we could, you lose the deep neural network,"}, {"start": 324.72, "end": 328.92, "text": " and then basically send the image, that's the image right here,"}, {"start": 328.92, "end": 331.44, "text": " send the image through the deep neural network,"}, {"start": 331.44, "end": 335.04, "text": " and then either take this last state right here."}, {"start": 335.04, "end": 337.84000000000003, "text": " So it goes through and through and through."}, {"start": 337.84000000000003, "end": 340.52, "text": " We could take either of the hidden states,"}, {"start": 340.52, "end": 342.56, "text": " or we could just take the last state,"}, {"start": 342.56, "end": 345.68, "text": " that is the sort of hidden representation right here,"}, {"start": 345.68, "end": 347.47999999999996, "text": " and do the clustering with that."}, {"start": 347.47999999999996, "end": 349.15999999999997, "text": " But then of course, the question is,"}, {"start": 349.15999999999997, "end": 352.52, "text": " what do you, which neural network do you take?"}, {"start": 352.52, "end": 356.03999999999996, "text": " How do you train that neural network?"}, {"start": 356.03999999999996, "end": 357.44, "text": " And there have been a few approaches"}, {"start": 357.44, "end": 361.64, "text": " such as a deep cluster, which try to formulate, basically,"}, {"start": 361.64, "end": 363.2, "text": " an objective for that neural network,"}, {"start": 363.2, "end": 366.03999999999996, "text": " where you first, you send all the images through,"}, {"start": 366.03999999999996, "end": 368.0, "text": " you send a bunch of images through,"}, {"start": 368.0, "end": 371.16, "text": " to get you in embedding space, you get your points,"}, {"start": 371.16, "end": 374.16, "text": " and then in embedding space, you think,"}, {"start": 374.16, "end": 376.56, "text": " well, the features that are in the embedding space,"}, {"start": 376.56, "end": 379.36, "text": " they are somehow latent, and they,"}, {"start": 379.36, "end": 382.16, "text": " if basically the entire thing is,"}, {"start": 382.16, "end": 385.6, "text": " if this neural network was used to classify images,"}, {"start": 385.6, "end": 388.52, "text": " you would have a classification head on top."}, {"start": 388.52, "end": 390.16, "text": " And a classification head,"}, {"start": 390.16, "end": 392.44, "text": " this is like a five-class classification head,"}, {"start": 392.44, "end": 396.56, "text": " is nothing else than a linear,"}, {"start": 396.56, "end": 401.88, "text": " classifier boundary that you put on top of this hidden representation."}, {"start": 401.88, "end": 404.76, "text": " So if you were to use this neural network for classification,"}, {"start": 404.76, "end": 409.52, "text": " it must be possible to draw a linear boundary between the classes."}, {"start": 409.52, "end": 413.4, "text": " And therefore, the, either things like the inner product,"}, {"start": 413.4, "end": 415.72, "text": " distance, or the Euclidean distance,"}, {"start": 415.72, "end": 418.8, "text": " must make sense in that space."}, {"start": 418.8, "end": 420.96, "text": " They don't make sense in the picture space,"}, {"start": 420.96, "end": 424.0, "text": " but they must make sense in the hidden representation space,"}, {"start": 424.0, "end": 426.92, "text": " because what you're going to do with them is exactly"}, {"start": 426.92, "end": 428.12, "text": " linear classification."}, {"start": 428.12, "end": 431.32, "text": " The last classification head of a neural network"}, {"start": 431.32, "end": 433.96, "text": " is just a linear classifier."}, {"start": 433.96, "end": 437.56, "text": " So the assumption is that,"}, {"start": 437.56, "end": 440.64, "text": " and the conclusion is, well, in this space,"}, {"start": 440.64, "end": 443.84, "text": " you should be able to cluster by Euclidean distance."}, {"start": 443.84, "end": 446.08, "text": " So what deep cluster does,"}, {"start": 446.08, "end": 449.12, "text": " alternate, like, is first, get the representations,"}, {"start": 449.12, "end": 450.64, "text": " you start off with a random neural network,"}, {"start": 450.64, "end": 453.68, "text": " then cluster these representations,"}, {"start": 453.68, "end": 459.08, "text": " then basically label, self label, the images, in a way."}, {"start": 459.08, "end": 462.0, "text": " Now, way over simplifying that technique right here."}, {"start": 462.0, "end": 464.32, "text": " But you have these alternative steps of clustering,"}, {"start": 464.32, "end": 467.56, "text": " and then kind of finding better representation,"}, {"start": 467.56, "end": 469.76, "text": " and then clustering these representations."}, {"start": 469.76, "end": 473.76, "text": " And what it basically says is that the CNN itself is such a,"}, {"start": 473.76, "end": 476.84000000000003, "text": " is like a prior, because it's the translation"}, {"start": 476.84000000000003, "end": 479.52, "text": " environment works very good for, very well for,"}, {"start": 479.52, "end": 481.08, "text": " natural images."}, {"start": 481.08, "end": 484.64, "text": " The CNN itself will lead to good representations"}, {"start": 484.64, "end": 486.35999999999996, "text": " if we do it in this way."}, {"start": 486.35999999999996, "end": 487.68, "text": " And they have some good results there,"}, {"start": 487.68, "end": 492.08, "text": " but this paper argues that, if you do that,"}, {"start": 492.08, "end": 497.4, "text": " then the algorithm tends to focus a lot"}, {"start": 497.4, "end": 499.08, "text": " on very low level feature."}, {"start": 499.08, "end": 503.03999999999996, "text": " So if the pixel on the bottom right here is blue, right?"}, {"start": 503.03999999999996, "end": 507.36, "text": " Then you can, and the neural network, by chance,"}, {"start": 507.36, "end": 510.15999999999997, "text": " puts two of those images, where the blue pixel"}, {"start": 510.16, "end": 513.0400000000001, "text": " on the bottom right, it puts them close together."}, {"start": 513.0400000000001, "end": 515.6, "text": " Then in the next step, it will, because they're close together,"}, {"start": 515.6, "end": 517.44, "text": " it will cluster them together."}, {"start": 517.44, "end": 519.8000000000001, "text": " And then it will basically feed back,"}, {"start": 519.8000000000001, "end": 521.72, "text": " the new representations should put the two"}, {"start": 521.72, "end": 523.72, "text": " in the same class, right?"}, {"start": 523.72, "end": 527.08, "text": " It will feed back that it should focus even more"}, {"start": 527.08, "end": 529.12, "text": " on that blue pixel."}, {"start": 529.12, "end": 533.1600000000001, "text": " So it's very, very dependent on initializations,"}, {"start": 533.1600000000001, "end": 537.08, "text": " and it can jump super easily onto these low level features"}, {"start": 537.08, "end": 542.2800000000001, "text": " that have nothing to do with the high level task"}, {"start": 542.2800000000001, "end": 543.9200000000001, "text": " you're ultimately trying to solve,"}, {"start": 543.9200000000001, "end": 546.9200000000001, "text": " which is to classify these images later."}, {"start": 546.9200000000001, "end": 552.4000000000001, "text": " So what this paper does is it says, we can eliminate this."}, {"start": 552.4000000000001, "end": 562.5600000000001, "text": " We can eliminate this, the fact that these methods will produce,"}, {"start": 562.5600000000001, "end": 564.76, "text": " neural networks that focus on low level features."}, {"start": 564.76, "end": 565.6400000000001, "text": " And how do we do that?"}, {"start": 565.64, "end": 568.3199999999999, "text": " We do that by representation learning."}, {"start": 568.3199999999999, "end": 571.16, "text": " So representation learning, you might know this"}, {"start": 571.16, "end": 574.16, "text": " as self-supervised learning."}, {"start": 574.16, "end": 578.56, "text": " And this is the task they solve in the first step"}, {"start": 578.56, "end": 580.24, "text": " of their objective."}, {"start": 580.24, "end": 581.88, "text": " So let's go through this."}, {"start": 581.88, "end": 586.08, "text": " This right here is an image."}, {"start": 586.08, "end": 589.68, "text": " Now, the T is a transformation of that image."}, {"start": 589.68, "end": 594.4, "text": " And in self-supervised learning, there are several methods"}, {"start": 594.4, "end": 596.88, "text": " that you can transform an image."}, {"start": 596.88, "end": 600.56, "text": " So for example, you can random crop an image."}, {"start": 600.56, "end": 603.4399999999999, "text": " You can just cut out like a piece right here"}, {"start": 603.4399999999999, "end": 607.8, "text": " and scale that up to be as large as the original image."}, {"start": 607.8, "end": 611.28, "text": " Or you can use, for example, data augmentation,"}, {"start": 611.28, "end": 614.24, "text": " which means you take the image, and you basically,"}, {"start": 614.24, "end": 617.36, "text": " so if there is, I don't know, the cat right here,"}, {"start": 617.36, "end": 619.56, "text": " you kind of convolve it with some things."}, {"start": 619.56, "end": 622.24, "text": " It's like a very squiggly cat."}, {"start": 622.24, "end": 623.1999999999999, "text": " OK, I'm terrible."}, {"start": 623.2, "end": 630.6800000000001, "text": " This is, you can rotate it, for example, so it's like this."}, {"start": 630.6800000000001, "end": 634.1600000000001, "text": " So these are all sets, including the crop sets"}, {"start": 634.1600000000001, "end": 639.6800000000001, "text": " of this transformation, T. So you transform it in some way."}, {"start": 639.6800000000001, "end": 644.24, "text": " And you want, after you've transformed it,"}, {"start": 644.24, "end": 649.84, "text": " you send your original image, that should be red."}, {"start": 649.84, "end": 653.5600000000001, "text": " You send your original image and the transformed image"}, {"start": 653.5600000000001, "end": 658.36, "text": " through a neural network, each one by themselves."}, {"start": 658.36, "end": 662.84, "text": " OK, and then after this, you say,"}, {"start": 662.84, "end": 666.84, "text": " the hidden representation here should be close to each other."}, {"start": 666.84, "end": 670.76, "text": " OK, this is basically the self-supervised training task."}, {"start": 670.76, "end": 673.2, "text": " It's been shown to work very, very well"}, {"start": 673.2, "end": 678.32, "text": " as a pre-training method for classification neural networks."}, {"start": 678.32, "end": 681.4000000000001, "text": " You have an image and it's augmented version,"}, {"start": 681.4000000000001, "end": 683.7600000000001, "text": " and you minimize the inner product"}, {"start": 683.7600000000001, "end": 686.2800000000001, "text": " or the Euclidean distance between the two versions"}, {"start": 686.2800000000001, "end": 687.6400000000001, "text": " in the hidden space."}, {"start": 687.6400000000001, "end": 689.72, "text": " And the rationale is exactly the same."}, {"start": 689.72, "end": 692.6400000000001, "text": " The rationale is that this hidden space, of course,"}, {"start": 692.6400000000001, "end": 695.5200000000001, "text": " should be linearly classifiable."}, {"start": 695.5200000000001, "end": 699.0400000000001, "text": " And so the distance between those should be close."}, {"start": 699.0400000000001, "end": 702.32, "text": " And the rationale between having these tasks"}, {"start": 702.32, "end": 705.6400000000001, "text": " is that, well, if I flip the image,"}, {"start": 705.64, "end": 709.6, "text": " if I flip the image to the right, it cannot focus"}, {"start": 709.6, "end": 711.64, "text": " on the pixel on the bottom right anymore,"}, {"start": 711.64, "end": 714.56, "text": " because that's not going to be the pixel on the bottom right here."}, {"start": 714.56, "end": 717.28, "text": " And I'm not always going to flip it into the same direction."}, {"start": 717.28, "end": 718.92, "text": " And sometimes I'm going to crop it."}, {"start": 718.92, "end": 721.68, "text": " So it also can't focus on the pixel on the bottom right,"}, {"start": 721.68, "end": 724.4, "text": " because in the crop, that pixel is like out here."}, {"start": 724.4, "end": 726.6, "text": " It's not even in the crop."}, {"start": 726.6, "end": 728.96, "text": " So basically, what you're looking to do"}, {"start": 728.96, "end": 731.36, "text": " with the self-supervised methods is you"}, {"start": 731.36, "end": 734.8, "text": " are looking to destroy this low-level information."}, {"start": 734.8, "end": 737.76, "text": " That's all you're looking to build a pipeline of a neural network"}, {"start": 737.76, "end": 741.16, "text": " here that destroys deliberately low-level information."}, {"start": 741.16, "end": 743.8399999999999, "text": " And you do that by coming up with tasks"}, {"start": 743.8399999999999, "end": 746.24, "text": " like this, self-supervision tasks,"}, {"start": 746.24, "end": 754.12, "text": " that deliberately exclude this information from being used."}, {"start": 754.12, "end": 755.7199999999999, "text": " I think that's what's going on generally"}, {"start": 755.7199999999999, "end": 759.0, "text": " in the self-supervised learning thing."}, {"start": 759.0, "end": 762.3599999999999, "text": " OK, so this here, as you can see,"}, {"start": 762.3599999999999, "end": 764.4799999999999, "text": " is the neural network that you train."}, {"start": 764.48, "end": 768.04, "text": " Send both images, the original and the augmented version,"}, {"start": 768.04, "end": 769.8000000000001, "text": " through the same neural network."}, {"start": 769.8000000000001, "end": 773.04, "text": " And then you minimize some distance,"}, {"start": 773.04, "end": 774.9200000000001, "text": " which is usually like the inner product"}, {"start": 774.9200000000001, "end": 778.36, "text": " or the Euclidean distance in this embedding space."}, {"start": 778.36, "end": 781.04, "text": " OK, and what you train, you can see right here,"}, {"start": 781.04, "end": 783.6, "text": " you train the parameters of this neural network."}, {"start": 783.6, "end": 786.44, "text": " So the transformations are fixed or sampled."}, {"start": 786.44, "end": 787.72, "text": " And the distance is fixed."}, {"start": 787.72, "end": 789.6, "text": " You train the neural networks such that you're"}, {"start": 789.6, "end": 793.2, "text": " embedding minimize this task."}, {"start": 793.2, "end": 794.32, "text": " Now, this is nothing new."}, {"start": 794.32, "end": 798.4000000000001, "text": " This has been used for a couple of years now"}, {"start": 798.4000000000001, "end": 800.84, "text": " to get better representation, self-supervised learning"}, {"start": 800.84, "end": 801.8000000000001, "text": " is the thing."}, {"start": 801.8000000000001, "end": 803.96, "text": " But they basically say, we can use this"}, {"start": 803.96, "end": 808.72, "text": " as an initialization step for this clustering procedure."}, {"start": 808.72, "end": 813.44, "text": " Because if we don't do that, we focus on these low-level"}, {"start": 813.44, "end": 814.8000000000001, "text": " features."}, {"start": 814.8000000000001, "end": 817.8000000000001, "text": " OK, and notice you don't need any labels for this procedure."}, {"start": 817.8000000000001, "end": 820.6400000000001, "text": " That's what's called self-supervised."}, {"start": 820.6400000000001, "end": 822.0400000000001, "text": " OK?"}, {"start": 822.04, "end": 826.88, "text": " So the second part is the clustering."}, {"start": 826.88, "end": 828.0, "text": " Now they cluster."}, {"start": 828.0, "end": 830.3199999999999, "text": " But they don't just cluster these representations."}, {"start": 830.3199999999999, "end": 833.68, "text": " That would be, that doesn't perform very well"}, {"start": 833.68, "end": 835.5999999999999, "text": " in their experiments."}, {"start": 835.5999999999999, "end": 837.7199999999999, "text": " What they instead do is they minimize"}, {"start": 837.7199999999999, "end": 841.04, "text": " this entire objective right here."}, {"start": 841.04, "end": 845.4399999999999, "text": " And we'll go through it step by step."}, {"start": 845.4399999999999, "end": 849.16, "text": " So they train a new neural network."}, {"start": 849.16, "end": 851.64, "text": " OK, this thing right here."}, {"start": 851.64, "end": 853.68, "text": " This is a new neural network."}, {"start": 853.68, "end": 859.04, "text": " So first, you already have the neural network, which"}, {"start": 859.04, "end": 862.8, "text": " was called, what was it even called?"}, {"start": 862.8, "end": 865.92, "text": " The one that gives you the embedding with the theta."}, {"start": 865.92, "end": 868.52, "text": " OK, it's called phi theta."}, {"start": 868.52, "end": 869.6, "text": " It's the same architecture."}, {"start": 869.6, "end": 871.56, "text": " And I think they initialize one with the other."}, {"start": 871.56, "end": 876.6, "text": " So in step one, you get phi theta."}, {"start": 876.6, "end": 882.0400000000001, "text": " Phi theta gives you a representation of x."}, {"start": 882.0400000000001, "end": 885.24, "text": " Let's call it hidden x."}, {"start": 885.24, "end": 888.28, "text": " So that's the self-supervised learning."}, {"start": 888.28, "end": 893.24, "text": " But in step two, you train an entirely new neural network."}, {"start": 893.24, "end": 896.44, "text": " This phi eta here."}, {"start": 896.44, "end": 898.72, "text": " And you initialize it with this one."}, {"start": 898.72, "end": 902.28, "text": " But now you train it to do the following."}, {"start": 902.28, "end": 910.48, "text": " Again, you want to maximize the inner product right here."}, {"start": 910.48, "end": 911.8399999999999, "text": " See, that's the inner product."}, {"start": 911.8399999999999, "end": 914.9599999999999, "text": " You want to maximize the inner product between two things."}, {"start": 914.9599999999999, "end": 916.52, "text": " Now, that's the same thing as before."}, {"start": 916.52, "end": 919.48, "text": " We want to minimize the distance between two things"}, {"start": 919.48, "end": 920.88, "text": " and the dot product distance."}, {"start": 920.88, "end": 924.8399999999999, "text": " In that case, you maximize the dot product between two things."}, {"start": 924.8399999999999, "end": 926.9599999999999, "text": " And the two things are two images"}, {"start": 926.9599999999999, "end": 930.3199999999999, "text": " that go through the same neural network as before."}, {"start": 930.3199999999999, "end": 931.76, "text": " This and this."}, {"start": 931.76, "end": 934.76, "text": " Now, what's different here is that here we input"}, {"start": 934.76, "end": 937.28, "text": " an one image of the data set."}, {"start": 937.28, "end": 939.48, "text": " That's the same as before."}, {"start": 939.48, "end": 941.12, "text": " So we input one image."}, {"start": 941.12, "end": 943.92, "text": " But here, before, in the self-supervised learning,"}, {"start": 943.92, "end": 947.3199999999999, "text": " we input an augmented version of that."}, {"start": 947.3199999999999, "end": 949.48, "text": " And now we input something else."}, {"start": 949.48, "end": 951.84, "text": " We input this k right here."}, {"start": 951.84, "end": 952.72, "text": " Now, what's k?"}, {"start": 952.72, "end": 956.68, "text": " What k comes from this neighbor set of x?"}, {"start": 956.68, "end": 959.92, "text": " This is the set of neighbors of x."}, {"start": 959.92, "end": 963.3199999999999, "text": " And these neighbors are determined with respect"}, {"start": 963.3199999999999, "end": 966.88, "text": " to this neural network right here."}, {"start": 966.88, "end": 973.12, "text": " So what you do after step one is you take your neural network"}, {"start": 973.12, "end": 974.52, "text": " with the good embeddings."}, {"start": 974.52, "end": 976.88, "text": " And here is your data set x."}, {"start": 976.88, "end": 979.4799999999999, "text": " Your data set x, this should be another."}, {"start": 979.4799999999999, "end": 982.7199999999999, "text": " Your data set x is this list, basically,"}, {"start": 982.7199999999999, "end": 985.36, "text": " of all the images in your data set."}, {"start": 985.36, "end": 986.5999999999999, "text": " And what you're going to do is you're"}, {"start": 986.5999999999999, "end": 989.5999999999999, "text": " going to take all of them using that neural network"}, {"start": 989.6, "end": 991.72, "text": " that you just trained and embed them"}, {"start": 991.72, "end": 994.76, "text": " into a latent space right here."}, {"start": 994.76, "end": 997.76, "text": " OK?"}, {"start": 997.76, "end": 1000.72, "text": " This is the latent space where you have done the self-supervised"}, {"start": 1000.72, "end": 1001.72, "text": " training."}, {"start": 1001.72, "end": 1005.64, "text": " And now, for each image right here,"}, {"start": 1005.64, "end": 1010.28, "text": " so if this is x i, you're going to find its k nearest neighbors."}, {"start": 1010.28, "end": 1013.48, "text": " And they use, I think they use 5 as a benchmark."}, {"start": 1013.48, "end": 1016.84, "text": " So you're going to find its nearest neighbors."}, {"start": 1016.84, "end": 1020.36, "text": " It's 5 nearest neighbors."}, {"start": 1020.36, "end": 1021.6800000000001, "text": " And you do that for each image."}, {"start": 1021.6800000000001, "end": 1024.76, "text": " So this image has these 5 nearest neighbors."}, {"start": 1024.76, "end": 1025.48, "text": " That's all."}, {"start": 1025.48, "end": 1027.76, "text": " So in step two, what you're trying to do"}, {"start": 1027.76, "end": 1031.6000000000001, "text": " is you're going to try to pull together each image"}, {"start": 1031.6000000000001, "end": 1038.48, "text": " and its nearest neighbors in this, not in this space directly,"}, {"start": 1038.48, "end": 1041.6000000000001, "text": " but you determine which ones are the nearest neighbor"}, {"start": 1041.6000000000001, "end": 1042.72, "text": " from this neural network."}, {"start": 1042.72, "end": 1044.4, "text": " And you keep it constant."}, {"start": 1044.4, "end": 1046.56, "text": " That's how you determine what the nearest neighbors are"}, {"start": 1046.56, "end": 1047.96, "text": " in the first task."}, {"start": 1047.96, "end": 1052.76, "text": " And that is your nx set for x i."}, {"start": 1052.76, "end": 1054.6399999999999, "text": " And in the second step, you're trying"}, {"start": 1054.6399999999999, "end": 1058.56, "text": " to make the representations of any image"}, {"start": 1058.56, "end": 1063.6399999999999, "text": " and its nearest neighbors closer to each other."}, {"start": 1063.6399999999999, "end": 1063.8799999999999, "text": " OK?"}, {"start": 1063.8799999999999, "end": 1069.8, "text": " So with this thing right here, you maximize the inner product"}, {"start": 1069.8, "end": 1074.76, "text": " between x in after this neural network"}, {"start": 1074.76, "end": 1079.36, "text": " and a nearest neighbor of x that was a nearest neighbor"}, {"start": 1079.36, "end": 1082.32, "text": " after the first task."}, {"start": 1082.32, "end": 1084.68, "text": " Now, the way they cluster here is not just again"}, {"start": 1084.68, "end": 1089.12, "text": " by putting it into an embedding space like we saw before."}, {"start": 1089.12, "end": 1092.48, "text": " But this thing right here, this neural network,"}, {"start": 1092.48, "end": 1100.52, "text": " as you can see here, is a C dimensional vector in 0.1."}, {"start": 1100.52, "end": 1102.8, "text": " Now, C is the number of classes."}, {"start": 1102.8, "end": 1106.2, "text": " You can either know that, so you don't know which classes,"}, {"start": 1106.2, "end": 1107.32, "text": " which you don't have labels, but you"}, {"start": 1107.32, "end": 1109.0, "text": " could know how many classes there are,"}, {"start": 1109.0, "end": 1112.8799999999999, "text": " or you could just guess how many classes there are."}, {"start": 1112.8799999999999, "end": 1116.24, "text": " And as long as you over-guess, you can still"}, {"start": 1116.24, "end": 1119.3999999999999, "text": " like build superclusters later."}, {"start": 1119.3999999999999, "end": 1123.76, "text": " So they simply say it's in 0.1, but they also say it"}, {"start": 1123.76, "end": 1125.48, "text": " performs a soft assignment."}, {"start": 1125.48, "end": 1128.84, "text": " So we're also going to assume that this is normalized."}, {"start": 1128.84, "end": 1132.2, "text": " So for each data point x here,"}, {"start": 1132.2, "end": 1136.4, "text": " you're going to have an image."}, {"start": 1136.4, "end": 1140.2, "text": " You're going to put it through this new neural network."}, {"start": 1140.2, "end": 1142.04, "text": " This new neural network, new."}, {"start": 1142.04, "end": 1144.24, "text": " And it's going to tell you, it's going"}, {"start": 1144.24, "end": 1146.52, "text": " to give you basically a histogram."}, {"start": 1146.52, "end": 1148.6000000000001, "text": " Let's say class 1, 2, or 3."}, {"start": 1148.6000000000001, "end": 1150.0, "text": " We guess there are three classes."}, {"start": 1150.0, "end": 1154.04, "text": " And it's going to give you an assignment of the three."}, {"start": 1154.04, "end": 1156.8, "text": " And you also take a nearest neighbor."}, {"start": 1156.8, "end": 1159.04, "text": " Here is your data set."}, {"start": 1159.04, "end": 1162.0, "text": " You also take a nearest neighbor of that."}, {"start": 1162.0, "end": 1165.32, "text": " So you look for this set n of x."}, {"start": 1165.32, "end": 1166.72, "text": " And you take a nearest neighbor."}, {"start": 1166.72, "end": 1174.96, "text": " Maybe that's a really can't draw a dog."}, {"start": 1174.96, "end": 1177.04, "text": " Yeah, that's the best I can do."}, {"start": 1177.04, "end": 1178.24, "text": " I'm sorry."}, {"start": 1178.24, "end": 1181.12, "text": " And you also put that through the same network."}, {"start": 1181.12, "end": 1184.56, "text": " And you were saying, since they were nearest neighbor in task"}, {"start": 1184.56, "end": 1188.0, "text": " 1, they must share some sort of interesting high level"}, {"start": 1188.0, "end": 1191.08, "text": " features, because that's what the first task was for."}, {"start": 1191.08, "end": 1194.1599999999999, "text": " Therefore, I want to make them closer together"}, {"start": 1194.1599999999999, "end": 1199.04, "text": " in the light of this neural network right here."}, {"start": 1199.04, "end": 1201.84, "text": " So this is also going to give you an assignment,"}, {"start": 1201.84, "end": 1206.32, "text": " like maybe like this."}, {"start": 1206.32, "end": 1210.76, "text": " And now you train this network right here"}, {"start": 1210.76, "end": 1215.6799999999998, "text": " to basically match these two distributions."}, {"start": 1215.6799999999998, "end": 1219.28, "text": " So this is now a classifier into C classes,"}, {"start": 1219.28, "end": 1222.3999999999999, "text": " but we guess C. And we don't have labels."}, {"start": 1222.3999999999999, "end": 1225.96, "text": " We simply, our label is going to be my neighbors"}, {"start": 1225.96, "end": 1228.36, "text": " from the first task must have the same labels."}, {"start": 1228.36, "end": 1230.44, "text": " That's our label."}, {"start": 1230.44, "end": 1234.84, "text": " Now, they say they also have this term right here, which"}, {"start": 1234.84, "end": 1238.16, "text": " is the entropy over assignments."}, {"start": 1238.16, "end": 1240.8799999999999, "text": " As you can see, so they minimize the following."}, {"start": 1240.8799999999999, "end": 1243.12, "text": " They minimize this quantity, which"}, {"start": 1243.12, "end": 1244.84, "text": " has a negative in front of it."}, {"start": 1244.84, "end": 1248.36, "text": " So that means they maximize this log inner product."}, {"start": 1248.36, "end": 1255.7199999999998, "text": " And they also maximize the entropy, because sorry."}, {"start": 1255.7199999999998, "end": 1258.52, "text": " So they minimize this thing, but the entropy"}, {"start": 1258.52, "end": 1261.28, "text": " is a negative quantity."}, {"start": 1261.28, "end": 1267.24, "text": " So they maximize the entropy, because here's a plus."}, {"start": 1267.24, "end": 1271.28, "text": " And they minimize the entropy."}, {"start": 1271.28, "end": 1273.84, "text": " Let's see what they say."}, {"start": 1273.84, "end": 1276.52, "text": " By minimizing the following objective, now"}, {"start": 1276.52, "end": 1281.16, "text": " entropy is the negative sum of p log p."}, {"start": 1281.16, "end": 1286.0, "text": " And if this is p, yes, this is the probability"}, {"start": 1286.0, "end": 1287.76, "text": " that an image is going to be assigned"}, {"start": 1287.76, "end": 1291.08, "text": " to cluster C over the entire data set."}, {"start": 1291.08, "end": 1295.6, "text": " So they're going to, yes."}, {"start": 1295.6, "end": 1305.84, "text": " So it's negative this quantity, negative minus p log p."}, {"start": 1305.84, "end": 1308.48, "text": " And this is the entropy."}, {"start": 1308.48, "end": 1311.32, "text": " So they're going to minimize the entropy."}, {"start": 1311.32, "end": 1312.24, "text": " Let's see what they say."}, {"start": 1315.6, "end": 1321.8, "text": " We include an entropy term, the second term in equation 2,"}, {"start": 1321.8, "end": 1328.36, "text": " which spreads the predictions uniformly across clusters C."}, {"start": 1328.36, "end": 1329.84, "text": " OK."}, {"start": 1329.84, "end": 1335.12, "text": " So what we want is a uniform assignment over cluster, which"}, {"start": 1335.12, "end": 1337.8, "text": " means we should maximize the entropy."}, {"start": 1341.9599999999998, "end": 1342.3999999999999, "text": " Oh, yes."}, {"start": 1342.3999999999999, "end": 1343.3999999999999, "text": " OK."}, {"start": 1343.3999999999999, "end": 1344.9199999999998, "text": " They minimize this thing."}, {"start": 1344.9199999999998, "end": 1347.8, "text": " And this here is the negative entropy."}, {"start": 1347.8, "end": 1349.04, "text": " OK."}, {"start": 1349.04, "end": 1353.9599999999998, "text": " So they want over the whole data set that not all of the images"}, {"start": 1353.9599999999998, "end": 1355.84, "text": " are going to be in the same cluster."}, {"start": 1355.84, "end": 1356.8, "text": " Well, excuse me."}, {"start": 1356.8, "end": 1359.12, "text": " This is cluster 1, and then this is cluster 2,"}, {"start": 1359.12, "end": 1360.6, "text": " and then this is cluster 3."}, {"start": 1360.6, "end": 1362.7199999999998, "text": " So that term counteracts that."}, {"start": 1362.72, "end": 1365.3600000000001, "text": " Basically, the more evenly spread the entire data set"}, {"start": 1365.3600000000001, "end": 1371.48, "text": " distribution is, the higher the entropy, the lower the negative"}, {"start": 1371.48, "end": 1373.68, "text": " entropy, and that's the goal right here."}, {"start": 1373.68, "end": 1374.84, "text": " I'm sorry."}, {"start": 1374.84, "end": 1378.64, "text": " This was, I was confused by the too many negative signs,"}, {"start": 1378.64, "end": 1381.04, "text": " and then you minimize the entire thing."}, {"start": 1381.04, "end": 1381.76, "text": " All right."}, {"start": 1381.76, "end": 1384.3600000000001, "text": " Now they say a different thing right here."}, {"start": 1384.3600000000001, "end": 1387.88, "text": " They say here, this bracket denotes the dot product"}, {"start": 1387.88, "end": 1388.44, "text": " operator."}, {"start": 1388.44, "end": 1393.68, "text": " As we saw, it's the dot product between these two distributions"}, {"start": 1393.68, "end": 1395.88, "text": " right here."}, {"start": 1395.88, "end": 1399.96, "text": " The first term in equation 2 imposes this neural network"}, {"start": 1399.96, "end": 1403.28, "text": " to make consistent predictions for a sample Xi"}, {"start": 1403.28, "end": 1408.0800000000002, "text": " and its neighboring samples, the neighbors of Xi."}, {"start": 1408.0800000000002, "end": 1409.44, "text": " And here is an interesting thing."}, {"start": 1409.44, "end": 1413.44, "text": " Note that the dot product will be maximal when the predictions"}, {"start": 1413.44, "end": 1416.16, "text": " are one hot, and that means confident,"}, {"start": 1416.16, "end": 1418.68, "text": " and assigned to the same cluster consistent."}, {"start": 1418.68, "end": 1422.3600000000001, "text": " So they basically say the objective encourages confidence,"}, {"start": 1422.3600000000001, "end": 1425.24, "text": " because it encourages predictions to be one hot,"}, {"start": 1425.24, "end": 1430.76, "text": " and it encourages consistency because the distributions"}, {"start": 1430.76, "end": 1432.5600000000002, "text": " need to be the same."}, {"start": 1432.5600000000002, "end": 1435.92, "text": " They should be in the same cluster, right."}, {"start": 1435.92, "end": 1437.92, "text": " Now I agree with the consistency."}, {"start": 1437.92, "end": 1440.64, "text": " Like if you make the inner product high"}, {"start": 1440.64, "end": 1444.2, "text": " then of these histograms, of course,"}, {"start": 1444.2, "end": 1447.0800000000002, "text": " they look the same, because these are ultimately"}, {"start": 1447.0800000000002, "end": 1447.6000000000001, "text": " vectors."}, {"start": 1447.6000000000001, "end": 1449.0, "text": " These are three-dimensional vectors."}, {"start": 1449.0, "end": 1451.8, "text": " Let's call them two-dimensional vectors."}, {"start": 1451.8, "end": 1453.1200000000001, "text": " So here is class 1."}, {"start": 1453.1200000000001, "end": 1454.56, "text": " Here's class 2."}, {"start": 1454.56, "end": 1460.3600000000001, "text": " If you make the inner product small or high,"}, {"start": 1460.3600000000001, "end": 1462.64, "text": " they will agree on their predictions."}, {"start": 1462.64, "end": 1467.1200000000001, "text": " But I disagree that this encourages anything to be one hot."}, {"start": 1467.1200000000001, "end": 1469.16, "text": " In my mind, if you have two vectors,"}, {"start": 1469.16, "end": 1472.52, "text": " they're both 0, 1 times 0, 1."}, {"start": 1472.52, "end": 1474.28, "text": " The inner product is going to be 1,"}, {"start": 1474.28, "end": 1478.6, "text": " and if you have two assignments that are 0.5 and 0.5,"}, {"start": 1478.6, "end": 1488.0, "text": " then it is also going to result in an inner product of 0.5."}, {"start": 1488.0, "end": 1492.6, "text": " It's also going to be no."}, {"start": 1492.6, "end": 1494.48, "text": " So what's the inner product here?"}, {"start": 1494.48, "end": 1500.24, "text": " The inner product is 0.5 times 0.5 plus 0.5 times 0.5,"}, {"start": 1500.24, "end": 1503.24, "text": " which is 0.5."}, {"start": 1503.24, "end": 1505.84, "text": " Am I dumb?"}, {"start": 1505.84, "end": 1509.76, "text": " I'm embarrassingly long time later."}, {"start": 1509.76, "end": 1511.72, "text": " Oh, it's because the L1 norm."}, {"start": 1511.72, "end": 1512.72, "text": " OK."}, {"start": 1512.72, "end": 1513.48, "text": " We got it."}, {"start": 1513.48, "end": 1514.32, "text": " We got it."}, {"start": 1517.32, "end": 1518.32, "text": " I am OK."}, {"start": 1518.32, "end": 1519.32, "text": " I am too dumb."}, {"start": 1519.32, "end": 1519.96, "text": " Yes."}, {"start": 1519.96, "end": 1522.16, "text": " Of course, I was thinking of these vectors"}, {"start": 1522.16, "end": 1525.28, "text": " being normalized in L2 space, where their inner products"}, {"start": 1525.28, "end": 1526.52, "text": " would always be 1."}, {"start": 1526.52, "end": 1531.48, "text": " But of course, if you have assignments between classes"}, {"start": 1531.48, "end": 1534.12, "text": " and it's a probability distribution, a histogram,"}, {"start": 1534.12, "end": 1537.44, "text": " then all of the possible assignments"}, {"start": 1537.44, "end": 1541.6, "text": " lie on this thing right here."}, {"start": 1541.6, "end": 1543.56, "text": " Now, the inner product with yourself,"}, {"start": 1543.56, "end": 1546.04, "text": " of course, is the length of the vector,"}, {"start": 1546.04, "end": 1549.6399999999999, "text": " and the length of a vector that points to one class,"}, {"start": 1549.6399999999999, "end": 1555.04, "text": " or the other class, is longer than a vector that points in between."}, {"start": 1555.04, "end": 1556.36, "text": " So OK, I see."}, {"start": 1556.36, "end": 1557.68, "text": " That's where they get this."}, {"start": 1557.68, "end": 1560.92, "text": " That's where they get this must be one hot from."}, {"start": 1560.92, "end": 1563.08, "text": " So OK, I'll give that to them."}, {"start": 1563.08, "end": 1567.28, "text": " It is actually encouraging one hot predictions,"}, {"start": 1567.28, "end": 1571.12, "text": " as long as these things are normalized in L1 space,"}, {"start": 1571.12, "end": 1574.48, "text": " which they probably are, because they're histograms, right?"}, {"start": 1574.48, "end": 1579.84, "text": " Yes, that was dumbness of me."}, {"start": 1579.84, "end": 1581.56, "text": " I was trying to make a counter-example."}, {"start": 1581.56, "end": 1583.12, "text": " I'm like, wait a minute."}, {"start": 1583.12, "end": 1587.8, "text": " This counter-example is a counter-example to my counter-example."}, {"start": 1587.8, "end": 1592.04, "text": " OK, so yeah, that's that."}, {"start": 1592.04, "end": 1595.7199999999998, "text": " So as you can see, they are, of course, correct here."}, {"start": 1595.7199999999998, "end": 1602.8799999999999, "text": " And they now make the first experiments."}, {"start": 1602.8799999999999, "end": 1605.3999999999999, "text": " So they say, basically, after the first step"}, {"start": 1605.3999999999999, "end": 1607.2399999999998, "text": " of the self-supervised training,"}, {"start": 1607.2399999999998, "end": 1610.36, "text": " they can already retrieve sort of nearest neighbors."}, {"start": 1610.36, "end": 1617.1999999999998, "text": " And the nearest neighbors of these images right here"}, {"start": 1617.1999999999998, "end": 1620.3999999999999, "text": " are the ones that you see on the right."}, {"start": 1620.3999999999999, "end": 1623.76, "text": " And after the self-supervised one, these nearest neighbors"}, {"start": 1623.76, "end": 1627.04, "text": " are already pretty good at sharing the high level features."}, {"start": 1627.04, "end": 1630.04, "text": " Actually, crazy, crazy good, right?"}, {"start": 1630.04, "end": 1632.7199999999998, "text": " This flute here is in different sizes."}, {"start": 1632.7199999999998, "end": 1639.12, "text": " As you can see, the fishes aren't all exactly the same."}, {"start": 1639.12, "end": 1640.28, "text": " The birds."}, {"start": 1640.28, "end": 1643.52, "text": " So you can see it really focuses on higher level features."}, {"start": 1643.52, "end": 1648.44, "text": " But I guess it's really dependent on this higher level task."}, {"start": 1648.44, "end": 1653.8799999999999, "text": " And they, well, they also investigate this quantitatively,"}, {"start": 1653.8799999999999, "end": 1657.2, "text": " but I just want to focus on how good is this after only"}, {"start": 1657.2, "end": 1660.52, "text": " the self-supervised thing."}, {"start": 1660.52, "end": 1662.56, "text": " And now they do this clustering."}, {"start": 1662.56, "end": 1666.68, "text": " And they could already evaluate it right here."}, {"start": 1666.68, "end": 1669.48, "text": " Because now they have a clustering, right?"}, {"start": 1669.48, "end": 1672.92, "text": " After this step, they've basically pulled together the neighbors"}, {"start": 1672.92, "end": 1676.44, "text": " and they have this neural network that is not assigning classes."}, {"start": 1676.44, "end": 1677.92, "text": " So they could already evaluate this."}, {"start": 1677.92, "end": 1679.1200000000001, "text": " And they are going to do that."}, {"start": 1679.1200000000001, "end": 1682.04, "text": " But that's not good enough yet."}, {"start": 1682.04, "end": 1688.0, "text": " Then they do a third step, which is fine tuning through self labeling."}, {"start": 1688.0, "end": 1693.32, "text": " Now self labeling is pretty much exactly what it says."}, {"start": 1693.32, "end": 1697.08, "text": " It's you label your own data with your own classifier."}, {"start": 1697.08, "end": 1699.8, "text": " Now that might be a bit outrageous."}, {"start": 1699.8, "end": 1702.1599999999999, "text": " And you basically saying, wait a minute."}, {"start": 1702.1599999999999, "end": 1707.6, "text": " If I label my own data and learn a classifier on these labels,"}, {"start": 1707.6, "end": 1710.48, "text": " isn't it just going to come out the same?"}, {"start": 1710.48, "end": 1712.96, "text": " And the answer is no."}, {"start": 1712.96, "end": 1716.8, "text": " If you have a data set, because your classifier"}, {"start": 1716.8, "end": 1722.3999999999999, "text": " doesn't give you just, first of all,"}, {"start": 1722.4, "end": 1728.16, "text": " if your classifier is something like this, just happens to be."}, {"start": 1728.16, "end": 1731.24, "text": " And you label and you learn a new classifier,"}, {"start": 1731.24, "end": 1734.0800000000002, "text": " it is going to be more like this."}, {"start": 1734.0800000000002, "end": 1738.3600000000001, "text": " Because it sort of maximizes, or a lot of classifiers"}, {"start": 1738.3600000000001, "end": 1741.76, "text": " maximize these distances between the classes."}, {"start": 1741.76, "end": 1743.8400000000001, "text": " So even if it's like that."}, {"start": 1743.8400000000001, "end": 1746.44, "text": " And then the second step they do is they say,"}, {"start": 1746.44, "end": 1748.96, "text": " OK, there are some points where we are actually"}, {"start": 1748.96, "end": 1751.8400000000001, "text": " more confident about such as this one."}, {"start": 1751.84, "end": 1754.9599999999998, "text": " We're more confident about that one, also this one."}, {"start": 1754.9599999999998, "end": 1757.0, "text": " And then this one here is pretty close."}, {"start": 1757.0, "end": 1759.6399999999999, "text": " Like we're not super knighted of this one."}, {"start": 1759.6399999999999, "end": 1761.6799999999998, "text": " But we're very confident about these two."}, {"start": 1761.6799999999998, "end": 1765.9199999999998, "text": " So we're only going to use the ones where we are, in fact,"}, {"start": 1765.9199999999998, "end": 1772.36, "text": " confident about to learn the new classifier."}, {"start": 1772.36, "end": 1777.08, "text": " Or basically, you can also weigh them and so on."}, {"start": 1777.08, "end": 1780.56, "text": " But they go by confidence right here."}, {"start": 1780.56, "end": 1783.8, "text": " As you can see in this final algorithm."}, {"start": 1783.8, "end": 1786.24, "text": " So this is the entire algorithm."}, {"start": 1786.24, "end": 1788.12, "text": " And I got kicked away."}, {"start": 1792.44, "end": 1793.36, "text": " The entire algorithm."}, {"start": 1793.36, "end": 1795.12, "text": " There we go."}, {"start": 1795.12, "end": 1797.52, "text": " All right."}, {"start": 1797.52, "end": 1801.12, "text": " So semantic clustering by adopting nearest neighbors."}, {"start": 1801.12, "end": 1803.24, "text": " They're scan algorithm."}, {"start": 1803.24, "end": 1806.28, "text": " So in the first step, you do this pretext task."}, {"start": 1806.28, "end": 1811.3999999999999, "text": " This is the self-supervision, the representation learning."}, {"start": 1811.3999999999999, "end": 1815.08, "text": " For your entire data set, no, sorry."}, {"start": 1815.08, "end": 1816.04, "text": " This is this here."}, {"start": 1816.04, "end": 1820.04, "text": " Optimize the neural network with task T."}, {"start": 1820.04, "end": 1823.2, "text": " That's just self-supervised representation learning."}, {"start": 1823.2, "end": 1823.48, "text": " OK."}, {"start": 1823.48, "end": 1826.76, "text": " Then the second thing, we're going to determine"}, {"start": 1826.76, "end": 1830.6, "text": " the nearest neighbor set for each x."}, {"start": 1830.6, "end": 1834.28, "text": " Now, they also, in that step, they also augment the data."}, {"start": 1834.28, "end": 1836.72, "text": " They do heavy data augmentation and so on."}, {"start": 1836.72, "end": 1839.52, "text": " Also, in the third step in the self-labeling,"}, {"start": 1839.52, "end": 1840.48, "text": " they do data augmentation."}, {"start": 1840.48, "end": 1842.52, "text": " There's a lot of tricks in here."}, {"start": 1842.52, "end": 1845.04, "text": " But ultimately, the base algorithm goes like this."}, {"start": 1845.04, "end": 1849.84, "text": " So you find your neighboring sets for each x."}, {"start": 1849.84, "end": 1855.12, "text": " And then what you do while you're clustering loss decreases,"}, {"start": 1855.12, "end": 1857.28, "text": " you update this clustering neural network"}, {"start": 1857.28, "end": 1860.16, "text": " by with this loss that we saw."}, {"start": 1860.16, "end": 1862.76, "text": " So this is the loss where you make the nearest neighbors"}, {"start": 1862.76, "end": 1868.04, "text": " closer to each other while still keeping the entropy high."}, {"start": 1868.04, "end": 1871.68, "text": " And then in the last after you've done this,"}, {"start": 1871.68, "end": 1876.12, "text": " you go through, and you say, while the length of y"}, {"start": 1876.12, "end": 1877.8799999999999, "text": " increases, what's y?"}, {"start": 1877.8799999999999, "end": 1884.04, "text": " y is all the data points that are above a certain threshold."}, {"start": 1884.04, "end": 1888.76, "text": " Now, you're going to filter the data set that is above a certain threshold."}, {"start": 1888.76, "end": 1890.08, "text": " And that's your data set y."}, {"start": 1890.08, "end": 1893.3999999999999, "text": " And you train this same neural network,"}, {"start": 1893.3999999999999, "end": 1896.8, "text": " you basically fine tune it with the cross-entropy loss"}, {"start": 1896.8, "end": 1898.1599999999999, "text": " on your own labels."}, {"start": 1898.1599999999999, "end": 1902.1599999999999, "text": " So now you only have labels y."}, {"start": 1908.8799999999999, "end": 1910.3999999999999, "text": " Or it's not labels."}, {"start": 1910.3999999999999, "end": 1914.0, "text": " You have the cross-entropy loss between the assignments"}, {"start": 1914.0, "end": 1917.48, "text": " of this and the assignments of your data set."}, {"start": 1917.48, "end": 1919.84, "text": " So you basically do the same task,"}, {"start": 1919.84, "end": 1922.6, "text": " but you filter by confidence."}, {"start": 1927.08, "end": 1931.9199999999998, "text": " And they use a threshold, I think, of 0.7 or something like this."}, {"start": 1931.9199999999998, "end": 1940.56, "text": " Now, let's go into the experiments, or look as follows."}, {"start": 1940.56, "end": 1944.0, "text": " So they do some ablations to find out where in their methods,"}, {"start": 1944.0, "end": 1947.56, "text": " kind of the gains come from."}, {"start": 1947.56, "end": 1949.6, "text": " And we'll just quickly go through them."}, {"start": 1949.6, "end": 1953.56, "text": " If they just do these self-supervision at the beginning,"}, {"start": 1953.56, "end": 1956.3999999999999, "text": " and then just do k means clustering on top of that,"}, {"start": 1956.3999999999999, "end": 1961.7199999999998, "text": " that will give them on c410, a 35.9% accuracy."}, {"start": 1961.7199999999998, "end": 1963.1599999999999, "text": " So not very good."}, {"start": 1963.1599999999999, "end": 1965.0, "text": " So the clustering, you can't just cluster"}, {"start": 1965.0, "end": 1970.6, "text": " on top of these representations and then be done."}, {"start": 1970.6, "end": 1978.12, "text": " If they do what they say, so this is sample and batch entropy loss,"}, {"start": 1978.12, "end": 1981.52, "text": " this basically means you do not care about the nearest neighbors."}, {"start": 1981.52, "end": 1985.28, "text": " You do this entire thing, but you only make an image close"}, {"start": 1985.28, "end": 1988.9599999999998, "text": " to the prediction close to itself and its augmentations."}, {"start": 1988.9599999999998, "end": 1991.8799999999999, "text": " So you don't use any nearest neighbor information."}, {"start": 1991.8799999999999, "end": 1993.36, "text": " Also, it doesn't work."}, {"start": 1993.36, "end": 1997.76, "text": " I wouldn't pay too much attention that the numbers are 20 or 30."}, {"start": 1997.76, "end": 2000.76, "text": " It just, it's like, doesn't work."}, {"start": 2000.76, "end": 2006.28, "text": " Now, if you use the scan loss, you all of a sudden,"}, {"start": 2006.28, "end": 2009.04, "text": " you get into a regime where there is actual signal."}, {"start": 2009.04, "end": 2012.8799999999999, "text": " So this is now significantly above the,"}, {"start": 2012.8799999999999, "end": 2018.04, "text": " this is significantly above random guessing."}, {"start": 2018.04, "end": 2021.68, "text": " And if you use strong data augmentation, as I said,"}, {"start": 2021.68, "end": 2024.6, "text": " a lot of this has these tricks in it"}, {"start": 2024.6, "end": 2027.52, "text": " of what kind of data augmentation you do and so on."}, {"start": 2027.52, "end": 2032.08, "text": " So never forget that, that these papers, besides their idea,"}, {"start": 2032.08, "end": 2035.2, "text": " they put in all the tricks they can."}, {"start": 2035.2, "end": 2037.24, "text": " So you get 10% more."}, {"start": 2037.24, "end": 2039.32, "text": " And then if you do this self labeling step,"}, {"start": 2039.32, "end": 2043.68, "text": " you get another 10% more."}, {"start": 2043.68, "end": 2047.6000000000001, "text": " And this is fairly respectable, like 83.5,"}, {"start": 2047.6000000000001, "end": 2049.36, "text": " without ever seeing labels."}, {"start": 2049.36, "end": 2051.88, "text": " It's fairly good."}, {"start": 2051.88, "end": 2054.48, "text": " But of course, there are only 10 classes right here."}, {"start": 2054.48, "end": 2056.36, "text": " So keep that in mind."}, {"start": 2056.36, "end": 2059.4, "text": " But they will do it on ImageNet later."}, {"start": 2059.4, "end": 2063.7200000000003, "text": " And they investigate what kind of self supervision tasks"}, {"start": 2063.72, "end": 2065.52, "text": " at the beginning are important."}, {"start": 2065.52, "end": 2067.56, "text": " And they investigate things like"}, {"start": 2067.56, "end": 2071.16, "text": " RodNet, FeatureD coupling, and noise contrast of estimation,"}, {"start": 2071.16, "end": 2073.8399999999997, "text": " which noise contrast of estimation is the best."}, {"start": 2073.8399999999997, "end": 2075.72, "text": " And noise contrast of estimation, I think,"}, {"start": 2075.72, "end": 2078.9599999999996, "text": " is just where you, as we said, you input an image"}, {"start": 2078.9599999999996, "end": 2081.2799999999997, "text": " and then it's kind of noisy versions"}, {"start": 2081.2799999999997, "end": 2083.6, "text": " with augmented in various ways."}, {"start": 2083.6, "end": 2088.08, "text": " And then you classify them together."}, {"start": 2088.08, "end": 2090.8799999999997, "text": " And this has been, like, these methods"}, {"start": 2090.88, "end": 2093.88, "text": " have been very successful in the last few years."}, {"start": 2096.92, "end": 2101.92, "text": " Yeah, so they have various investigations"}, {"start": 2102.56, "end": 2103.7200000000003, "text": " into their algorithm."}, {"start": 2103.7200000000003, "end": 2106.2000000000003, "text": " I want to point out this here."}, {"start": 2106.2000000000003, "end": 2111.04, "text": " This is the accuracy versus confidence"}, {"start": 2111.04, "end": 2113.0, "text": " after the complete clustering step."}, {"start": 2113.0, "end": 2116.32, "text": " So this is now the third step, the self labeling."}, {"start": 2116.32, "end": 2119.52, "text": " And you can see right here, as these confidence"}, {"start": 2119.52, "end": 2125.0, "text": " of the network goes up, the actual accuracy goes up as well."}, {"start": 2125.0, "end": 2126.96, "text": " So that means the network after the clustering"}, {"start": 2126.96, "end": 2130.4, "text": " is really more confident about the points"}, {"start": 2130.4, "end": 2132.56, "text": " that it can classify more accurately."}, {"start": 2132.56, "end": 2135.96, "text": " There's like a correlation between where the network is confident"}, {"start": 2135.96, "end": 2139.56, "text": " and the actual label of the point, which"}, {"start": 2139.56, "end": 2142.48, "text": " is remarkable because it has never seen the label."}, {"start": 2142.48, "end": 2147.32, "text": " But also see how, sort of, the range here is quite small."}, {"start": 2147.32, "end": 2149.16, "text": " So with the standard augmentation that goes"}, {"start": 2149.16, "end": 2151.12, "text": " back from here to here."}, {"start": 2151.12, "end": 2156.7599999999998, "text": " So where you set that threshold is fairly important"}, {"start": 2156.7599999999998, "end": 2160.12, "text": " and might be quite brittle here."}, {"start": 2160.12, "end": 2163.16, "text": " Because you need to set the threshold,"}, {"start": 2163.16, "end": 2166.6, "text": " such that some points are below it and some are above it."}, {"start": 2166.6, "end": 2169.44, "text": " And you don't want to pull in points"}, {"start": 2169.44, "end": 2175.12, "text": " where you're not, because if you pull in points from here,"}, {"start": 2175.12, "end": 2180.7999999999997, "text": " you only have the correct label for 75% or something"}, {"start": 2180.7999999999997, "end": 2183.2, "text": " like them, of them."}, {"start": 2183.2, "end": 2186.48, "text": " And that means if you now self label and learn on them,"}, {"start": 2186.48, "end": 2189.0, "text": " you're going to learn the wrong signal."}, {"start": 2189.0, "end": 2194.3599999999997, "text": " So this step seems fairly brittle, honestly."}, {"start": 2194.3599999999997, "end": 2196.2, "text": " But I don't know, of course."}, {"start": 2199.88, "end": 2203.2799999999997, "text": " They go on and investigate various things,"}, {"start": 2203.28, "end": 2206.6800000000003, "text": " such as how many clusters do you need?"}, {"start": 2206.6800000000003, "end": 2208.0400000000004, "text": " Or how many nearest neighbors?"}, {"start": 2208.0400000000004, "end": 2210.6000000000004, "text": " Sorry, do you need this number K here?"}, {"start": 2210.6000000000004, "end": 2214.1200000000003, "text": " And you can see that if you have zero neighbors,"}, {"start": 2214.1200000000003, "end": 2217.96, "text": " then you're doing a lot worse than if you have,"}, {"start": 2217.96, "end": 2220.0800000000004, "text": " let's say, five nearest neighbors."}, {"start": 2220.0800000000004, "end": 2222.0400000000004, "text": " So the jump here, as you can see,"}, {"start": 2222.0400000000004, "end": 2224.88, "text": " is fairly high in all the data sets."}, {"start": 2224.88, "end": 2228.7200000000003, "text": " But after that, it sort of doesn't really matter much."}, {"start": 2228.7200000000003, "end": 2230.96, "text": " So it seems like five nearest neighbors"}, {"start": 2230.96, "end": 2234.12, "text": " should be enough for most things."}, {"start": 2234.12, "end": 2235.48, "text": " And here they just show that when they"}, {"start": 2235.48, "end": 2238.64, "text": " remove the false positives, that their algorithm actually"}, {"start": 2238.64, "end": 2242.64, "text": " converges to the correct clustering, the correct accuracy,"}, {"start": 2242.64, "end": 2244.16, "text": " which is not surprising."}, {"start": 2244.16, "end": 2247.4, "text": " If you remove the wrong samples that are wrong,"}, {"start": 2247.4, "end": 2250.64, "text": " then the rest of the samples are going to be right."}, {"start": 2250.64, "end": 2252.88, "text": " I think that's just showing that it doesn't go into some kind"}, {"start": 2252.88, "end": 2256.04, "text": " of crazy downward spiral loop or something like this."}, {"start": 2256.04, "end": 2260.6, "text": " But still, it's just kind of funny."}, {"start": 2260.6, "end": 2264.2799999999997, "text": " OK, so they do investigate how much they improve."}, {"start": 2264.2799999999997, "end": 2268.8399999999997, "text": " And they improve by quite a lot of the kind of previous methods."}, {"start": 2268.8399999999997, "end": 2270.44, "text": " So they have a lot of previous methods."}, {"start": 2270.44, "end": 2274.68, "text": " But they mean that this includes things like K-means and so on,"}, {"start": 2274.68, "end": 2279.0, "text": " GANS, deep cluster that we spoke about."}, {"start": 2279.0, "end": 2282.04, "text": " And this method, it already gets, as you can see,"}, {"start": 2282.04, "end": 2284.08, "text": " fairly close to good accuracy."}, {"start": 2284.08, "end": 2289.8399999999997, "text": " So you have like 88.6% accuracy."}, {"start": 2289.84, "end": 2296.4, "text": " And that's fairly remarkable on C410 without seeing the labels."}, {"start": 2299.1600000000003, "end": 2300.92, "text": " But we'll go on."}, {"start": 2300.92, "end": 2302.6800000000003, "text": " And now they go into ImageNet."}, {"start": 2302.6800000000003, "end": 2306.4, "text": " Now ImageNet, of course, has way more classes."}, {"start": 2306.4, "end": 2310.08, "text": " It has 1,000 classes compared to C410's 10 classes."}, {"start": 2310.08, "end": 2313.1600000000003, "text": " So if you think clustering 10 classes"}, {"start": 2313.1600000000003, "end": 2315.6400000000003, "text": " might, and they're fairly apart from each other,"}, {"start": 2315.6400000000003, "end": 2318.96, "text": " might work with various techniques, ImageNet, 1,000 classes."}, {"start": 2318.96, "end": 2320.68, "text": " That's way more difficult."}, {"start": 2320.68, "end": 2327.44, "text": " But they do sub-sample this to 50, 100, and 200 classes."}, {"start": 2327.44, "end": 2333.52, "text": " And they get OK accuracy."}, {"start": 2333.52, "end": 2340.2400000000002, "text": " As you can see, they get 81% in for 50 classes"}, {"start": 2340.2400000000002, "end": 2344.44, "text": " where a supervised baseline would get 86%."}, {"start": 2344.44, "end": 2348.0, "text": " In the 200 classes, they get 69% where"}, {"start": 2348.0, "end": 2350.84, "text": " a supervised baseline would get 76%."}, {"start": 2350.84, "end": 2355.4, "text": " So it's fairly, it's there."}, {"start": 2355.4, "end": 2361.24, "text": " And that's quite remarkable for these low number of classes."}, {"start": 2361.24, "end": 2365.0, "text": " And they figure out that if they look for the samples"}, {"start": 2365.0, "end": 2368.28, "text": " that are kind of in the most of the middle of their cluster,"}, {"start": 2368.28, "end": 2371.12, "text": " they get these prototypes right here."}, {"start": 2371.12, "end": 2372.96, "text": " And you can see all of these images."}, {"start": 2372.96, "end": 2374.8, "text": " If you know ImageNet, some of the images"}, {"start": 2374.8, "end": 2377.88, "text": " really only have the part of the object and so on."}, {"start": 2377.88, "end": 2381.32, "text": " So here with the prototypical things,"}, {"start": 2381.32, "end": 2385.6400000000003, "text": " you really get center, clear shot of the object"}, {"start": 2385.6400000000003, "end": 2388.28, "text": " with clearly visible features, and so on."}, {"start": 2388.28, "end": 2396.12, "text": " So this sort of repeats the fact that this clustering really"}, {"start": 2396.12, "end": 2401.4, "text": " does go on that sort of semantic information."}, {"start": 2401.4, "end": 2405.0, "text": " Of course, the labels here are from the test label set."}, {"start": 2405.0, "end": 2407.76, "text": " The network can't figure that out."}, {"start": 2407.76, "end": 2413.4, "text": " And then they go for 1,000 classes."}, {"start": 2413.4, "end": 2415.5600000000004, "text": " And in 1,000 classes, it doesn't really"}, {"start": 2415.5600000000004, "end": 2420.6000000000004, "text": " work because there might be just too many confusions right here."}, {"start": 2420.6000000000004, "end": 2426.1600000000003, "text": " But they do have this confusion matrix of their method."}, {"start": 2426.1600000000003, "end": 2428.36, "text": " And it shows that the confusion matrix"}, {"start": 2428.36, "end": 2433.6000000000004, "text": " is pretty much a long block diagonal along these superclusters"}, {"start": 2433.6000000000004, "end": 2433.96, "text": " right here."}, {"start": 2433.96, "end": 2437.7200000000003, "text": " So you can see the dogs, the network confuses the dogs."}, {"start": 2437.72, "end": 2440.3599999999997, "text": " Fairly often, and then insects with each other,"}, {"start": 2440.3599999999997, "end": 2445.2, "text": " but not really across here, which is still quite remarkable."}, {"start": 2445.2, "end": 2449.56, "text": " But I mean, you get the same thing for a lot of these methods."}, {"start": 2449.56, "end": 2456.52, "text": " So I don't know how much different this would be in other methods."}, {"start": 2456.52, "end": 2459.7599999999998, "text": " But certainly it's interesting to look at."}, {"start": 2459.7599999999998, "end": 2461.56, "text": " Now, they go into one last thing."}, {"start": 2461.56, "end": 2466.68, "text": " And that is what if we don't know how many clusters there are,"}, {"start": 2466.68, "end": 2468.48, "text": " if we don't know anything."}, {"start": 2468.48, "end": 2471.3999999999996, "text": " So say so far we have assumed to have knowledge"}, {"start": 2471.3999999999996, "end": 2473.72, "text": " about the number of ground truth classes."}, {"start": 2473.72, "end": 2475.2, "text": " The model predictions were validated"}, {"start": 2475.2, "end": 2477.48, "text": " losing the whole Hungarian matching algorithm."}, {"start": 2477.48, "end": 2484.3599999999997, "text": " We already saw this in the DETR by Facebook, if you remember."}, {"start": 2484.3599999999997, "end": 2486.96, "text": " However, what happens if the number of clusters"}, {"start": 2486.96, "end": 2490.48, "text": " does not match the number of ground truth classes anymore?"}, {"start": 2490.48, "end": 2494.3999999999996, "text": " So they now say table three reports the results"}, {"start": 2494.4, "end": 2497.32, "text": " when we overestimate the number of ground truth classes"}, {"start": 2497.32, "end": 2499.2000000000003, "text": " by a factor of two."}, {"start": 2499.2000000000003, "end": 2505.7200000000003, "text": " So now they build just 20 classes for C410 instead of 10 classes."}, {"start": 2505.7200000000003, "end": 2509.08, "text": " And we'll look at table three real quick."}, {"start": 2509.08, "end": 2511.12, "text": " Where's table three?"}, {"start": 2511.12, "end": 2513.44, "text": " This is table three."}, {"start": 2513.44, "end": 2519.64, "text": " So when they over cluster, you get the thing here on the bottom."}, {"start": 2519.64, "end": 2523.84, "text": " And you can see there is a drop in accuracy right here."}, {"start": 2523.84, "end": 2531.92, "text": " Now, what I don't actually say how they do the over cluster"}, {"start": 2531.92, "end": 2532.84, "text": " matching."}, {"start": 2532.84, "end": 2537.76, "text": " So if you imagine, if I now have, I don't know, six clusters,"}, {"start": 2537.76, "end": 2544.84, "text": " but I need to assign them to three clusters here."}, {"start": 2544.84, "end": 2547.76, "text": " Do I still use this most optimistic thing?"}, {"start": 2547.76, "end": 2549.6000000000004, "text": " So do I still use, I think they still"}, {"start": 2549.6000000000004, "end": 2551.96, "text": " use this most optimistic matching, right,"}, {"start": 2551.96, "end": 2557.48, "text": " where you assign everything to its best fitted cluster?"}, {"start": 2557.48, "end": 2559.28, "text": " You compute all the permutations,"}, {"start": 2559.28, "end": 2562.28, "text": " and then you give it the best benefit of the doubt."}, {"start": 2562.28, "end": 2567.28, "text": " Now, if you imagine the situation"}, {"start": 2567.28, "end": 2572.2400000000002, "text": " where I over cluster to the point that I have each image"}, {"start": 2572.2400000000002, "end": 2576.7200000000003, "text": " in its own cluster, and I run this algorithm to evaluate"}, {"start": 2576.7200000000003, "end": 2577.32, "text": " my clustering."}, {"start": 2577.32, "end": 2580.64, "text": " I give it basically the most beneficial view,"}, {"start": 2580.64, "end": 2583.92, "text": " then I would get 100% accuracy."}, {"start": 2583.92, "end": 2589.3199999999997, "text": " So in one of these over cluster approach,"}, {"start": 2589.3199999999997, "end": 2593.96, "text": " I would sort of expect that you actually"}, {"start": 2593.96, "end": 2600.3199999999997, "text": " get a better score, because there is more generosity"}, {"start": 2600.3199999999997, "end": 2602.16, "text": " of the matching algorithm involved."}, {"start": 2602.16, "end": 2604.24, "text": " Now, that's counteracted by the fact"}, {"start": 2604.24, "end": 2607.7999999999997, "text": " that you can't group together things that obviously"}, {"start": 2607.8, "end": 2610.96, "text": " have similar features, because they are in the same class."}, {"start": 2610.96, "end": 2612.76, "text": " So there's two forces pulling here,"}, {"start": 2612.76, "end": 2617.36, "text": " but I was kind of astounded that it's going down,"}, {"start": 2617.36, "end": 2620.32, "text": " and the evaluation method of this matching algorithm,"}, {"start": 2620.32, "end": 2622.8, "text": " it sort of breaks down when you have more classes,"}, {"start": 2622.8, "end": 2626.1200000000003, "text": " at least in my opinion."}, {"start": 2626.1200000000003, "end": 2632.1200000000003, "text": " Yeah, but it's interesting to see that you can just overshoot,"}, {"start": 2632.1200000000003, "end": 2636.92, "text": " but then you need some sort of heuristic to reconcile that."}, {"start": 2636.92, "end": 2640.6, "text": " In any case, I think this paper is pretty cool."}, {"start": 2640.6, "end": 2642.64, "text": " It brings together a lot of things"}, {"start": 2642.64, "end": 2645.04, "text": " that were already present and introduces"}, {"start": 2645.04, "end": 2648.4, "text": " this kind of this step approach, but what you have to keep"}, {"start": 2648.4, "end": 2652.92, "text": " in mind, and by the way, there's lots of samples down here."}, {"start": 2652.92, "end": 2654.44, "text": " What you have to keep in mind is there"}, {"start": 2654.44, "end": 2657.16, "text": " are a lot of hyperparameters in here."}, {"start": 2657.16, "end": 2661.84, "text": " There are like this threshold, and first of all,"}, {"start": 2661.84, "end": 2664.12, "text": " yeah, the number of classes, the thresholds,"}, {"start": 2664.12, "end": 2668.52, "text": " the architectures, and so on, and all of this"}, {"start": 2668.52, "end": 2673.3199999999997, "text": " has been tuned to get these numbers really high."}, {"start": 2673.3199999999997, "end": 2675.88, "text": " All of these steps, all of the augmentations,"}, {"start": 2675.88, "end": 2678.72, "text": " and so on, the chosen data augmentations,"}, {"start": 2678.72, "end": 2683.72, "text": " it has been chosen to get this number as high as possible."}, {"start": 2683.72, "end": 2689.2799999999997, "text": " So to interpret this as, oh, look, we can classify"}, {"start": 2689.2799999999997, "end": 2691.04, "text": " without knowing the labels."}, {"start": 2691.04, "end": 2697.2, "text": " It is, yes, in this case, but the hyperparameter choices"}, {"start": 2697.2, "end": 2700.8, "text": " of the algorithm are all informed by the labels."}, {"start": 2700.8, "end": 2704.88, "text": " So it is still very, very unclear of how this method will"}, {"start": 2704.88, "end": 2708.2, "text": " actually work when you really don't have the labels,"}, {"start": 2708.2, "end": 2712.0, "text": " when you actually have to choose the hyperparameters"}, {"start": 2712.0, "end": 2713.88, "text": " in absence of anything."}, {"start": 2713.88, "end": 2717.12, "text": " And yeah, I think the future might"}, {"start": 2717.12, "end": 2719.84, "text": " tell if they continue to work on this."}, {"start": 2719.84, "end": 2723.88, "text": " All right, thanks for listening, looking, watching,"}, {"start": 2723.88, "end": 2727.84, "text": " and bearing with me through my wrestling with,"}, {"start": 2727.84, "end": 2731.32, "text": " with various math, basic math in this video."}, {"start": 2731.32, "end": 2758.76, "text": " I wish you a good day, and bye-bye."}] |
Yannic Kilcher | 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 Honsuashou Lei 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, it's 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, it 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 Shou Lei 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 intelligent. 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 touring test, for example, which is that you have a computer or a human behind a wall and on the other end, it's a human and the human needs to kind of communicate without seeing what he community 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 touring test and therefore intelligent. Now, surely it 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 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 Sholes says, the definitions that exist today of intelligence are basically 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 an author that distilled lots of different definitions and tried to distill them into 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 must be getting high 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 this, this is the main issue that Sholei 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 says in this thing, in this sentence right here that you just saw, there is an implicit sort of something is said implicitly, that these skills, this ability to achieve goals in this wide range of environments, it must be acquired, it must be learned. 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 program 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 pre programed 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 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 Minski said. The quote, I believe by Minski, at least Cholay says it's by Minski or I miss red. 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 Minski 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, why 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 tabular arasa viewpoint where it basically says you come into this world and your brain is the 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 are 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 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 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 a science 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 might realize, this is much closer 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 basically recognize any sort of learning, anything that you haven't seen before is intelligent, right? If you can handle any new situation, you're intelligent. And Sholei 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 we build the 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 Sholei is going to 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 Sholei 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 touring 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 ones 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, Sholei says, with 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 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, Sholei, let's a bit of that, that's basically his point that's going to come into the, the measurement later into the math where he says you simply have to arrive at a solution in this skill based evaluation. 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're like, Oh, yeah, 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 tree, the full tree search. So chess is intelligent. And then you build like a smarter tree, search, you build a stockfish and they're like, yeah, but it's just, you know, that's just this machine thing. And so the goal posts 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 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 acquisition, what is not in this definition is the fact that why do we think that someone that plays chess very well? Like, what do we think? Magnus Carlson 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 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 hard to memorize things as a human. So we know all of their constraints that went into learning this. And 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 this can be done is through general intelligence. We know that there is this correlation in humans that if you argue that chess you must have this or you're very, very likely to have this general problem solving ability. That's a human centric view and that does not count for machines. Machines can take forever to calculate the can the still years and years of experience like thousands of years. And this would also, this would be the same case with this open AI, Delta 5, right? Delta 5 is exactly here. Alpha go 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. It's about skill acquisition. But think about it, it's not that easy to actually define this skill acquisition thing 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 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 isn't 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 the 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 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. You're a small distribution shift. So the test set here comes from a known distribution. So this is 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 within between all of these training data points. So we can infer from the surrounding training data points. What 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 a test time and you can't pre build sort of your expectations into the system. This is more akin to something like level five autonomous driving where you built this car but you don't really know what kind of situation is coming. No, no, 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 probablyistically 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 an intuition thing what you categorize as local and broad and so on. Also here the Wozniak coffee cup example where basically Wozniak says 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 sorry unknown unknowns because you can't possibly foresee all possible kitchen arrangements. There might be obstacles and so on. You know the coffee might you 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 fanciness press some 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 the if you solve an IQ test right so or any sort of any service 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 you can you hear 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 acmeads 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 matter 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 sholey 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 the 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 or 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 like sholey really goes after psychometrics here and really models 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 uh encounter 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 fair 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 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 Scholes framework that would correspond to broad generalization and then these are again hierarchically subdivided and sometimes as you can see here shared task specific skills okay and this in in Scholes 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 the thing to note here according to Scholes 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 okay 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 you want to measure the abilities but you can only measure tasks the abilities or abstract concepts and the skill are 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 feel like okay complete this series which number comes next draw like rotate this in your head and so on but there there also very human centric things like reading comprehension and so on but you do these broad battery of tests and you might think oh oh okay 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 super glue in NLP where one NLP system has to learn to do all these different NLP tasks you know there is entailments there is sentiment there is boolean question answering and but this is according to Shalei 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 super glue thing so the developer can first of all train the system until it reaches a good super glue 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 they 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'd only measure that one test by the way that's also why a lot of these you know brain exercise apps and so on they none of them really ups your intelligence 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 Sholei says there have been a number of attempts at making machines making AI solve human IQ tests right as well the reasoning is the follows like oh okay humans develop IQ tests for humans and presumably those are no you don't know 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 ones so you could technically if you really wanted you could like prepare super hard and that's exactly what developers are going to do yeah they're basically going to look at all these tests they're 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 systems solve human IQ tests what we need are tests that are reliable which means they are reproducible that are valid that means they really measure IQ or they really measure artificial intelligence and not you know just tasks specific skill or 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 it 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 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 it's 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 a like leave a comment share it out and I'll see you next time bye bye | [{"start": 0.0, "end": 6.32, "text": " Hello there. Today we're going to look at on the measure of intelligence by Honsuashou"}, {"start": 6.32, "end": 14.48, "text": " Lei of Google. This is a bit of a special episode, I would say, because if you look at the"}, {"start": 14.48, "end": 20.84, "text": " paper, it is, first of all, it's very long and then second of all, it is a wall of text,"}, {"start": 20.84, "end": 27.240000000000002, "text": " basically. Now, it's very interesting text, but if I were to go through this with you,"}, {"start": 27.24, "end": 33.68, "text": " it basically just be kind of scrolling and reading along. So what I've done is I've basically"}, {"start": 33.68, "end": 39.96, "text": " read this and taken notes and I will attempt to just tell you what happens, at least for"}, {"start": 39.96, "end": 45.44, "text": " the first part. So I intend for this to be a multi-part series because it's so long. So"}, {"start": 45.44, "end": 51.76, "text": " the first part, as you can see here, is context and history, which is a little less boring"}, {"start": 51.76, "end": 57.44, "text": " than it sounds. The second part is going to be a new perspective where Shou Lei proposes"}, {"start": 57.44, "end": 62.839999999999996, "text": " his measure of intelligence. And the third part is going to be about the benchmark, the"}, {"start": 62.839999999999996, "end": 70.08, "text": " arc benchmark that is currently, I believe, running on Kaggle. So as it sees, as it looks"}, {"start": 70.08, "end": 78.08, "text": " right now, three parts and today we're going to dive into that first part. So here we go."}, {"start": 78.08, "end": 85.84, "text": " He basically says that we need to define what intelligence means. We need an explicit"}, {"start": 85.84, "end": 92.16, "text": " goal to measure where if we think about AI, like artificial intelligence, what does intelligence"}, {"start": 92.16, "end": 97.0, "text": " mean, we need something where we can basically put a number or multiple numbers on it and"}, {"start": 97.0, "end": 102.52, "text": " says, that's intelligent. That's not intelligent. What we have right now is just basically"}, {"start": 102.52, "end": 109.96, "text": " anecdotes. It's just we all kind of feel what seems intelligent, but we are not like sure."}, {"start": 109.96, "end": 115.96, "text": " And sometimes it's very misleading. He brings up the touring test, for example, which"}, {"start": 115.96, "end": 123.47999999999999, "text": " is that you have a computer or a human behind a wall and on the other end, it's a human"}, {"start": 123.47999999999999, "end": 129.0, "text": " and the human needs to kind of communicate without seeing what he community or what he"}, {"start": 129.0, "end": 134.24, "text": " or she communicates with and then determine whether or not on the other side of the wall"}, {"start": 134.24, "end": 141.52, "text": " is a human or a computer. And if the computer could fool a human into kind of a 50-50 guess,"}, {"start": 141.52, "end": 149.76, "text": " then the computer would be passing the touring test and therefore intelligent. Now, surely"}, {"start": 149.76, "end": 154.32, "text": " it doesn't go right now into why that's not sufficient, but he's basically saying this"}, {"start": 154.32, "end": 159.72, "text": " is not sufficient. It's distracting. And second of all, it's basically just outsourcing"}, {"start": 159.72, "end": 165.35999999999999, "text": " the problems of defining intelligence to human, right, to this human right here, who is"}, {"start": 165.35999999999999, "end": 173.51999999999998, "text": " fallible and noisy and you know, doesn't all doesn't really know all you tell the human"}, {"start": 173.51999999999998, "end": 179.12, "text": " is basically like, is this thing intelligent? Does this thing seem human to you? It's also"}, {"start": 179.12, "end": 186.92000000000002, "text": " not clearly defined. So we need some something more. And Sholes says, the definitions that"}, {"start": 186.92000000000002, "end": 194.64000000000001, "text": " exist today of intelligence are basically they have implicit, they are implicit definitions"}, {"start": 194.64000000000001, "end": 201.88, "text": " that are loaded with biases and biases basically from a human perspective on what intelligence"}, {"start": 201.88, "end": 208.04000000000002, "text": " is. And if we want to really make progress in terms of measuring intelligence, we need"}, {"start": 208.04, "end": 217.39999999999998, "text": " to point out these biases that are in these measures. Okay. They has a range of quotes,"}, {"start": 217.39999999999998, "end": 225.04, "text": " namely one here, intelligence measures an agent's ability to achieve goals in a wide range"}, {"start": 225.04, "end": 231.84, "text": " of environments. That was, I believe, the conclusion of an author that distilled lots of"}, {"start": 231.84, "end": 238.24, "text": " different definitions and tried to distill them into one sentence. And that's it. Intelligence"}, {"start": 238.24, "end": 244.68, "text": " measures an agent's ability to achieve goals in a wide range of environments. So the crucial"}, {"start": 244.68, "end": 250.96, "text": " parts here is to ability to achieve goals. So it must, the agent must be, you know, doing"}, {"start": 250.96, "end": 256.64, "text": " something useful, doing it like in reinforcement learning, we'd say must be getting high"}, {"start": 256.64, "end": 264.8, "text": " rewards. And the second part is in a wide range of environments. So the, the notion right"}, {"start": 264.8, "end": 270.84, "text": " here that we're going to encounter time and time again is basically an addition of skill"}, {"start": 270.84, "end": 277.52, "text": " and adaptivity. So if you have, it's not enough to have high skill, you also need to be"}, {"start": 277.52, "end": 283.24, "text": " kind of adaptive to very, very different environments to a range of environments. And"}, {"start": 283.24, "end": 289.2, "text": " that this, this is the main issue that Sholei has with the current sort of definitions"}, {"start": 289.2, "end": 294.40000000000003, "text": " of intelligence and the current direction of the AI field, because it mostly measures"}, {"start": 294.40000000000003, "end": 304.48, "text": " skill and not generalization or adaptivity. Now he says in this thing, in this sentence"}, {"start": 304.48, "end": 310.92, "text": " right here that you just saw, there is an implicit sort of something is said implicitly,"}, {"start": 310.92, "end": 318.88, "text": " that these skills, this ability to achieve goals in this wide range of environments, it"}, {"start": 318.88, "end": 325.48, "text": " must be acquired, it must be learned. These new tasks, these different environments, the"}, {"start": 325.48, "end": 331.24, "text": " agent should basically learn to adapt to the different environments. Then, and then the"}, {"start": 331.24, "end": 336.8, "text": " agent is intelligent. It's not that intelligent when it is sort of pre program to already"}, {"start": 336.8, "end": 342.48, "text": " handle these environments. So he says that's that's sort of implicit in that statement."}, {"start": 342.48, "end": 348.92, "text": " And we're going to see how this is made explicit later. He goes into basically there are two"}, {"start": 348.92, "end": 354.96000000000004, "text": " two different viewpoints on intelligence, this old nature versus nurture debate. And that"}, {"start": 354.96000000000004, "end": 362.12, "text": " refers to two things like crystallized intelligence versus skill acquisition intelligence. So"}, {"start": 362.12, "end": 368.4, "text": " the evolutionary view would be that intelligence is sort of this set of static programs. And"}, {"start": 368.4, "end": 374.4, "text": " here we simply kind of boil down these two views to their extremes, right? So don't I"}, {"start": 374.4, "end": 382.28000000000003, "text": " don't think any major evolutionary biologist is complete like is apps is that extreme right"}, {"start": 382.28000000000003, "end": 389.44, "text": " now. But these were historical set of views that were held. One of them was that intelligence"}, {"start": 389.44, "end": 396.8, "text": " is basically just it's all pre pre programed into you by evolution. So you can you can solve"}, {"start": 396.8, "end": 401.0, "text": " this puzzle because during evolution, you know, your ancestors that could solve these"}, {"start": 401.0, "end": 409.28, "text": " puzzles were survived. You can plan your path through a tree jungle because, you know,"}, {"start": 409.28, "end": 417.12, "text": " that was beneficiary to you. And so evolution put that into your brain. And therefore, what"}, {"start": 417.12, "end": 424.44, "text": " results is AI is the science of making machines capable of performing tasks that would require"}, {"start": 424.44, "end": 431.72, "text": " intelligence if done by humans. That's basically what Minski said. The quote, I believe by"}, {"start": 431.72, "end": 439.2, "text": " Minski, at least Cholay says it's by Minski or I miss red. Where if you have this this set"}, {"start": 439.2, "end": 445.88, "text": " of view that that AI is basically just this set of static programs, that means that if"}, {"start": 445.88, "end": 455.15999999999997, "text": " a human applies that set of programs to a task, right? And the human achieves 200 points."}, {"start": 455.15999999999997, "end": 463.04, "text": " It means if the if an AI comes along and achieves 201 points, then it is intelligent because"}, {"start": 463.04, "end": 470.12, "text": " it has simply the better set of the better it has outperformed the static set of programs."}, {"start": 470.12, "end": 473.84, "text": " Intelligence is this static set of programs and the AI has a better set of static set of"}, {"start": 473.84, "end": 484.08, "text": " programs. So it's basically Minski says, if we know of a task that would require intelligence"}, {"start": 484.08, "end": 494.67999999999995, "text": " if done by a human, then if something that can solve that task is intelligent. And this"}, {"start": 494.67999999999995, "end": 501.71999999999997, "text": " equates learning basically just to memorization. If you if you ask a proponent of this viewpoint,"}, {"start": 501.72, "end": 506.12, "text": " well, what's what's learning? Like if everything is pre-programmed, why we can still learn and"}, {"start": 506.12, "end": 510.76000000000005, "text": " they would say, yeah, but the learning is just you memorize situations and that particular"}, {"start": 510.76000000000005, "end": 520.0, "text": " ability is also pre-programmed into you. The other extreme viewpoint is this tabular"}, {"start": 520.0, "end": 526.8000000000001, "text": " arasa viewpoint where it basically says you come into this world and your brain is"}, {"start": 526.8, "end": 532.76, "text": " the blank slate and everything you all of your abilities, you basically must acquire through"}, {"start": 532.76, "end": 542.0799999999999, "text": " learning throughout your life. So this is another extreme viewpoint. And in terms of intelligence"}, {"start": 542.0799999999999, "end": 549.3599999999999, "text": " where that leads is following AI is the science and engineering of making machines do tasks"}, {"start": 549.3599999999999, "end": 556.76, "text": " they have never seen and have not been prepared for beforehand. And that's a quote by McCarthy."}, {"start": 556.76, "end": 562.76, "text": " And Friedberg, if we are ever to make a machine that will speak, understand, translate human"}, {"start": 562.76, "end": 568.12, "text": " languages, solve mathematical problems with imagination, practice a profession or direct"}, {"start": 568.12, "end": 573.52, "text": " an organization, either we must reduce these activities to a science so exact that we can"}, {"start": 573.52, "end": 579.4399999999999, "text": " tell a machine precisely how to go about doing them, or we must develop a machine that can"}, {"start": 579.4399999999999, "end": 586.4, "text": " do things without being told precisely how. So this leads to more of of these notions"}, {"start": 586.4, "end": 595.16, "text": " right here that you can see here the machines have not been prepared for a particular situation."}, {"start": 595.16, "end": 602.0799999999999, "text": " So if we make a machine that can do a task that it has not been prepared for, we know it's"}, {"start": 602.0799999999999, "end": 609.9599999999999, "text": " basically intelligent. And again, so if we make a machine that can do all of these things,"}, {"start": 609.96, "end": 617.48, "text": " all of the things right here, then either Friedberg says we must reduce these activities to"}, {"start": 617.48, "end": 623.6800000000001, "text": " a science so basically we must program the solution in there already, or we must develop"}, {"start": 623.6800000000001, "end": 630.32, "text": " a machine that can do things without being told precisely how. And as you might realize,"}, {"start": 630.32, "end": 637.48, "text": " this is much closer to the machine learning paradigm. It's basically it's all about"}, {"start": 637.48, "end": 646.48, "text": " how much you say precisely because the extreme proponent of this thing would basically recognize"}, {"start": 646.48, "end": 653.64, "text": " any sort of learning, anything that you haven't seen before is intelligent, right? If you"}, {"start": 653.64, "end": 661.36, "text": " can handle any new situation, you're intelligent. And Sholei is going to argue that that's also"}, {"start": 661.36, "end": 667.4, "text": " not really the case. Like we have to be a bit more graded about it. But this is basically"}, {"start": 667.4, "end": 674.48, "text": " the machine learning approach. It's we build the machines that can do things without being"}, {"start": 674.48, "end": 681.16, "text": " told precisely how that they have not been prepared for beforehand. Like it can solve"}, {"start": 681.16, "end": 687.52, "text": " things that are not in the training data. That's one interpretation. And if you're a very"}, {"start": 687.52, "end": 693.52, "text": " strong proponent of this, you would call that intelligent. And Sholei is going to argue"}, {"start": 693.52, "end": 698.3199999999999, "text": " that the truth, of course, is somewhere in the middle between these two viewpoints. And therefore,"}, {"start": 698.3199999999999, "end": 705.68, "text": " defining intelligence in either of these terms is going to lack in in expressivity and in usefulness."}, {"start": 705.68, "end": 717.68, "text": " So how do we evaluate AI? And Sholei goes through different levels here of AI evaluation. So first"}, {"start": 717.68, "end": 726.7199999999999, "text": " of all, he contrasts these these two things right here, skill based evaluation and generalization"}, {"start": 726.7199999999999, "end": 736.68, "text": " based evaluation. So in skill based evaluation, you basically go for one given task. So you evaluate"}, {"start": 736.68, "end": 744.04, "text": " a system on one given task. One example here is, for example, the touring test. And that's"}, {"start": 744.04, "end": 752.68, "text": " done by human review. Another example is where you have like a proof. So you evaluate a system"}, {"start": 752.68, "end": 759.64, "text": " in by giving its optimality proof. You can analyze it. And you can say it is always correct at this"}, {"start": 759.64, "end": 767.16, "text": " particular task. What you can also do is this peer competition. So this is maybe what we see in"}, {"start": 767.16, "end": 773.3199999999999, "text": " sort of like chess. So we let the bots play first humans. And then we let them play other bots."}, {"start": 773.32, "end": 781.1600000000001, "text": " And we determine which ones the best. And also the most familiar one benchmarks. So this would be"}, {"start": 781.1600000000001, "end": 790.5200000000001, "text": " where your, I don't know, your image net net test set is right. That's right here. That's a skill"}, {"start": 790.5200000000001, "end": 797.8800000000001, "text": " based evaluation. That's one given task. How well can you solve the image net test set without"}, {"start": 797.88, "end": 806.2, "text": " looking at it? That's one task. So the problem, Sholei says, with this skill based evaluation is"}, {"start": 806.2, "end": 812.52, "text": " sort of obvious. It's like a single focus. You can't, like you are only good at this particular"}, {"start": 812.52, "end": 819.96, "text": " thing. And that is one of the examples of this is the fact that the Kaggle models are usually the"}, {"start": 819.96, "end": 825.24, "text": " winning Kaggle models are usually useless outside of that particular data set because they're just"}, {"start": 825.24, "end": 833.4, "text": " so hyper optimized and hyper focused on winning that particular Kaggle competition. So it's actually"}, {"start": 833.4, "end": 839.48, "text": " pretty strong science on how to set up a Kaggle competition such that you can then use the model,"}, {"start": 839.48, "end": 849.4, "text": " the winning model afterwards for doing something actually useful. No, there are no conditions on how"}, {"start": 849.4, "end": 856.1999999999999, "text": " to arrive at a solution. And there, Sholei, let's a bit of that, that's basically his point that's"}, {"start": 856.1999999999999, "end": 863.9599999999999, "text": " going to come into the, the measurement later into the math where he says you simply have to arrive"}, {"start": 863.9599999999999, "end": 869.88, "text": " at a solution in this skill based evaluation. The skill based evaluation usually doesn't care"}, {"start": 870.6, "end": 876.76, "text": " how you arrive there. So the image net test set score doesn't care how you got the neural network"}, {"start": 876.76, "end": 882.28, "text": " or what not that you got. It simply cares how many images do you classify correctly."}, {"start": 883.96, "end": 889.3199999999999, "text": " And this leads to what is called the AI effect, which I didn't know it was called like this until"}, {"start": 889.3199999999999, "end": 895.8, "text": " recently, but it's fairly obvious where people say people say people come up with a task that's"}, {"start": 895.8, "end": 902.2, "text": " that is intelligence. So people used to say, Oh, checkers. The game of checkers, it requires"}, {"start": 902.2, "end": 907.8000000000001, "text": " intelligence. And then you build a machine to solve checkers because you can just, I don't know,"}, {"start": 907.8000000000001, "end": 913.48, "text": " search, do like a bit of a smart tree search and you solve it and you tell them here's like a"}, {"start": 913.48, "end": 917.08, "text": " tree search that does checkers and they're like, Oh, yeah, but that's not, that's not really"}, {"start": 917.08, "end": 923.8000000000001, "text": " intelligent. It's just like a tree search. But, but chess, chess, you can't possibly do the tree,"}, {"start": 923.8, "end": 932.5999999999999, "text": " the full tree search. So chess is intelligent. And then you build like a smarter tree,"}, {"start": 932.5999999999999, "end": 938.52, "text": " search, you build a stockfish and they're like, yeah, but it's just, you know, that's just this"}, {"start": 938.52, "end": 944.92, "text": " machine thing. And so the goal posts keep moving every time they come up with a task and you solve"}, {"start": 944.92, "end": 951.8, "text": " the tasks, they'll just say, wow, that's not really intelligence. This next task, that's intelligence."}, {"start": 951.8, "end": 958.12, "text": " And it's easy to see that if you just do this skill based evaluation, you will never get there"}, {"start": 958.12, "end": 964.28, "text": " because it's always going to be the next task, the next task, the next task. It's overly"}, {"start": 965.7199999999999, "end": 972.12, "text": " anthropocentric. It's overly based on how humans view the world and what is not left in here."}, {"start": 972.12, "end": 978.76, "text": " And again, this acquisition, what is not in this definition is the fact that why do we think"}, {"start": 978.76, "end": 985.4, "text": " that someone that plays chess very well? Like, what do we think? Magnus Carlson is smart. Why do we"}, {"start": 985.4, "end": 994.68, "text": " think someone like a go master is very intelligent? And that's because we know that this person is"}, {"start": 994.68, "end": 1001.48, "text": " human. At least we believe there are doubts about some of these grandmasters. But we believe"}, {"start": 1001.48, "end": 1009.8000000000001, "text": " that they are humans. And therefore we know that they have only had whatever 20, 30 years to learn"}, {"start": 1009.8000000000001, "end": 1015.96, "text": " this. And they must eat regularly and they can only think so fast. And it's hard to memorize"}, {"start": 1015.96, "end": 1022.6800000000001, "text": " things as a human. So we know all of their constraints that went into learning this. And we basically"}, {"start": 1022.68, "end": 1032.36, "text": " know there is, it's not like we are not aware of something like Neo has in the matrix where you"}, {"start": 1032.36, "end": 1039.48, "text": " can just upload the solution to chess into your brain. We know what's required to achieve"}, {"start": 1039.48, "end": 1046.04, "text": " that level of success. And we know the only way this can be done is through general intelligence."}, {"start": 1046.04, "end": 1053.24, "text": " We know that there is this correlation in humans that if you argue that chess you must have this"}, {"start": 1053.24, "end": 1060.52, "text": " or you're very, very likely to have this general problem solving ability. That's a human centric"}, {"start": 1060.52, "end": 1065.72, "text": " view and that does not count for machines. Machines can take forever to calculate the can"}, {"start": 1065.72, "end": 1072.28, "text": " the still years and years of experience like thousands of years. And this would also,"}, {"start": 1072.28, "end": 1079.96, "text": " this would be the same case with this open AI, Delta 5, right? Delta 5 is exactly here. Alpha"}, {"start": 1079.96, "end": 1086.76, "text": " go is exactly here. We only think they might be intelligent if a human does it because we know"}, {"start": 1086.76, "end": 1095.24, "text": " what's required for humans to get there. Again, focus skill acquisition. Now you might be bored"}, {"start": 1095.24, "end": 1102.76, "text": " a little bit. It's about skill acquisition. But think about it, it's not that easy to actually"}, {"start": 1102.76, "end": 1111.32, "text": " define this skill acquisition thing without falling back into the exact same trap. So it goes"}, {"start": 1111.32, "end": 1119.4, "text": " into say, okay, as opposed to this skill based, we can measure generalization. So what's generalization?"}, {"start": 1119.4, "end": 1125.48, "text": " Generalization is the broad ability to handle tasks that differ from previous tasks. So they,"}, {"start": 1126.8400000000001, "end": 1132.76, "text": " they, you have a task and it's different from previous tasks, you generalize. Now there are two"}, {"start": 1133.3200000000002, "end": 1139.48, "text": " ways you can view this. There is system centric generalization and that's basically if you take"}, {"start": 1139.48, "end": 1145.5600000000002, "text": " the strict definition here. So this would be a machine learning system trains on the training set"}, {"start": 1145.56, "end": 1153.3999999999999, "text": " and then is evaluated on the test set. It has never seen the test set before. So it's generalizing,"}, {"start": 1153.3999999999999, "end": 1159.3999999999999, "text": " right? That's called system centric generalization. But that's not really enough here because we"}, {"start": 1159.3999999999999, "end": 1166.6, "text": " also need to take into account the developer of the system. So developer aware generalization"}, {"start": 1167.32, "end": 1172.44, "text": " means that you generalize the situations that are new to the system and to the developer."}, {"start": 1172.44, "end": 1180.1200000000001, "text": " So a developer of an image net model knows that it is going to be evaluated on the image net test set."}, {"start": 1180.92, "end": 1187.0, "text": " And that is, that isn't this category system centric because the developer knows. However,"}, {"start": 1188.2, "end": 1194.76, "text": " a broader generalization, this developer aware generalization also takes into account that fact."}, {"start": 1194.76, "end": 1202.28, "text": " And it would say developer aware generalization is only when the system generalizes to something"}, {"start": 1202.28, "end": 1207.96, "text": " that is not known to the developer that is new to even to the developer themselves. They don't,"}, {"start": 1207.96, "end": 1214.36, "text": " they haven't foreseen that. So this accounts for prior knowledge of the developer."}, {"start": 1216.12, "end": 1223.24, "text": " It surely defines different degrees of generalization largely along these lines. So absence of"}, {"start": 1223.24, "end": 1228.6, "text": " generalization is when you have like an algorithm that you know you absolutely have built in that"}, {"start": 1228.6, "end": 1234.4399999999998, "text": " it works for every possible situation like a certain assorting algorithm that you have proven"}, {"start": 1234.4399999999998, "end": 1239.9599999999998, "text": " mathematically proven to work for all sequences of numbers. No generalization. Everything has been"}, {"start": 1239.9599999999998, "end": 1246.84, "text": " foreseen. Then there is local generalization. And this in machine learning we call this something"}, {"start": 1246.84, "end": 1253.0, "text": " like robustness. This would be your test set robustness. You're a small distribution shift. So"}, {"start": 1253.0, "end": 1260.44, "text": " the test set here comes from a known distribution. So this is the notion of known unknowns. You"}, {"start": 1260.44, "end": 1267.32, "text": " you have an idea of what can come at your system. And you require basically you require a dense"}, {"start": 1267.32, "end": 1272.84, "text": " sampling of the input space. Usually machine learning training sets are very, very densely"}, {"start": 1272.84, "end": 1278.36, "text": " sample. That means there's a lot of data there that we can learn from. So we have like lots and"}, {"start": 1278.36, "end": 1285.1599999999999, "text": " lots and lots and lots and lots of data. And when the test point comes it is going to be like somewhere"}, {"start": 1285.8, "end": 1292.36, "text": " really in within between all of these training data points. So we can infer from the surrounding"}, {"start": 1292.36, "end": 1297.7199999999998, "text": " training data points. What test data point is going to be like if there's a classification boundary"}, {"start": 1297.7199999999998, "end": 1304.28, "text": " right here. We can sort of nearest neighbor it. And there are arguments that deep networks are"}, {"start": 1304.28, "end": 1311.56, "text": " basically large nearest neighbor classifiers. But that's a topic for another day. And we are here"}, {"start": 1311.56, "end": 1320.68, "text": " basically we are here in machine learning right now. We do local generalization. We know our unknowns."}, {"start": 1320.68, "end": 1329.3999999999999, "text": " We know our test set. As the the opposition to this is broad generalization broad generalization"}, {"start": 1329.4, "end": 1335.4, "text": " is where you don't know what you don't know unknown unknowns. You don't know what comes a test time"}, {"start": 1335.4, "end": 1344.92, "text": " and you can't pre build sort of your expectations into the system. This is more akin to something like"}, {"start": 1344.92, "end": 1353.0, "text": " level five autonomous driving where you built this car but you don't really know what kind of"}, {"start": 1353.0, "end": 1358.1200000000001, "text": " situation is coming. No, no, this is a this is a fuzzy definition right. I mean you do sort of"}, {"start": 1358.12, "end": 1366.12, "text": " know what situations will come at the car. You can certainly probablyistically make a statement"}, {"start": 1366.12, "end": 1372.52, "text": " about what so this is it's not a clear cut definition. And I think we're going to so in the math"}, {"start": 1372.52, "end": 1379.8, "text": " it seems clear cut. But when we get there I don't think it is that clear cut honestly. It's still"}, {"start": 1379.8, "end": 1386.6, "text": " kind of an intuition thing what you categorize as local and broad and so on. Also here the"}, {"start": 1386.6, "end": 1392.1999999999998, "text": " Wozniak coffee cup example where basically Wozniak says you should be able to build a robot that"}, {"start": 1392.1999999999998, "end": 1400.04, "text": " goes into any kitchen and gets you a cup of coffee. And here you have known sorry unknown unknowns"}, {"start": 1400.04, "end": 1406.12, "text": " because you can't possibly foresee all possible kitchen arrangements. There might be obstacles"}, {"start": 1406.12, "end": 1410.9199999999998, "text": " and so on. You know the coffee might you might be different coffee makers that you've never"}, {"start": 1410.92, "end": 1419.3200000000002, "text": " encountered before. But I've long been saying that this is a bit of a trick right here because"}, {"start": 1419.3200000000002, "end": 1428.3600000000001, "text": " what what you can always do is you can construct a room a kitchen right and right here is the coffee"}, {"start": 1428.3600000000001, "end": 1433.64, "text": " machine. So there's the how do we draw this there's the coffee machine right here one of these"}, {"start": 1433.64, "end": 1441.64, "text": " fanciness press some machines you put in a capsule here. And here's the coffee machine okay but then"}, {"start": 1441.64, "end": 1450.44, "text": " you you build a wall around it and the wall has a door and the door the door will only open"}, {"start": 1450.44, "end": 1458.3600000000001, "text": " if the if you solve an IQ test right so or any sort of any service so whatever you put whatever"}, {"start": 1458.36, "end": 1464.12, "text": " you put in that spot that's the level of generalization you you can achieve basically so you can"}, {"start": 1464.12, "end": 1471.24, "text": " always up the level of generalization to or you can put I don't know you can put the halting"}, {"start": 1471.24, "end": 1477.3999999999999, "text": " problem here right you can you can you can you can you hear you can say you only solve this door if"}, {"start": 1477.3999999999999, "end": 1486.36, "text": " you can whatever give me a proof of the ABC conjecture something like this so coffee cup example"}, {"start": 1486.36, "end": 1495.08, "text": " kind of kind of has some back doors in any case you sort of know what was the acmeads you should"}, {"start": 1495.08, "end": 1502.12, "text": " be able to go into a standard kitchen but the standard kitchens are still diverse enough you can't"}, {"start": 1502.12, "end": 1509.8799999999999, "text": " foresee all of them like I don't if any of you has this sort of kitchen that I'm talking about like"}, {"start": 1509.88, "end": 1516.92, "text": " matter respect all we will all get this robot and you'll you'll just have to wait for the next"}, {"start": 1516.92, "end": 1526.1200000000001, "text": " iteration okay then there's extreme extreme generalization is where you have kind of open ended"}, {"start": 1526.1200000000001, "end": 1531.0800000000002, "text": " you you don't know what's gonna come you don't even know the broad category of tasks that is"}, {"start": 1531.0800000000002, "end": 1537.8000000000002, "text": " going to come right broad here is still broad still refers to a broad category of related tasks"}, {"start": 1537.8, "end": 1545.32, "text": " so it is sort of a general ability and the extreme generalization just means you know whatever"}, {"start": 1545.32, "end": 1552.2, "text": " whatever comes you can solve it but it is different from universal universal generalization"}, {"start": 1552.2, "end": 1560.2, "text": " sholey says is any conceivable task in the universe and that's pointless it's pointless because"}, {"start": 1560.2, "end": 1568.52, "text": " it's just too much there's this no free lunch theorem right plus what we actually want is we want"}, {"start": 1568.52, "end": 1575.32, "text": " human level intelligence and human level intelligence has this property of extreme generalization"}, {"start": 1575.32, "end": 1581.64, "text": " with extreme generalization we mean the scope see it's dependent on a scope we mean the scope of"}, {"start": 1581.64, "end": 1589.72, "text": " all human tasks of all tasks that humans could produce or could find useful could find themselves"}, {"start": 1589.72, "end": 1600.6000000000001, "text": " in or could pose of this system not all tasks that the universe could pose so the here you you"}, {"start": 1600.6000000000001, "end": 1606.68, "text": " don't even have the relation between tasks the relation between tasks are at most abstract so"}, {"start": 1606.68, "end": 1616.3600000000001, "text": " there maybe it's like the general ability of sorting things generally in in whatever fashion in"}, {"start": 1616.36, "end": 1624.12, "text": " and things whatever these things are with whatever properties or the general ability to communicate"}, {"start": 1624.12, "end": 1634.84, "text": " an idea or something like this and this in humans is called the G factor if you or it's related to"}, {"start": 1634.84, "end": 1643.24, "text": " but we're going to take like sholey really goes after psychometrics here and really models its"}, {"start": 1643.24, "end": 1650.52, "text": " his framework after psychometrics for humans and the sort of achievement in psychometrics one of"}, {"start": 1650.52, "end": 1656.52, "text": " the achievements is this measure of the G factor and that's what we humans usually call intelligence"}, {"start": 1659.16, "end": 1664.2, "text": " he says note that humans have system centric and developer aware generalization though"}, {"start": 1664.2, "end": 1674.28, "text": " you know that one this this uh encounter this contains the other one so why because we can handle"}, {"start": 1674.28, "end": 1680.8400000000001, "text": " situations that previous humans haven't experienced now I'm not I'm not sure he basically says humans"}, {"start": 1680.8400000000001, "end": 1687.48, "text": " have developer aware generalization because we can we can fair well in situations that no humans"}, {"start": 1687.48, "end": 1695.56, "text": " during evolution have experienced prior but okay let's let's have this abstractly let's say our"}, {"start": 1695.56, "end": 1704.76, "text": " developer is the evolution process you still have to ask can humans really solve things that"}, {"start": 1706.1200000000001, "end": 1712.2, "text": " the evolutionary process has not built into them in some sort I guess that refers back to the"}, {"start": 1712.2, "end": 1721.72, "text": " nature versus nurture like humans humans cannot you know multiply long floating point numbers it"}, {"start": 1721.72, "end": 1730.76, "text": " doesn't matter how I get without a pen and paper it doesn't matter how how much you learn or"}, {"start": 1730.76, "end": 1737.96, "text": " something like this there are some things that they just can't do but would want to do and I guess"}, {"start": 1737.96, "end": 1744.3600000000001, "text": " the evolutionary path simply didn't provide us for doing that kind of stuff we have a finite"}, {"start": 1744.3600000000001, "end": 1752.28, "text": " working memory and so on so I think the the discussion here is still to be had if we really do have"}, {"start": 1752.28, "end": 1759.32, "text": " developer aware generalization if you consider our developer to be the evolutionary process"}, {"start": 1759.32, "end": 1768.84, "text": " but but we can forgive a little bit here so this is the general diagram that also emerges from"}, {"start": 1768.84, "end": 1776.6, "text": " kind of theories of intelligence from psychology where generally you have a general intelligence"}, {"start": 1776.6, "end": 1783.3999999999999, "text": " factor which is one factor this is quite remarkable in humans there is one general intelligence"}, {"start": 1783.4, "end": 1790.76, "text": " factor statistically all all these general intelligence tasks they broadly correlate and lead to"}, {"start": 1790.76, "end": 1797.0800000000002, "text": " one statistical factor it's not it's not obvious why that should be but turns out to be one factor"}, {"start": 1797.8000000000002, "end": 1804.2, "text": " and that distributes hierarchically into these things which are called broad abilities broad"}, {"start": 1804.2, "end": 1809.8000000000002, "text": " cognitive abilities and in Scholes framework that would correspond to broad generalization"}, {"start": 1809.8, "end": 1815.0, "text": " and then these are again hierarchically subdivided and sometimes as you can see here shared"}, {"start": 1816.04, "end": 1823.6399999999999, "text": " task specific skills okay and this in in Scholes framework would be local or no generalization"}, {"start": 1825.72, "end": 1834.9199999999998, "text": " so again he basically goes into psychometrics and specifically IQ tests for humans can they inform"}, {"start": 1834.92, "end": 1843.0, "text": " the measuring process the note the thing to note here according to Scholes is in an IQ test"}, {"start": 1843.72, "end": 1849.96, "text": " you want to measure these broad abilities you want to measure ultimately want to measure G"}, {"start": 1849.96, "end": 1854.8400000000001, "text": " but if even if you measure different things in psychometrics you want to measure these broad"}, {"start": 1854.8400000000001, "end": 1860.68, "text": " abilities but these are like these are abstract concepts so what you're left with what you can"}, {"start": 1860.68, "end": 1870.2, "text": " only do is you can only measure really tasks okay and is this wrongly numbered or is this intentional"}, {"start": 1871.48, "end": 1878.44, "text": " I don't know you can only measure tasks but you somehow have to make an inference about the broad"}, {"start": 1878.44, "end": 1886.28, "text": " ability from measuring the tasks so that's the difficulty in psychometrics you you you you want to"}, {"start": 1886.28, "end": 1892.12, "text": " measure the abilities but you can only measure tasks the abilities or abstract concepts and the"}, {"start": 1892.12, "end": 1900.2, "text": " skill are the measurable things where you can put a number on it now you you can so what these IQ"}, {"start": 1900.2, "end": 1907.8, "text": " tests do they usually usually employ these broad battery of tests so you don't give the human just"}, {"start": 1907.8, "end": 1913.32, "text": " one tasks you give you give the human a lot of tasks you feel like okay complete this series"}, {"start": 1913.32, "end": 1921.3999999999999, "text": " which number comes next draw like rotate this in your head and so on but there there also very"}, {"start": 1921.3999999999999, "end": 1928.28, "text": " human centric things like reading comprehension and so on but you do these broad battery of tests"}, {"start": 1928.28, "end": 1934.2, "text": " and you might think oh oh okay this is sort of like the Atari you know sweet where"}, {"start": 1935.3999999999999, "end": 1941.32, "text": " the one reinforcement learning agent has to solve these whole bunch of Atari games or a super glue"}, {"start": 1941.32, "end": 1948.9199999999998, "text": " in NLP where one NLP system has to learn to do all these different NLP tasks you know there is"}, {"start": 1948.9199999999998, "end": 1957.0, "text": " entailments there is sentiment there is boolean question answering and but this is according to"}, {"start": 1957.0, "end": 1964.6799999999998, "text": " Shalei it's sort of not really it's not really the case that these are equivalent because"}, {"start": 1965.8799999999999, "end": 1971.08, "text": " it is a battery but it is known to the developer so the developer knows that the NLP system"}, {"start": 1971.08, "end": 1978.28, "text": " has to solve the super glue thing so the developer can first of all train the system until it reaches"}, {"start": 1978.28, "end": 1984.6799999999998, "text": " a good super glue score but then also it will have built in already the assumptions of the developer"}, {"start": 1984.6799999999998, "end": 1989.96, "text": " that you have to solve this so the second important thing about these battery of tests and IQ"}, {"start": 1989.96, "end": 1997.3999999999999, "text": " test is that they are unknown to the tested they tested cannot or ideally should not practice for"}, {"start": 1997.4, "end": 2003.0, "text": " them that's why people keep developing new and new IQ tests because we sort of know they all"}, {"start": 2003.0, "end": 2007.88, "text": " correlate first of all so they measure the same thing but also second because otherwise people"}, {"start": 2009.16, "end": 2017.24, "text": " if you just always do the same test people could practice it and then you would no longer measure"}, {"start": 2017.24, "end": 2023.0, "text": " the general ability you'd only measure that one test by the way that's also why a lot of these"}, {"start": 2023.0, "end": 2032.04, "text": " you know brain exercise apps and so on they none of them really ups your intelligence"}, {"start": 2034.36, "end": 2040.12, "text": " you you only get better at one app if you do that you don't you don't get smarter in general"}, {"start": 2043.32, "end": 2043.56, "text": " so"}, {"start": 2043.56, "end": 2054.04, "text": " if and and Sholei says there have been a number of attempts at making machines making AI solve"}, {"start": 2054.04, "end": 2060.44, "text": " human IQ tests right as well the reasoning is the follows like oh okay humans develop IQ tests"}, {"start": 2060.44, "end": 2069.88, "text": " for humans and presumably those are no you don't know and so on but again the tasks broadly of"}, {"start": 2069.88, "end": 2076.76, "text": " IQ tests are known I guess really IQ tests work on humans because they only work on humans who don't"}, {"start": 2076.76, "end": 2083.7200000000003, "text": " really care like if someone really really really really cared they would you know research what kind"}, {"start": 2083.7200000000003, "end": 2087.8, "text": " of tests there are they would look at all the tests from history there's only so many tests you"}, {"start": 2087.8, "end": 2093.0, "text": " can come up with the new ones are going to be like variations on the old ones so you could technically"}, {"start": 2093.0, "end": 2098.92, "text": " if you really wanted you could like prepare super hard and that's exactly what developers are going"}, {"start": 2098.92, "end": 2104.52, "text": " to do yeah they're basically going to look at all these tests they're going to pre-solve the problem"}, {"start": 2104.52, "end": 2110.36, "text": " and then they're going to program their you know pre-solved solution into an AI system so we can't"}, {"start": 2110.36, "end": 2119.32, "text": " just let AI systems solve human IQ tests what we need are tests that are reliable which means they"}, {"start": 2119.32, "end": 2126.76, "text": " are reproducible that are valid that means they really measure IQ or they really measure artificial"}, {"start": 2126.76, "end": 2133.48, "text": " intelligence and not you know just tasks specific skill or or something else they're standardized"}, {"start": 2133.48, "end": 2140.2000000000003, "text": " across the spectrum so they're standardized so everyone can do them in the same way by the way"}, {"start": 2140.2000000000003, "end": 2147.32, "text": " the current benchmarks are standardized that's the good part about them and they should be they"}, {"start": 2147.32, "end": 2153.8, "text": " should be free from bias which means they should not measure anything orthogonal to what they claim"}, {"start": 2153.8, "end": 2160.04, "text": " to measure and the example it gives is they should not measure reaction time which is also a big"}, {"start": 2160.04, "end": 2166.2000000000003, "text": " component in human IQ tests you also measure how fast the human is at the test and the machine"}, {"start": 2166.2000000000003, "end": 2172.84, "text": " obviously if you simply put more electrons through the cable it's going to run faster you can"}, {"start": 2172.84, "end": 2183.2400000000002, "text": " or if you put more more GPUs there so in broad terms what we should focus on is this new skill"}, {"start": 2183.24, "end": 2190.2799999999997, "text": " acquisition as I said from the beginning but it is not as easy as you might think right now"}, {"start": 2191.56, "end": 2196.2, "text": " and we're going to dive into the next episode and it's going to be math heavy"}, {"start": 2197.8799999999997, "end": 2204.12, "text": " and that's going to be fun so I hope you enjoyed this kind of special episode maybe let me know if"}, {"start": 2204.12, "end": 2210.12, "text": " you like this style the paper doesn't have any pictures so you're just left with what I'm"}, {"start": 2210.12, "end": 2217.08, "text": " what I'm drawing yeah if you enjoyed this leave a like leave a comment share it out and I'll"}, {"start": 2217.08, "end": 2246.92, "text": " see you next time bye bye"}] |
Yannic Kilcher | 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 a reward from walking from checkpoint to checkpoint. Take a look at this end. This is called the end. It also walks from checkpoint to checkpoint. We've seen a lot of reinforcement learning algorithms in this environment. Where you basically teach these little things to walk around. So what's the impressive part here? The impressive part is that at training time, this end has never ever seen what a checkpoint is and has never gotten any reward from walking from checkpoint to another checkpoint. Actually, it hasn't ever gotten any reward for anything 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, sort of 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 of walking here. And if you know anything about this environment, it's actually not that easy to make the end walk by itself. So 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 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, that's live 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. So 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, a tic-tac-toe. So in tic-tac-toe, 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 going to happen. And I can do this with many things. And I can in my mind continue this and basically roll out the entire games. 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 interactable 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 opposition to that in model free in reinforcement learning, what you do, you are this agent, there's 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 you have basically no clue how the environment will change if you do something. All 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 in action. And you can do this in various ways. Anything you're learning or policy gradient or actor critic and so on, but ultimately, it's simply mapping the up the 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 or techniques tend to work better, I could here 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. 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 known a paper where curious AI takes denoising auto encoders to regularize exactly such a planning procedure to counter this. 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 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 have a learning and 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 print and the model-free learning is of primitives that make model-based planning easy. Okay. 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. So that the model is simply asked to come up with these things or the agent is simply asked to come up with these things. And then 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. And with, if we have a good enough model of the environment, it 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, you 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 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. And 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 2 right here. Okay. So what they want is the following. They want to maximize the mutual information. 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 indexed by z. Now z here, it seems like they're discrete, right? But in this case, they would be a continuous vector. But it's easier if you imagine that, so each one of this is like z1, z2 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 time the agent has to choose a skill and say, 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. It's to say, if I know which state I'm in, what's the entropy over my, okay, that's a wrong bad way for me leading 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, right, 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 that'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 this 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, 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? Tell me about the next state, then if I only show you this. So in this formulation, what we would do is, I would say, I tell you the human is here looking to the right. What can you tell me about the next state? And you would be like, well, I couldn't tell you very much, right? It can, it could 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, 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 going to 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. And to see this, yeah, we only have to imagine what would happen, what would happen 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, whoops, thing. It's basically what you'll have to do is you'll have to decompose it 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. Actually 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 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 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. 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, it 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 you can see that the difference, that the tightness of the bound depends on this quantity right here, which is the k-ild divergence between this and this. So yeah, let's watch this in the context of we can actually 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 entries, which the entries 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 the property of the log. And so it's expectations over logs, these entries. 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 or something is lower 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 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 the true environment. Peer is the true environment, which we don't know, right? We don't know what the environment is 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. All right, so we approximated 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 be basically compensated 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. This is this KL divergence right here. So the KL divergence basically measures how different two distributions are. It's sort of a distance, not exactly a 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 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 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 the tightening of the variational bound. And the second step is this right here to maximize the approximate lower bound. 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. This is going to be the part that says now given that I already have a. 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 which 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 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 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 somehow has to come up with saying, ah, skill zero. That's a, that's a 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 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, um, 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 out loop. And then whether they're 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 max 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. 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, 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 this skill and the state into my world model. And I look 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 say, 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. 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. 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 Z I 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 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 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 select it, 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 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 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 it to be low. Okay? Now 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 this denominator is an approximation to this. It's an approximation. As you can see here, this is 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 an integral over this conditional right here. So they bring in the Z variable. And then they say, well, this is approximately, approximately, we can replace this here by this. And we can replace this here by this. They say, well, since this is an approximation, this is the world model is an approximation to the real world, we can sort of replace that. And then this is the part that doesn't convince me they say, well, this PZ of S, we can just replace it by PZ. Now, this is very tricky to see what these quantities are. Ultimately, it ends up being that right here. But it's so tricky. So they say we replace PZ 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 how you 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, all 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? And this we don't know. 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 that you were acting on the state? 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 just say, well, this is approximately the same. So this right here basically means what skills, 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, basically disregard the state here. And this seems overly shaky. And 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 just replace it. And then sort of things break down. 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 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? Now you know how to like walk forward and walk back and so on. And now 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 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. 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 isn't 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 can 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 and say, I'm in this new situation right here. What should I do? And again, the planner is going to be like, ah, if you first walk forward and then walk back where you're 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 I plan again. 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 are normal since everything is continuous will 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'll do it in such a way that the peak of this normal distribution is going to be the highest where you think you'll 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 picky. And then as you look out, they can be more sort of broad. And that's how you plan ahead. 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 here. Then you imagine forward again, you refine these distributions over the future. And then you take the next step that gets you to 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 tick-tack-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 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 check one, 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, they're 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'm about to check out the paper if you're still here. Thanks for being here. I hope this, this was like 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. You can use math to derive basically these intuitive, very intuitive objectives to learn. It's also pretty cool. Alright, that was it from me and bye-bye. | [{"start": 0.0, "end": 2.72, "text": " Hi there."}, {"start": 2.72, "end": 5.32, "text": " Take a look at this humanoid right here."}, {"start": 5.32, "end": 12.040000000000001, "text": " It walks from one checkpoint to another checkpoint and then to the next checkpoint and so on."}, {"start": 12.040000000000001, "end": 13.040000000000001, "text": " And that is its task."}, {"start": 13.040000000000001, "end": 17.88, "text": " It gets a reward from walking from checkpoint to checkpoint."}, {"start": 17.88, "end": 19.72, "text": " Take a look at this end."}, {"start": 19.72, "end": 21.44, "text": " This is called the end."}, {"start": 21.44, "end": 24.12, "text": " It also walks from checkpoint to checkpoint."}, {"start": 24.12, "end": 30.720000000000002, "text": " We've seen a lot of reinforcement learning algorithms in this environment."}, {"start": 30.720000000000002, "end": 35.24, "text": " Where you basically teach these little things to walk around."}, {"start": 35.24, "end": 37.480000000000004, "text": " So what's the impressive part here?"}, {"start": 37.480000000000004, "end": 45.400000000000006, "text": " The impressive part is that at training time, this end has never ever seen what a checkpoint is"}, {"start": 45.400000000000006, "end": 51.72, "text": " and has never gotten any reward from walking from checkpoint to another checkpoint."}, {"start": 51.72, "end": 57.6, "text": " Actually, it hasn't ever gotten any reward for anything that is given from the environment."}, {"start": 57.6, "end": 61.64, "text": " It has discovered the skill of walking by itself."}, {"start": 61.64, "end": 67.56, "text": " And then at test time, there is no additional learning when it goes from checkpoint to checkpoint."}, {"start": 67.56, "end": 75.32, "text": " It simply composes the skills that it knows from its unsupervised discovery phase"}, {"start": 75.32, "end": 80.0, "text": " in order to go from checkpoint to checkpoint."}, {"start": 80.0, "end": 86.4, "text": " So here you can see this paper basically proposes to learn these skills in a completely unsupervised"}, {"start": 86.4, "end": 87.4, "text": " way."}, {"start": 87.4, "end": 91.8, "text": " At the beginning, sort of, sort of in the training phase, it learns these skills."}, {"start": 91.8, "end": 95.0, "text": " You can see these skills that the humanoid has learned."}, {"start": 95.0, "end": 101.92, "text": " And then all you have to do at test time is to compose these skills to reach a given goal."}, {"start": 101.92, "end": 104.0, "text": " And these are the things that the end has learned."}, {"start": 104.0, "end": 106.03999999999999, "text": " Watch out, this is trippy."}, {"start": 106.04, "end": 111.88000000000001, "text": " You can see it has learned various walks, various ways of walking here."}, {"start": 111.88000000000001, "end": 115.96000000000001, "text": " And if you know anything about this environment, it's actually not that easy to make the"}, {"start": 115.96000000000001, "end": 118.60000000000001, "text": " end walk by itself."}, {"start": 118.60000000000001, "end": 126.08000000000001, "text": " So the discovery here that these skills that are discovered are various ways of walking"}, {"start": 126.08000000000001, "end": 128.72, "text": " is actually already pretty impressive."}, {"start": 128.72, "end": 134.0, "text": " And the last thing here, this cheetah, of course, also has learned to walk back forward,"}, {"start": 134.0, "end": 136.24, "text": " kind of jump around and so on."}, {"start": 136.24, "end": 138.6, "text": " So we're going to dive into this paper."}, {"start": 138.6, "end": 144.96, "text": " It's called Dynamics Aware Unsupervised Discovery of Skills by Archie Sharma and other"}, {"start": 144.96, "end": 147.84, "text": " people of Google Brain."}, {"start": 147.84, "end": 150.84, "text": " So this was published at IClear 2020."}, {"start": 150.84, "end": 157.76, "text": " And on a high level, I already said it's basically proposing to learn unsupervised skills"}, {"start": 157.76, "end": 164.88, "text": " and then to compose these skills in a model-based planning method at test time to reach a given"}, {"start": 164.88, "end": 172.79999999999998, "text": " goal without additional training, without additional training on the reward that you give at test"}, {"start": 172.79999999999998, "end": 174.12, "text": " time."}, {"start": 174.12, "end": 180.23999999999998, "text": " As always, if you like videos like this, you're very welcome to subscribe and share it to"}, {"start": 180.23999999999998, "end": 182.04, "text": " everyone you know."}, {"start": 182.04, "end": 183.04, "text": " Yeah."}, {"start": 183.04, "end": 186.2, "text": " Okay, that's live in."}, {"start": 186.2, "end": 192.79999999999998, "text": " So they say, conventionally model-based reinforcement learning aims to learn a global model for the"}, {"start": 192.79999999999998, "end": 198.2, "text": " dynamics of the environment, which is not exactly true."}, {"start": 198.2, "end": 203.51999999999998, "text": " So we dive into model-based and model-free reinforcement learning."}, {"start": 203.51999999999998, "end": 210.2, "text": " Model-based reinforcement learning basically means that you have a model of the environment."}, {"start": 210.2, "end": 214.76, "text": " A example for this is, let's say, a tic-tac-toe."}, {"start": 214.76, "end": 220.64, "text": " So in tic-tac-toe, I have nine actions at my disposal."}, {"start": 220.64, "end": 227.32, "text": " And if I take action, let's say I take action zero, which is to make a, let's say I'm the"}, {"start": 227.32, "end": 228.32, "text": " X player."}, {"start": 228.32, "end": 230.39999999999998, "text": " So I take action zero."}, {"start": 230.39999999999998, "end": 235.6, "text": " And if I, you know, number my things correctly, then that will result in this state of the"}, {"start": 235.6, "end": 236.6, "text": " world."}, {"start": 236.6, "end": 237.6, "text": " Okay."}, {"start": 237.6, "end": 241.95999999999998, "text": " So I know exactly how the world will look when I take a given action."}, {"start": 241.96, "end": 245.72, "text": " And what that allows me to do is that allows me to actually plan."}, {"start": 245.72, "end": 246.72, "text": " So I cannot plan ahead."}, {"start": 246.72, "end": 250.36, "text": " I can say, what would happen if I took action zero?"}, {"start": 250.36, "end": 252.68, "text": " So I can do this in my mind."}, {"start": 252.68, "end": 257.6, "text": " And then what would happen if I took action one, I can be like, okay, that's going to"}, {"start": 257.6, "end": 258.6, "text": " happen."}, {"start": 258.6, "end": 259.68, "text": " And I can do this with many things."}, {"start": 259.68, "end": 265.88, "text": " And I can in my mind continue this and basically roll out the entire games."}, {"start": 265.88, "end": 273.0, "text": " And then only do the given action that has led to the best result at the end, right?"}, {"start": 273.0, "end": 278.15999999999997, "text": " So this is model, model based reinforcement learning means you have a model of the environment."}, {"start": 278.15999999999997, "end": 282.28, "text": " You know what's going to happen when you perform given actions."}, {"start": 282.28, "end": 288.6, "text": " And you can also combine this with machine learning, like, you know, alpha, alpha, go,"}, {"start": 288.6, "end": 289.6, "text": " alpha zero."}, {"start": 289.6, "end": 292.52, "text": " Or so they have models of the games they're playing."}, {"start": 292.52, "end": 294.08, "text": " They know what's going to happen."}, {"start": 294.08, "end": 299.76, "text": " But it's very interactable to basically go down this entire tree and plan out everything."}, {"start": 299.76, "end": 303.24, "text": " So they combine it with machine learning."}, {"start": 303.24, "end": 306.68, "text": " It doesn't change that it's a model based."}, {"start": 306.68, "end": 312.91999999999996, "text": " Now in opposition to that in model free in reinforcement learning, what you do, you"}, {"start": 312.91999999999996, "end": 317.56, "text": " are this agent, there's the environment, and you simply have to do an action."}, {"start": 317.56, "end": 318.96, "text": " I do action zero."}, {"start": 318.96, "end": 323.56, "text": " And the environment just gives you back a reward and the next observation."}, {"start": 323.56, "end": 331.52, "text": " And you have basically no clue how the environment will change if you do something."}, {"start": 331.52, "end": 339.48, "text": " All these agents do, or the classic model free agents do is basically they're trying to"}, {"start": 339.48, "end": 343.68, "text": " have a neural network somewhere in them."}, {"start": 343.68, "end": 348.04, "text": " And you put the observation in here and outcomes in action."}, {"start": 348.04, "end": 349.2, "text": " And you can do this in various ways."}, {"start": 349.2, "end": 353.71999999999997, "text": " Anything you're learning or policy gradient or actor critic and so on, but ultimately,"}, {"start": 353.71999999999997, "end": 360.15999999999997, "text": " it's simply mapping the up the current observation and maybe the last few to the best action"}, {"start": 360.15999999999997, "end": 365.4, "text": " to take without explicitly modeling what happens in the environment."}, {"start": 365.4, "end": 372.0, "text": " Now when they say model based reinforcement learning, what they mean is technically what"}, {"start": 372.0, "end": 376.8, "text": " you can do if you're in if you are in the model free."}, {"start": 376.8, "end": 382.16, "text": " If you're in this situation, what you could do is you could say well, since these model"}, {"start": 382.16, "end": 388.96000000000004, "text": " based or techniques tend to work better, I could here inside the agent, I could try to"}, {"start": 388.96000000000004, "end": 396.32, "text": " learn a model of the environment, e prime, and I could try to basically learn what happens"}, {"start": 396.32, "end": 398.84000000000003, "text": " in my environment when I do a certain action."}, {"start": 398.84000000000003, "end": 404.84000000000003, "text": " And then I could use that model right here in order to do this planning that I know from"}, {"start": 404.84000000000003, "end": 405.84000000000003, "text": " up here."}, {"start": 405.84, "end": 414.91999999999996, "text": " So in this case, they go for exactly this, they go for let's learn a model of the environment."}, {"start": 414.91999999999996, "end": 418.15999999999997, "text": " This is not an exact model, it's a learned model."}, {"start": 418.15999999999997, "end": 420.4, "text": " And then let's use that to plan."}, {"start": 420.4, "end": 427.91999999999996, "text": " Now this usually has a bunch of, you know, very a bunch of things that go against it namely,"}, {"start": 427.92, "end": 437.16, "text": " if this model right here is bad, then the planning in the model will often accumulate and even"}, {"start": 437.16, "end": 440.0, "text": " exaggerate the errors that are in this model."}, {"start": 440.0, "end": 445.72, "text": " So it's sometimes very hard to learn a model of the world and then use that for planning."}, {"start": 445.72, "end": 455.72, "text": " And I've recently known a paper where curious AI takes denoising auto encoders to regularize"}, {"start": 455.72, "end": 459.52000000000004, "text": " exactly such a planning procedure to counter this."}, {"start": 459.52000000000004, "end": 467.72, "text": " This paper right here is a different approach of combining this learned model, this learned"}, {"start": 467.72, "end": 469.88000000000005, "text": " model."}, {"start": 469.88000000000005, "end": 475.12, "text": " So okay, that was about the first sentence."}, {"start": 475.12, "end": 479.40000000000003, "text": " They say it aims to learn a global model for the dynamics of the environment."}, {"start": 479.40000000000003, "end": 484.76000000000005, "text": " A good model can potentially enable planning algorithms to generate a large variety of"}, {"start": 484.76, "end": 487.28, "text": " behaviors and solve diverse tasks."}, {"start": 487.28, "end": 492.24, "text": " Which is true right, if I have a model of the environment, then I could just use it to"}, {"start": 492.24, "end": 493.24, "text": " plan."}, {"start": 493.24, "end": 497.32, "text": " I wouldn't even have to do anything fancy anymore right, if I have a model of how my"}, {"start": 497.32, "end": 504.15999999999997, "text": " tic-tac-toe works, I can just plan my way to success and I can do this alpha zero style"}, {"start": 504.15999999999997, "end": 510.24, "text": " or if the, if this state tree is small enough, I can actually just use a planner and I don't"}, {"start": 510.24, "end": 514.56, "text": " even have to, I don't have to do anything anymore if I have a good model."}, {"start": 514.56, "end": 519.68, "text": " They say have a learning and accurate model for complex dynamical systems is difficult"}, {"start": 519.68, "end": 524.7199999999999, "text": " and even then the model might not generalize well outside the distribution of states on"}, {"start": 524.7199999999999, "end": 525.8399999999999, "text": " which it was trained."}, {"start": 525.8399999999999, "end": 527.5999999999999, "text": " So this is another problem."}, {"start": 527.5999999999999, "end": 531.52, "text": " If you learn a model, it's only going to be valid in a certain range."}, {"start": 531.52, "end": 532.52, "text": " Okay."}, {"start": 532.52, "end": 541.0, "text": " And say in this work, we combine model-based learning with model-free learning of print and"}, {"start": 541.0, "end": 546.12, "text": " the model-free learning is of primitives that make model-based planning easy."}, {"start": 546.12, "end": 547.12, "text": " Okay."}, {"start": 547.12, "end": 554.56, "text": " So what they attempt to do is they attempt in an unsupervised fashion to learn so-called"}, {"start": 554.56, "end": 556.12, "text": " set of skills."}, {"start": 556.12, "end": 569.44, "text": " And the set of skills could be something like walk forward, walk backward, stay put, jump."}, {"start": 569.44, "end": 577.0400000000001, "text": " So they attempt to learn things like this in a model-free way."}, {"start": 577.0400000000001, "end": 582.0400000000001, "text": " So that the model is simply asked to come up with these things or the agent is simply"}, {"start": 582.0400000000001, "end": 584.44, "text": " asked to come up with these things."}, {"start": 584.44, "end": 592.12, "text": " And then in stage two, a planner can use these skills and decompose a plan."}, {"start": 592.12, "end": 597.5600000000001, "text": " Now this plan here, the special thing about this plan, this planner, it doesn't operate"}, {"start": 597.56, "end": 601.64, "text": " in the space of actions, of like small scale actions."}, {"start": 601.64, "end": 605.64, "text": " It actually operates in the space of these skills right here."}, {"start": 605.64, "end": 609.4399999999999, "text": " So here would be walk forward, walk back."}, {"start": 609.4399999999999, "end": 614.3599999999999, "text": " And with, if we have a good enough model of the environment, it will tell us, if I walk"}, {"start": 614.3599999999999, "end": 617.52, "text": " forward in this situation, what will happen?"}, {"start": 617.52, "end": 618.52, "text": " Okay."}, {"start": 618.52, "end": 623.56, "text": " So I can walk forward and then after that, I could walk backward what's going to happen."}, {"start": 623.56, "end": 630.28, "text": " And if I have a good model of the environment over the, and the actions now are these macro"}, {"start": 630.28, "end": 635.8, "text": " actions of these skills, then I can use planning to reach my goal."}, {"start": 635.8, "end": 636.8, "text": " Okay."}, {"start": 636.8, "end": 643.0, "text": " So the question is, how do we come up with useful skills that the planner can then use?"}, {"start": 643.0, "end": 645.3599999999999, "text": " So they need to be somewhat diverse, right?"}, {"start": 645.3599999999999, "end": 652.0799999999999, "text": " But also, and here is the crucial part and the, the sort of contribution of this paper,"}, {"start": 652.08, "end": 660.88, "text": " they say, how can we discover skills whose outcomes are easy to predict?"}, {"start": 660.88, "end": 666.5200000000001, "text": " And this is how they counteract this notion here, that if your environment model is crap,"}, {"start": 666.5200000000001, "end": 670.48, "text": " then you're, you're, you can't, basically can't be used for planning."}, {"start": 670.48, "end": 672.0, "text": " You'll just make it worse."}, {"start": 672.0, "end": 678.5200000000001, "text": " So what they say is that these things right here, these skills that we learn, we will"}, {"start": 678.52, "end": 682.64, "text": " learn them in a way that make them easy to predict."}, {"start": 682.64, "end": 687.4399999999999, "text": " So it makes, it makes it easy to predict what will happen after I do them."}, {"start": 687.4399999999999, "end": 689.4, "text": " So they must be at the same time diverse."}, {"start": 689.4, "end": 693.4399999999999, "text": " So only, you know, if you stay put, it's pretty easy to predict what's going to happen,"}, {"start": 693.4399999999999, "end": 694.4399999999999, "text": " like nothing."}, {"start": 694.4399999999999, "end": 695.4399999999999, "text": " Okay."}, {"start": 695.4399999999999, "end": 701.28, "text": " But we're going to see in the exact objective that they have to be sort of diverse."}, {"start": 701.28, "end": 705.3199999999999, "text": " But also, so only one of them can be stay put."}, {"start": 705.3199999999999, "end": 706.96, "text": " The other ones have to do something else."}, {"start": 706.96, "end": 711.9200000000001, "text": " And also they should be easily predictable by the environment model."}, {"start": 711.9200000000001, "end": 717.6800000000001, "text": " And if you learn the skills such that they're easily predictable, your environment model"}, {"start": 717.6800000000001, "end": 719.1600000000001, "text": " will make less errors."}, {"start": 719.1600000000001, "end": 722.88, "text": " And then you can use it for planning."}, {"start": 722.88, "end": 723.88, "text": " Okay."}, {"start": 723.88, "end": 726.8000000000001, "text": " Let's dive in."}, {"start": 726.8000000000001, "end": 731.24, "text": " They do actually open source code and they have more of these videos."}, {"start": 731.24, "end": 735.2800000000001, "text": " If you want to check it out, I'll link everything in the description."}, {"start": 735.2800000000001, "end": 736.2800000000001, "text": " Okay."}, {"start": 736.28, "end": 744.36, "text": " Let's actually dive into the, the meat right here."}, {"start": 744.36, "end": 750.76, "text": " They say they do maximize the mutual information."}, {"start": 750.76, "end": 754.88, "text": " And we're going to see between between what and what."}, {"start": 754.88, "end": 756.76, "text": " They want to maximize the mutual information."}, {"start": 756.76, "end": 761.36, "text": " If you don't know what the mutual information is, the mutual information is a quantity."}, {"start": 761.36, "end": 764.72, "text": " The mutual information between x and y is a quantity."}, {"start": 764.72, "end": 768.08, "text": " That's the entropy of x minus the entropy of x conditioned on y."}, {"start": 768.08, "end": 774.6, "text": " Or you can also decompose it in the other way around entropy of y minus entropy of y"}, {"start": 774.6, "end": 776.52, "text": " conditioned on x."}, {"start": 776.52, "end": 782.32, "text": " And we're going to, they apply this, where is it?"}, {"start": 782.32, "end": 784.28, "text": " Equation 2 right here."}, {"start": 784.28, "end": 785.28, "text": " Okay."}, {"start": 785.28, "end": 788.88, "text": " So what they want is the following."}, {"start": 788.88, "end": 792.0, "text": " They want to maximize the mutual information."}, {"start": 792.0, "end": 797.72, "text": " The mutual information basically means how much does one variable tell me about the other"}, {"start": 797.72, "end": 798.72, "text": " variable?"}, {"start": 798.72, "end": 801.72, "text": " Okay."}, {"start": 801.72, "end": 810.28, "text": " The mutual information between the skill and we're going to see what that is and the next"}, {"start": 810.28, "end": 811.28, "text": " state."}, {"start": 811.28, "end": 814.08, "text": " So what, what is a skill?"}, {"start": 814.08, "end": 819.6, "text": " A skill is one entry in our table right here."}, {"start": 819.6, "end": 823.84, "text": " So these here are skills, skills."}, {"start": 823.84, "end": 826.08, "text": " And they're indexed by z."}, {"start": 826.08, "end": 829.4, "text": " Now z here, it seems like they're discrete, right?"}, {"start": 829.4, "end": 833.5600000000001, "text": " But in this case, they would be a continuous vector."}, {"start": 833.5600000000001, "end": 840.64, "text": " But it's easier if you imagine that, so each one of this is like z1, z2 and so on."}, {"start": 840.64, "end": 846.5600000000001, "text": " They're going to be continuous, but in our case, we'll just think of a discrete set of"}, {"start": 846.5600000000001, "end": 848.8000000000001, "text": " skills to be learned."}, {"start": 848.8, "end": 849.8, "text": " Okay."}, {"start": 849.8, "end": 856.7199999999999, "text": " So they say we want to maximize the mutual information between the skill that's currently"}, {"start": 856.7199999999999, "end": 857.7199999999999, "text": " in action."}, {"start": 857.7199999999999, "end": 863.92, "text": " So in every time the agent has to choose a skill and say, okay, now I'm going to walk"}, {"start": 863.92, "end": 865.4799999999999, "text": " forward."}, {"start": 865.4799999999999, "end": 868.8, "text": " And it's in a given state."}, {"start": 868.8, "end": 872.76, "text": " And what you want to say is you have to maximize the mutual information between the skill"}, {"start": 872.76, "end": 878.76, "text": " and the next state, which means that it means two things."}, {"start": 878.76, "end": 880.68, "text": " Which you can see right here."}, {"start": 880.68, "end": 883.8, "text": " You can decompose it in two different ways."}, {"start": 883.8, "end": 885.92, "text": " One way is the following."}, {"start": 885.92, "end": 896.2, "text": " It's to say, if I know which state I'm in, what's the entropy over my, okay, that's"}, {"start": 896.2, "end": 899.76, "text": " a wrong bad way for me leading it."}, {"start": 899.76, "end": 907.04, "text": " It's if I knew, if I know these two things."}, {"start": 907.04, "end": 913.12, "text": " So if I know the state I'm in and the next state that I'm going to, right, I can in hindsight,"}, {"start": 913.12, "end": 914.12, "text": " I look back."}, {"start": 914.12, "end": 922.56, "text": " If I know both things, what can I say about this skill, z right here, that I couldn't"}, {"start": 922.56, "end": 925.8399999999999, "text": " say just from the starting state."}, {"start": 925.8399999999999, "end": 932.56, "text": " So the starting state, let's say, is the person right here."}, {"start": 932.56, "end": 941.4399999999999, "text": " And the end state is the person a little bit more over there."}, {"start": 941.4399999999999, "end": 943.0799999999999, "text": " So that's, let's call this forward."}, {"start": 943.0799999999999, "end": 945.88, "text": " It's the person is looking to the right."}, {"start": 945.88, "end": 946.88, "text": " Okay."}, {"start": 946.88, "end": 952.8399999999999, "text": " Now, if I only show you, if I only show you this state on the left, the starting state,"}, {"start": 952.8399999999999, "end": 957.1199999999999, "text": " what can you tell me which action is going to follow right here?"}, {"start": 957.1199999999999, "end": 958.2399999999999, "text": " Basically you can't tell me much."}, {"start": 958.2399999999999, "end": 962.3199999999999, "text": " It could be any action like, walk forward, walk back, stay put."}, {"start": 962.32, "end": 969.24, "text": " But if I also show you the next state, then you can pretty confidently say, ah, I know"}, {"start": 969.24, "end": 971.9200000000001, "text": " what you did, you did walk forward."}, {"start": 971.9200000000001, "end": 972.9200000000001, "text": " Okay."}, {"start": 972.9200000000001, "end": 980.08, "text": " So this, in this situation, we would have a high mutual information between z and s prime"}, {"start": 980.08, "end": 981.72, "text": " in the formulation here."}, {"start": 981.72, "end": 985.44, "text": " If you decompose it in the other way, this is equivalent, but it's a different way of"}, {"start": 985.44, "end": 986.8000000000001, "text": " thinking about it."}, {"start": 986.8000000000001, "end": 992.2800000000001, "text": " It means when I show you these two things, how much more can you tell me?"}, {"start": 992.28, "end": 996.24, "text": " Tell me about the next state, then if I only show you this."}, {"start": 996.24, "end": 1003.36, "text": " So in this formulation, what we would do is, I would say, I tell you the human is here"}, {"start": 1003.36, "end": 1004.68, "text": " looking to the right."}, {"start": 1004.68, "end": 1007.36, "text": " What can you tell me about the next state?"}, {"start": 1007.36, "end": 1012.12, "text": " And you would be like, well, I couldn't tell you very much, right?"}, {"start": 1012.12, "end": 1014.24, "text": " It can, it could be anything."}, {"start": 1014.24, "end": 1020.12, "text": " But if I then tell you the action is walk forward, then you could say, ah, now I, now"}, {"start": 1020.12, "end": 1023.64, "text": " I get it, it's probably going to be something like this."}, {"start": 1023.64, "end": 1024.8, "text": " Okay."}, {"start": 1024.8, "end": 1027.24, "text": " This also would be a high mutual information."}, {"start": 1027.24, "end": 1033.88, "text": " So you see that the, the task of maximizing this mutual information is good because what"}, {"start": 1033.88, "end": 1040.52, "text": " happens if I don't, if I have a low mutual information, if I have a low mutual information,"}, {"start": 1040.52, "end": 1048.96, "text": " it would mean that I could predict the next state just as well from the current state."}, {"start": 1048.96, "end": 1053.48, "text": " It doesn't make a difference whether you give me the, the skill or not."}, {"start": 1053.48, "end": 1055.44, "text": " It would not make a difference."}, {"start": 1055.44, "end": 1061.32, "text": " And that is only the case if my skills are basically either all the same or all pretty,"}, {"start": 1061.32, "end": 1063.28, "text": " pretty random and pretty useless."}, {"start": 1063.28, "end": 1064.28, "text": " Right."}, {"start": 1064.28, "end": 1069.3600000000001, "text": " So if, if all my skills are basically walking backwards, then I don't, you don't have"}, {"start": 1069.3600000000001, "end": 1071.16, "text": " to tell me which skill you do."}, {"start": 1071.16, "end": 1073.96, "text": " I'm going to know that the next state is like this."}, {"start": 1073.96, "end": 1081.28, "text": " So you can see that the objective of maximizing the mutual information between the skill and"}, {"start": 1081.28, "end": 1088.8, "text": " the next state is going to result in a situation where these skills are going to be first of"}, {"start": 1088.8, "end": 1097.0, "text": " all diverse and second of all easy to, easy to predict."}, {"start": 1097.0, "end": 1103.8400000000001, "text": " And to see this, yeah, we only have to imagine what would happen, what would happen in a"}, {"start": 1103.84, "end": 1108.4399999999998, "text": " situation where the skills weren't diverse or weren't easy to predict."}, {"start": 1108.4399999999998, "end": 1113.1999999999998, "text": " And you'll get exactly the situation where the information of the skill doesn't help"}, {"start": 1113.1999999999998, "end": 1118.6799999999998, "text": " you in predicting the next state because yeah, either it's obvious or it's random."}, {"start": 1118.6799999999998, "end": 1119.6799999999998, "text": " Okay."}, {"start": 1119.6799999999998, "end": 1125.52, "text": " So we agree that it makes sense to maximize the mutual information."}, {"start": 1125.52, "end": 1128.9599999999998, "text": " And they decompose this into two objectives."}, {"start": 1128.9599999999998, "end": 1133.56, "text": " So they say the mutual information, whoops, thing."}, {"start": 1133.56, "end": 1142.44, "text": " It's basically what you'll have to do is you'll have to decompose it into two terms where"}, {"start": 1142.44, "end": 1148.8799999999999, "text": " you can into two terms in a lower bound in the mutual information."}, {"start": 1148.8799999999999, "end": 1154.2, "text": " And this is kind of the, this is sort of the standard variational approximation literature."}, {"start": 1154.2, "end": 1160.08, "text": " If you're into that, read up on variational auto encoders and things like this."}, {"start": 1160.08, "end": 1166.96, "text": " Actually the two steps here are you tighten the variational lower bound and you maximize"}, {"start": 1166.96, "end": 1169.3999999999999, "text": " the approximate lower bound."}, {"start": 1169.3999999999999, "end": 1170.3999999999999, "text": " Okay."}, {"start": 1170.3999999999999, "end": 1175.6, "text": " So you have the mutual information and you can lower bound it."}, {"start": 1175.6, "end": 1176.6, "text": " Okay."}, {"start": 1176.6, "end": 1181.3999999999999, "text": " You can lower bound it by this quantity."}, {"start": 1181.3999999999999, "end": 1186.56, "text": " Now the, if since this is a lower bound, you can prove that this is a lower bound."}, {"start": 1186.56, "end": 1195.08, "text": " It means that the higher you make this term, then the more basically, okay, if it's a"}, {"start": 1195.08, "end": 1198.84, "text": " lower, I don't know how to formulate, but it should be fairly obvious."}, {"start": 1198.84, "end": 1203.8, "text": " If this, if this thing on the right is a lower bound to the mutual information, then maximizing"}, {"start": 1203.8, "end": 1208.12, "text": " the thing on the right will maximize the thing on the left."}, {"start": 1208.12, "end": 1210.9199999999998, "text": " And it will do so."}, {"start": 1210.9199999999998, "end": 1216.52, "text": " So imagine I is up here and this E on the right side is down here."}, {"start": 1216.52, "end": 1217.52, "text": " It's a lower bound, right?"}, {"start": 1217.52, "end": 1219.12, "text": " It's lower than I."}, {"start": 1219.12, "end": 1225.56, "text": " So if I maximize E, well, I haven't really done anything to I, but if I maximize it even"}, {"start": 1225.56, "end": 1231.84, "text": " more up to here and since it's a lower bound, I know now my I must be at least higher than"}, {"start": 1231.84, "end": 1232.84, "text": " this."}, {"start": 1232.84, "end": 1233.84, "text": " Okay."}, {"start": 1233.84, "end": 1239.08, "text": " So maximizing a lower bound to a quantity will ultimately increase the quantity, but you"}, {"start": 1239.08, "end": 1245.8, "text": " can also, the efficiency by which it does this, it depends on how tight the bound is."}, {"start": 1245.8, "end": 1253.96, "text": " So if the bound is very tight like this, you see, I is not much above E. If the bound"}, {"start": 1253.96, "end": 1260.6, "text": " is very tight, then maximizing E will result in a faster maximization of I."}, {"start": 1260.6, "end": 1261.6, "text": " Okay."}, {"start": 1261.6, "end": 1263.2, "text": " So you can do two things."}, {"start": 1263.2, "end": 1268.6399999999999, "text": " You can maximize the quantity that is the lower bound or you can tighten the bound."}, {"start": 1268.6399999999999, "end": 1272.6399999999999, "text": " And here you can see that the difference, that the tightness of the bound depends on"}, {"start": 1272.64, "end": 1278.1200000000001, "text": " this quantity right here, which is the k-ild divergence between this and this."}, {"start": 1278.1200000000001, "end": 1289.2, "text": " So yeah, let's watch this in the context of we can actually go through it on the high"}, {"start": 1289.2, "end": 1290.2, "text": " level."}, {"start": 1290.2, "end": 1297.1200000000001, "text": " If you've never done this variational approximation sort of math, then this might be a bit informative."}, {"start": 1297.12, "end": 1304.36, "text": " Okay, so the thing right here is just pops out of the definition of the mutual information."}, {"start": 1304.36, "end": 1311.12, "text": " It's the, it's basically the differences of the entries, which the entries are log quantities,"}, {"start": 1311.12, "end": 1312.12, "text": " right?"}, {"start": 1312.12, "end": 1318.4399999999998, "text": " So if you have a log a minus log b, that you can also write this as the log of the fraction"}, {"start": 1318.4399999999998, "end": 1319.6, "text": " of a over b."}, {"start": 1319.6, "end": 1323.12, "text": " That's just the property of the log."}, {"start": 1323.12, "end": 1327.0, "text": " And so it's expectations over logs, these entries."}, {"start": 1327.0, "end": 1329.96, "text": " So you can write it as this thing right here."}, {"start": 1329.96, "end": 1339.24, "text": " Okay, and this basically says this is very high if or very low, depending."}, {"start": 1339.24, "end": 1345.88, "text": " So you need to whether or something is lower high, always will depend on what you exactly"}, {"start": 1345.88, "end": 1348.32, "text": " you have to consider."}, {"start": 1348.32, "end": 1357.52, "text": " But ultimately, what you'll want is the ratio between this quantity, which is the probability"}, {"start": 1357.52, "end": 1363.72, "text": " of the next state given the current state and the skill you're taking divided by just"}, {"start": 1363.72, "end": 1371.96, "text": " the probability over the next state given the current state in expectation over all the"}, {"start": 1371.96, "end": 1375.3999999999999, "text": " skills, current states and next states."}, {"start": 1375.4, "end": 1381.64, "text": " Now what they're saying is this here, this is basically the environment, right?"}, {"start": 1381.64, "end": 1387.16, "text": " This is if you are in a state and you perform a skill, what's the next state?"}, {"start": 1387.16, "end": 1388.88, "text": " That's the true environment."}, {"start": 1388.88, "end": 1392.3200000000002, "text": " Peer is the true environment, which we don't know, right?"}, {"start": 1392.3200000000002, "end": 1397.44, "text": " We don't know what the environment is going to do, but we would like to learn a model"}, {"start": 1397.44, "end": 1398.88, "text": " for the environment."}, {"start": 1398.88, "end": 1410.68, "text": " And this model for the environment is now Q, Q theta, phi theta, phi, Greek letter."}, {"start": 1410.68, "end": 1418.3200000000002, "text": " So Q phi here is going to be a neural network that will approximate the environment."}, {"start": 1418.3200000000002, "end": 1424.4, "text": " And in this probabilistic framework, it is going to be a learned distribution that will"}, {"start": 1424.4, "end": 1427.24, "text": " approximate the distribution of P."}, {"start": 1427.24, "end": 1430.8, "text": " All right, so we approximated by this."}, {"start": 1430.8, "end": 1435.04, "text": " But now this is here, it says equal, equal, right?"}, {"start": 1435.04, "end": 1438.44, "text": " This is not equal because this is just an approximation."}, {"start": 1438.44, "end": 1447.76, "text": " So the equality must be basically compensated by this term right here."}, {"start": 1447.76, "end": 1451.92, "text": " You can see this here is expanded into these two."}, {"start": 1451.92, "end": 1456.08, "text": " You can go through the exact definitions and see why this is an equality, but basically"}, {"start": 1456.08, "end": 1463.36, "text": " you can say that the mutual information is this expectation or it is this expectation,"}, {"start": 1463.36, "end": 1467.24, "text": " but now you have to correct for the fact that here you only have an approximation."}, {"start": 1467.24, "end": 1473.56, "text": " And you have to correct for the fact by exactly the amount by which the approximation is"}, {"start": 1473.56, "end": 1477.12, "text": " different than the quantity that you're approximating."}, {"start": 1477.12, "end": 1480.76, "text": " This is this KL divergence right here."}, {"start": 1480.76, "end": 1487.48, "text": " So the KL divergence basically measures how different two distributions are."}, {"start": 1487.48, "end": 1493.0, "text": " It's sort of a distance, not exactly a distance, but sort of a distance between these two"}, {"start": 1493.0, "end": 1494.0, "text": " distributions right here."}, {"start": 1494.0, "end": 1497.68, "text": " It says here's the real world and here is your estimate of the real world."}, {"start": 1497.68, "end": 1500.68, "text": " How much do they disagree?"}, {"start": 1500.68, "end": 1509.04, "text": " And that quantity plus then you can replace the exact world distribution by your approximate"}, {"start": 1509.04, "end": 1510.24, "text": " distribution."}, {"start": 1510.24, "end": 1514.64, "text": " And you still are equal to the mutual information."}, {"start": 1514.64, "end": 1520.6, "text": " And now the basically the trick is you say, oh, the KL divergence is always positive."}, {"start": 1520.6, "end": 1524.28, "text": " It's a quantity that it can only be a positive number."}, {"start": 1524.28, "end": 1530.48, "text": " So if I leave it away, certainly this is going to be a lower bound to the quantity."}, {"start": 1530.48, "end": 1531.48, "text": " Okay."}, {"start": 1531.48, "end": 1533.44, "text": " All right."}, {"start": 1533.44, "end": 1535.08, "text": " So two tasks right here."}, {"start": 1535.08, "end": 1539.8, "text": " First of all, tighten the variational bound, which means make this quantity small."}, {"start": 1539.8, "end": 1544.72, "text": " Make your approximate world model as close as possible to the real world."}, {"start": 1544.72, "end": 1546.8799999999999, "text": " How do we do this neural network?"}, {"start": 1546.8799999999999, "end": 1547.8799999999999, "text": " Okay."}, {"start": 1547.8799999999999, "end": 1550.1599999999999, "text": " You input trajectories."}, {"start": 1550.1599999999999, "end": 1551.1599999999999, "text": " I was in this state."}, {"start": 1551.1599999999999, "end": 1555.36, "text": " I performed this skill and I ended up in this state."}, {"start": 1555.36, "end": 1557.04, "text": " Sorry, that's this."}, {"start": 1557.04, "end": 1561.6399999999999, "text": " And then you simply match your neural network, simply matches what happens in the real world."}, {"start": 1561.6399999999999, "end": 1565.6, "text": " It learns the transition function basically."}, {"start": 1565.6, "end": 1569.44, "text": " So that's the tightening of the variational bound."}, {"start": 1569.44, "end": 1581.92, "text": " And the second step is this right here to maximize the approximate lower bound."}, {"start": 1581.92, "end": 1583.76, "text": " The first step was tighten variational low bound."}, {"start": 1583.76, "end": 1586.88, "text": " That basically means make your world model more accurate."}, {"start": 1586.88, "end": 1591.16, "text": " And the second is tighten that maximize the approximate lower bound."}, {"start": 1591.16, "end": 1593.4, "text": " Now this is going to part."}, {"start": 1593.4, "end": 1599.04, "text": " This is going to be the part that says now given that I already have a."}, {"start": 1599.04, "end": 1601.68, "text": " A better world model right here."}, {"start": 1601.68, "end": 1610.84, "text": " Can I improve my can I sort of improve my skills such that they become easier to predict"}, {"start": 1610.84, "end": 1612.52, "text": " and more diverse?"}, {"start": 1612.52, "end": 1619.24, "text": " Can I improve my skills such that this mutual information right here gets to be high as"}, {"start": 1619.24, "end": 1621.0, "text": " high as possible?"}, {"start": 1621.0, "end": 1622.76, "text": " Okay."}, {"start": 1622.76, "end": 1626.32, "text": " So this is sort of an alternating thing."}, {"start": 1626.32, "end": 1632.56, "text": " And you can see this in this very, very, very, very confusing diagram honestly."}, {"start": 1632.56, "end": 1635.52, "text": " So what are you going to do in this algorithm?"}, {"start": 1635.52, "end": 1640.1599999999999, "text": " First of all, in each episode, you're going to select a skill at random."}, {"start": 1640.1599999999999, "end": 1643.12, "text": " And as I said, these skills, they're not predefined."}, {"start": 1643.12, "end": 1648.9199999999998, "text": " So no one tells the agent to walk for which it simply says, okay, you have like in a discrete"}, {"start": 1648.9199999999998, "end": 1653.12, "text": " case, you would have like you have five skill slots, right?"}, {"start": 1653.12, "end": 1657.4399999999998, "text": " And the only thing I require is that they're sort of consistent over time."}, {"start": 1657.4399999999998, "end": 1661.1999999999998, "text": " So skill one is always going to be sort of the same thing and skill two."}, {"start": 1661.1999999999998, "end": 1665.0, "text": " But agent, you can basically decide what skill one is, right?"}, {"start": 1665.0, "end": 1671.1599999999999, "text": " But make the skills such that it's predictable and that the different skills are diverse."}, {"start": 1671.1599999999999, "end": 1672.1599999999999, "text": " Okay."}, {"start": 1672.1599999999999, "end": 1677.08, "text": " So you're going to sample one of the skills like skill zero or whatnot."}, {"start": 1677.08, "end": 1680.2399999999998, "text": " And then you're going to do two things."}, {"start": 1680.24, "end": 1689.24, "text": " First of all, you're going to learn these skill dynamics, which is you're going to learn"}, {"start": 1689.24, "end": 1693.64, "text": " your approximate model of the world, okay?"}, {"start": 1693.64, "end": 1695.88, "text": " And how do you do that?"}, {"start": 1695.88, "end": 1703.68, "text": " Basically here, you're the agent and the agent will, so what does the agent have to do?"}, {"start": 1703.68, "end": 1711.0800000000002, "text": " The agent will take in the skill Z and it will take in the current state of the world"}, {"start": 1711.0800000000002, "end": 1712.96, "text": " and it will output an action."}, {"start": 1712.96, "end": 1715.3200000000002, "text": " Now this is the model free part, right?"}, {"start": 1715.3200000000002, "end": 1719.72, "text": " So the agent somehow has to come up with saying, ah, skill zero."}, {"start": 1719.72, "end": 1722.28, "text": " That's a, that's a walking forward."}, {"start": 1722.28, "end": 1729.8400000000001, "text": " And in this situation, walking forward means I have to lift my leg or something like this."}, {"start": 1729.8400000000001, "end": 1731.92, "text": " So you're going to take your skill."}, {"start": 1731.92, "end": 1735.72, "text": " You're going to, with your agent, perform an action based on that skill and the current"}, {"start": 1735.72, "end": 1737.48, "text": " state of the world."}, {"start": 1737.48, "end": 1741.28, "text": " Then the environment is going to give you the next state right here."}, {"start": 1741.28, "end": 1745.5600000000002, "text": " And from those things, you can now learn your world model."}, {"start": 1745.5600000000002, "end": 1748.44, "text": " You know, I was in state S."}, {"start": 1748.44, "end": 1754.68, "text": " I performed action A, but I performed action A based on skill Z."}, {"start": 1754.68, "end": 1758.72, "text": " And then I ended up in state S prime."}, {"start": 1758.72, "end": 1762.0, "text": " And I can learn a model of the world, right?"}, {"start": 1762.0, "end": 1763.0, "text": " This is a triple."}, {"start": 1763.0, "end": 1765.44, "text": " I can do supervised learning of a world model."}, {"start": 1765.44, "end": 1769.76, "text": " Now here they do probabilistic learning, but, um, and we're going to see in a second"}, {"start": 1769.76, "end": 1771.16, "text": " how that works."}, {"start": 1771.16, "end": 1775.04, "text": " But ultimately they approximate the world with their model."}, {"start": 1775.04, "end": 1777.3600000000001, "text": " Cool."}, {"start": 1777.3600000000001, "end": 1778.84, "text": " So that's the, this out loop."}, {"start": 1778.84, "end": 1785.16, "text": " And then whether they're going to do next, they're going to use that world model to determine"}, {"start": 1785.16, "end": 1788.0, "text": " a reward for the agent."}, {"start": 1788.0, "end": 1792.24, "text": " And the reward for the agent for taking the action."}, {"start": 1792.24, "end": 1797.32, "text": " So the reward is going to be, oh, agent, you took action A."}, {"start": 1797.32, "end": 1799.12, "text": " Now what's your reward for doing this?"}, {"start": 1799.12, "end": 1802.32, "text": " This is the model free reinforcement learning part."}, {"start": 1802.32, "end": 1812.48, "text": " Your reward is going to be very high if, if this was very predictable."}, {"start": 1812.48, "end": 1815.36, "text": " And if it is also diverse, right?"}, {"start": 1815.36, "end": 1824.12, "text": " So now the agent has to sort of max sort of the agent has to go and make this quantity"}, {"start": 1824.12, "end": 1825.12, "text": " very high."}, {"start": 1825.12, "end": 1832.1599999999999, "text": " This, we want the outcome of these actions to be predictable and dive and the actions"}, {"start": 1832.1599999999999, "end": 1835.0, "text": " themselves to be diverse."}, {"start": 1835.0, "end": 1839.6399999999999, "text": " It is, I'm sorry, it's very hard to keep all of this very straight."}, {"start": 1839.6399999999999, "end": 1840.6399999999999, "text": " Okay."}, {"start": 1840.64, "end": 1847.3200000000002, "text": " Ultimately, two steps, learn world model from the experience that you've generated."}, {"start": 1847.3200000000002, "end": 1853.76, "text": " And second thing, learn the agent such that it maximizes this, this quantity that we've"}, {"start": 1853.76, "end": 1855.24, "text": " seen before."}, {"start": 1855.24, "end": 1862.5600000000002, "text": " And you do this via giving the agent a reward that is proportional to the mutual information."}, {"start": 1862.56, "end": 1873.72, "text": " And we've already seen that we can approximate the mutual information by, by this quantity"}, {"start": 1873.72, "end": 1874.72, "text": " here."}, {"start": 1874.72, "end": 1876.84, "text": " Okay."}, {"start": 1876.84, "end": 1882.8799999999999, "text": " So learn world model and make the agent go higher mutual information."}, {"start": 1882.8799999999999, "end": 1883.8799999999999, "text": " Two steps."}, {"start": 1883.8799999999999, "end": 1884.8799999999999, "text": " Okay."}, {"start": 1884.8799999999999, "end": 1888.6, "text": " Learn world model is very, very classic."}, {"start": 1888.6, "end": 1893.52, "text": " You can say, okay, I need to improve, I need to minimize this KL divergence."}, {"start": 1893.52, "end": 1898.12, "text": " So I need the gradient with respect to the parameters of my world model."}, {"start": 1898.12, "end": 1903.32, "text": " I can write down the KL divergence like this."}, {"start": 1903.32, "end": 1910.4399999999998, "text": " And then since I can do this reverse, so log a over b is log a minus log b."}, {"start": 1910.4399999999998, "end": 1915.32, "text": " And since the world doesn't depend on the parameters of my model, this will simply"}, {"start": 1915.32, "end": 1922.28, "text": " give me this thing right here, which is the gradient of the log probability, basically,"}, {"start": 1922.28, "end": 1923.48, "text": " of my neural network."}, {"start": 1923.48, "end": 1926.84, "text": " And this can be just optimized straightforward."}, {"start": 1926.84, "end": 1930.32, "text": " This is a neural network, optimized with gradient descent."}, {"start": 1930.32, "end": 1931.32, "text": " These are the inputs."}, {"start": 1931.32, "end": 1933.32, "text": " This is the output."}, {"start": 1933.32, "end": 1937.4399999999998, "text": " Now, okay, this is all probability distributions."}, {"start": 1937.4399999999998, "end": 1941.0, "text": " But ultimately, you can, you can do it pretty straightforward, okay?"}, {"start": 1941.0, "end": 1947.64, "text": " So corresponds to maximizing the likelihood of the samples from P under Q."}, {"start": 1947.64, "end": 1953.64, "text": " Now the second step, maximize the approximate lower bound, okay?"}, {"start": 1953.64, "end": 1962.56, "text": " So after they say after fitting Q, after improving our world model, we can optimize pi, pi"}, {"start": 1962.56, "end": 1966.64, "text": " is the agent that actually takes the actions based on the skill."}, {"start": 1966.64, "end": 1970.98, "text": " So it's given a skill and it needs to perform an action."}, {"start": 1970.98, "end": 1977.88, "text": " And it needs to maximize this quantity, as we've seen, needs to maximize the mutual information"}, {"start": 1977.88, "end": 1985.04, "text": " between if I know the action and if I don't, or the mutual information between the skill"}, {"start": 1985.04, "end": 1988.1200000000001, "text": " and the next state."}, {"start": 1988.1200000000001, "end": 1994.8, "text": " I say note, this is a reinforcement learning style optimization with a reward function of"}, {"start": 1994.8, "end": 1996.44, "text": " this quantity."}, {"start": 1996.44, "end": 2001.24, "text": " However, so you look at the quantity that they need right here."}, {"start": 2001.24, "end": 2004.48, "text": " The quantity is going to be this thing."}, {"start": 2004.48, "end": 2009.88, "text": " And this thing is just, I feed this skill and the state into my world model."}, {"start": 2009.88, "end": 2012.88, "text": " And I look what comes out of the world model."}, {"start": 2012.88, "end": 2015.4, "text": " So this, I can compute, right?"}, {"start": 2015.4, "end": 2022.48, "text": " But this thing right here, I can't compute because this is, this is what happens in the"}, {"start": 2022.48, "end": 2029.68, "text": " world when I'm in state S and I just run my agent over in expectation over all the"}, {"start": 2029.68, "end": 2031.32, "text": " skills."}, {"start": 2031.32, "end": 2032.32, "text": " So this I don't know."}, {"start": 2032.32, "end": 2036.76, "text": " They have a log of this is intractable."}, {"start": 2036.76, "end": 2042.3600000000001, "text": " And they so we approximate the reward function for pi as this thing right here."}, {"start": 2042.3600000000001, "end": 2047.48, "text": " Now first, let's look at what this thing is."}, {"start": 2047.48, "end": 2056.2, "text": " So the reward of taking action a and action a is based on skill Z, right?"}, {"start": 2056.2, "end": 2058.56, "text": " So skill Z was fed into the agent."}, {"start": 2058.56, "end": 2063.04, "text": " The agent comes up with action a say, oh, you want me to walk forward in this situation."}, {"start": 2063.04, "end": 2065.08, "text": " Okay, I'm going to lift my leg."}, {"start": 2065.08, "end": 2066.08, "text": " That's the action."}, {"start": 2066.08, "end": 2067.08, "text": " Okay."}, {"start": 2067.08, "end": 2072.12, "text": " So the reward for this action given this skill and given the current state is going to be"}, {"start": 2072.12, "end": 2073.12, "text": " what?"}, {"start": 2073.12, "end": 2078.12, "text": " It's going to be very high if this here is very high."}, {"start": 2078.12, "end": 2087.8399999999997, "text": " So it's going to be very high if the probability, so this S prime is the state you ended up in."}, {"start": 2087.8399999999997, "end": 2091.8399999999997, "text": " So after taking the action, you ended up in S prime."}, {"start": 2091.8399999999997, "end": 2096.8399999999997, "text": " So if what does it mean when this quantity is very high?"}, {"start": 2096.84, "end": 2105.52, "text": " It means that my world model Q that is approximating the world thinks that this state is very"}, {"start": 2105.52, "end": 2111.1600000000003, "text": " probable if you were in this state and are given the skill Z."}, {"start": 2111.1600000000003, "end": 2117.4, "text": " So this basically means that the neural network can predict with very high accuracy what's"}, {"start": 2117.4, "end": 2124.6000000000004, "text": " going to happen if you are in this state and are given this skill to perform."}, {"start": 2124.6, "end": 2128.44, "text": " This is one of the things that we want."}, {"start": 2128.44, "end": 2130.3199999999997, "text": " Now what is it divided by?"}, {"start": 2130.3199999999997, "end": 2132.72, "text": " It's divided by this."}, {"start": 2132.72, "end": 2137.7999999999997, "text": " And you can see here the Z I are other skills."}, {"start": 2137.7999999999997, "end": 2141.04, "text": " So it is what does this mean?"}, {"start": 2141.04, "end": 2142.6, "text": " This is almost the same quantity."}, {"start": 2142.6, "end": 2151.68, "text": " It means how well can the same neural network predict the next state if you were given a different"}, {"start": 2151.68, "end": 2152.68, "text": " skill?"}, {"start": 2152.68, "end": 2161.12, "text": " So it means if I'm here and I ended up here, how well can you predict it if I tell you"}, {"start": 2161.12, "end": 2163.64, "text": " that I walked forward?"}, {"start": 2163.64, "end": 2168.56, "text": " And here you ask, well, how well can you predict it if I told you you walked backward,"}, {"start": 2168.56, "end": 2171.64, "text": " if I told you you jumped, if I told you, and so on."}, {"start": 2171.64, "end": 2180.96, "text": " So you basically aggregate over all the other skills you could perform and each time you"}, {"start": 2180.96, "end": 2185.64, "text": " ask the neural network, well, how likely is it that you end up in the state that I ended"}, {"start": 2185.64, "end": 2187.32, "text": " up when?"}, {"start": 2187.32, "end": 2194.08, "text": " So what does it mean if this quantity is high or sorry, if the entire sum here is high?"}, {"start": 2194.08, "end": 2199.56, "text": " That means that the skill doesn't really give you much information."}, {"start": 2199.56, "end": 2201.16, "text": " The neural network is very good."}, {"start": 2201.16, "end": 2203.4, "text": " No matter which skill you select it, right?"}, {"start": 2203.4, "end": 2205.56, "text": " It's very accurate in predicting the next state."}, {"start": 2205.56, "end": 2206.8, "text": " Doesn't really matter."}, {"start": 2206.8, "end": 2208.7200000000003, "text": " The skill doesn't really matter."}, {"start": 2208.72, "end": 2211.16, "text": " And this is what we don't want, right?"}, {"start": 2211.16, "end": 2216.7599999999998, "text": " We want that the skills are very diverse, right?"}, {"start": 2216.7599999999998, "end": 2219.0, "text": " So the top part is they're easy."}, {"start": 2219.0, "end": 2224.08, "text": " It's easy to predict what will happen if you perform a given skill."}, {"start": 2224.08, "end": 2227.24, "text": " And we divide this by the bottom part."}, {"start": 2227.24, "end": 2232.9599999999996, "text": " And this makes it such that these skills are very diverse because if they're not diverse,"}, {"start": 2232.9599999999996, "end": 2235.7599999999998, "text": " then it doesn't really matter which one you perform."}, {"start": 2235.76, "end": 2240.44, "text": " And then this quantity on the bottom will be very high, but we divide by it."}, {"start": 2240.44, "end": 2244.2000000000003, "text": " So we want it to be low."}, {"start": 2244.2000000000003, "end": 2245.2000000000003, "text": " Okay?"}, {"start": 2245.2000000000003, "end": 2249.84, "text": " Now the reward is going to be the log of this fraction here."}, {"start": 2249.84, "end": 2256.8, "text": " And this makes sense, right, intuitively, but they're going to try to motivate this mathematically."}, {"start": 2256.8, "end": 2260.96, "text": " And for motivating this mathematically, of course, they need to approximate this quantity"}, {"start": 2260.96, "end": 2262.28, "text": " right here."}, {"start": 2262.28, "end": 2270.28, "text": " This quantity is the denominator, so this denominator is an approximation to this."}, {"start": 2270.28, "end": 2271.96, "text": " It's an approximation."}, {"start": 2271.96, "end": 2280.92, "text": " As you can see here, this is sort of a sample-based approximation to the transition from S to"}, {"start": 2280.92, "end": 2284.76, "text": " S prime under the distribution of Z."}, {"start": 2284.76, "end": 2293.5200000000004, "text": " But what you want is just is the transition from S to S prime, not in your approximation,"}, {"start": 2293.5200000000004, "end": 2296.28, "text": " but in the real world."}, {"start": 2296.28, "end": 2299.2400000000002, "text": " And they formulate this."}, {"start": 2299.2400000000002, "end": 2309.0400000000004, "text": " They say, okay, we can decompose it as such as an integral over this conditional right"}, {"start": 2309.0400000000004, "end": 2310.0400000000004, "text": " here."}, {"start": 2310.0400000000004, "end": 2313.44, "text": " So they bring in the Z variable."}, {"start": 2313.44, "end": 2325.44, "text": " And then they say, well, this is approximately, approximately, we can replace this here by"}, {"start": 2325.44, "end": 2326.64, "text": " this."}, {"start": 2326.64, "end": 2329.28, "text": " And we can replace this here by this."}, {"start": 2329.28, "end": 2336.36, "text": " They say, well, since this is an approximation, this is the world model is an approximation"}, {"start": 2336.36, "end": 2340.52, "text": " to the real world, we can sort of replace that."}, {"start": 2340.52, "end": 2349.7599999999998, "text": " And then this is the part that doesn't convince me they say, well, this PZ of S, we can just"}, {"start": 2349.7599999999998, "end": 2351.56, "text": " replace it by PZ."}, {"start": 2351.56, "end": 2357.36, "text": " Now, this is very tricky to see what these quantities are."}, {"start": 2357.36, "end": 2360.08, "text": " Ultimately, it ends up being that right here."}, {"start": 2360.08, "end": 2362.6, "text": " But it's so tricky."}, {"start": 2362.6, "end": 2371.92, "text": " So they say we replace PZ given S by P of Z."}, {"start": 2371.92, "end": 2377.0, "text": " And okay, let's think about this for a second."}, {"start": 2377.0, "end": 2381.64, "text": " What does the top, the bottom quantity is simply the distribution over your skills."}, {"start": 2381.64, "end": 2385.64, "text": " And depending on how you sample them, this could be like a uniform distribution over"}, {"start": 2385.64, "end": 2386.64, "text": " your skills."}, {"start": 2386.64, "end": 2388.0, "text": " Like, that's fine."}, {"start": 2388.0, "end": 2389.7999999999997, "text": " But what's the top thing?"}, {"start": 2389.7999999999997, "end": 2391.88, "text": " The top thing, basically."}, {"start": 2391.88, "end": 2395.1600000000003, "text": " We can use base formula to reformulate it."}, {"start": 2395.1600000000003, "end": 2410.2400000000002, "text": " It's P of S given Z times P of, all right, times P of Z divided by P of S."}, {"start": 2410.2400000000002, "end": 2414.28, "text": " So this quantity depends on multiple things."}, {"start": 2414.28, "end": 2417.08, "text": " Here's that prior again."}, {"start": 2417.08, "end": 2422.64, "text": " And this means what's the general distribution of states?"}, {"start": 2422.64, "end": 2429.52, "text": " What's the general distribution of states if your agent acts in the world, right?"}, {"start": 2429.52, "end": 2431.12, "text": " And this we don't know."}, {"start": 2431.12, "end": 2433.56, "text": " We don't know."}, {"start": 2433.56, "end": 2435.52, "text": " And also this right here."}, {"start": 2435.52, "end": 2439.12, "text": " What's the distribution in the true world?"}, {"start": 2439.12, "end": 2447.04, "text": " What's the probability of a state given a given that you were acting on the state?"}, {"start": 2447.04, "end": 2449.32, "text": " Under a skill Z."}, {"start": 2449.32, "end": 2454.0, "text": " And this is also something we don't know because we don't know the world."}, {"start": 2454.0, "end": 2455.44, "text": " We don't have the world model."}, {"start": 2455.44, "end": 2459.96, "text": " So you run into the same problem again and again that you're trying to approximate this."}, {"start": 2459.96, "end": 2464.68, "text": " And they want to make this so mathematically rigorous, but ultimately, and they go in"}, {"start": 2464.68, "end": 2468.32, "text": " the appendix, they go through various ways that they could solve this."}, {"start": 2468.32, "end": 2473.92, "text": " But ultimately they just say, well, this is approximately the same."}, {"start": 2473.92, "end": 2483.88, "text": " So this right here basically means what skills, if you're in a certain state, what skills"}, {"start": 2483.88, "end": 2485.4, "text": " brought you here?"}, {"start": 2485.4, "end": 2487.08, "text": " Basically, what skills brought you here?"}, {"start": 2487.08, "end": 2490.88, "text": " What's the distribution of skills that brought you to this state?"}, {"start": 2490.88, "end": 2494.88, "text": " And they say, well, we're just going to approximate that by the prior distribution over"}, {"start": 2494.88, "end": 2499.16, "text": " our skills, basically disregard the state here."}, {"start": 2499.16, "end": 2501.48, "text": " And this seems overly shaky."}, {"start": 2501.48, "end": 2510.04, "text": " And as I said, the entire paper makes sense, but I just feel it's trying to be overly mathematical."}, {"start": 2510.04, "end": 2516.36, "text": " And then run into a point where you can't be and then they're just, okay, we'll just"}, {"start": 2516.36, "end": 2517.36, "text": " replace it."}, {"start": 2517.36, "end": 2521.36, "text": " And then sort of things break down."}, {"start": 2521.36, "end": 2525.28, "text": " You can only be overly mathematical to some degree."}, {"start": 2525.28, "end": 2528.2400000000002, "text": " It doesn't really fit."}, {"start": 2528.2400000000002, "end": 2529.72, "text": " But okay."}, {"start": 2529.72, "end": 2531.64, "text": " So this is how you discover the skills."}, {"start": 2531.64, "end": 2533.2799999999997, "text": " You maximize these quantities."}, {"start": 2533.2799999999997, "end": 2539.9599999999996, "text": " Alternately, you learn the world model and you improve your skills by making them diverse"}, {"start": 2539.9599999999996, "end": 2542.16, "text": " and easily predictable."}, {"start": 2542.16, "end": 2545.0, "text": " So how do you then plan using these skills?"}, {"start": 2545.0, "end": 2546.48, "text": " This is the second part of the paper."}, {"start": 2546.48, "end": 2551.3599999999997, "text": " And this is just as complicated as the first part."}, {"start": 2551.3599999999997, "end": 2556.3599999999997, "text": " So they say given the learned skills, so the learned skills are policies over action given"}, {"start": 2556.3599999999997, "end": 2558.6, "text": " the DZ, right?"}, {"start": 2558.6, "end": 2562.52, "text": " Now you know how to like walk forward and walk back and so on."}, {"start": 2562.52, "end": 2567.68, "text": " And now you're placed in a world and you're given this checkpoint."}, {"start": 2567.68, "end": 2570.7599999999998, "text": " It says, well, walk there."}, {"start": 2570.7599999999998, "end": 2573.8399999999997, "text": " And you want this to do this using planning."}, {"start": 2573.8399999999997, "end": 2575.24, "text": " You don't want to learn anymore."}, {"start": 2575.24, "end": 2577.36, "text": " You simply want to plan."}, {"start": 2577.36, "end": 2578.44, "text": " Okay."}, {"start": 2578.44, "end": 2579.96, "text": " What do you do?"}, {"start": 2579.96, "end": 2583.64, "text": " And as I said, this is even more."}, {"start": 2583.64, "end": 2589.2, "text": " So what you want to do is you want to do something like model predictive control, but not over"}, {"start": 2589.2, "end": 2594.24, "text": " actions, but over your learned skills."}, {"start": 2594.24, "end": 2603.0, "text": " So you have this planner in the NPC and the planner will in its head roll out a number of"}, {"start": 2603.0, "end": 2606.72, "text": " different, a number of different plans."}, {"start": 2606.72, "end": 2610.8799999999997, "text": " It will kind of explore a bunch of different different plans."}, {"start": 2610.8799999999997, "end": 2612.92, "text": " Z will roll them out."}, {"start": 2612.92, "end": 2618.64, "text": " I'll say, okay, if I do this and this and this and this, what will happen using its world"}, {"start": 2618.64, "end": 2621.12, "text": " model that it has learned?"}, {"start": 2621.12, "end": 2625.88, "text": " It will observe what's going to be the reward in each of these cases."}, {"start": 2625.88, "end": 2631.28, "text": " Now they say here, access the environment reward, but can also be estimated."}, {"start": 2631.28, "end": 2638.08, "text": " This is another sort of, I feel, weak point of this in that they now assume they have"}, {"start": 2638.08, "end": 2643.92, "text": " the true reward function, but they don't have a world model, right?"}, {"start": 2643.92, "end": 2649.12, "text": " They don't have the world model, but they assume that they can sort of always ask for"}, {"start": 2649.12, "end": 2656.04, "text": " the true reward, which isn't probably not the case if you, if you, like, if you had a"}, {"start": 2656.04, "end": 2658.2, "text": " true world, but it could be the case."}, {"start": 2658.2, "end": 2662.08, "text": " The reward could be something like, well, if you're over there, you get higher reward,"}, {"start": 2662.08, "end": 2668.68, "text": " but you don't exactly know how to get over there in any case."}, {"start": 2668.68, "end": 2671.2, "text": " So they roll out a bunch of trajectories in their head."}, {"start": 2671.2, "end": 2673.4, "text": " They can plan forward."}, {"start": 2673.4, "end": 2678.3199999999997, "text": " See what's going to happen if they do this or that or this or that."}, {"start": 2678.3199999999997, "end": 2685.52, "text": " And then they choose the best one of these forward thoughts and they execute it in the"}, {"start": 2685.52, "end": 2687.0, "text": " real world, right?"}, {"start": 2687.0, "end": 2691.36, "text": " So they say, well, I'm going to you choose the skill, walk forward."}, {"start": 2691.36, "end": 2695.56, "text": " So the agent is now going to be tasked with walking forward and it's going to do that"}, {"start": 2695.56, "end": 2700.6, "text": " in the real world for a certain amount of steps, like 10 steps of walking forward."}, {"start": 2700.6, "end": 2705.2000000000003, "text": " After 10 steps of walking forward, you go back and say, I'm in this new situation right"}, {"start": 2705.2000000000003, "end": 2706.2000000000003, "text": " here."}, {"start": 2706.2000000000003, "end": 2707.2000000000003, "text": " What should I do?"}, {"start": 2707.2000000000003, "end": 2710.92, "text": " And again, the planner is going to be like, ah, if you first walk forward and then walk"}, {"start": 2710.92, "end": 2714.2400000000002, "text": " back where you're going to be and so on."}, {"start": 2714.2400000000002, "end": 2721.28, "text": " So the planner will always plan basically to go from where you are to the checkpoint using"}, {"start": 2721.28, "end": 2726.0, "text": " a composition of the skills that you have learned."}, {"start": 2726.0, "end": 2727.1600000000003, "text": " So the planner may be fine."}, {"start": 2727.1600000000003, "end": 2733.1600000000003, "text": " Okay, if I first walk forward, walk back a bit and so on, I'm going to get to the goal."}, {"start": 2733.1600000000003, "end": 2735.28, "text": " I'm going to reach the goal."}, {"start": 2735.28, "end": 2739.48, "text": " Now please agent execute this first thing, walk forward."}, {"start": 2739.48, "end": 2743.44, "text": " The agent executes it and maybe it won't, you know, it won't do as well."}, {"start": 2743.44, "end": 2745.0800000000004, "text": " It will maybe end up here."}, {"start": 2745.0800000000004, "end": 2747.6400000000003, "text": " And then it says, well, I'm here now."}, {"start": 2747.6400000000003, "end": 2748.96, "text": " Please plan again."}, {"start": 2748.96, "end": 2749.96, "text": " So I plan again."}, {"start": 2749.96, "end": 2751.52, "text": " Okay, I can still kind of walk back."}, {"start": 2751.52, "end": 2754.56, "text": " I'll be here here, but then I have to do something else."}, {"start": 2754.56, "end": 2757.4, "text": " So now walk back and okay."}, {"start": 2757.4, "end": 2760.2400000000002, "text": " So this is what's going to happen."}, {"start": 2760.2400000000002, "end": 2764.08, "text": " But it is going to happen in a weird way."}, {"start": 2764.08, "end": 2773.08, "text": " Namely, what we keep are normal since everything is continuous will keep normal distributions"}, {"start": 2773.08, "end": 2774.84, "text": " of all our future steps."}, {"start": 2774.84, "end": 2780.08, "text": " So we don't say, okay, I go here and then I go here."}, {"start": 2780.08, "end": 2786.2000000000003, "text": " What you'll say is I approximately go here and after that, I'll approximately go here."}, {"start": 2786.2000000000003, "end": 2791.4, "text": " And you'll do it in such a way that the peak of this normal distribution is going to be"}, {"start": 2791.4, "end": 2797.44, "text": " the highest where you think you'll get the most reward if you follow this trajectory."}, {"start": 2797.44, "end": 2800.36, "text": " Like if you follow this trajectory, you get a very high reward."}, {"start": 2800.36, "end": 2805.6, "text": " And if I follow a trajectory that maybe goes here, I won't get a high reward."}, {"start": 2805.6, "end": 2810.52, "text": " If it actually turns out in your imagination that you do get a high reward for this trajectory,"}, {"start": 2810.52, "end": 2815.2400000000002, "text": " you'll change this distribution such that the peak is here."}, {"start": 2815.2400000000002, "end": 2818.48, "text": " And of course, the tighter the peak is, the more sure you are."}, {"start": 2818.48, "end": 2824.28, "text": " So you sort of are looking, if you look out into the world, you want the closest steps"}, {"start": 2824.28, "end": 2825.8, "text": " to be very picky."}, {"start": 2825.8, "end": 2831.96, "text": " And then as you look out, they can be more sort of broad."}, {"start": 2831.96, "end": 2832.96, "text": " And that's how you plan ahead."}, {"start": 2832.96, "end": 2835.48, "text": " You keep doing a step."}, {"start": 2835.48, "end": 2841.1200000000003, "text": " So if you go from here to finally you choose, I want to go here where the tip is the highest"}, {"start": 2841.1200000000003, "end": 2842.1200000000003, "text": " here."}, {"start": 2842.1200000000003, "end": 2848.5600000000004, "text": " Then you imagine forward again, you refine these distributions over the future."}, {"start": 2848.5600000000004, "end": 2854.32, "text": " And then you take the next step that gets you to where the highest peak is right here,"}, {"start": 2854.32, "end": 2855.52, "text": " basically."}, {"start": 2855.52, "end": 2857.4, "text": " And so on."}, {"start": 2857.4, "end": 2861.44, "text": " This is simply planning in a continuous domain."}, {"start": 2861.44, "end": 2868.48, "text": " It is pretty analogous to how you would plan in like, alpha go if you or tick-tack-toe,"}, {"start": 2868.48, "end": 2869.92, "text": " if you had a planner."}, {"start": 2869.92, "end": 2875.64, "text": " But since everything's continuous, it makes it just so much harder."}, {"start": 2875.64, "end": 2881.04, "text": " So they, yeah, they always update these distributions, as you can see here, to the skill that gave"}, {"start": 2881.04, "end": 2888.84, "text": " you a high reward in your imagination compared to the rewards of the other plans that you"}, {"start": 2888.84, "end": 2889.84, "text": " had."}, {"start": 2889.84, "end": 2896.64, "text": " Okay, well, this was a long, long way until we got here."}, {"start": 2896.64, "end": 2903.16, "text": " But if you recap, so first, they, in an unsupervised fashion, learn these low-level skills"}, {"start": 2903.16, "end": 2907.96, "text": " such that they're easily predictable by their own world model and diverse."}, {"start": 2907.96, "end": 2916.0, "text": " And then in the second step, they can use that to do basically planning."}, {"start": 2916.0, "end": 2922.8, "text": " So they first learn these skills and then the planner composes them to make the agent"}, {"start": 2922.8, "end": 2924.32, "text": " do something."}, {"start": 2924.32, "end": 2929.64, "text": " And again, the agent will never have to learn how to do this, go from checkpoint to check"}, {"start": 2929.64, "end": 2935.2400000000002, "text": " one, because the planner can just compose these low-level skills."}, {"start": 2935.24, "end": 2940.4799999999996, "text": " So they have these experiments right here, and we won't go through the experiment, because"}, {"start": 2940.4799999999996, "end": 2948.0, "text": " this video is already very, very long, but they basically show that they, they're learned"}, {"start": 2948.0, "end": 2955.68, "text": " things, actually, their learned skills do end up being very diverse, do end up predictable,"}, {"start": 2955.68, "end": 2958.16, "text": " have a high variance and so on."}, {"start": 2958.16, "end": 2964.56, "text": " They have to give certain priors to it to make it actually work in a real setting."}, {"start": 2964.56, "end": 2969.7599999999998, "text": " But the results you can actually see in these videos and in the graphs."}, {"start": 2969.7599999999998, "end": 2973.44, "text": " I'm about to check out the paper if you're still here."}, {"start": 2973.44, "end": 2974.44, "text": " Thanks for being here."}, {"start": 2974.44, "end": 2979.32, "text": " I hope this, this was like one of the most more complicated and mathy papers we looked"}, {"start": 2979.32, "end": 2980.32, "text": " at."}, {"start": 2980.32, "end": 2986.6, "text": " But I think, I still think it's fun and I still think the outcome is pretty impressive"}, {"start": 2986.6, "end": 2987.6, "text": " right here."}, {"start": 2987.6, "end": 2996.16, "text": " You can use math to derive basically these intuitive, very intuitive objectives to learn."}, {"start": 2996.16, "end": 2997.48, "text": " It's also pretty cool."}, {"start": 2997.48, "end": 3026.2, "text": " Alright, that was it from me and bye-bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=q7QP_lfqnQM | Synthesizer: Rethinking Self-Attention in Transformer Models (Paper Explained) | Do we really need dot-product attention? The attention mechanism is a central part of modern Transformers, mainly due to the dot-product attention mechanism. This paper changes the mechanism to remove the quadratic interaction terms and comes up with a new model, the Synthesizer. As it turns out, you can do pretty well like that!
OUTLINE:
0:00 - Intro & High Level Overview
1:00 - Abstract
2:30 - Attention Mechanism as Information Routing
5:45 - Dot Product Attention
8:05 - Dense Synthetic Attention
15:00 - Random Synthetic Attention
17:15 - Comparison to Feed-Forward Layers
22:00 - Factorization & Mixtures
23:10 - Number of Parameters
25:35 - Machine Translation & Language Modeling Experiments
36:15 - Summarization & Dialogue Generation Experiments
37:15 - GLUE & SuperGLUE Experiments
42:00 - Weight Sizes & Number of Head Ablations
47:05 - Conclusion
Paper: https://arxiv.org/abs/2005.00743
My Video on Transformers (Attention Is All You Need): https://youtu.be/iDulhoQ2pro
My Video on BERT: https://youtu.be/-9evrZnBorM
Abstract:
The dot product self-attention is known to be central and indispensable to state-of-the-art Transformer models. But is it really required? This paper investigates the true importance and contribution of the dot product-based self-attention mechanism on the performance of Transformer models. Via extensive experiments, we find that (1) random alignment matrices surprisingly perform quite competitively and (2) learning attention weights from token-token (query-key) interactions is not that important after all. To this end, we propose \textsc{Synthesizer}, a model that learns synthetic attention weights without token-token interactions. Our experimental results show that \textsc{Synthesizer} is competitive against vanilla Transformer models across a range of tasks, including MT (EnDe, EnFr), language modeling (LM1B), abstractive summarization (CNN/Dailymail), dialogue generation (PersonaChat) and Multi-task language understanding (GLUE, SuperGLUE).
Authors: Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, Che Zheng
Links:
YouTube: https://www.youtube.com/c/yannickilcher
Twitter: https://twitter.com/ykilcher
BitChute: https://www.bitchute.com/channel/yannic-kilcher
Minds: https://www.minds.com/ykilcher | Hi there. Today we're looking at synthesizer rethinking self-attention in transformer models by Yi Tai, Darabari, Donald Metzler, Dacheng, Chuan, Chia Zhao, and Chie Cheng. These people are of Google research and on a high level they're trying to replace the self-attention mechanism which is currently a dot product mechanism in a transformer by a sort of a learned a learned detention mechanism. Therefore eliminating this expensive dot product and they test the model and conclude that it sometimes works a bit. So the results are sort of inconclusive but that's the paper on a high level and it's it's fairly cool to go through and as always if you like content like this consider subscribing and sharing it out. Alright so they say the dot product self-attention is known to be central and indispensable to state-of-the-art transformer models. So if you don't know what a transformer is it's best I made a video on the attention is all you need paper and that explains what a transformer is and what an attention mechanism is in detail. But they are right of course the attention mechanism that is via the dot product of queries and keys is pretty much what makes transformers transformers and they here ask is it really required which is a bold question in light of that right. They say they they investigate whether or not you really need this and they say via expensive expensive experiments we find that first random alignment matrices surprisingly perform quite competitively and two learning attention weights from token token that means query key interactions which is this dot product interaction is not that important after all. Okay they propose this new model called synthesizer a model that learns synthetic attention weights without token token interactions. Our experimental results show that synthesizers competitive against even electron transformer models across a range of tasks. Okay so let's dive in. So what is what is different here they're basically saying look in each in each each transformer layer boils down to something like this where you have an input sequence x right here and you want to get an output sequence y and in order to do that you need some sort of this thing which is the attention matrix multiplied by this thing which are called the values and we'll explore that a bit deeper over here. So in these transformers it's always kind of helpful to visualize yourself the input sequence as sort of nodes and so this this would be one layer we have a five length sequence and we want to transform it into the next length five sequence and maybe it even helps to label maybe like a b c d you can just imagine kind of these of course as you go up the layers it doesn't necessarily always correspond to the same input token but the position labeling them is still it's pretty helpful I find especially for you know lathe things like burk or something like this. So you want to transform the sequence that's incoming here into a another sequence and the basic the basic mechanism in a transformer if you go up the layers is the routing of information so you want to like a route information around the sequence and basically such that at the end the whole sequence knows about every word in the sentence knows about every other word that there is in the sentence knows about the associations between the other words and so on such that you gain sort of you start out with individual words and that the end what you want is sort of that every word has a pretty good idea of what's going on with every other word okay and that's why you continuously as you go up the layer route around this information now the question is how do you route this information how do you know which word goes to which other word and here maybe the sentence starts with the word let's call Sarah okay Sarah and then it goes on and at some point it says she okay so she is the pronoun and we can also label these Sarah she so if we want to if we think how do how do we route information it would be beneficial for us if the information that there is a word Sarah here in the sentence would be routed to the word she because the word she it's a pronoun it knows I'm a pronoun and if there is like a person in the sentence that would be valuable information for me like to know what's kind of going on and to understand myself better this clever word wants to understand itself and it kind of calls out for information from the other words in a transformer this is done via what this paper calls this dot product attention and that's the follows every word every token emits what is called a key and a value and the key and the value are just two vectors so every word is going to emit two vectors I'm gonna draw one at the bottom here and I'm going to draw one at the top okay like that so you can imagine the key as sort of the word advertising what it is to other words and the so these are the keys down here and you sorry the top I think I called it value that's wrong it's called a query you can imagine the query as a word asking describing what it wants from others to know okay so in that case you'll see that the vector here and the vector here the these are now routed by dot product so the ones that align in the dot product in the angle they will be routed to each other so this would be routed here and maybe you know okay I drew this this one would be routed here and the others would be kind of routed some a bit here and a bit here maybe okay it gets it gets fuzzy but you get the concept but in order to do that you basically need the to pull to put the dot product from every single key with every value sorry query and that gives you basically this quadratic dot product that these transformers have and that's expensive okay so they have a little picture here this is what a vanilla transformer does every input here emits two things a query and a key and then there's the dot product attention to decide what's this attention matrix okay now this attention matrix is then used to aggregate these values so actually every token emits three things also this value here which is basically it's not that important but this just describes the information that you want to pass on to the next layer and then it goes through this routing right here that routes the information to the correct output places and you get your output now what they propose is something different they propose this dense synthesizer right here where instead of the dot product attention every single um every single input here emits a basically a row of this matrix directly without having to go through the dot product that helps a bit if you um imagine it in our little framework here so let's draw this again and let's see what this synthesizer by the way they call this the dense synthesizer because they have another variant as well okay here's our here is our sequence the lower layer we want to transform it in the upper layer let's this is the sera node and this is the she node sera she okay so how do we route information now wow okay let me start um in the dense synthesizer framework every token just gets to output basically it already gets to output where it wants information from so every single token here gets to output where it wants information to come from and by where because in the original transformer the where was basically defined by these inner product now the where is just defined by the position okay so it just says I want information from position 2 and 3 or this node here could say I want I want information from position 5 and 3 okay and this is dependent on which token there is so each token looks at itself and in the case here of she you can imagine this token says well I'm a pronoun therefore I may be referring to a person and I know that in the english language a person is often at the beginning of the sentence and therefore I certainly want information from token from position 0 it doesn't see that there is this word sera here it simply can see only the positions 0 1 2 3 4 okay so it will output it will basically output each token here will output an L dimensional vector and L here is the length of the sequence an L dimensional vector that already defines the distribution of how you want the information so I want lots of that and then not much of that and maybe it wants a bit of that and then not much of that okay so each word up here is going to emit this L dimensional vector okay so each word each token decides for itself where it wants information to come from pays based purely on what the token itself is okay and of course in the higher layers this information like the information of what the token is and what else is there gets aggregated and that's how computation happens but in a fundamental level each node looks at itself and decides where do I want information from just given what I am and not what others are so this results in a in you not having to do this dot product attention but of course you lose the information of what's down here you simply go on the positions of the nodes and they they formalize this like this so they basically say okay each each transformer mechanism needs some sort of a a soft max over this matrix B right here which this is the this is this routing matrix and then g of x is just the values of x so g is often just a linear function and they say well this B here in the classic transformer is computed via this dot product attention can we just simply have a function right here that just outputs the B given an x so and it's you see here x i refers to one row so x here is an L by D matrix and they say the sequence length is L so if you imagine this if you this is the sequence length x every x i is is a vector here of dimension D right sort of like a word embedding okay now what you want to do is you want to take each individually run it through the function f and then get out an L dimensional vector sorry an L dimensional vector this is of dimension L and if you do this with enough of the with all of the x's you'll get an L by L matrix which basically is now your routing matrix it tells you so this piece this thing tells you that this particular piece in the input sequence wants how much information from this particular piece in the output sequence or vice versa I see this is the problem here they don't really specify this B how this B matrix will be composed from the in from the B i like is B i a column or a row of this B matrix I don't know and therefore it could actually be the other way around that the information if it's not the sort of the tokens deciding where they want information from but it could be the tokens deciding where they want to send information to but just from the notation I can sort of guess that it's the way that I described right here but I hope you see the difference here right before we had this dot product and here each of these columns basically is an independent evaluation of this function that only considers x i and doesn't consider any of the x j that it wants information from it simply goes by position and they use for this they use this basically this two layer one hidden layer neural network right here two weight matrices and a non-linearity a relu non-linearity so they replace the dot product by simply learning what the attention pattern is going to be per individual token okay now they do it one step further they say okay so we've already lost the dependency basically on what the on what the input sequence tokens here are can't we also just kind of lose the dependency of what the output token sequences here are so what they propose in their second variant this random synthesizer is the following is hey why don't we just learn how the information is going to be routed irrespective of which tokens come in right we just we're just going to learn this and it's going to be one routing pattern for all of the possible input output sequences that's it's just going to be this routing pattern so they have actually two variants first one where it is really just random like they just leave it random and they don't even train it and the second one where they train this thing but these things now have nothing to do with the tokens they're just fixed and they are just global so this this would here be this would directly be you learn this l by l matrix and yeah so if this strikes you a bit in an odd way because you kind of lose the dependency on your data in this routing pattern and this not really routing anymore right and if you think that you've seen this before somewhere and you think hey that looks like a feed forward layer from from like your very first mlp then you would be absolutely correct and i'm not sure why they don't point this out if i'm like i have a really hard time believing that they themselves trick them into such a thing right here and so i can actually show it right so the question is how is how is this here this dense synthesizer how is this still is this still different or the same as a feed forward layer and is this different or the same as a feed forward layer so if you do the the math say and you look at what a feed forward layer is in a feed forward layer why i right my i of entry and the output is going to be a sum over all the inputs x j multiplied by a weight i j okay so if whenever i can represent something in this fashion where i have a sum and then i have like a fixed weight and that i learn and that has nothing to do with x that is not dependent on x multiplied by x then it is a feed forward layer basically or like a fancy feed forward layer so let's look at the dense synthesizer what does the dense synthesizer do the dense synthesizer says y i is equal to a sum okay we're starting off we're starting off well and so it says g of x j of right but this g usually is just a a weight matrix where we compute the values right we said this was the values of x so g is usually just a matrix let's call it v w v and then here we have like some softmax thing right we have some softmax and the softmax is going to be over this dense pattern right here that we described sorry here and this pattern is going to be f of x j right so no x i f of x i is that correct x i and here is a j maybe yes that's correct and f okay it's like two it's two layers but we can basically say it's like a a weight matrix because ultimately if we learn a neural network or a single layer it doesn't really matter to the discussion here so let's call this a w b x i so you see right here we do have a weighted sum over the x j's but the weight that the weighted sum is using is dependent on x i right here and therefore you can't you can't represent this as just a feed forward layer right here of course if you have the full dot product attention then in here would actually be a dot product between x j and x i right so x j transposed x i or something like this so what about what about this random synthesizer so the random synthesizer has y i has a weighted sum over this w v x i that's the values softmax over this matrix r and r is simply this l by l matrix right here now you can immediately see that this part right here is static it doesn't depend on any x and it is learned as in as a joint function right so this if I just call this w w i j then I'm back to my formulation right I'm sorry i j then I basically have my feed forward layer so the random synthesizer is just a fancy way of writing a feed forward layer and I of course if you're going to have the softmax you maybe have a different inductive bias is in learning it but ultimately it is a is a straightforward feed forward layer at least that's what it looks like to me I am very open to be convinced otherwise okay so they have this drawing right here on the left you see the vanilla transformer the dense synthesizer in the middle where you kind of learn how to produce this matrix and then around the value through it and on the right where you simply output this in a learned or actually completely random fashion and then route your values through that to the output okay now the question of course is okay they also do factorize it but this is not really the this is more of a a point where now you can actually if you have such a matrix or you produce such a matrix you can then factorize it into sort of lower-dimensional matrices and that is first of all to save space and this is also a regularizer because what you're essentially saying is you're applying an inductive prior to say I think these matrices have like some low-level structure to them and if you factorize them that will that's a prior on that exactly so you can factorize the dense and the random synthesizer into smaller matrices and that will save you parameters and you can actually also mix too so you can for example mix the random and the dense synthesizer now you have to pay attention it's not like an interpolation if you mix random and dense you will have to learn the parameters of the random end of the dense synthesizer so that's going to be like strictly more powerful than either one alone they list everything here where they say the standard dot product attention what we have is we have this formula right here you can actually formulate it in their framework you condition on all the xj for any x i and and uh see here i wrote this as xj i was dumb should be the entire x and there is interaction between the tokens and it's going to cost you two d squared parameters now parameters is different from computation which if you don't you don't do the dot product you also save a bunch of computation but here they look at a number of parameters so in this random synthesizer you simply output this matrix or it's global it there's no interaction and you are you are it's cost you l squared memory in l squared parameters now often in these models l and d are actually pretty similar so l might be something like 512 tokens the length and the dimension right here might also be something like 512 so per se this is not really a saving in parameters only when you go to the to the factorized models right here can you bring in this k and k is this lower dimension of factorization and if k is much much smaller than l then you save a bunch of parameters the dense synthesizer is formula is like this this is I produce the attention matrix you condition on x i but not xj right for each y i you condition on x i and you do not care about the xj's that is it is a it is local that means it depends on x i so the the routing actually depends on the information that goes through but there is no interaction and you're going into d squared plus d l which is also pretty much 2d squared right and or you go to this lower lower number here if you choose a good k all right now experiments so they apply this and we are absolutely stoked how this is going to turn out so they go on machine translation now okay before before we go into the results do you think machine translation is a good or a bad task for this model okay I think it is a good task for this model is a very favorable task for this model why why is machine translation a favorable task well mostly in machine translation if you think about how information is routed so I have I have a I have a sequence of German let's call it or English let's call it the dog barks and I have a sequence of German der Hundbelt come on hold belt now okay first of all I know they are only talking about self-attention so this example here actually makes little sense in the actual practical applications but I just want to demonstrate why machine translation specifically has so how would you route information here if you have to route information between the two things what you would do is pretty deterministically do this right so in machine translation what is very very very often the case is that mostly you're going to align the positions in the same way independent of the input specifically here you would always most of the time align the beginning with the beginning the end with the end and so on because for most languages especially similar languages like English and German the order of sentences and number of words per thing you need to express is going to be roughly the same so if you did not know about even about what the sequences were or you only knew one of them like you only knew there and you have to guess where should information come from well I know in English you also start with like this what's this called an article yeah it yes this is an article showing my linguistic skills here you you would also you would also start with that right you would say I want most information from position zero obviously I don't care what they're what what is there so I and again I know they don't do it in self-attention so it actually makes no sense that I have two different languages here but machine translation is probably a task that lends itself very much to sort of global globally learned or only partially the partial observably learned attention patterns because just because of the nature of the task right so let's keep that in mind and go to the results right here that they first of all what they do is they list the original transformer paper and actually have it here because they have to they have this same experiment now this is the kind of transformer we're talking about right here and it is notable that this paper only proposes to replace the self-attention that means the attention that would be within one of these two columns and not the attention that goes across from the left to the right right but still you can see that the attention that goes from the left to the right then in the next layer is going to end up as self attention information right so my I think my argument still counts in the in this case in the machine translation case all right so they have this same experiment right here here yes they have English German translation and they their base model gets 27.3 and that's what they evaluate right here they list this 27.3 but they also say when we train it we get a bit of a higher number 27.67 and especially on English French they get a higher number than that but let's stick to English German for now now they also do language modeling which the original paper didn't do and record the perplexity right here okay so the first thing they point out is if we train the synthesizer with a fixed random matrix that means we just put a random routing and we do not we do not ever change it what's there to learn so if you want to learn something in the transformer there's still many things to learn there's the feet forward layers right there is the the value and coder and so on so it is it is reasonable to assume that the transformer could sort of learn to just handle the the routing pattern that is in place and that the rest of the model can sort of absorb that chalk and interestingly you get onto 23.9 so almost 24 blue points and I mean it seems they they point out that it's fairly close if you look here this 24 is actually pretty far away it's the worst the worst baseline right here in the original paper this bite net had this 24 blue I mean it's I guess it's cool to point out that it works as such but you know in these tasks actually many things work right with with if you distill this down to some sort of a bag of words model and so on I'm pretty sure you can get pretty pretty good results as well and you can get you know fairly you can go to 24 blue I actually I have no clue of this field but I just want to point out just because the number is in the same ballpark doesn't mean that it is very astonishing it's maybe just you have so many parameters that the rest of the model can sort of absorb this the shock of not of not being able to learn this and you can just handle whatever pattern you put there I can just kind of work with it okay that's many people have observed if you like put just random junk in the lower layers of a CNN like random filters never train them you can still the rest of the network can adapt so that's basically this effect right here I don't think it's a testament to we don't need the dot product attention it's more like this this just happens in deep learning then however they say if we now learn this one matrix so we learn this routing but globally we get into 27.27 blue and this already seems fairly close right and you mainly need to compare with this number right here because that's actually the same training run and so on so but still it is quite it is quite a bit away it's 0.4 blue points away and that is a sort of significant difference I think then they go further if they go to the dense synthesizer you can see right here the model size is lower than this one and they get 27.43 now they get even closer right and they are actually on par if they mix random and dense right here and you can see that it's also almost the same amount of parameters and when they mix these random and vanilla so what they now have is the dot product attention plus a purely global feat forward sort of like a bias of what to route where then they can outcompete this original model but also now they have more parameters right so this model you would expect it to be you know strictly better than either of the two alone and it is and it is actually astounding that the synthesizer that mixes the vanilla with the dense even though it has even more parameters it does worse so with these sort of results especially then you go fiddle with like 0.1 you know between this and that I know I said 0.4 blue is a lot so 0.1 must be something and it surely is but also it's always the question of how many hyper parameter tunings you put into something like this and generally you should always sort of look at this if you were a researcher and had to put the best possible numbers here what would you do and then you correct for that in your mind for how much it might actually work if you if you are to if you are to you know go ahead and and train that on your data but nevertheless it it gives some cool insights right what I'm a bit confused by is that if you sort of look at the original paper and you look at the perplexities and they have a table down here where they compare a bunch of their instantiations of their model and you compare the compare also the perplexity on a language modeling task and the perplexity here seems to correlate extremely well with the blue score right whereas the perplexity here if you look at the perplexities over here they do correlate but I somehow I have the feeling they don't really correlate as much here which sort of speaks to the fact that you're going to see in the rest of the paper that these models they tend to sometimes be able to do well but then other times not and it's not really clear super clear when so look at this for example they now apply their models to summarization and dialogue generation right these are two tasks where you need to output text and you can see that the results are all over the place so in this metric rouge too and rouge is sort of an engram overlap metric between gold standards and what you produce in this metric the original transformer is best but in rouge one this synthesizer mix here is the best and in rouge l this one is the best and in dialogue generation all of them are actually not as good as this one right here where it's just the dense which is strictly less powerful than the ones on the bottom but so as you as you can see yeah I think what you should take away from this is that it it is interesting that it sometimes works but it seems to be a fair bit of shakiness to these to these results okay now they go on and they test this on super glue and this is a benchmark so glue and super glue they consist of these different tasks right here and now we are out of the text generation game we are in the game of for example you have two sentences and you need to decide which which one is like which one entails the other or are they contradictory or things like this so it's more of a like say a classification task and people apply different models so it's no longer a text generation task so they switch model instead of the vanilla transformer from the attention is all you need paper they now go on to the t5 the text to text transformer and they change they simply take the architecture and they change the attention in there with their attention and you can see right here that the results are quite different than before so in every single case either the t5 model the base model with the dot product attention is the best model or the synthesizer but including v so plus v means plus vanilla means it also has the dot product attention plus this learned thing right here okay so r is now the learned I think the learned right I would be surprised if it was the random random but it could also be but in any case it's strictly better right it's strictly more powerful model and the only way can actually perform worse is when you know it's too many parameters and so on and they kind of take stuff from each other and there's effects where more parameters can hurt you but never is any model that doesn't have the dot product attention on on top and these authors here argue that thus this can be largely attributed to the fact that the encoder self-attention in the t5 setting also functions as a cross sentence attention so what do they mean here if in the t5 is just as I understand it this is just like an encoder like bird so imagine imagine maybe this is bird right what bird is simply an encoder only transformer that means you here you put in your sequence and out again comes a sequence and you have like a special token that you use for classification and so on so this is less when you have to generate text but more when you want to classify text or things like this find something in a text and what you would do if you have two sentences you need to decide something about them you put the first sentence here and then you say you put like a separator token here this is usually called like a separator token and then you put the second sentence here is you just concatenate them and you let them go into the transformer and they argue that if you do self-attention on this entire sequence then you get attention patterns like this and this is sort of like cross-attention between sequences right it's not really self-attention and that's why their method doesn't work because it basically deals with self-attention but I'm not really buying that argument I mean if this is a sequence it is if this is one sequence this is self-attention and if you are going to argue that out of the blue a token in your case like in your original formulation can simply you know just by looking at itself know where where which position it wants the information from and certainly here this token could also learn that it wants information from over here or from the first word here I don't I don't really see the difference maybe maybe you need to somehow standardize where this separator token is so that it's always in the same place and that the second sentence always starts at the same place but if you have that then I really don't see any difference in the argument you can make here that this shouldn't work as much as the others what I think is happening is that this task is simply involves more difficult reasoning involves more routing of information like dynamic routing that's actually dependent on what's in the tasks rather than something like machine translation which most of the time has some global routing bias like like some some pattern that works pretty well across all all right so the last part here is where they kind of introspect the model and in the in the first thing they say okay we look at the distribution of weights so these are the weights the weights in the decoder at the beginning of training and you can already see that the standard transformer weights are and the synthesizer weights are different from the sorry the dense synthesizer weights are different from the random synthesizer weights and this probably is mostly due to the fact of how you initialize like these deep learning frameworks if you have a matrix they will look at what's this dimension what's this dimension and look calculate how they have to initialize it such that sort of the the total norm of a random vector that goes through stays the same sorry the vector would go through like it would go in here and out there so you see if it changes dimension then if you just randomly initialize with all the same like every matrix with the same number then like with the normal distribution then the in this case the vector would gain in norm and to account for that you initialize the matrices such that the vector norms approximately stay the same and this is why they're I guess why there are different initializations here and you can see this at the end of the training now these in in different layers right here it's pretty much always the same pattern that they they say they they just remark it so this this is what I find weird they just say what the graphs show they don't interpret it like I would expect something like oh this pattern is exactly what we would expect from our model because something something something right like if they claim that this attention is being able to be learned I just don't see why they do this stuff they simply point out oh yeah this this is higher here and this is higher here but I don't even see that as too interesting given that is this is how you initialize it like if I shift everything to the left of it and you know this is wall so it like this piles up here then this is exactly what turns out I don't I don't see you know what what this is supposed to mean especially since they don't make any claim of what it is supposed to mean and the same here they say the effect of the number of heads okay we we investigate the effect and the number of heads on the random synthesizer models you know and they train the number of heads now somewhere in the text they say I remember they say since you know since we don't dynamically route it is very important for our models very crucial to have many attention heads right such that basically you don't have one routing pattern you have many routing patterns that you learn globally so they say it's very important for our model to have many attention heads and I guess that's what they're trying to demonstrate here but again they simply say what's happening they don't interpret it and and they don't compare it to anything they just you know put it here they just put the number and I don't like is this good is this is this bad can you compare it to something and also here in the so here in the original paper they do the same thing here as you can see the number h is the heads and they do a blade this but at the same time they adjust the dimensions of the key and value vectors such that in total they have the same amount of parameters right so they can really investigate is one big attention head better or worse than many small attention heads is there a trade-off and they find here that there is a bit of a trade-off like there is a sweet spot you don't want too many you don't want too much because they get too small something like this but first we like we don't know whether or not have they simply changed the heads but left every other parameter the same or have they also adjusted the dimensions because if they haven't adjusted the dimensions then this this increase would be absolutely expected because you now have more parameters and if they have adjusted then can we compare this to you know something because this here is the this is the T5 small this is not the original transformer like is this big is this small and what does it say about the claim that you made that the number of heads is so important for your model can you validate this using this so it's just a bit of like this entire page here it's just they they just measure some things and then they state them here and you're somehow supposed to guess what they mean by stating that here okay but that was enough for me ranting so they give some supplementary material right here but in essence what I like about the paper is sort of the thinking that goes into this thinking outside the box asking the fundamental questions about these models do we really need this what what do they do I don't think it's super well investigated really from a scientific point like the formulation of hypotheses it simply trains these things and then make some claims but the claims interact you know with the number of parameters here and so on so and they're sort of noisy all around and of course the fact that this thing here turns out to be a fully connected layer in disguise is also pretty funny but I get it it's a fan it's like it's it's more it's not exactly the same thing but it you know yeah all right so that was my take on this paper if you have a different one let me know in the comments for sure I read all of them and at least I try and I've always succeeded so far all right I'll see you next time bye bye | [{"start": 0.0, "end": 5.78, "text": " Hi there. Today we're looking at synthesizer rethinking self-attention in"}, {"start": 5.78, "end": 13.36, "text": " transformer models by Yi Tai, Darabari, Donald Metzler, Dacheng, Chuan, Chia Zhao, and"}, {"start": 13.36, "end": 18.12, "text": " Chie Cheng. These people are of Google research and on a high level they're"}, {"start": 18.12, "end": 23.22, "text": " trying to replace the self-attention mechanism which is currently a dot"}, {"start": 23.22, "end": 28.72, "text": " product mechanism in a transformer by a sort of a learned a learned"}, {"start": 28.72, "end": 34.48, "text": " detention mechanism. Therefore eliminating this expensive dot product and they"}, {"start": 34.48, "end": 41.5, "text": " test the model and conclude that it sometimes works a bit. So the results are"}, {"start": 41.5, "end": 46.44, "text": " sort of inconclusive but that's the paper on a high level and it's it's fairly"}, {"start": 46.44, "end": 50.64, "text": " cool to go through and as always if you like content like this consider"}, {"start": 50.64, "end": 57.92, "text": " subscribing and sharing it out. Alright so they say the dot product self-attention"}, {"start": 57.92, "end": 62.24, "text": " is known to be central and indispensable to state-of-the-art transformer models."}, {"start": 62.24, "end": 66.24000000000001, "text": " So if you don't know what a transformer is it's best I made a video on the"}, {"start": 66.24000000000001, "end": 71.04, "text": " attention is all you need paper and that explains what a transformer is and what"}, {"start": 71.04, "end": 77.2, "text": " an attention mechanism is in detail. But they are right of course the attention"}, {"start": 77.2, "end": 84.04, "text": " mechanism that is via the dot product of queries and keys is pretty much what"}, {"start": 84.04, "end": 90.64, "text": " makes transformers transformers and they here ask is it really required which is"}, {"start": 90.64, "end": 96.92, "text": " a bold question in light of that right. They say they they investigate whether"}, {"start": 96.92, "end": 102.24000000000001, "text": " or not you really need this and they say via expensive expensive experiments we"}, {"start": 102.24000000000001, "end": 108.16000000000001, "text": " find that first random alignment matrices surprisingly perform quite"}, {"start": 108.16, "end": 114.39999999999999, "text": " competitively and two learning attention weights from token token that means"}, {"start": 114.39999999999999, "end": 119.67999999999999, "text": " query key interactions which is this dot product interaction is not that"}, {"start": 119.67999999999999, "end": 125.8, "text": " important after all. Okay they propose this new model called synthesizer a model"}, {"start": 125.8, "end": 130.96, "text": " that learns synthetic attention weights without token token interactions. Our"}, {"start": 130.96, "end": 134.68, "text": " experimental results show that synthesizers competitive against even"}, {"start": 134.68, "end": 143.44, "text": " electron transformer models across a range of tasks. Okay so let's dive in. So what"}, {"start": 143.44, "end": 151.4, "text": " is what is different here they're basically saying look in each in each each"}, {"start": 151.4, "end": 158.52, "text": " transformer layer boils down to something like this where you have an input"}, {"start": 158.52, "end": 165.92000000000002, "text": " sequence x right here and you want to get an output sequence y and in order to"}, {"start": 165.92000000000002, "end": 172.32000000000002, "text": " do that you need some sort of this thing which is the attention matrix multiplied"}, {"start": 172.32000000000002, "end": 178.24, "text": " by this thing which are called the values and we'll explore that a bit deeper"}, {"start": 178.24, "end": 184.8, "text": " over here. So in these transformers it's always kind of helpful to visualize"}, {"start": 184.8, "end": 191.60000000000002, "text": " yourself the input sequence as sort of nodes and so this this would be one layer"}, {"start": 191.60000000000002, "end": 197.92000000000002, "text": " we have a five length sequence and we want to transform it into the next length"}, {"start": 197.92000000000002, "end": 204.24, "text": " five sequence and maybe it even helps to label maybe like a b c d you can just"}, {"start": 204.24, "end": 210.08, "text": " imagine kind of these of course as you go up the layers it doesn't necessarily"}, {"start": 210.08, "end": 215.88000000000002, "text": " always correspond to the same input token but the position labeling them is still"}, {"start": 215.88000000000002, "end": 220.12, "text": " it's pretty helpful I find especially for you know lathe things like burk or"}, {"start": 220.12, "end": 224.36, "text": " something like this. So you want to transform the sequence that's incoming here"}, {"start": 224.36, "end": 232.16000000000003, "text": " into a another sequence and the basic the basic mechanism in a transformer if"}, {"start": 232.16000000000003, "end": 236.60000000000002, "text": " you go up the layers is the routing of information so you want to like a"}, {"start": 236.6, "end": 243.44, "text": " route information around the sequence and basically such that at the end the"}, {"start": 243.44, "end": 248.35999999999999, "text": " whole sequence knows about every word in the sentence knows about every other"}, {"start": 248.35999999999999, "end": 252.4, "text": " word that there is in the sentence knows about the associations between the"}, {"start": 252.4, "end": 256.88, "text": " other words and so on such that you gain sort of you start out with individual"}, {"start": 256.88, "end": 262.12, "text": " words and that the end what you want is sort of that every word has a pretty good"}, {"start": 262.12, "end": 266.6, "text": " idea of what's going on with every other word okay and that's why you"}, {"start": 266.6, "end": 272.24, "text": " continuously as you go up the layer route around this information now the"}, {"start": 272.24, "end": 276.64, "text": " question is how do you route this information how do you know which word goes"}, {"start": 276.64, "end": 283.96, "text": " to which other word and here maybe the sentence starts with the word let's"}, {"start": 283.96, "end": 292.79999999999995, "text": " call Sarah okay Sarah and then it goes on and at some point it says she okay so"}, {"start": 292.79999999999995, "end": 303.03999999999996, "text": " she is the pronoun and we can also label these Sarah she so if we want to if"}, {"start": 303.03999999999996, "end": 308.88, "text": " we think how do how do we route information it would be beneficial for us if"}, {"start": 308.88, "end": 314.48, "text": " the information that there is a word Sarah here in the sentence would be"}, {"start": 314.48, "end": 319.08, "text": " routed to the word she because the word she it's a pronoun it knows I'm a"}, {"start": 319.08, "end": 324.71999999999997, "text": " pronoun and if there is like a person in the sentence that would be valuable"}, {"start": 324.71999999999997, "end": 328.28, "text": " information for me like to know what's kind of going on and to understand"}, {"start": 328.28, "end": 333.71999999999997, "text": " myself better this clever word wants to understand itself and it kind of calls"}, {"start": 333.71999999999997, "end": 338.24, "text": " out for information from the other words in a transformer this is done via what"}, {"start": 338.24, "end": 342.44, "text": " this paper calls this dot product attention and that's the follows every word"}, {"start": 342.44, "end": 350.0, "text": " every token emits what is called a key and a value and the key and the value are"}, {"start": 350.0, "end": 355.32, "text": " just two vectors so every word is going to emit two vectors I'm gonna draw one at"}, {"start": 355.32, "end": 365.0, "text": " the bottom here and I'm going to draw one at the top okay like that so you can"}, {"start": 365.0, "end": 371.12, "text": " imagine the key as sort of the word advertising what it is to other words and"}, {"start": 371.12, "end": 376.24, "text": " the so these are the keys down here and you sorry the top I think I called it"}, {"start": 376.24, "end": 383.0, "text": " value that's wrong it's called a query you can imagine the query as a word"}, {"start": 383.0, "end": 390.16, "text": " asking describing what it wants from others to know okay so in that case you'll"}, {"start": 390.16, "end": 394.8, "text": " see that the vector here and the vector here the these are now routed by dot"}, {"start": 394.8, "end": 400.64000000000004, "text": " product so the ones that align in the dot product in the angle they will be"}, {"start": 400.64000000000004, "end": 407.52000000000004, "text": " routed to each other so this would be routed here and maybe you know okay I"}, {"start": 407.52000000000004, "end": 411.04, "text": " drew this this one would be routed here and the others would be kind of"}, {"start": 411.04, "end": 419.04, "text": " routed some a bit here and a bit here maybe okay it gets it gets fuzzy but you"}, {"start": 419.04, "end": 423.76000000000005, "text": " get the concept but in order to do that you basically need the to pull to put"}, {"start": 423.76000000000005, "end": 432.16, "text": " the dot product from every single key with every value sorry query and that"}, {"start": 432.16, "end": 437.52000000000004, "text": " gives you basically this quadratic dot product that these transformers have and"}, {"start": 437.52000000000004, "end": 444.08000000000004, "text": " that's expensive okay so they have a little picture here this is what a vanilla"}, {"start": 444.08, "end": 451.59999999999997, "text": " transformer does every input here emits two things a query and a key and then"}, {"start": 451.59999999999997, "end": 456.64, "text": " there's the dot product attention to decide what's this attention matrix okay"}, {"start": 456.64, "end": 463.03999999999996, "text": " now this attention matrix is then used to aggregate these values so actually"}, {"start": 463.03999999999996, "end": 469.2, "text": " every token emits three things also this value here which is basically it's"}, {"start": 469.2, "end": 475.52, "text": " not that important but this just describes the information that you want to"}, {"start": 475.52, "end": 479.84, "text": " pass on to the next layer and then it goes through this routing right here"}, {"start": 479.84, "end": 484.48, "text": " that routes the information to the correct output places and you get your"}, {"start": 484.48, "end": 489.2, "text": " output now what they propose is something different they"}, {"start": 489.2, "end": 494.15999999999997, "text": " propose this dense synthesizer right here where instead of the dot product"}, {"start": 494.16, "end": 503.04, "text": " attention every single um every single input here emits a basically a row of"}, {"start": 503.04, "end": 508.32000000000005, "text": " this matrix directly without having to go through the dot product that helps a"}, {"start": 508.32000000000005, "end": 513.6800000000001, "text": " bit if you um imagine it in our little framework here so let's draw this"}, {"start": 513.6800000000001, "end": 518.88, "text": " again and let's see what this synthesizer by the way they call this the"}, {"start": 518.88, "end": 524.16, "text": " dense synthesizer because they have another variant as well okay here's our"}, {"start": 524.16, "end": 527.76, "text": " here is our sequence the lower layer we want to transform it in the upper"}, {"start": 527.76, "end": 531.84, "text": " layer let's this is the sera node and this is the she"}, {"start": 531.84, "end": 540.24, "text": " node sera she okay so how do we route information now"}, {"start": 540.24, "end": 543.44, "text": " wow okay let me start"}, {"start": 543.44, "end": 553.2800000000001, "text": " um in the dense synthesizer framework every token just gets to output"}, {"start": 553.2800000000001, "end": 559.7600000000001, "text": " basically it already gets to output where it wants information from so"}, {"start": 559.7600000000001, "end": 568.08, "text": " every single token here gets to output where it wants information to come"}, {"start": 568.08, "end": 573.9200000000001, "text": " from and by where because in the original transformer the where was basically"}, {"start": 573.9200000000001, "end": 578.88, "text": " defined by these inner product now the where is just defined by the"}, {"start": 578.88, "end": 586.32, "text": " position okay so it just says I want information from position 2 and 3"}, {"start": 586.32, "end": 591.5200000000001, "text": " or this node here could say I want I want information from position 5 and 3"}, {"start": 591.5200000000001, "end": 596.24, "text": " okay and this is dependent on which token there is"}, {"start": 596.24, "end": 600.32, "text": " so each token looks at itself and in the case here of"}, {"start": 600.32, "end": 604.5600000000001, "text": " she you can imagine this token says well I'm a pronoun"}, {"start": 604.5600000000001, "end": 610.24, "text": " therefore I may be referring to a person and I know that in the english"}, {"start": 610.24, "end": 615.2, "text": " language a person is often at the beginning of the sentence and therefore I"}, {"start": 615.2, "end": 621.44, "text": " certainly want information from token from position 0 it doesn't see that"}, {"start": 621.44, "end": 629.12, "text": " there is this word sera here it simply can see only the positions 0 1 2 3 4"}, {"start": 629.12, "end": 633.84, "text": " okay so it will output it will basically output"}, {"start": 633.84, "end": 639.84, "text": " each token here will output an L dimensional vector and L here is the length of"}, {"start": 639.84, "end": 644.1600000000001, "text": " the sequence an L dimensional vector that already defines the"}, {"start": 644.1600000000001, "end": 648.96, "text": " distribution of how you want the information so I want lots of that and then"}, {"start": 648.96, "end": 652.64, "text": " not much of that and maybe it wants a bit of that and then not much of that"}, {"start": 652.64, "end": 659.2, "text": " okay so each word up here is going to emit this L dimensional vector okay"}, {"start": 659.2, "end": 664.5600000000001, "text": " so each word each token decides for itself where it wants information to come"}, {"start": 664.5600000000001, "end": 671.44, "text": " from pays based purely on what the token itself is okay and of course in the"}, {"start": 671.44, "end": 675.76, "text": " higher layers this information like the information of what the token is"}, {"start": 675.76, "end": 679.28, "text": " and what else is there gets aggregated and that's how computation happens"}, {"start": 679.28, "end": 684.88, "text": " but in a fundamental level each node looks at itself and decides where do I want"}, {"start": 684.88, "end": 690.4, "text": " information from just given what I am and not what others are"}, {"start": 690.4, "end": 696.08, "text": " so this results in a in you not having to do this dot product attention but of"}, {"start": 696.08, "end": 700.88, "text": " course you lose the information of what's down here you simply go on the"}, {"start": 700.88, "end": 711.04, "text": " positions of the nodes and they they formalize this like this so they basically"}, {"start": 711.04, "end": 717.68, "text": " say okay each each transformer mechanism needs some sort of a a soft max over"}, {"start": 717.68, "end": 723.76, "text": " this matrix B right here which this is the this is this routing matrix"}, {"start": 723.76, "end": 729.92, "text": " and then g of x is just the values of x so g is often just a linear function"}, {"start": 729.92, "end": 734.24, "text": " and they say well this B here in the classic transformer is computed via this"}, {"start": 734.24, "end": 740.7199999999999, "text": " dot product attention can we just simply have a function right here"}, {"start": 740.7199999999999, "end": 748.16, "text": " that just outputs the B given an x so and it's you see here x i"}, {"start": 748.16, "end": 754.88, "text": " refers to one row so x here is an L by D matrix and they say the sequence length"}, {"start": 754.88, "end": 762.8, "text": " is L so if you imagine this if you this is the sequence length x every x i is"}, {"start": 762.8, "end": 771.36, "text": " is a vector here of dimension D right sort of like a word embedding okay now"}, {"start": 771.36, "end": 776.64, "text": " what you want to do is you want to take each individually run it through the"}, {"start": 776.64, "end": 785.92, "text": " function f and then get out an L dimensional vector sorry an L dimensional"}, {"start": 785.92, "end": 792.0, "text": " vector this is of dimension L and if you do this with enough of the with all of"}, {"start": 792.0, "end": 799.12, "text": " the x's you'll get an L by L matrix which basically is now your routing"}, {"start": 799.12, "end": 804.8, "text": " matrix it tells you so this piece this thing tells you that this particular"}, {"start": 804.8, "end": 809.76, "text": " piece in the input sequence wants how much information from this particular"}, {"start": 809.76, "end": 815.1999999999999, "text": " piece in the output sequence or vice versa I see this is the problem here they"}, {"start": 815.1999999999999, "end": 822.3199999999999, "text": " don't really specify this B how this B matrix will be composed from the"}, {"start": 822.3199999999999, "end": 828.7199999999999, "text": " in from the B i like is B i a column or a row of this B matrix I don't know"}, {"start": 828.7199999999999, "end": 833.3599999999999, "text": " and therefore it could actually be the other way around that the"}, {"start": 833.36, "end": 839.44, "text": " information if it's not the sort of the tokens"}, {"start": 839.44, "end": 843.76, "text": " deciding where they want information from but it could be the tokens deciding"}, {"start": 843.76, "end": 849.12, "text": " where they want to send information to but just from the notation I can"}, {"start": 849.12, "end": 855.04, "text": " sort of guess that it's the way that I described right here but I hope you see"}, {"start": 855.04, "end": 859.6, "text": " the difference here right before we had this dot product and here each of"}, {"start": 859.6, "end": 864.4, "text": " these columns basically is an independent evaluation of this function that"}, {"start": 864.4, "end": 869.84, "text": " only considers x i and doesn't consider any of the x j that it wants"}, {"start": 869.84, "end": 873.44, "text": " information from it simply goes by position"}, {"start": 873.44, "end": 879.9200000000001, "text": " and they use for this they use this basically this two layer one hidden layer"}, {"start": 879.9200000000001, "end": 885.6800000000001, "text": " neural network right here two weight matrices and a non-linearity a"}, {"start": 885.68, "end": 891.68, "text": " relu non-linearity so they replace the dot product by simply"}, {"start": 891.68, "end": 897.4399999999999, "text": " learning what the attention pattern is going to be per individual token"}, {"start": 897.4399999999999, "end": 902.7199999999999, "text": " okay now they do it one step further they say okay so we've already lost the"}, {"start": 902.7199999999999, "end": 909.68, "text": " dependency basically on what the on what the input sequence tokens here are"}, {"start": 909.68, "end": 913.8399999999999, "text": " can't we also just kind of lose the dependency of what the output token"}, {"start": 913.84, "end": 917.6800000000001, "text": " sequences here are so what they propose in their second"}, {"start": 917.6800000000001, "end": 927.76, "text": " variant this random synthesizer is the following is hey why don't we just"}, {"start": 927.76, "end": 933.9200000000001, "text": " learn how the information is going to be routed irrespective of which"}, {"start": 933.9200000000001, "end": 937.44, "text": " tokens come in right we just we're just going to learn this"}, {"start": 937.44, "end": 941.84, "text": " and it's going to be one routing pattern for all of the"}, {"start": 941.84, "end": 946.4, "text": " possible input output sequences that's it's just going to be this routing"}, {"start": 946.4, "end": 950.64, "text": " pattern so they have actually two variants first one where it is really just"}, {"start": 950.64, "end": 954.72, "text": " random like they just leave it random and they don't even train it and the"}, {"start": 954.72, "end": 960.24, "text": " second one where they train this thing but these things now have nothing to do"}, {"start": 960.24, "end": 966.1600000000001, "text": " with the tokens they're just fixed and they are just"}, {"start": 966.16, "end": 972.0, "text": " global so this this would here be this would directly be you learn this l by"}, {"start": 972.0, "end": 978.4, "text": " l matrix and yeah so if this strikes you a bit in an odd way because you kind of"}, {"start": 978.4, "end": 983.92, "text": " lose the dependency on your data in this routing pattern and this not really"}, {"start": 983.92, "end": 988.48, "text": " routing anymore right and if you think that you've seen this before"}, {"start": 988.48, "end": 995.1999999999999, "text": " somewhere and you think hey that looks like a feed forward layer"}, {"start": 995.2, "end": 1001.84, "text": " from from like your very first mlp then you would be absolutely correct"}, {"start": 1001.84, "end": 1007.6800000000001, "text": " and i'm not sure why they don't point this out if i'm like i have a really"}, {"start": 1007.6800000000001, "end": 1013.2800000000001, "text": " hard time believing that they themselves trick them into such a"}, {"start": 1013.2800000000001, "end": 1020.1600000000001, "text": " thing right here and so i can actually show it right so the question is"}, {"start": 1020.16, "end": 1025.12, "text": " how is how is this here this dense synthesizer how is this still"}, {"start": 1025.12, "end": 1029.76, "text": " is this still different or the same as a feed forward layer"}, {"start": 1029.76, "end": 1033.84, "text": " and is this different or the same as a feed forward layer"}, {"start": 1033.84, "end": 1040.1599999999999, "text": " so if you do the the math say and you look at what a feed forward layer is"}, {"start": 1040.1599999999999, "end": 1045.12, "text": " in a feed forward layer why i right my i of entry and the output"}, {"start": 1045.12, "end": 1053.28, "text": " is going to be a sum over all the inputs x j"}, {"start": 1053.28, "end": 1058.3999999999999, "text": " multiplied by a weight i j okay so if whenever i can represent"}, {"start": 1058.3999999999999, "end": 1063.28, "text": " something in this fashion where i have a sum and then i have like a fixed"}, {"start": 1063.28, "end": 1068.6399999999999, "text": " weight and that i learn and that has nothing to do with x that is not"}, {"start": 1068.6399999999999, "end": 1073.1999999999998, "text": " dependent on x multiplied by x then it is a feed forward"}, {"start": 1073.2, "end": 1077.04, "text": " layer basically or like a fancy feed forward layer"}, {"start": 1077.04, "end": 1083.28, "text": " so let's look at the dense synthesizer what does the dense synthesizer do"}, {"start": 1083.28, "end": 1088.24, "text": " the dense synthesizer says y i is equal to a sum okay we're starting off we're"}, {"start": 1088.24, "end": 1096.0, "text": " starting off well and so it says g of x j"}, {"start": 1096.0, "end": 1103.44, "text": " of right but this g usually is just a a weight matrix where we compute the values"}, {"start": 1103.44, "end": 1109.12, "text": " right we said this was the values of x so g is usually just a matrix let's"}, {"start": 1109.12, "end": 1116.96, "text": " call it v w v and then here we have like some"}, {"start": 1116.96, "end": 1121.76, "text": " softmax thing right we have some softmax and the softmax is going to be"}, {"start": 1121.76, "end": 1127.04, "text": " over this dense pattern right here that we described"}, {"start": 1127.04, "end": 1133.68, "text": " sorry here and this pattern is going to be"}, {"start": 1133.68, "end": 1148.56, "text": " f of x j right so no x i f of x i is that correct"}, {"start": 1148.56, "end": 1157.6, "text": " x i and here is a j maybe yes that's correct and f okay it's like two"}, {"start": 1157.6, "end": 1163.28, "text": " it's two layers but we can basically say it's like a"}, {"start": 1163.28, "end": 1167.9199999999998, "text": " a weight matrix because ultimately if we learn a neural network or a single"}, {"start": 1167.9199999999998, "end": 1172.56, "text": " layer it doesn't really matter to the discussion here so let's call this"}, {"start": 1172.56, "end": 1180.8799999999999, "text": " a w b x i so you see right here we do have a weighted"}, {"start": 1180.8799999999999, "end": 1188.8, "text": " sum over the x j's but the weight that the weighted sum is using"}, {"start": 1188.8, "end": 1194.96, "text": " is dependent on x i right here and therefore you can't"}, {"start": 1194.96, "end": 1200.24, "text": " you can't represent this as just a feed forward layer right here"}, {"start": 1200.24, "end": 1204.96, "text": " of course if you have the full dot product attention then in here would"}, {"start": 1204.96, "end": 1211.36, "text": " actually be a dot product between x j and x i right so x j"}, {"start": 1211.36, "end": 1218.72, "text": " transposed x i or something like this so what about"}, {"start": 1218.72, "end": 1225.28, "text": " what about this random synthesizer so the random synthesizer has y i"}, {"start": 1225.28, "end": 1232.32, "text": " has a weighted sum over this w v x i that's the values"}, {"start": 1232.32, "end": 1241.44, "text": " softmax over this matrix r and r is simply this l by l matrix right here"}, {"start": 1241.44, "end": 1246.8, "text": " now you can immediately see that this part right here is static it doesn't"}, {"start": 1246.8, "end": 1252.8799999999999, "text": " depend on any x and it is learned as in as a joint function right so"}, {"start": 1252.88, "end": 1261.7600000000002, "text": " this if I just call this w w i j then I'm back to my formulation"}, {"start": 1261.7600000000002, "end": 1272.24, "text": " right I'm sorry i j then I basically have my feed forward layer so the"}, {"start": 1272.24, "end": 1277.1200000000001, "text": " random synthesizer is just a fancy way of writing a feed forward layer and I"}, {"start": 1277.1200000000001, "end": 1279.6000000000001, "text": " of course if you're going to have the softmax you maybe have a different"}, {"start": 1279.6, "end": 1283.6, "text": " inductive bias is in learning it but ultimately it is a"}, {"start": 1283.6, "end": 1291.04, "text": " is a straightforward feed forward layer at least that's what it looks like to"}, {"start": 1291.04, "end": 1295.36, "text": " me I am very open to be convinced otherwise"}, {"start": 1295.36, "end": 1299.4399999999998, "text": " okay so they have this drawing right here on the left you see the vanilla"}, {"start": 1299.4399999999998, "end": 1303.52, "text": " transformer the dense synthesizer in the middle where you"}, {"start": 1303.52, "end": 1307.28, "text": " kind of learn how to produce this matrix and then around the value through"}, {"start": 1307.28, "end": 1312.24, "text": " it and on the right where you simply output this in a learned or actually"}, {"start": 1312.24, "end": 1317.44, "text": " completely random fashion and then route your values through that to the"}, {"start": 1317.44, "end": 1324.56, "text": " output okay now the question of course is okay they also do factorize it"}, {"start": 1324.56, "end": 1329.68, "text": " but this is not really the this is more of a a point where"}, {"start": 1329.68, "end": 1333.84, "text": " now you can actually if you have such a matrix or you produce such a matrix"}, {"start": 1333.84, "end": 1339.04, "text": " you can then factorize it into sort of lower-dimensional matrices and that is"}, {"start": 1339.04, "end": 1342.6399999999999, "text": " first of all to save space and this is also a regularizer because what you're"}, {"start": 1342.6399999999999, "end": 1347.36, "text": " essentially saying is you're applying an inductive prior to say"}, {"start": 1347.36, "end": 1351.9199999999998, "text": " I think these matrices have like some low-level structure to them"}, {"start": 1351.9199999999998, "end": 1357.84, "text": " and if you factorize them that will that's a prior on that exactly so you can"}, {"start": 1357.84, "end": 1363.4399999999998, "text": " factorize the dense and the random synthesizer into smaller matrices"}, {"start": 1363.44, "end": 1369.92, "text": " and that will save you parameters and you can actually also mix too so you can"}, {"start": 1369.92, "end": 1375.52, "text": " for example mix the random and the dense synthesizer now you have to pay"}, {"start": 1375.52, "end": 1380.16, "text": " attention it's not like an interpolation if you mix random and dense you will"}, {"start": 1380.16, "end": 1385.44, "text": " have to learn the parameters of the random end of the dense synthesizer so"}, {"start": 1385.44, "end": 1391.44, "text": " that's going to be like strictly more powerful than either one alone"}, {"start": 1391.44, "end": 1396.72, "text": " they list everything here where they say the standard dot product attention"}, {"start": 1396.72, "end": 1401.28, "text": " what we have is we have this formula right here you can actually formulate it"}, {"start": 1401.28, "end": 1407.04, "text": " in their framework you condition on all the xj for any x i"}, {"start": 1407.04, "end": 1415.2, "text": " and and uh see here i wrote this as xj i was dumb"}, {"start": 1415.2, "end": 1422.56, "text": " should be the entire x and there is interaction between the tokens"}, {"start": 1422.56, "end": 1426.96, "text": " and it's going to cost you two d squared parameters now parameters is different"}, {"start": 1426.96, "end": 1431.76, "text": " from computation which if you don't you don't do the dot product you also save"}, {"start": 1431.76, "end": 1436.24, "text": " a bunch of computation but here they look at a number of parameters"}, {"start": 1436.24, "end": 1444.88, "text": " so in this random synthesizer you simply output this matrix or"}, {"start": 1444.88, "end": 1449.2, "text": " it's global it there's no interaction and you are"}, {"start": 1449.2, "end": 1456.88, "text": " you are it's cost you l squared memory in l squared parameters"}, {"start": 1456.88, "end": 1462.24, "text": " now often in these models l and d are actually pretty similar"}, {"start": 1462.24, "end": 1467.6000000000001, "text": " so l might be something like 512 tokens the length and the dimension right here"}, {"start": 1467.6000000000001, "end": 1472.4, "text": " might also be something like 512 so per se this is not really a"}, {"start": 1472.4, "end": 1477.2800000000002, "text": " saving in parameters only when you go to the to the"}, {"start": 1477.2800000000002, "end": 1482.3200000000002, "text": " factorized models right here can you bring in this k and k is this lower"}, {"start": 1482.3200000000002, "end": 1487.76, "text": " dimension of factorization and if k is much much smaller than l then you save a"}, {"start": 1487.76, "end": 1494.0800000000002, "text": " bunch of parameters the dense synthesizer is formula is like this this is"}, {"start": 1494.0800000000002, "end": 1499.92, "text": " I produce the attention matrix you condition on x i but not xj right"}, {"start": 1499.92, "end": 1508.88, "text": " for each y i you condition on x i and you do not care about the xj's"}, {"start": 1508.88, "end": 1515.8400000000001, "text": " that is it is a it is local that means it depends on x i so the the routing"}, {"start": 1515.8400000000001, "end": 1518.8000000000002, "text": " actually depends on the information that goes through but there is no"}, {"start": 1518.8000000000002, "end": 1523.68, "text": " interaction and you're going into d squared plus d l which is also pretty much"}, {"start": 1523.68, "end": 1530.3200000000002, "text": " 2d squared right and or you go to this lower"}, {"start": 1530.3200000000002, "end": 1536.88, "text": " lower number here if you choose a good k all right now experiments so they"}, {"start": 1536.88, "end": 1543.04, "text": " apply this and we are absolutely stoked how this is going to"}, {"start": 1543.04, "end": 1547.52, "text": " turn out so they go on machine translation now"}, {"start": 1547.52, "end": 1554.32, "text": " okay before before we go into the results do you think machine translation is a"}, {"start": 1554.32, "end": 1562.08, "text": " good or a bad task for this model okay I think it is a good task for this"}, {"start": 1562.08, "end": 1566.96, "text": " model is a very favorable task for this model why why is machine translation"}, {"start": 1566.96, "end": 1571.84, "text": " a favorable task well mostly in machine translation if you think about how"}, {"start": 1571.84, "end": 1582.9599999999998, "text": " information is routed so I have I have a I have a sequence of German let's call"}, {"start": 1582.9599999999998, "end": 1589.36, "text": " it or English let's call it the dog barks"}, {"start": 1589.36, "end": 1596.0, "text": " and I have a sequence of German der Hundbelt"}, {"start": 1596.0, "end": 1604.24, "text": " come on hold belt now okay first of all I know they are only talking about"}, {"start": 1604.24, "end": 1608.24, "text": " self-attention so this example here actually makes little sense in the actual"}, {"start": 1608.24, "end": 1613.76, "text": " practical applications but I just want to demonstrate why machine translation"}, {"start": 1613.76, "end": 1620.08, "text": " specifically has so how would you route information here if you have to route"}, {"start": 1620.08, "end": 1623.44, "text": " information between the two things what you would do is pretty"}, {"start": 1623.44, "end": 1629.44, "text": " deterministically do this right so in machine translation what is very very"}, {"start": 1629.44, "end": 1636.16, "text": " very often the case is that mostly you're going to align the positions in the"}, {"start": 1636.16, "end": 1641.04, "text": " same way independent of the input specifically here you would always most of"}, {"start": 1641.04, "end": 1644.24, "text": " the time align the beginning with the beginning the end with the end and"}, {"start": 1644.24, "end": 1648.56, "text": " so on because for most languages especially similar languages like"}, {"start": 1648.56, "end": 1654.08, "text": " English and German the order of sentences and number of words per thing you"}, {"start": 1654.08, "end": 1659.6, "text": " need to express is going to be roughly the same so if you did not know"}, {"start": 1659.6, "end": 1665.04, "text": " about even about what the sequences were or you only knew one of them"}, {"start": 1665.04, "end": 1670.96, "text": " like you only knew there and you have to guess where should information come"}, {"start": 1670.96, "end": 1676.24, "text": " from well I know in English you also start with like this what's this called"}, {"start": 1676.24, "end": 1684.64, "text": " an article yeah it yes this is an article showing my linguistic skills here"}, {"start": 1684.64, "end": 1689.04, "text": " you you would also you would also start with that right you would say I want"}, {"start": 1689.04, "end": 1693.2, "text": " most information from position zero obviously I don't care what they're"}, {"start": 1693.2, "end": 1697.44, "text": " what what is there so I and again I know they don't"}, {"start": 1697.44, "end": 1700.16, "text": " do it in self-attention so it actually makes no sense that I have two"}, {"start": 1700.16, "end": 1703.84, "text": " different languages here but machine translation"}, {"start": 1703.84, "end": 1708.72, "text": " is probably a task that lends itself very much to sort of global"}, {"start": 1708.72, "end": 1715.52, "text": " globally learned or only partially the partial observably learned"}, {"start": 1715.52, "end": 1720.9599999999998, "text": " attention patterns because just because of the nature of the task right so"}, {"start": 1720.9599999999998, "end": 1725.6, "text": " let's keep that in mind and go to the"}, {"start": 1725.6, "end": 1730.56, "text": " results right here that they first of all what they do is they list the"}, {"start": 1730.56, "end": 1735.28, "text": " original transformer paper and actually have it here because they have to they"}, {"start": 1735.28, "end": 1741.76, "text": " have this same experiment now this is the kind of transformer we're"}, {"start": 1741.76, "end": 1746.48, "text": " talking about right here and it is notable that this paper only proposes to"}, {"start": 1746.48, "end": 1750.24, "text": " replace the self-attention that means the attention that would be"}, {"start": 1750.24, "end": 1755.36, "text": " within one of these two columns and not the attention that goes across from"}, {"start": 1755.36, "end": 1761.12, "text": " the left to the right right but still you can see that the attention that goes"}, {"start": 1761.12, "end": 1766.3999999999999, "text": " from the left to the right then in the next layer is going to end up as self"}, {"start": 1766.3999999999999, "end": 1772.8, "text": " attention information right so my I think my argument still counts in the in this"}, {"start": 1772.8, "end": 1778.1599999999999, "text": " case in the machine translation case all right"}, {"start": 1778.16, "end": 1786.16, "text": " so they have this same experiment right here here yes they have English German"}, {"start": 1786.16, "end": 1792.88, "text": " translation and they their base model gets 27.3 and that's what they evaluate"}, {"start": 1792.88, "end": 1800.8000000000002, "text": " right here they list this 27.3 but they also say when we train it we get a bit"}, {"start": 1800.8000000000002, "end": 1804.88, "text": " of a higher number 27.67 and especially on English"}, {"start": 1804.88, "end": 1809.8400000000001, "text": " French they get a higher number than that but let's stick to"}, {"start": 1809.8400000000001, "end": 1816.24, "text": " English German for now now they also do language modeling which the original"}, {"start": 1816.24, "end": 1820.88, "text": " paper didn't do and record the perplexity right here"}, {"start": 1820.88, "end": 1827.6000000000001, "text": " okay so the first thing they point out is if we train the synthesizer with a"}, {"start": 1827.6000000000001, "end": 1832.24, "text": " fixed random matrix that means we just put a random"}, {"start": 1832.24, "end": 1839.28, "text": " routing and we do not we do not ever change it what's there to learn so if you"}, {"start": 1839.28, "end": 1842.08, "text": " want to learn something in the transformer there's still many things to"}, {"start": 1842.08, "end": 1847.76, "text": " learn there's the feet forward layers right there is the the value and"}, {"start": 1847.76, "end": 1852.32, "text": " coder and so on so it is it is reasonable to assume that the"}, {"start": 1852.32, "end": 1857.6, "text": " transformer could sort of learn to just handle the the routing pattern that"}, {"start": 1857.6, "end": 1862.1599999999999, "text": " is in place and that the rest of the model can sort of absorb that chalk and"}, {"start": 1862.1599999999999, "end": 1867.6, "text": " interestingly you get onto 23.9 so almost 24"}, {"start": 1867.6, "end": 1874.48, "text": " blue points and I mean it seems they they point out that it's fairly close"}, {"start": 1874.48, "end": 1880.0, "text": " if you look here this 24 is actually pretty far away it's the worst"}, {"start": 1880.0, "end": 1885.36, "text": " the worst baseline right here in the original paper this bite net had"}, {"start": 1885.36, "end": 1891.6, "text": " this 24 blue I mean it's I guess it's cool to point out that it works"}, {"start": 1891.6, "end": 1897.12, "text": " as such but you know in these tasks actually many things work right with"}, {"start": 1897.12, "end": 1902.8, "text": " with if you distill this down to some sort of a bag of words model and so on"}, {"start": 1902.8, "end": 1907.52, "text": " I'm pretty sure you can get pretty pretty good results as well and you can get"}, {"start": 1907.52, "end": 1913.4399999999998, "text": " you know fairly you can go to 24 blue I actually I have no clue of this field"}, {"start": 1913.44, "end": 1917.52, "text": " but I just want to point out just because the number is in the same ballpark"}, {"start": 1917.52, "end": 1923.92, "text": " doesn't mean that it is very astonishing it's maybe just you have so many"}, {"start": 1923.92, "end": 1929.92, "text": " parameters that the rest of the model can sort of absorb this the shock of"}, {"start": 1929.92, "end": 1934.0800000000002, "text": " not of not being able to learn this and you can just handle whatever pattern"}, {"start": 1934.0800000000002, "end": 1938.3200000000002, "text": " you put there I can just kind of work with it okay that's"}, {"start": 1938.3200000000002, "end": 1942.48, "text": " many people have observed if you like put just random junk in the lower"}, {"start": 1942.48, "end": 1946.64, "text": " layers of a CNN like random filters never train them you can still"}, {"start": 1946.64, "end": 1951.68, "text": " the rest of the network can adapt so that's basically this effect right here"}, {"start": 1951.68, "end": 1956.4, "text": " I don't think it's a testament to we don't need the dot product attention it's"}, {"start": 1956.4, "end": 1960.8, "text": " more like this this just happens in deep learning"}, {"start": 1960.8, "end": 1967.1200000000001, "text": " then however they say if we now learn this one matrix so we learn this"}, {"start": 1967.12, "end": 1975.1999999999998, "text": " routing but globally we get into 27.27 blue and this already seems"}, {"start": 1975.1999999999998, "end": 1981.1999999999998, "text": " fairly close right and you mainly need to compare with this number right here"}, {"start": 1981.1999999999998, "end": 1986.2399999999998, "text": " because that's actually the same training run and so on so"}, {"start": 1986.2399999999998, "end": 1991.76, "text": " but still it is quite it is quite a bit away it's 0.4 blue points away and that"}, {"start": 1991.76, "end": 1998.16, "text": " is a sort of significant difference I think"}, {"start": 1998.32, "end": 2004.8, "text": " then they go further if they go to the dense synthesizer"}, {"start": 2004.8, "end": 2011.44, "text": " you can see right here the model size is lower than this one"}, {"start": 2011.44, "end": 2017.68, "text": " and they get 27.43 now they get even closer right"}, {"start": 2017.68, "end": 2023.8400000000001, "text": " and they are actually on par if they mix random and dense"}, {"start": 2023.8400000000001, "end": 2030.72, "text": " right here and you can see that it's also almost the same"}, {"start": 2030.72, "end": 2038.5600000000002, "text": " amount of parameters and when they mix these random and vanilla so what they"}, {"start": 2038.5600000000002, "end": 2042.8, "text": " now have is the dot product attention plus a purely global"}, {"start": 2042.8, "end": 2048.88, "text": " feat forward sort of like a bias of what to route where"}, {"start": 2048.88, "end": 2054.4, "text": " then they can outcompete this original model but also now they have"}, {"start": 2054.4, "end": 2058.48, "text": " more parameters right so this model you would expect it to be you know"}, {"start": 2058.48, "end": 2062.0, "text": " strictly better than either of the two alone and it is"}, {"start": 2062.0, "end": 2068.48, "text": " and it is actually astounding that the synthesizer that mixes the vanilla with"}, {"start": 2068.48, "end": 2074.0, "text": " the dense even though it has even more parameters it does worse so with these"}, {"start": 2074.0, "end": 2079.12, "text": " sort of results especially then you go fiddle with like 0.1 you know between"}, {"start": 2079.12, "end": 2085.2, "text": " this and that I know I said 0.4 blue is a lot so 0.1 must be"}, {"start": 2085.2, "end": 2089.6, "text": " something and it surely is but also it's always the question of how many"}, {"start": 2089.6, "end": 2093.84, "text": " hyper parameter tunings you put into something like this and"}, {"start": 2093.84, "end": 2100.4, "text": " generally you should always sort of look at this if you were a researcher"}, {"start": 2100.4, "end": 2104.6400000000003, "text": " and had to put the best possible numbers here what would you do and then you"}, {"start": 2104.6400000000003, "end": 2110.08, "text": " correct for that in your mind for how much it might actually work if you"}, {"start": 2110.08, "end": 2114.56, "text": " if you are to if you are to you know go ahead and"}, {"start": 2114.56, "end": 2120.2400000000002, "text": " and train that on your data but nevertheless it it gives some cool insights"}, {"start": 2120.24, "end": 2127.2, "text": " right what I'm a bit confused by is that if you sort of look at the"}, {"start": 2127.2, "end": 2132.0, "text": " original paper and you look at the perplexities and they have a table down here"}, {"start": 2132.0, "end": 2135.9199999999996, "text": " where they compare a bunch of their instantiations of their model and you"}, {"start": 2135.9199999999996, "end": 2141.52, "text": " compare the compare also the perplexity on a language modeling task"}, {"start": 2141.52, "end": 2146.72, "text": " and the perplexity here seems to correlate extremely well with the blue"}, {"start": 2146.72, "end": 2152.9599999999996, "text": " score right whereas the perplexity here if you look at the perplexities over here"}, {"start": 2152.9599999999996, "end": 2159.4399999999996, "text": " they do correlate but I somehow I have the feeling they don't really correlate"}, {"start": 2159.4399999999996, "end": 2164.7999999999997, "text": " as much here which sort of speaks to the fact that you're going to see in the"}, {"start": 2164.7999999999997, "end": 2170.9599999999996, "text": " rest of the paper that these models they tend to sometimes be able to do well"}, {"start": 2170.9599999999996, "end": 2176.64, "text": " but then other times not and it's not really clear super clear when"}, {"start": 2176.64, "end": 2182.7999999999997, "text": " so look at this for example they now apply their models to summarization and"}, {"start": 2182.7999999999997, "end": 2188.16, "text": " dialogue generation right these are two tasks where you need to output text"}, {"start": 2188.16, "end": 2193.12, "text": " and you can see that the results are all over the place so in this metric rouge"}, {"start": 2193.12, "end": 2196.4, "text": " too and rouge is sort of an engram overlap metric"}, {"start": 2196.4, "end": 2200.7999999999997, "text": " between gold standards and what you produce in this metric the original"}, {"start": 2200.8, "end": 2207.36, "text": " transformer is best but in rouge one this synthesizer mix here is the best"}, {"start": 2207.36, "end": 2212.4, "text": " and in rouge l this one is the best and in dialogue generation all of them are"}, {"start": 2212.4, "end": 2217.28, "text": " actually not as good as this one right here where it's just the dense"}, {"start": 2217.28, "end": 2221.04, "text": " which is strictly less powerful than the ones on the bottom but"}, {"start": 2221.04, "end": 2225.76, "text": " so as you as you can see yeah I think what you should take away from this is"}, {"start": 2225.76, "end": 2232.88, "text": " that it it is interesting that it sometimes works but it seems to be a fair bit"}, {"start": 2232.88, "end": 2240.88, "text": " of shakiness to these to these results okay now they go on and they test this"}, {"start": 2240.88, "end": 2245.6800000000003, "text": " on super glue and this is a benchmark so glue and super glue they"}, {"start": 2245.6800000000003, "end": 2251.2000000000003, "text": " consist of these different tasks right here and now we are out of the text"}, {"start": 2251.2, "end": 2256.16, "text": " generation game we are in the game of for example you have two sentences and you"}, {"start": 2256.16, "end": 2262.0, "text": " need to decide which which one is like which one entails the other or are they"}, {"start": 2262.0, "end": 2266.3199999999997, "text": " contradictory or things like this so it's more of a like say a classification"}, {"start": 2266.3199999999997, "end": 2271.2, "text": " task and people apply different models so it's no longer a text generation"}, {"start": 2271.2, "end": 2275.7599999999998, "text": " task so they switch model instead of the vanilla transformer from the"}, {"start": 2275.7599999999998, "end": 2281.12, "text": " attention is all you need paper they now go on to the t5 the text to text"}, {"start": 2281.12, "end": 2286.96, "text": " transformer and they change they simply take the architecture and they change"}, {"start": 2286.96, "end": 2294.48, "text": " the attention in there with their attention and you can see right here that the"}, {"start": 2294.48, "end": 2300.56, "text": " results are quite different than before so in every single case either the"}, {"start": 2300.56, "end": 2305.12, "text": " t5 model the base model with the dot product attention"}, {"start": 2305.12, "end": 2311.6, "text": " is the best model or the synthesizer but including"}, {"start": 2311.6, "end": 2316.88, "text": " v so plus v means plus vanilla means it also has the dot product attention"}, {"start": 2316.88, "end": 2324.08, "text": " plus this learned thing right here okay so r is now the learned I think the"}, {"start": 2324.08, "end": 2328.16, "text": " learned right I would be surprised if it was the random random"}, {"start": 2328.16, "end": 2331.92, "text": " but it could also be but in any case it's strictly"}, {"start": 2331.92, "end": 2335.6800000000003, "text": " better right it's strictly more powerful model"}, {"start": 2335.6800000000003, "end": 2340.08, "text": " and the only way can actually perform worse is when you know it's too many"}, {"start": 2340.08, "end": 2344.0, "text": " parameters and so on and they kind of take stuff from each other and there's"}, {"start": 2344.0, "end": 2348.08, "text": " effects where more parameters can hurt you but never"}, {"start": 2348.08, "end": 2351.76, "text": " is any model that doesn't have the dot product attention"}, {"start": 2351.76, "end": 2358.48, "text": " on on top and these authors here argue that thus"}, {"start": 2358.48, "end": 2363.28, "text": " this can be largely attributed to the fact that the encoder self-attention in"}, {"start": 2363.28, "end": 2367.92, "text": " the t5 setting also functions as a cross sentence attention"}, {"start": 2367.92, "end": 2375.04, "text": " so what do they mean here if in the t5 is just as I understand it"}, {"start": 2375.04, "end": 2378.64, "text": " this is just like an encoder like bird so imagine"}, {"start": 2378.64, "end": 2382.96, "text": " imagine maybe this is bird right what bird is simply an encoder only"}, {"start": 2382.96, "end": 2389.12, "text": " transformer that means you here you put in your sequence and out again comes a"}, {"start": 2389.12, "end": 2392.7200000000003, "text": " sequence and you have like a special token that you use for classification"}, {"start": 2392.7200000000003, "end": 2397.36, "text": " and so on so this is less when you have to generate text but"}, {"start": 2397.36, "end": 2402.48, "text": " more when you want to classify text or things like this"}, {"start": 2402.48, "end": 2407.28, "text": " find something in a text and what you would do if you have two sentences you need"}, {"start": 2407.28, "end": 2410.88, "text": " to decide something about them you put the first sentence here"}, {"start": 2410.88, "end": 2414.56, "text": " and then you say you put like a separator token here"}, {"start": 2414.56, "end": 2418.48, "text": " this is usually called like a separator token and then you put the second"}, {"start": 2418.48, "end": 2422.08, "text": " sentence here is you just concatenate them and you let them go into the"}, {"start": 2422.08, "end": 2426.32, "text": " transformer and they argue that if you do self-attention on this entire"}, {"start": 2426.32, "end": 2431.04, "text": " sequence then you get attention patterns like this and this is sort of like"}, {"start": 2431.04, "end": 2435.92, "text": " cross-attention between sequences right it's not really self-attention"}, {"start": 2435.92, "end": 2440.1600000000003, "text": " and that's why their method doesn't work because it basically"}, {"start": 2440.16, "end": 2444.72, "text": " deals with self-attention but I'm not really buying that argument I mean if"}, {"start": 2444.72, "end": 2449.52, "text": " this is a sequence it is if this is one sequence this is self-attention"}, {"start": 2449.52, "end": 2455.2799999999997, "text": " and if you are going to argue that out of the blue a token"}, {"start": 2455.2799999999997, "end": 2460.0, "text": " in your case like in your original formulation can simply"}, {"start": 2460.0, "end": 2463.2, "text": " you know just by looking at itself know where"}, {"start": 2463.2, "end": 2467.68, "text": " where which position it wants the information from and certainly here this"}, {"start": 2467.68, "end": 2471.12, "text": " token could also learn that it wants information from over here or from the"}, {"start": 2471.12, "end": 2474.7999999999997, "text": " first word here I don't I don't really see the difference"}, {"start": 2474.7999999999997, "end": 2478.56, "text": " maybe maybe you need to somehow standardize"}, {"start": 2478.56, "end": 2483.7599999999998, "text": " where this separator token is so that it's always in the same place and that"}, {"start": 2483.7599999999998, "end": 2487.12, "text": " the second sentence always starts at the same place but"}, {"start": 2487.12, "end": 2492.08, "text": " if you have that then I really don't see any difference in the argument you"}, {"start": 2492.08, "end": 2496.3999999999996, "text": " can make here that this shouldn't work as much as the others"}, {"start": 2496.4, "end": 2500.1600000000003, "text": " what I think is happening is that this task is simply"}, {"start": 2500.1600000000003, "end": 2505.44, "text": " involves more difficult reasoning involves more routing of information"}, {"start": 2505.44, "end": 2509.84, "text": " like dynamic routing that's actually dependent on what's in the tasks"}, {"start": 2509.84, "end": 2513.2000000000003, "text": " rather than something like machine translation which"}, {"start": 2513.2000000000003, "end": 2518.32, "text": " most of the time has some global routing bias like"}, {"start": 2518.32, "end": 2523.44, "text": " like some some pattern that works pretty well across all"}, {"start": 2523.44, "end": 2527.2000000000003, "text": " all right so the last part here is where they kind of"}, {"start": 2527.2000000000003, "end": 2531.68, "text": " introspect the model and in the in the first thing they say okay we look at the"}, {"start": 2531.68, "end": 2536.32, "text": " distribution of weights so these are the weights"}, {"start": 2536.32, "end": 2540.32, "text": " the weights in the decoder at the beginning of training"}, {"start": 2540.32, "end": 2546.56, "text": " and you can already see that the standard transformer weights are"}, {"start": 2546.56, "end": 2550.8, "text": " and the synthesizer weights are different from the sorry the dense"}, {"start": 2550.8, "end": 2555.04, "text": " synthesizer weights are different from the random synthesizer weights"}, {"start": 2555.04, "end": 2558.8, "text": " and this probably is mostly due to the fact of how you initialize"}, {"start": 2558.8, "end": 2563.04, "text": " like these deep learning frameworks if you have a matrix they will look at"}, {"start": 2563.04, "end": 2566.4, "text": " what's this dimension what's this dimension and look calculate"}, {"start": 2566.4, "end": 2571.44, "text": " how they have to initialize it such that sort of the the total norm of a random"}, {"start": 2571.44, "end": 2575.76, "text": " vector that goes through stays the same sorry the vector would go through"}, {"start": 2575.76, "end": 2580.1600000000003, "text": " like it would go in here and out there so you see if it changes dimension"}, {"start": 2580.16, "end": 2585.3599999999997, "text": " then if you just randomly initialize with all the same"}, {"start": 2585.3599999999997, "end": 2591.68, "text": " like every matrix with the same number then like with the normal distribution"}, {"start": 2591.68, "end": 2597.3599999999997, "text": " then the in this case the vector would gain in norm and to account for that"}, {"start": 2597.3599999999997, "end": 2602.56, "text": " you initialize the matrices such that the vector norms approximately stay the"}, {"start": 2602.56, "end": 2607.12, "text": " same and this is why they're I guess why there are different initializations"}, {"start": 2607.12, "end": 2611.7599999999998, "text": " here and you can see this at the end of the training"}, {"start": 2611.7599999999998, "end": 2616.3199999999997, "text": " now these in in different layers right here it's pretty much always the same"}, {"start": 2616.3199999999997, "end": 2620.88, "text": " pattern that they they say they they just remark it so this this is what I find"}, {"start": 2620.88, "end": 2627.2799999999997, "text": " weird they just say what the graphs show they don't interpret it like I would"}, {"start": 2627.2799999999997, "end": 2632.4, "text": " expect something like oh this pattern is exactly what we would expect"}, {"start": 2632.4, "end": 2636.7999999999997, "text": " from our model because something something something right like if they claim"}, {"start": 2636.8, "end": 2642.32, "text": " that this attention is being able to be learned I just don't see why they do"}, {"start": 2642.32, "end": 2646.5600000000004, "text": " this stuff they simply point out oh yeah this this is higher here and this is"}, {"start": 2646.5600000000004, "end": 2651.76, "text": " higher here but I don't even see that as too interesting given that is this"}, {"start": 2651.76, "end": 2656.0, "text": " is how you initialize it like if I shift everything to the left of it and"}, {"start": 2656.0, "end": 2661.44, "text": " you know this is wall so it like this piles up here then this is exactly what"}, {"start": 2661.44, "end": 2667.76, "text": " turns out I don't I don't see you know what what this is supposed to mean"}, {"start": 2667.76, "end": 2671.36, "text": " especially since they don't make any claim of what it is supposed to mean and"}, {"start": 2671.36, "end": 2676.08, "text": " the same here they say the effect of the number of heads okay we we"}, {"start": 2676.08, "end": 2681.36, "text": " investigate the effect and the number of heads on the random synthesizer models"}, {"start": 2681.36, "end": 2687.12, "text": " you know and they train the number of heads now somewhere in the text they say"}, {"start": 2687.12, "end": 2693.2, "text": " I remember they say since you know since we don't dynamically route it is"}, {"start": 2693.2, "end": 2697.44, "text": " very important for our models very crucial to have many attention heads"}, {"start": 2697.44, "end": 2701.68, "text": " right such that basically you don't have one routing pattern you have many"}, {"start": 2701.68, "end": 2706.88, "text": " routing patterns that you learn globally so they say it's very important for"}, {"start": 2706.88, "end": 2711.44, "text": " our model to have many attention heads and I guess that's what they're trying to"}, {"start": 2711.44, "end": 2717.76, "text": " demonstrate here but again they simply say what's happening they don't interpret it"}, {"start": 2718.64, "end": 2725.6, "text": " and and they don't compare it to anything they just you know put it here they just put"}, {"start": 2725.6, "end": 2732.56, "text": " the number and I don't like is this good is this is this bad can you compare it to something"}, {"start": 2732.56, "end": 2738.4, "text": " and also here in the so here in the original paper they do the same thing here as you can see"}, {"start": 2738.4, "end": 2744.4, "text": " the number h is the heads and they do a blade this but at the same time they adjust the"}, {"start": 2744.4, "end": 2749.6, "text": " dimensions of the key and value vectors such that in total they have the same"}, {"start": 2749.6, "end": 2755.6800000000003, "text": " amount of parameters right so they can really investigate is one big attention head better or"}, {"start": 2755.6800000000003, "end": 2762.7200000000003, "text": " worse than many small attention heads is there a trade-off and they find here that there is a"}, {"start": 2762.7200000000003, "end": 2767.52, "text": " bit of a trade-off like there is a sweet spot you don't want too many you don't want too much"}, {"start": 2767.52, "end": 2773.7599999999998, "text": " because they get too small something like this but first we like we don't know whether or not"}, {"start": 2773.7599999999998, "end": 2778.8, "text": " have they simply changed the heads but left every other parameter the same or have they also"}, {"start": 2778.8, "end": 2784.24, "text": " adjusted the dimensions because if they haven't adjusted the dimensions then this this increase"}, {"start": 2784.24, "end": 2789.7599999999998, "text": " would be absolutely expected because you now have more parameters and if they have adjusted"}, {"start": 2789.76, "end": 2798.2400000000002, "text": " then can we compare this to you know something because this here is the this is the T5 small this"}, {"start": 2798.2400000000002, "end": 2806.5600000000004, "text": " is not the original transformer like is this big is this small and what does it say about the"}, {"start": 2806.5600000000004, "end": 2812.88, "text": " claim that you made that the number of heads is so important for your model can you validate this"}, {"start": 2812.88, "end": 2818.6400000000003, "text": " using this so it's just a bit of like this entire page here it's just they they just measure"}, {"start": 2818.64, "end": 2825.3599999999997, "text": " some things and then they state them here and you're somehow supposed to guess what they mean"}, {"start": 2825.3599999999997, "end": 2834.08, "text": " by stating that here okay but that was enough for me ranting so they give some supplementary"}, {"start": 2834.08, "end": 2840.8799999999997, "text": " material right here but in essence what I like about the paper is sort of the thinking that goes"}, {"start": 2840.8799999999997, "end": 2846.4, "text": " into this thinking outside the box asking the fundamental questions about these models do we really"}, {"start": 2846.4, "end": 2852.48, "text": " need this what what do they do I don't think it's super well investigated really from a scientific"}, {"start": 2852.48, "end": 2858.56, "text": " point like the formulation of hypotheses it simply trains these things and then make some claims"}, {"start": 2858.56, "end": 2864.7200000000003, "text": " but the claims interact you know with the number of parameters here and so on so and they're"}, {"start": 2864.7200000000003, "end": 2870.88, "text": " sort of noisy all around and of course the fact that this thing here turns out to be a fully"}, {"start": 2870.88, "end": 2878.6400000000003, "text": " connected layer in disguise is also pretty funny but I get it it's a fan it's like it's it's more"}, {"start": 2878.6400000000003, "end": 2886.48, "text": " it's not exactly the same thing but it you know yeah all right so that was my take on this paper"}, {"start": 2886.48, "end": 2893.76, "text": " if you have a different one let me know in the comments for sure I read all of them and at least I"}, {"start": 2893.76, "end": 2900.8, "text": " try and I've always succeeded so far all right I'll see you next time bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=LfUsGv-ESbc | [Code] How to use Facebook's DETR object detection algorithm in Python (Full Tutorial) | Watch my as I struggle my way up the glorious path of using the DETR object detection model in PyTorch.
Original Video on DETR: https://youtu.be/T35ba_VXkMY
Their GitHub repo: https://github.com/facebookresearch/detr
My Colab: https://colab.research.google.com/drive/1Exoc3-A141_h8GKk-B6cJxoidJsgOZOZ?usp=sharing
OUTLINE:
0:00 - Intro
0:45 - TorchHub Model
2:00 - Getting an Image
6:00 - Image to PyTorch Tensor
7:50 - Handling Model Output
15:00 - Draw Bounding Boxes
20:10 - The Dress
22:00 - Rorschach Ink Blots
23:00 - Forcing More Predictions
28:30 - Jackson Pollock Images
32:00 - Elephant Herds
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 | How the how's it going? So today we are going to try out the DETR, the end-to-end object detection with transformers from Facebook AI research and they have a GitHub repo and they pretty much give you everything like the model, the pre-trained weight, and so on. So today we're going to check out how easy it is to get started with that. So in order to do that they have like a collab but we we won't look at it too much. I've glanced at it and we'll basically see how far can we go without looking at it too much and how easy is that. So what I've done is I've spun up a collab that I will share at the end and I've imported torches and just loaded the model so you don't have to wait for that to happen. So I've loaded that up and now we have it in the cache. So now we can basically go ahead and load an image into the model and try to detect objects in the image. So first of all this is super easy right? You simply load this from Torch Hub. It's kind of like the the TensorFlow Hub. You simply give the name of the model. You say I want a pre-trained please. Shalgabum you now have a model. So if we look at that model this is going to be this entire DETR model right here with all the transformer and ResNet and whatnot. Okay this is almost a bit too much right here. So what we want is an image. So let's go find an image. Where better they find an image than Google. So let's find an image of dogs because dogs is one of the classes in this co-code dataset. This one's nice right? Okay so we want the image address. We want to load it in here somehow. So let the URL is let's make this into some sort of like an input thing where we can paste the URL right here. Okay there we go. So we have this right here and that's the URL. All right no that's not the URL at all. Is it? Ba da bim, ba da boom, ba da boom. Cool. Better. Now we need to load this. For that we going to use the request library. Always a pleasure requests requests. So the way to load a binary file is you can put the URL here and you can say streamed here. I glanced this from the other thing and the raw entry will get you the eventual the bytes. No. Oh sorry get your L streamed stream. Yeah so this will get you the sort of the the bytes of the image and then use to say image.open and of course we need the image from a the pill library the Python image library. So import image. We got that and we can open that image up and with a bit of luck. Yeah yeah. So this model expects I think Cocoa dataset is 640 by 480 images but they if you can see right here and we're going to take a quick glance at their transforming they resize it to 800 so we're going to we're going to steal that part right here. People last time were some some found it really funny that I called copy pasting to go Sirage so we'll from now on we'll call it just Siraging. What we also need are the class labels because that's in defined in the Cocoa dataset right so these are the class labels. Let's take those and okay so this T here these are Torch revision transforms we're going to need that so from let's say so if you don't know Torch vision it's kind of an addition to PyTorch that just helps you with with images and has a lot of datasets and these transforms they're really helpful because so let's call this image because you can you know resize but they have much more like random cropping and rotating images and so on pretty much everything you need for pre training and this here is just the standard image net I believe the image net normalization so these are the means and these are the standard deviations from the image net dataset and let's already resize our image actually to this 800 and I believe I believe if you rescale the 642 800 you get 600 here right fairly sure okay and then let's display it just because we can okay what it's it's a bit squished but we don't care and let's put that up here so we only need to execute it once nice okay so from now on it should be a breeze so what these transforms do is they resize the image okay we don't need that anymore they make it into a tensor and then they normalize by that so if we run our image through this because our image right now is this is pill image right so our image is this pill image but if we run it through the transforms then we'll get a tensor so that's pretty cool so the model as it is a deep learning model it expects batches so we'll unsquease that in the first dimension and then we get batches so shape let's see we don't have unskies no of course we don't so this is a one image of three channels of 600 by 800 so this is the Y and X coordinates I guess are shifted yes in PyTorch cool so we'll call this our image tensor now we just need to put it into the model so model we put that in there and since we don't let's actually up here put the model in eval mode I don't know if that's already done but you know you can never be sure enough that the batch norms aren't but I think it probably doesn't have batch norms okay you're not utilizing the GPU we'll do that we'll do that thanks so how do we use the GPU we put our model on the GPU model equals model dot kuda yes yes yes I think so this is gonna work okay we're gonna come back to this later so we forward our image of course we also need that on the GPU and this worked this worked this worked nice okay and since this is just for evaluation we should probably go with no grad right here because we don't need this whole gradient stuff if we do that okay I'm dumb there you go and nothing happens of course because we need to capture the output somehow let's look at that output wow wow just wow so the output is a dictionary right because we get back class labels and bounding boxes so let's look at the pred boxes let's look at that tensor that's a tensor very nice let's look at its shape that's not print giant tensors anymore cool so since this was a batch of one we should probably go with the zero if and you can see right here there is a hundred bounding boxes and each one has four numbers and if you go with the other thing that's in there the logits then you you'll see that there are also should be a hundred logits and hello there should be a hundred logits and each one is of size 92 because there are 92 different classes 92 we'll see about that well one is going to be the nothing class right by the way how many classes do we have we have 91 classes okay cool we can deal with that all right so what are we gonna do next what we want to do is for each of the for each of the for each of the logit predictions we want to find which class corresponds to so what we're going to do is we're going to take the arg max of the last dimension right so you can see here almost all of these things correspond to class 91 and class 91 is not in our classes because our class is only length 91 so that must be the nothing class so what we can technically be is for logits and boxes in let's just zip them together and like this okay class is class is the logits arg max if that's 92 or let's say you save that's larger than the length of our classes we'll just skip it for now okay so that should work somehow and if not then our label should be the class index right here so let's just see what the detector detects right here it detects nothing why does it detect nothing that's doesn't seem good what are we doing wrong we zip together the logits oh yeah of course we still need the zero with entry we are dumb dumb dumb cool so so so so we can delete this and now finally beautiful dogs two dogs detected excellent so now for each of these dogs we want the bounding box okay so now we somehow need to think of how are we gonna draw this on an image and well let's let's actually make a copy of that image because I don't really trust myself and then at the end of this we're just going to display that image right now actually the reason I make a copy is because in these in this pillow library you can actually draw on these images and we're gonna use that to draw these bounding boxes so for that we need an image draw if I remember correctly and I think later we also want some texts so we need an image font yes all right so let's draw a bounding box right here where so first of all let's look at that bounding box let's call this box box print box dot shape and break right here what's happening let's not do this right now so this is a box is of size four now this could be two things it could be x zero y zero x one y one so the two corner points or the kind of the boundaries or it could be x y with height now from the paper I know that they predict the center and the width and the height so I'm gonna go with that and I'm just gonna guess that it's like x y w h and not some other way around if this is a bad guess then yeah we'll see we can just print out one of these boxes and honestly look look that looks reason oh by the way we should scale that up yeah so these are normalized coordinates probably between zero and one so we should scale that up so we should probably the x coordinates which is scale by 800 and the y by 600 so let's do it so first of all we scale our box by 800 in the x and here's a y and the width is the x direction and this is the y direction boom okay we should probably get that on CPU we'll just hack together a bunch of things right here okay so now this isn't the correct so we so our x and y and w and h are going to be this box so now we need to actually draw on the image how are we gonna do that so let's first go x zero x one is x minus w half x plus w half y zero y one is the same for y with h plus h half cullio now we need an image draw object so I think draw on this image so whatever you draw on the draw object will end up on the image so we can use that to draw a bounding box and let's just quickly look it up so peel Python draw rectangle maybe there we go okay so there's this rectangle yeah there's the rectangle function and you can see you put in a shape x y here and with height like this wait for real we wouldn't even have to need to transform it I'm pretty sure you can go x I thought I remember you could do the different thing as well but it's called rectangle okay so let's do that so draw rectangle and we'll go we'll go x zero or we'll go x y with height let's display that down here yeah that looks that looks nothing like we want but it's you know it's a start maybe actually we need the other thing here we need x zero y zero x one y one yes yes doggy okay we still have the break in here now we get both dogs nice nice okay let's do I think fill yes red and let's go for with five or so five seems like a good with oh god five is a terrible with oh it's not feel I think it's it's outline yeah yeah yeah okay okay let's go still go with five cool we got our dogs now we need to put like some some snappy text labels I think there is actually a pill image draw text I think that exists because I've this font thing yeah exactly so you need the font thing get a font in there and then yeah exactly you could put a text like this okay so you probably need the x and y coordinates of the text so let's do that w dot text and let's just go with x and y right here put it right in the middle and the text is going to be our label of course and we want the fill that's now going to be the color of the text let's go with white and the font we're going to load some font right here font dot how are we doing this true type true type okay ah no not cheating let's just go with regular fonts it won't look as fancy but we'll be fine so where where he's our text you see it I don't see it red let's make it red yes there we go okay so it wasn't red enough this should work on it so I did we just I just not see it I'm dominant cool so we have two dogs how easy was that actually we wasted the most time with like bounding boxes and stuff absolutely cool right okay so now we can have some fun with it I'm going to scale this down for a bit because you don't need to see the actual code anymore so much so you can see the image more so we'll go to the images and the first thing I want to do is the dress what does this think of the dress okay so we'll copy that and we'll go into our colab and just paste this right here but a boom but a beam sounds nice and what is wrong the size of a tensor must match the size of a tensor we do something wrong transform image our images this maybe this is like an RGB image I think if this is RGBA we should just convert it to like an RGB it's pretty sure you can do something like this right here this should work if if it has an alpha channel then that will remove it yes now works okay let's see what the model thinks of this there okay apparently there's a car and there's a surfboard and there's a person and there's a person nice see well we didn't figure out whether the dress was blue or white or gold it was just a person now they you could actually like threshold by how sure you are of a given class but where's the fun in that so let's go further let's do some Rocha ink plots because those are always lots and lots of fun so which one should we go for this one looks like fun okay so we'll put this into here and it's astonishing right this this co-co data set it only has these 90 classes it's like it doesn't have anything anything else so it's a cake it's a cake and this here what is it okay we'll have to go maybe with blue what is it stop sign okay but so you might think what if what if we want more like what if we want more predictions so there's a hack right right now the model can always assign mass to this not a class thing like right here this class 91 in order for it to say I don't think there's anything there but generally we have a hundred predictions right so you see where this is going so yes let's let's change it but let's change it up a bit and let's go here let's first extract these tensors and boxes okay so we have the boxes and this and log it's and boxes okay so we got that what we want to do is basically we want to filter the we want to basically just remove the last class before we do the argmax and thereby we want to force the model to make a prediction it won't be a very good prediction because of course this is only the second highest class and it's arguable how much that counts but still it'll do something so this must be done in the log it's right so well look at the log it's and the log it's R of shape 100 so we have 100 predictions of 92 classes now the first thing we want to do is just remove the last class so let's go everything here until the last class all right so now we have 91 actually let's make it more generic whatever thing however many class there okay so we don't have this class anymore so now if we do the softmax over the last thing we can technically we get 91 but now they're normalized so they add up to one so it's kind of a probability distribution next we we want to find the max over this and that that will give us a max output so we don't want to plot all the 100 predictions because that will just be like like squares all over the place and we'd have no clue what's happening so this max output right here this what we're trying to find is we're trying to find a let's say the five best predictions or so the five ones where the model thinks where the model is most confident it's not really good metric but you know so these are the probability values of all of the 100 predictions so what we want is like the top K okay so let's go with five and again we'll get like a top K output let's call that top K and I think it also has like values and indices yes so now we simply need to filter from the logits and the boxes where these these top ones are so we'll filter the logits we'll filter the logits by that top K indices and we'll also filter the I am not very gifted today boxes by the way I'm using a colab just because it's nice to kind of play around with a model because if I were to use a file I'd have to restart and reload the model over and over again just not as nice right so now we have the logits and the boxes and if we do that right now we get always the top five predictions how nice is that and you can see the top five predictions are probably still K K K K K K K K K K and just to verify that and we can put its shape see this is what I don't like about this stuff yes okay so we just have five predictions of 92 things and we don't want the 92 we've already said so we just want the 91 that's actually good put that here okay so now we have five by 91 and I would you give us the top five ah there we go so many cakes and many stop signs that's fine that's cool so the ultimate test right here is going to be yes the human adversarial example let's check it out so we'll put in a jacks pollock image and we'll see what the model says now we're actually forcing it to make predictions right so it can't escape it will need to do something okay I made another mistake I would need to copy the image address right here like this that's what happens when you're not an idiot you get the actual image so what does the model think of our pretty image okay I can't even read that so let's make this into white bird bird bird okay lots of birds in this image clearly clearly lots of birds in this image let's try another one let's go with this this this one yes yes absolutely love it love it okay so we copy image address and beam more birds wow there's a lot of birds in this pollock images just so many birds okay let's try one last how about this one this one is a bit more human-friendly right put it in here and and okay we get some detections there's a clock right here there is a what's that house horses let's print let's print the labels so just so we know what they are cake horse car horse and clock okay so I see the clock like this here is clearly a clock then this rectangle on the right side must be something let's put this to red as well now that's terrible white back to white how about back to white okay clock we got horse right here and how's probably and the entire image is again a cake yes okay so as you can see it is a pretty pretty good system but of course it is only these 90 classes but it's for now it's a it's pretty cool and it works pretty well and just the easiness with which you get which which you can get this stuff elephants in Kruger National Park just the easiness is astonishing you can just load it up kind of have this have a bit of a notebook and with a bit of like a very few lines of code you can put something together that detects these bounding boxes lots of elephants and remember we only have the top five elephants right here so what happens if we go for more where is our top K so here we can let maybe say the top 15 predictions and as always if we want to make the model to make its own decision we can simply revert back and add back the no-class label all right with that I hope you like this video if you did then maybe tell YouTube that you liked it share it out and I will share this notebook in the description for you to find and play around with all right thanks for watching bye bye | [{"start": 0.0, "end": 7.96, "text": " How the how's it going? So today we are going to try out the DETR, the end-to-end"}, {"start": 7.96, "end": 12.88, "text": " object detection with transformers from Facebook AI research and they have a"}, {"start": 12.88, "end": 16.6, "text": " GitHub repo and they pretty much give you everything like the model, the"}, {"start": 16.6, "end": 21.12, "text": " pre-trained weight, and so on. So today we're going to check out how easy it is to"}, {"start": 21.12, "end": 27.72, "text": " get started with that. So in order to do that they have like a collab but we"}, {"start": 27.72, "end": 33.28, "text": " we won't look at it too much. I've glanced at it and we'll basically see how far"}, {"start": 33.28, "end": 38.84, "text": " can we go without looking at it too much and how easy is that. So what I've"}, {"start": 38.84, "end": 43.16, "text": " done is I've spun up a collab that I will share at the end and I've imported"}, {"start": 43.16, "end": 48.4, "text": " torches and just loaded the model so you don't have to wait for that to happen."}, {"start": 48.4, "end": 53.68, "text": " So I've loaded that up and now we have it in the cache. So now we can basically"}, {"start": 53.68, "end": 59.12, "text": " go ahead and load an image into the model and try to detect objects in the"}, {"start": 59.12, "end": 64.64, "text": " image. So first of all this is super easy right? You simply load this from"}, {"start": 64.64, "end": 69.03999999999999, "text": " Torch Hub. It's kind of like the the TensorFlow Hub. You simply give the name of"}, {"start": 69.03999999999999, "end": 72.96000000000001, "text": " the model. You say I want a pre-trained please. Shalgabum you now have a"}, {"start": 72.96000000000001, "end": 80.2, "text": " model. So if we look at that model this is going to be this entire DETR model"}, {"start": 80.2, "end": 84.92, "text": " right here with all the transformer and ResNet and whatnot. Okay this is"}, {"start": 84.92, "end": 89.16, "text": " almost a bit too much right here. So what we want is an image. So let's go find"}, {"start": 89.16, "end": 95.08, "text": " an image. Where better they find an image than Google. So let's find an image of"}, {"start": 95.08, "end": 100.0, "text": " dogs because dogs is one of the classes in this co-code dataset. This one's"}, {"start": 100.0, "end": 104.56, "text": " nice right? Okay so we want the image address. We want to load it in here"}, {"start": 104.56, "end": 115.68, "text": " somehow. So let the URL is let's make this into some sort of like an input"}, {"start": 115.68, "end": 123.16, "text": " thing where we can paste the URL right here. Okay there we go. So we have this"}, {"start": 123.16, "end": 134.48000000000002, "text": " right here and that's the URL. All right no that's not the URL at all. Is it?"}, {"start": 134.48, "end": 143.95999999999998, "text": " Ba da bim, ba da boom, ba da boom. Cool. Better. Now we need to load this. For that we"}, {"start": 143.95999999999998, "end": 153.6, "text": " going to use the request library. Always a pleasure requests requests. So the way"}, {"start": 153.6, "end": 161.79999999999998, "text": " to load a binary file is you can put the URL here and you can say streamed"}, {"start": 161.8, "end": 168.24, "text": " here. I glanced this from the other thing and the raw entry will get you the"}, {"start": 168.24, "end": 178.52, "text": " eventual the bytes. No. Oh sorry get your L streamed stream. Yeah so this will"}, {"start": 178.52, "end": 185.84, "text": " get you the sort of the the bytes of the image and then use to say image.open"}, {"start": 185.84, "end": 192.24, "text": " and of course we need the image from a the pill library the Python image library."}, {"start": 192.24, "end": 203.36, "text": " So import image. We got that and we can open that image up and with a bit of"}, {"start": 203.36, "end": 213.2, "text": " luck. Yeah yeah. So this model expects I think Cocoa dataset is 640 by 480"}, {"start": 213.2, "end": 218.07999999999998, "text": " images but they if you can see right here and we're going to take a quick glance at"}, {"start": 218.07999999999998, "end": 225.64, "text": " their transforming they resize it to 800 so we're going to we're going to steal that"}, {"start": 225.64, "end": 234.32, "text": " part right here. People last time were some some found it really funny that I"}, {"start": 234.32, "end": 238.72, "text": " called copy pasting to go Sirage so we'll from now on we'll call it just"}, {"start": 238.72, "end": 245.92, "text": " Siraging. What we also need are the class labels because that's in defined in"}, {"start": 245.92, "end": 251.28, "text": " the Cocoa dataset right so these are the class labels. Let's take those and"}, {"start": 251.28, "end": 257.12, "text": " okay so this T here these are Torch revision transforms we're going to need"}, {"start": 257.12, "end": 262.6, "text": " that so from let's say"}, {"start": 262.6, "end": 269.96000000000004, "text": " so if you don't know Torch vision it's kind of an addition to PyTorch that"}, {"start": 269.96000000000004, "end": 274.08000000000004, "text": " just helps you with with images and has a lot of datasets and these transforms"}, {"start": 274.08000000000004, "end": 282.64000000000004, "text": " they're really helpful because so let's call this image because you can you"}, {"start": 282.64000000000004, "end": 287.24, "text": " know resize but they have much more like random cropping and rotating images"}, {"start": 287.24, "end": 290.24, "text": " and so on pretty much everything you need for pre training and this here is just"}, {"start": 290.24, "end": 294.36, "text": " the standard image net I believe the image net normalization so these are the"}, {"start": 294.36, "end": 298.48, "text": " means and these are the standard deviations from the image net dataset and"}, {"start": 298.48, "end": 307.48, "text": " let's already resize our image actually to this 800 and I believe I believe if"}, {"start": 307.48, "end": 316.36, "text": " you rescale the 642 800 you get 600 here right fairly sure okay and then"}, {"start": 316.36, "end": 322.12, "text": " let's display it just because we can okay what it's it's a bit squished but we"}, {"start": 322.12, "end": 328.76, "text": " don't care and let's put that up here so we only need to execute it once nice"}, {"start": 328.76, "end": 337.08000000000004, "text": " okay so from now on it should be a breeze so what these transforms do is they"}, {"start": 337.08000000000004, "end": 343.6, "text": " resize the image okay we don't need that anymore they make it into a tensor and"}, {"start": 343.6, "end": 349.0, "text": " then they normalize by that so if we run our image through this because our"}, {"start": 349.0, "end": 356.36, "text": " image right now is this is pill image right so our image is this pill image but if"}, {"start": 356.36, "end": 366.32000000000005, "text": " we run it through the transforms then we'll get a tensor so that's pretty cool"}, {"start": 366.32000000000005, "end": 371.96000000000004, "text": " so the model as it is a deep learning model it expects batches so we'll"}, {"start": 371.96, "end": 379.96, "text": " unsquease that in the first dimension and then we get batches so shape let's see"}, {"start": 379.96, "end": 389.24, "text": " we don't have unskies no of course we don't so this is a one image of three"}, {"start": 389.24, "end": 394.79999999999995, "text": " channels of 600 by 800 so this is the Y and X coordinates I guess are shifted"}, {"start": 394.8, "end": 405.68, "text": " yes in PyTorch cool so we'll call this our image tensor now we just need to"}, {"start": 405.68, "end": 414.16, "text": " put it into the model so model we put that in there and since we don't let's"}, {"start": 414.16, "end": 417.72, "text": " actually up here put the model in eval mode I don't know if that's already"}, {"start": 417.72, "end": 426.0, "text": " done but you know you can never be sure enough that the batch norms aren't but I"}, {"start": 426.0, "end": 431.52000000000004, "text": " think it probably doesn't have batch norms okay you're not utilizing the GPU"}, {"start": 431.52000000000004, "end": 441.6, "text": " we'll do that we'll do that thanks so how do we use the GPU we put our model on"}, {"start": 441.6, "end": 452.64000000000004, "text": " the GPU model equals model dot kuda yes yes yes I think so this is gonna work"}, {"start": 452.64000000000004, "end": 462.04, "text": " okay we're gonna come back to this later so we forward our image of course we"}, {"start": 462.04, "end": 472.04, "text": " also need that on the GPU and this worked this worked this worked nice okay and"}, {"start": 472.04, "end": 478.84000000000003, "text": " since this is just for evaluation we should probably go with no grad right"}, {"start": 478.84000000000003, "end": 484.6, "text": " here because we don't need this whole gradient stuff if we do that okay I'm"}, {"start": 484.6, "end": 492.44, "text": " dumb there you go and nothing happens of course because we need to capture the"}, {"start": 492.44, "end": 501.52000000000004, "text": " output somehow let's look at that output wow wow just wow so the output is a"}, {"start": 501.52000000000004, "end": 507.72, "text": " dictionary right because we get back class labels and bounding boxes so let's"}, {"start": 507.72, "end": 518.48, "text": " look at the pred boxes let's look at that tensor that's a tensor very nice"}, {"start": 518.48, "end": 527.0400000000001, "text": " let's look at its shape that's not print giant tensors anymore cool so since this"}, {"start": 527.0400000000001, "end": 531.0400000000001, "text": " was a batch of one we should probably go with the zero if and you can see"}, {"start": 531.0400000000001, "end": 535.6, "text": " right here there is a hundred bounding boxes and each one has four numbers and"}, {"start": 535.6, "end": 542.52, "text": " if you go with the other thing that's in there the logits then you you'll see"}, {"start": 542.52, "end": 552.64, "text": " that there are also should be a hundred logits and hello there should be a hundred"}, {"start": 552.64, "end": 561.6800000000001, "text": " logits and each one is of size 92 because there are 92 different classes 92"}, {"start": 561.68, "end": 569.1999999999999, "text": " we'll see about that well one is going to be the nothing class right by the way"}, {"start": 569.1999999999999, "end": 577.9599999999999, "text": " how many classes do we have we have 91 classes okay cool we can deal with that"}, {"start": 577.9599999999999, "end": 589.28, "text": " all right so what are we gonna do next what we want to do is for each of the"}, {"start": 589.28, "end": 594.72, "text": " for each of the for each of the logit predictions we want to find which class"}, {"start": 594.72, "end": 598.92, "text": " corresponds to so what we're going to do is we're going to take the arg max of"}, {"start": 598.92, "end": 604.88, "text": " the last dimension right so you can see here almost all of these things correspond"}, {"start": 604.88, "end": 610.68, "text": " to class 91 and class 91 is not in our classes because our class is only"}, {"start": 610.68, "end": 617.0, "text": " length 91 so that must be the nothing class so what we can technically be"}, {"start": 617.0, "end": 636.52, "text": " is for logits and boxes in let's just zip them together and like this okay"}, {"start": 636.52, "end": 649.52, "text": " class is class is the logits arg max if that's 92 or let's say you save that's"}, {"start": 649.52, "end": 657.92, "text": " larger than the length of our classes we'll just skip it for now okay so"}, {"start": 657.92, "end": 670.4, "text": " that should work somehow and if not then our label should be the class index"}, {"start": 670.4, "end": 680.3199999999999, "text": " right here so let's just see what the detector detects right here it detects"}, {"start": 680.32, "end": 697.08, "text": " nothing why does it detect nothing that's doesn't seem good what are we doing"}, {"start": 697.08, "end": 711.6, "text": " wrong we zip together the logits oh yeah of course we still need the zero with"}, {"start": 711.6, "end": 729.8000000000001, "text": " entry we are dumb dumb dumb cool so so so so we can delete this and now finally"}, {"start": 729.8000000000001, "end": 735.6, "text": " beautiful dogs two dogs detected excellent so now for each of these dogs we"}, {"start": 735.6, "end": 741.9200000000001, "text": " want the bounding box okay so now we somehow need to think of how are we"}, {"start": 741.9200000000001, "end": 747.72, "text": " gonna draw this on an image and well let's let's actually make a copy of that"}, {"start": 747.72, "end": 754.5600000000001, "text": " image because I don't really trust myself and then at the end of this we're"}, {"start": 754.5600000000001, "end": 759.0400000000001, "text": " just going to display that image right now actually the reason I make a"}, {"start": 759.0400000000001, "end": 764.08, "text": " copy is because in these in this pillow library you can actually draw on these"}, {"start": 764.08, "end": 768.48, "text": " images and we're gonna use that to draw these bounding boxes so for that we"}, {"start": 768.48, "end": 775.64, "text": " need an image draw if I remember correctly and I think later we also want"}, {"start": 775.64, "end": 789.1600000000001, "text": " some texts so we need an image font yes all right so let's draw a bounding"}, {"start": 789.16, "end": 796.24, "text": " box right here where so first of all let's look at that bounding box let's"}, {"start": 796.24, "end": 807.92, "text": " call this box box print box dot shape and break right here what's happening"}, {"start": 807.92, "end": 817.52, "text": " let's not do this right now so this is a box is of size four now this could be"}, {"start": 817.52, "end": 824.12, "text": " two things it could be x zero y zero x one y one so the two corner points or the"}, {"start": 824.12, "end": 829.3199999999999, "text": " kind of the boundaries or it could be x y with height now from the paper I know"}, {"start": 829.3199999999999, "end": 833.36, "text": " that they predict the center and the width and the height so I'm gonna go with"}, {"start": 833.36, "end": 839.48, "text": " that and I'm just gonna guess that it's like x y w h and not some other way"}, {"start": 839.48, "end": 846.4399999999999, "text": " around if this is a bad guess then yeah we'll see we can just print out one of"}, {"start": 846.44, "end": 852.2800000000001, "text": " these boxes and honestly look look that looks reason oh by the way we should"}, {"start": 852.2800000000001, "end": 856.0, "text": " scale that up yeah so these are normalized coordinates probably between"}, {"start": 856.0, "end": 861.9200000000001, "text": " zero and one so we should scale that up so we should probably the x coordinates"}, {"start": 861.9200000000001, "end": 869.72, "text": " which is scale by 800 and the y by 600 so let's do it so first of all we scale"}, {"start": 869.72, "end": 881.1600000000001, "text": " our box by 800 in the x and here's a y and the width is the x direction and"}, {"start": 881.1600000000001, "end": 890.08, "text": " this is the y direction boom okay we should probably get that on CPU we'll just"}, {"start": 890.08, "end": 894.12, "text": " hack together a bunch of things right here okay so now this isn't the"}, {"start": 894.12, "end": 903.32, "text": " correct so we so our x and y and w and h are going to be this box so now we"}, {"start": 903.32, "end": 909.04, "text": " need to actually draw on the image how are we gonna do that so let's first go"}, {"start": 909.04, "end": 920.8, "text": " x zero x one is x minus w half x plus w half y zero y one is the same for y"}, {"start": 920.8, "end": 935.4799999999999, "text": " with h plus h half cullio now we need an image draw object so I think draw on"}, {"start": 935.4799999999999, "end": 940.4399999999999, "text": " this image so whatever you draw on the draw object will end up on the image so"}, {"start": 940.4399999999999, "end": 944.68, "text": " we can use that to draw a bounding box and let's just quickly look it up so"}, {"start": 944.68, "end": 955.7199999999999, "text": " peel Python draw rectangle maybe there we go okay so there's this rectangle"}, {"start": 955.7199999999999, "end": 962.68, "text": " yeah there's the rectangle function and you can see you put in a shape x y"}, {"start": 962.68, "end": 969.1999999999999, "text": " here and with height like this wait for real we wouldn't even have to need"}, {"start": 969.2, "end": 978.6400000000001, "text": " to transform it I'm pretty sure you can go x I thought I remember you could"}, {"start": 978.6400000000001, "end": 982.2800000000001, "text": " do the different thing as well but it's called rectangle okay so let's do"}, {"start": 982.2800000000001, "end": 997.36, "text": " that so draw rectangle and we'll go we'll go x zero or we'll go x y with height"}, {"start": 997.36, "end": 1007.8000000000001, "text": " let's display that down here yeah that looks that looks nothing like we want"}, {"start": 1007.8000000000001, "end": 1016.88, "text": " but it's you know it's a start maybe actually we need the other thing here we"}, {"start": 1016.88, "end": 1030.92, "text": " need x zero y zero x one y one yes yes doggy okay we still have the break in"}, {"start": 1030.92, "end": 1046.0, "text": " here now we get both dogs nice nice okay let's do I think fill yes red and let's"}, {"start": 1046.0, "end": 1052.04, "text": " go for with five or so five seems like a good with oh god five is a terrible"}, {"start": 1052.04, "end": 1065.52, "text": " with oh it's not feel I think it's it's outline yeah yeah yeah okay okay let's"}, {"start": 1065.52, "end": 1071.0, "text": " go still go with five cool we got our dogs now we need to put like some"}, {"start": 1071.0, "end": 1078.84, "text": " some snappy text labels I think there is actually a pill image draw text I"}, {"start": 1078.84, "end": 1085.88, "text": " think that exists because I've this font thing yeah exactly so you need the"}, {"start": 1085.88, "end": 1096.04, "text": " font thing get a font in there and then yeah exactly you could put a text like"}, {"start": 1096.04, "end": 1100.6, "text": " this okay so you probably need the x and y coordinates of the text"}, {"start": 1100.6, "end": 1109.6799999999998, "text": " so let's do that w dot text and let's just go with x and y right here put it"}, {"start": 1109.6799999999998, "end": 1115.48, "text": " right in the middle and the text is going to be our label of course and we"}, {"start": 1115.48, "end": 1121.48, "text": " want the fill that's now going to be the color of the text let's go with white"}, {"start": 1121.48, "end": 1132.96, "text": " and the font we're going to load some font right here font dot how are we doing"}, {"start": 1132.96, "end": 1140.92, "text": " this true type true type okay ah no not cheating let's just go with regular"}, {"start": 1140.92, "end": 1159.04, "text": " fonts it won't look as fancy but we'll be fine so where where he's our text you"}, {"start": 1159.04, "end": 1180.24, "text": " see it I don't see it red let's make it red yes there we go okay so it wasn't"}, {"start": 1180.24, "end": 1184.6, "text": " red enough this should work on it so I did we just I just not see it I'm"}, {"start": 1184.6, "end": 1188.6399999999999, "text": " dominant cool so we have two dogs how easy was that actually we wasted the most"}, {"start": 1188.6399999999999, "end": 1197.9199999999998, "text": " time with like bounding boxes and stuff absolutely cool right okay so now we"}, {"start": 1197.9199999999998, "end": 1202.0, "text": " can have some fun with it I'm going to scale this down for a bit because you"}, {"start": 1202.0, "end": 1206.8, "text": " don't need to see the actual code anymore so much so you can see the image more"}, {"start": 1206.8, "end": 1214.72, "text": " so we'll go to the images and the first thing I want to do is the dress what"}, {"start": 1214.72, "end": 1222.6399999999999, "text": " does this think of the dress okay so we'll copy that and we'll go into our"}, {"start": 1222.64, "end": 1238.2800000000002, "text": " colab and just paste this right here but a boom but a beam sounds nice and what"}, {"start": 1238.2800000000002, "end": 1243.6000000000001, "text": " is wrong the size of a tensor must match the size of a tensor we do something"}, {"start": 1243.6, "end": 1265.52, "text": " wrong transform image our images this maybe this is like an RGB image I think if"}, {"start": 1265.52, "end": 1272.36, "text": " this is RGBA we should just convert it to like an RGB it's pretty sure you can"}, {"start": 1272.36, "end": 1280.04, "text": " do something like this right here this should work if if it has an alpha"}, {"start": 1280.04, "end": 1290.3999999999999, "text": " channel then that will remove it yes now works okay let's see what the"}, {"start": 1290.3999999999999, "end": 1296.8, "text": " model thinks of this there okay apparently there's a car and there's a"}, {"start": 1296.8, "end": 1304.84, "text": " surfboard and there's a person and there's a person nice see well we didn't"}, {"start": 1304.84, "end": 1312.6399999999999, "text": " figure out whether the dress was blue or white or gold it was just a person now"}, {"start": 1312.6399999999999, "end": 1321.3999999999999, "text": " they you could actually like threshold by how sure you are of a given class but"}, {"start": 1321.4, "end": 1329.68, "text": " where's the fun in that so let's go further let's do some Rocha ink plots"}, {"start": 1329.68, "end": 1338.0, "text": " because those are always lots and lots of fun so which one should we go for"}, {"start": 1338.0, "end": 1352.72, "text": " this one looks like fun okay so we'll put this into here and it's astonishing"}, {"start": 1352.72, "end": 1356.2, "text": " right this this co-co data set it only has these 90 classes it's like it"}, {"start": 1356.2, "end": 1363.44, "text": " doesn't have anything anything else so it's a cake it's a cake and this here"}, {"start": 1363.44, "end": 1374.8, "text": " what is it okay we'll have to go maybe with blue what is it stop sign okay but"}, {"start": 1374.8, "end": 1379.28, "text": " so you might think what if what if we want more like what if we want more"}, {"start": 1379.28, "end": 1384.4, "text": " predictions so there's a hack right right now the model can always assign"}, {"start": 1384.4, "end": 1391.88, "text": " mass to this not a class thing like right here this class 91 in order for it to"}, {"start": 1391.88, "end": 1395.92, "text": " say I don't think there's anything there but generally we have a hundred"}, {"start": 1395.92, "end": 1406.64, "text": " predictions right so you see where this is going so yes let's let's change"}, {"start": 1406.64, "end": 1414.8000000000002, "text": " it but let's change it up a bit and let's go here let's first extract these"}, {"start": 1414.8, "end": 1429.32, "text": " tensors and boxes okay so we have the boxes and this and log it's and boxes"}, {"start": 1429.32, "end": 1438.36, "text": " okay so we got that what we want to do is basically we want to filter the we"}, {"start": 1438.36, "end": 1441.9199999999998, "text": " want to basically just remove the last class before we do the argmax and"}, {"start": 1441.92, "end": 1448.8000000000002, "text": " thereby we want to force the model to make a prediction it won't be a very good"}, {"start": 1448.8000000000002, "end": 1452.44, "text": " prediction because of course this is only the second highest class and it's"}, {"start": 1452.44, "end": 1460.76, "text": " arguable how much that counts but still it'll do something so this must be"}, {"start": 1460.76, "end": 1467.44, "text": " done in the log it's right so well look at the log it's and the log it's R of"}, {"start": 1467.44, "end": 1472.24, "text": " shape 100 so we have 100 predictions of 92 classes now the first thing we want"}, {"start": 1472.24, "end": 1478.28, "text": " to do is just remove the last class so let's go everything here until the last"}, {"start": 1478.28, "end": 1484.72, "text": " class all right so now we have 91 actually let's make it more generic"}, {"start": 1484.72, "end": 1490.72, "text": " whatever thing however many class there okay so we don't have this class anymore"}, {"start": 1490.72, "end": 1499.3600000000001, "text": " so now if we do the softmax over the last thing we can technically we get 91"}, {"start": 1499.3600000000001, "end": 1503.52, "text": " but now they're normalized so they add up to one so it's kind of a probability"}, {"start": 1503.52, "end": 1515.44, "text": " distribution next we we want to find the max over this and that that will give us"}, {"start": 1515.44, "end": 1522.16, "text": " a max output so we don't want to plot all the 100 predictions because that"}, {"start": 1522.16, "end": 1526.64, "text": " will just be like like squares all over the place and we'd have no clue what's"}, {"start": 1526.64, "end": 1535.4, "text": " happening so this max output right here this what we're trying to find is we're"}, {"start": 1535.4, "end": 1542.2, "text": " trying to find a let's say the five best predictions or so the five ones where"}, {"start": 1542.2, "end": 1547.0, "text": " the model thinks where the model is most confident it's not really good metric"}, {"start": 1547.0, "end": 1555.92, "text": " but you know so these are the probability values of all of the 100"}, {"start": 1555.92, "end": 1564.4, "text": " predictions so what we want is like the top K okay so let's go with five and"}, {"start": 1564.4, "end": 1574.92, "text": " again we'll get like a top K output let's call that top K and I think it also"}, {"start": 1574.92, "end": 1585.8000000000002, "text": " has like values and indices yes so now we simply need to filter from the"}, {"start": 1585.8, "end": 1597.9199999999998, "text": " logits and the boxes where these these top ones are so we'll filter the logits"}, {"start": 1597.92, "end": 1614.64, "text": " we'll filter the logits by that top K indices and we'll also filter the I am"}, {"start": 1614.64, "end": 1624.76, "text": " not very gifted today boxes by the way I'm using a colab just because it's"}, {"start": 1624.76, "end": 1628.64, "text": " nice to kind of play around with a model because if I were to use a file I'd"}, {"start": 1628.64, "end": 1633.4, "text": " have to restart and reload the model over and over again just not as nice"}, {"start": 1633.4, "end": 1640.76, "text": " right so now we have the logits and the boxes and if we do that right now we"}, {"start": 1640.76, "end": 1646.8799999999999, "text": " get always the top five predictions how nice is that and you can see the top"}, {"start": 1646.8799999999999, "end": 1653.52, "text": " five predictions are probably still K K K K K K K K K K and just to verify"}, {"start": 1653.52, "end": 1665.4, "text": " that and we can put its shape"}, {"start": 1667.6, "end": 1672.96, "text": " see this is what I don't like about this stuff yes okay so we just have five"}, {"start": 1672.96, "end": 1682.28, "text": " predictions of 92 things and we don't want the 92 we've already said so we"}, {"start": 1682.28, "end": 1699.44, "text": " just want the 91 that's actually good put that here okay so now we have five"}, {"start": 1699.44, "end": 1704.36, "text": " by 91 and I would you give us the top five ah there we go so many cakes and"}, {"start": 1704.36, "end": 1712.04, "text": " many stop signs that's fine that's cool so the ultimate test right here is going"}, {"start": 1712.04, "end": 1726.3999999999999, "text": " to be yes the human adversarial example let's check it out so we'll put in a"}, {"start": 1726.3999999999999, "end": 1732.1999999999998, "text": " jacks pollock image and we'll see what the model says now we're actually"}, {"start": 1732.2, "end": 1739.64, "text": " forcing it to make predictions right so it can't escape it will need to do"}, {"start": 1739.64, "end": 1745.8400000000001, "text": " something okay I made another mistake I would need to copy the image address"}, {"start": 1745.8400000000001, "end": 1756.3600000000001, "text": " right here like this that's what happens when you're not an idiot you get the"}, {"start": 1756.36, "end": 1764.1999999999998, "text": " actual image so what does the model think of our pretty image okay I can't even"}, {"start": 1764.1999999999998, "end": 1776.76, "text": " read that so let's make this into white bird bird bird okay lots of birds in this"}, {"start": 1776.76, "end": 1783.6, "text": " image clearly clearly lots of birds in this image let's try another one let's"}, {"start": 1783.6, "end": 1795.4399999999998, "text": " go with this this this one yes yes absolutely love it love it okay so we"}, {"start": 1795.4399999999998, "end": 1800.04, "text": " copy image address"}, {"start": 1800.04, "end": 1818.6, "text": " and beam more birds wow there's a lot of birds in this"}, {"start": 1818.6, "end": 1829.7199999999998, "text": " pollock images just so many birds okay let's try one last how about this one"}, {"start": 1829.72, "end": 1851.72, "text": " this one is a bit more human-friendly right put it in here and and okay we get"}, {"start": 1851.72, "end": 1861.76, "text": " some detections there's a clock right here there is a what's that house horses"}, {"start": 1861.76, "end": 1871.16, "text": " let's print let's print the labels so just so we know what they are cake horse"}, {"start": 1871.16, "end": 1879.24, "text": " car horse and clock okay so I see the clock like this here is clearly a clock"}, {"start": 1879.24, "end": 1890.64, "text": " then this rectangle on the right side must be something let's put this to red"}, {"start": 1890.64, "end": 1902.32, "text": " as well now that's terrible white back to white how about back to white okay"}, {"start": 1902.32, "end": 1913.76, "text": " clock we got horse right here and how's probably and the entire image is again a"}, {"start": 1913.76, "end": 1925.6, "text": " cake yes okay so as you can see it is a pretty pretty good system but of course"}, {"start": 1925.6, "end": 1932.04, "text": " it is only these 90 classes but it's for now it's a it's pretty cool and it"}, {"start": 1932.04, "end": 1936.84, "text": " works pretty well and just the easiness with which you get which which you can"}, {"start": 1936.84, "end": 1947.8799999999999, "text": " get this stuff elephants in Kruger National Park just the easiness is astonishing"}, {"start": 1947.8799999999999, "end": 1953.92, "text": " you can just load it up kind of have this have a bit of a notebook and with a"}, {"start": 1953.92, "end": 1961.08, "text": " bit of like a very few lines of code you can put something together that detects"}, {"start": 1961.08, "end": 1965.76, "text": " these bounding boxes lots of elephants and remember we only have the top five"}, {"start": 1965.76, "end": 1971.3999999999999, "text": " elephants right here so what happens if we go for more where is our top K so"}, {"start": 1971.3999999999999, "end": 1977.32, "text": " here we can let maybe say the top 15 predictions and as always if we want to"}, {"start": 1977.32, "end": 1982.9199999999998, "text": " make the model to make its own decision we can simply revert back and add"}, {"start": 1982.9199999999998, "end": 1990.4399999999998, "text": " back the no-class label all right with that I hope you like this video if you"}, {"start": 1990.44, "end": 1997.1200000000001, "text": " did then maybe tell YouTube that you liked it share it out and I will share"}, {"start": 1997.1200000000001, "end": 2002.3600000000001, "text": " this notebook in the description for you to find and play around with all right"}, {"start": 2002.36, "end": 2029.08, "text": " thanks for watching bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=SY5PvZrJhLE | GPT-3: Language Models are Few-Shot Learners (Paper Explained) | #gpt3 #openai #gpt-3
How far can you go with ONLY language modeling? Can a large enough language model perform NLP task out of the box? OpenAI take on these and other questions by training a transformer that is an order of magnitude larger than anything that has ever been built before and the results are astounding.
OUTLINE:
0:00 - Intro & Overview
1:20 - Language Models
2:45 - Language Modeling Datasets
3:20 - Model Size
5:35 - Transformer Models
7:25 - Fine Tuning
10:15 - In-Context Learning
17:15 - Start of Experimental Results
19:10 - Question Answering
23:10 - What I think is happening
28:50 - Translation
31:30 - Winograd Schemes
33:00 - Commonsense Reasoning
37:00 - Reading Comprehension
37:30 - SuperGLUE
40:40 - NLI
41:40 - Arithmetic Expressions
48:30 - Word Unscrambling
50:30 - SAT Analogies
52:10 - News Article Generation
58:10 - Made-up Words
1:01:10 - Training Set Contamination
1:03:10 - Task Examples
https://arxiv.org/abs/2005.14165
https://github.com/openai/gpt-3
Abstract:
Recent work has demonstrated substantial gains on many NLP tasks and benchmarks by pre-training on a large corpus of text followed by fine-tuning on a specific task. While typically task-agnostic in architecture, this method still requires task-specific fine-tuning datasets of thousands or tens of thousands of examples. By contrast, humans can generally perform a new language task from only a few examples or from simple instructions - something which current NLP systems still largely struggle to do. Here we show that scaling up language models greatly improves task-agnostic, few-shot performance, sometimes even reaching competitiveness with prior state-of-the-art fine-tuning approaches. Specifically, we train GPT-3, an autoregressive language model with 175 billion parameters, 10x more than any previous non-sparse language model, and test its performance in the few-shot setting. For all tasks, GPT-3 is applied without any gradient updates or fine-tuning, with tasks and few-shot demonstrations specified purely via text interaction with the model. GPT-3 achieves strong performance on many NLP datasets, including translation, question-answering, and cloze tasks, as well as several tasks that require on-the-fly reasoning or domain adaptation, such as unscrambling words, using a novel word in a sentence, or performing 3-digit arithmetic. At the same time, we also identify some datasets where GPT-3's few-shot learning still struggles, as well as some datasets where GPT-3 faces methodological issues related to training on large web corpora. Finally, we find that GPT-3 can generate samples of news articles which human evaluators have difficulty distinguishing from articles written by humans. We discuss broader societal impacts of this finding and of GPT-3 in general.
Authors: Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, Dario Amodei
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 language models, our few shop learners by Tom B. Brown, Benjamin Mann, Nick Rider, and Melanie Sibaya, and a whole slew of authors from OpenAI. This paper also called GPT-3 just came out recently. GPT-3 is a model that is a language model, and it comes out of a succession of language models of OpenAI. This paper is basically an investigation into what you can do with giant language models. This language model is an order of magnitude larger than anyone has ever built a language model, and it can do some absolutely crazy things. So we'll basically go over the architecture, over what the model does, and over the experimental results. It turns out that if you train a language model on enough data, it is able to solve NLP tasks that it has never seen just out of the box. And we're going to look into this very cool kind of formulation of the problem. As you can see here, the paper is 40 pages long without the appendix. It needs its own table of contents, which is crazy. So we're going to skip a fair bit of things. So first of all, what is a language model? For those of you who don't know, I've done a bunch of videos, and you can see those in my natural language processing playlist about language models, and specifically about transformer language models. So a language model, let's just take an example, this sentence right here, just the sentence as such, like third, humans do not require to do not require large supervised data sets to learn most language tasks. But this is an English sentence, and a language model would be a model that if you cross out a portion from the end here, like this right here, it would be able to tell you what comes next. So in a language model, you would input this part right here, and it will tell you the next word is data sets. So that's basically all the language model does. And once you've trained one, you can basically generate word after word after word from it. Or you can ask it a question like which word is most likely to come next or more likely. So a language model is nothing but a model that can kind of generate language in a probabilistic way. And the cool thing about language models is that you can train it on any sort of text data. And that's what they do here. So they train a language model on giant amounts of data, specifically right here, they go into the data sets they use. They use this, let's skip down, they use this common crawl data set, which they filter down for quality. And this is basically a crawl of the entire internet, if you will. Together with these books, data sets and the web text data set and the Wikipedia data set. So they throw all of this text that they scrape from the internet together and then train a language model on that. Now the language model right here is called GPT3 and they train various sizes of it. And we'll get into how it's built in a second, but just compare this to a language model like Bert. Bert required this much flops to train and these, this is a log scale. So this is right here. This is several orders of magnitude larger and bigger model and is trained for way longer on this text. So naturally it is going to be a lot better at language modeling. You can see right here the size of these models that they trained on. Remember the previous largest language model, the touring NLG of Microsoft, had something like 17 billion parameters. So it would be comparable to this right here. Whereas GPT3 has 175 billion parameters, which this is absolutely crazy. This is an order of magnitude higher than anything that's ever existed. And if you look at the last GPT, the GPT2 model that if you remember, I've made a video about it, is too dangerous to be released. Well now it has been released, but was too dangerous to be released. It clocked in at about 1.5 billion parameters. So compared to this GPT3 XL model right here, they trained these multiple models to basically estimate the effect of the model size. And you can see here the largest model has 96 attention layers. Each layer has 96 attention heads and each head is 128 dimensional. And it trains on batches of size 3.2 million. This is the batch size. Absolutely crazy. So they trained this on a giant distributed cluster that apparently is provided by Microsoft. And yes, crazy, crazy things. So how does this model look? This model is a transformer model. And right here, we don't even have like a description of a transformer model. It's just assumed you know what that is. I have made several videos on transformer models and especially things like attention is all you need or burped or something like this. But for those who don't know if I have a transformer model. And I want to build a language model from it. Let's take this sentence right here. I would input a what's called a context, which is the thing I already have. Right. I would input that into a transformer model and a transformer model is just several layers of attention mechanism. Now an attention mechanism is basically a way where information is routed in between the different tokens right here. And as it goes up the layer, basically the information is routed around and the model can make various inferences. And at the end, the model is supposed to come up with the next word that you're going to put here specifically in this paper. They use sub words like word piece tokens like it is common in NLP right now. Actually, this is an auto regressive language model. So it's not like bird. It's not bidirectional. It is auto regressive. It goes from left to right. It always produces the next word. It is like GPT2. They even say this. They say we use the same model and architecture as GPT2. They just have more layers and wider layers and more data to train it on. So how do they train it? Okay, that's we already said they train it in simply in simply a language modeling way. Just next word prediction. That's it. Okay, so it's not even something fancy like bird. The interesting part is when you do the now the single tasks. So what you usually did with something like bird. So with something like bird, you would do first pre-train. So there you would. This is the language modeling right here. This pre-training phase where you teach bird about the English language by just feeding it a lot of data. And then second, you had a step called fine tuning. Fine. I can't even write tuning. So on the second one, you'd have something like the task you're actually interested in. And let's say the task you're actually interested in is sentiment classification. So in sentiment classification, you have like a sentence like blah, blah, blah. And you want to know is that a positive sentiment like is a happy sentence or is it a sad sentence. And you would have a database of labeled instances of that. So in this database, you'd have a bunch of sentences. And for each one, you would know, is it good? Is it positive or is it negative? And then you'd have like a smaller test set right here. And you would you would train you would basically take this pre-trained model, train it on this data set in a supervised machine learning way. And then test it on this test set right here. This is called fine tuning. That's what they display here. So in fine tuning, the model is trained via repeated gradient updates using a large corpus of example tasks. Right. So the example task right here could be translating to French. So in your training database of the translation task would be this would be see order is called l'outre de mer. And then you'd actually change your model. You do a gradient update. I mean, if if you're in the NLP world, this seems very natural, but they are going to argue in a second that this isn't the only way that you can teach a model a task. So this this seems very natural, right? You're going to change your model. You take your pre-trained model and you're going to fine tune it on this task. And if you have a different task, right? If you have now question answering task, you're going to have a different data set right here with a train and test data set. And you're going to take the pre-trained model and then fine tune it on that data set and evaluate it on that test set. So this gives you basically with as many models as you have tasks and you for each one, you need a big, big training date set in order to perform well. Sometimes we have this. Sometimes we don't. What they are interested in is basically to take the pre-trained model and directly go and evaluate it on the test data set in a sort of a zero shot fashion. Now it is not zero shot as they will argue. So what are they doing in a true zero shot fashion. You would just take your your language model that you pre-trained and you just input the following text you input what they call a task description and a prompt. So this is the input and you're simply asked the model as a language model to predict the next word. It's just what comes here. Now what you're counting on is basically that in the training data, the model has seen a structure like this enough to understand what's going on. So that in the training data somewhere in the internet, there was this structure of translate something to something and then there would be a word here of something and you know it kind of has to realize that this goes here like that the next word. So basically what you're asking is if you were to find this text on a website or on Wikipedia or in any of the books data set, if you were to find this piece of text, what would be the next word in that piece of text. And you kind of hope that this is enough if you've trained a good language model that this is enough to actually produce the French translation here. Now before I realize I've said the language modeling is to teach the model the English language. Actually not true in this common crawl corpus, you also have many foreign languages. So you basically teach it a general model of the internet. Now they they contrast this to what they call one shot learning. So in one shot learning, you not only do you have the task description right here. And this is this is a string, right? You don't specifically tell the model that this is now a translation task. You simply input this as a string. So not only do you have the task description and the prompt right here, but you also have one example and the example and this is where they this is where they bring in the where they say it's not exactly zero shot. Where's my little drawing here. So the example is going to come from the training data set of the task that you're interested in. But the important part is you never train on it. You never explicitly train on that example. You simply put it in the context. So you simply put this string. So translate English to French, new line, see order is loot the mayor, new line, cheese is what you simply input that string into the model as a language model and you ask it what's the next word right here. Okay. So I hope this is clear. This is what they call kind of one shot generalization and by one shot, they basically mean you simply provide this thing in the context of the model as a language model. Now the advantage here is immediately clear that you only have to train one model then and then basically at inference time, you can just input the task description and the sort of training data for the task into its its evaluation context and the task itself. And it will if it is if it really does what they claim it does, it would be able to sort of understand the prompt here understand what it means to translate from English to French. So I would look at this example and say, oh, that's what you want me to do. Okay. And then it would be able to generalize to this input right here to say, okay, from the task description and the example, I get what you want me to do. I will the next word here is cheese. What's cheese in French? I don't remember. Now the way the language model is going to interpret that is slightly different. As we said before, the way the language model is going to interpret is if you were to find the following text on a website somewhere, the text is called translating to French new line see order goes to the main new line cheese goes to what would be the next word on that website. So that's what the model sees right you have to differentiate between what the human wants and what the model sees the model is just a language model that is going to take the next that is just going to determine if I were to see this text somewhere what will be the most likely next word. So you have to phrase your tasks in a way that makes sense in that thing. And they also have this few shot thing where you not only provide one context, but you provide a bunch of context to basically tell the model more of what it what it should do. Now this doesn't only work in a free mode where you basically say what's the next word here what you can also do if you have such a language with the exact same model you can give it basically a couple of possibilities. So you can give it it's you can say like it's either shot or it's from a or it's hotel. I think that has like this. So you can you can basically restrict it to only produce one of these three things. So in translation this might not be you know the way to go but in if you have like yes no answers questions you can restrict it to that. So in a lot of these NLP tasks you have some options given for a given question and you can also restrict it. So don't you know you always have to go with the task at hand. But this is in essence what the model does and this is I think this is the new well not the new per se but this is one of the core ideas of this paper if you take anything from it. There's no new architecture right here. There's no new wisdom in training. They train in a standard way in a standard language modeling fashion a standard transformer architecture. This just happens to be ginormous. Okay. This right here this thing where they say most of these things would fine tune and then basically end up with one model per task and you need a big data set per task. But we simply can do this since we have such a large language model it is basically already basically already knows how to do this tasks as long as we formulate them in a language model way we can have the model perform these tasks and they will show that this works surprisingly well throughout this paper. Now we get into the experimental results right here and the experimental results first of all on language modeling as you can see here. Now basically say as you go up with the parameters you see the more you want are the parameters you go into your validation loss goes down and down and down and down and I believe this is sort of a log scale as well. So this is the log probability so the the perplexity and that the this basically follows a trend. Oh no, this is a log scale. This is a log scale. It follows a trend where as you scale up the model and as you scale up the compute that the model gets and we know for these big language models we basically know you have to scale up model size compute time and data set size in the same fashion for them to make these gains. But if you do that it follows like a parallel where as you scale up these things the model basically gets better and better and better and the question of course is you know how far how far can we go with this but for now it seems to hold quite well that you can just make improvements by scaling up your model on language modeling at least. So where do we where do we basically go from here so before we dive into the actual results of the individual tasks and other going to formulate these individual tasks so they have like pure language modeling tasks right here like Alice was friends with Bob Alice went to visit our friend and then it's like what's the next word. Okay, this Bob and George bought some baseball equipment of all a glove and a what's the next word and I guess this should be had sorry bat right here. But we're going to go into the into the tasks and one of them is for example question answering so in question answering you simply get either you get just a pure question or a context and a question. And they do the fact that they they test where a situation where you just get the question so you just get I don't know who is the Queen of England or something like this and the model is simply to produce either the result direct or to choose from a bunch of answers which one is the most likely as a language model. And as you can see as you scale up the language model the zero shot one shot and few shot predictions so in few shot you give 64 different examples from the training set in the context so you always have. So your context is going to look something like this and they have examples at the bottom and haven't looked at the QA task but the the examples going to be something like this you have a task description like answer the following questions answer the question and then you have your example so in zero shot that zero and one shot it's one that's what I like and then you say how tall who sorry who. I don't know who climbed Everest the first the first and then you say Hillary I think it was Hillary no I don't remember and then you say I don't know how tall is the Empire State building and then you have like some number here and at the end you say what was the was a question from before. I don't know who is the Queen of England who is the Queen of England and then you ask the model to predict the next word right here okay and you do this in a closed book setting which means you have no access to Wikipedia or whatever like usually these systems they can go and query Wikipedia but this system doesn't so you just you just want to know what has the model learned about the world. By simply absorbing giant amounts of text so if somewhere in the training data the fact that the Queen of England is Elizabeth the second is present it should complete this right here and it performs surprisingly well as you can see here so it manages to outperform a fine tuned state of the art model that is actually that is fine tuned on question answering right this has it has been built for question answering and this model is the same as the one that I was talking about. And this model outperforms it by simply having a lot of of language so this here is the results on on these open domain QA tasks and you you see right here it it this this few shot it outperforms this open domain it open domain means that the model can go and look at some Wikipedia page and yeah so so this is pretty cool but there are other things like the natural questions where it underperforms compared to this open domain thing and they say this is mainly due to the natural questions being like it's very much about factual Wikipedia knowledge and so on maybe like the question we just made maybe is more of a natural question type of thing and since and the model is apparently not as good at that but it's still impressive that the model is able to do this out of the box. Okay so before I said something like before we go into the experiments I want the following so I have like some sort of hypothesis it's not it's not an uncommon hypothesis that basically these things these giant language models right they're just these transformers layer after layer after layer with their connections in here what I think is happening is they are simply storing the training data right they are simply storing the training data in these connections right here so usually you think of storing the training data in some form of maybe we have like some module right here some database module in the neural network and it learns to query the module but ultimately if you train a neural network what you have is data and you train a function with parameters on that data and ultimately what you're doing is you're distilling the data into these parameters and you kind of hope to learn some regularities from it but ultimately the information about your training data influences or determines your final parameters of your function. Now I can imagine that if you have such a giant neural network with so many weights like 17 sorry 170 billion weights that you can pretty efficiently actually store the training data in that model and when you ask this model now to do something what it basically does is what these people sort of argue is that it has learned these language task is learned to reason over language and so on what I think is happening much more is it will simply go to the training data since it has stored the entire training data in its weights and it will sort of pull out the five to ten to 50 training examples that are most relevant to what you put in and it will sort of interpolate right you go to the training data and it will pull out a bunch of training samples that are relevant to the context you put in right now and then it will sort of integrate those into the next word that's going to come out right here and I think if you look at this paper in terms of this so you always read you input a context and the context is split into a task description and then it is split into K different examples and then it is it is it has a prompt sorry this is the prompt so the task description is please translate from English to French and the K different things are K different translations and then the prompt is you know what what you should do so it's like half of a cake half of one of these boxes right here so these boxes are have blah blah blah turns to blah blah blah and then the prompt is simply without the the right side I think what it does is it will simply take all of this and it will go to its own training data which it has stored in its weights and it will filter the training data and basically take out the things that sort of pattern match sort of reg X match in a fuzzy way to this context and then it will kind of interpolate these training examples in order to come up with the answer I don't think there is reasoning happening here and we're going to if you go through the paper with this view then you can a lot of things actually make sense and I actually I think that we need we need what we need when think people think of like explainable machine learning they often think that if I'm going to input something like I'm going to input an image into a classifier that and it comes out a certain class car I like the explainability should be a which part of this image was it the wheels was it the hood which part of the image which part of the input image is responsible for making that determination what I think in especially these language models what we should do is if the model predicts something right here the next word I think we should somehow have a method of determining which of the training examples that the model used to interpolate given this context because I'm pretty sure these training is you will find so if you'll find that for example this weight and this weight and this weight was very responsible for making this prediction happen I'm pretty sure you can somehow during training build an index of which of the which five training examples had most influence on that particular weight or on this combination of weights and then you can sort of go backwards and say you made this decision right here model please tell me which of the training data samples were responsible for making that decision actually pretty sure that already exists like I'm never the first one to think of these things though if I am sight me sight the channel no but just an interesting way to think about this model and an interesting way to think about kind of what does what would explain ability even mean in a model like this and my argument is since it interpolates the training data the interpretability should come out and I'm going to explain this interpretability should come from the fact of which training samples does it interpolate okay let's go to translation so in translation as we said they simply input the like the task and then the few examples and then the output okay and you can see right here what you can see is that again as the model goes up in parameters the performance generally increases and also you can see that the performance is pretty good every time that this model goes to English so it goes if it if the target language is English which sort of makes sense because like a large part of the corpus they train on is English so being an English language model it should be pretty good if it is asked to produce English and it's not as good if it is asked to go into the different direction now what you also see is that it is not really a difference whether you translate from from which language you translate but if you go to English but it very much very much matters to which language you go if it is from English so this sort of makes sense in that it is just trained on a lot of English data and right here sometimes they are on par with the with the state of the art supervised methods and also other times they out perform these methods right here and these methods are unsupervised but are specifically so they don't have a supervised training data set that goes let's say from English to French but they are built with this in mind that they need to translate later so they are sort of tasks specific but don't have a supervised training set and this model right here it just learns whatever it learns and it just does this language model learning and at the end just because it has seen some websites where language of both things appear it can now translate reasonably well okay now yeah so the results here are a bit noisy but it is still interesting to see that it sometimes even gets close to the supervised thing though they say that they are not familiar with the literature and are not sure that these models that these numbers are good okay okay the next thing is these we know grud schemes where you do have where is the text here is a classic NLP task that involves determining which word a pronoun refers to when the pronoun is grammatically ambiguous but semantically unambiguous to a human so these are sort of human produced sentences where it's kind of a pronoun could refer to multiple things I don't have a example present but where do we have the right here you can see that this model will out produce a fine tuned birth large but will not out produce a fine tuned a Roberto large so it is going to it is going to come it is competing at least with the fine tuned models that were made specifically for that task right again this is pretty pretty interesting and you also see that the larger models here it starts to make a difference whether or not you give it one zero or one or more examples okay so we'll get into we'll get into the more interesting things right here in this thing right here where is it yes this is the kind of a physical physical question physical qa where it is a bit of common sense reasoning so you're asked to I don't yeah these are like science questions multiple choice questions collected from a third to ninth grade exams and the physical qa is physical qa they ask common sense question about how the physical word world works and is intended as a probe of grounded understanding of the world so it has questions as I understand it it has questions like if a drop a ball will it fall on the ground or where will it fall or something like this and they say that they can outperform a fine tuned state of the art model on this if they go just high enough and you can also see that there isn't much of a difference between zero one and few shot the methods of this model even those zero shot is even higher than one shot so this is probably just noise but then you find out that they have an asterisk here and this means that this is potentially a contaminated data set so they have potential contamination issues so what they found was there was a significant overlap between the data set this data set and their training data set and they they only realized this too late because there was a bug in their d du application code and then they couldn't change it anymore because this model is so large that they couldn't restart the training because they've already spent like so much money and energy on it this is crazy I think these language models are getting so large that we should building them we should more think of it like we build the international space station or something like this this is a project where humanity sort of collaborates or there's a big effort and you build it once and whatever you have you have right so these good numbers here are simply or not simply are because or could be influenced by this contamination and I think that's what's happening right here and though they will make the case that this contamination isn't really an issue I can probably show you that it might be it may be actually is an issue because on the other data sets act the fine tune state of the art model outperform the GPT3 quite a bit and also the fact that the you know if you provide a demonstration or many demonstrations it doesn't actually change that much it kind of tells me that the model sort of already knows the answer is and doesn't really need demonstrations because it doesn't help if you have the training data stored or the test data you don't really have to get demonstrations right so they have a few other a few other things right here where on this cocoa task they perform pretty poorly compared to others or poorly let's say they perform well but not particularly more well than a state of the art and they perform especially poorly on the reading comprehension sorry that's the that's the cocoa so in reading comprehension what you have to do is abstractive multiple choice and span based answer formats in both dialogue and single question settings so basically have to read a piece of text like this and then answer a question about the piece of text now this is something where I think you cannot really interpolate the training data super well and therefore so you can't really just pattern match an interpreter because you have to do actual reasoning and I think that's why the model performs poorly here they do measure this on super glue which is a NLP benchmark and also here you can see it doesn't outperform a fine tuned state of the art model on these tasks but it does outperform a fine tuned birth model slightly so the birth model is fine tuned on these things whereas GPT3 isn't but notice the tasks in which it does well and in which it doesn't do well compared to the state of the art model so for example in the bull queue it doesn't do particularly well right the state of the art is 91 and only has 76 that's quite a large difference and actually have the glue benchmark open here and you can see this is the bull queue so an example here would be is France the same time zone as the UK and then there is like a passage and you need to reason about from this passage about whether or not this answer is true or false this is very much not language modeling this is reasoning and that's why the model is doing poorly here whereas in another thing you see this for example this Copa right here the model is doing almost as good as a fine tuned state of the art and I have to stress this model has never actually learned this task in a supervised way it's simply a language model and I have this Copa task right here and these are the examples so one example is the premise the man broke his toe what was the cause of this and you have two different things that it could be either he got a hole in his sock or he dropped a hammer on his foot and the way you phrase it in this model is you would give the premise as the context simply ask the model since it's a language model which of these two things is more probable to come and of course it is going to select the thing that can have happened more often in the training data and you know broke his toe the cause of breaking his toe that is a hammer this is entirely conceivable that a language model would know this and with enough training data could sort of pull from the training data examples where hammer on foot and broke toe appear a bunch of times and hole in sock would be rather unrelated so as long as these questions are not too adversarial constructed specifically that a language model can't solve them the model is going to perform pretty well right here right so it is very interesting to see that if you view this as interpolating the training data it suddenly makes sense where it's good and where it isn't good so this was the super glue and and NLI it is performing particularly poorly on NLI which is the ability to understand the relationship between two sentences right so where the model classifies whether the second sentence logically follows from the first contradicts the first or is possibly true neutral okay so this is the reasoning part of this model is not given it is simply recalling the training data and doing language modeling now they say oh we can test this we can test this with synthetic and qualitative tasks so they invent some own tasks since you know now it's pretty easy since you don't have to find to in the model you don't have to to generate an actual training set for a task so you can focus on generating a test set and and you know that's what they do so they do something like arithmetic so they say okay can we come up with a bunch of arithmetic tasks for example two digit digit edition so what the model would see would this is an example and what the model would see is simply this as a context right here for the prompt and if you give it examples so if this is like one shot learning you would input add the following numbers the following numbers as a string right then a new line and then you would give it one example like what is 11 plus 12 and with the answer together with the answer answer is I don't know 23 and then you the prompt goes here so what is 48 plus 76 and then you ask what is the next word right here what is the next string token that comes here now the the inference here is that if the model manages to do this it can't simply because these are all strings the model basically has no clue how to do math these are numbers to the model these are just tokens as strings and the references if the model can do this it must have learned you know some kind of reasoning ability must have learned to like perform some logic inside so they go into two digit edition free digit edition five digit edition and even multiplication and subtraction and the results are right here so as you can see the lower parameter models they perform pretty poorly but as you go up the parameters the big model is performing really well in the two digit range is performing also really well so accuracy of look that accuracy 80 90% in three digit edition and subtraction but then if as soon as you get to the four digit or the two digit multiplication and so on the performance drops now they say that's because multiplication is harder and you know it's is logically very computationally you know but the two digit edition and so on model has learned something about the world I disagree because so here's the because what you will do is you will simply and this you simply recall the training data so look at the two digit edition with zero shot you already get 76% but with one shot you get 99% and with few shot you get a hundred percent so if you interpret this model is simply filtering the training data to pattern match then it makes a lot of sense that the one shot would like the examples here would give you a much improvement because if you have a bunch of examples where please add right add and then oh I raised our example again so you have 48 plus 72 equals blah blah blah you have these all this if you give more and more example all of a sudden this looks like a table and they say we made sure that the strings here these particular strings were not in our training data right so these strings never appeared but I just have an issue with this deduplication stuff because what can appear actually is not the what can appear is a table and then table often you have columns and then another column will be the sum of these columns on the left and if you are asked to pattern match you'll naturally find websites right if you have a few of these examples you'll find websites where the columns exactly refer to these things and then you'll find the sum here and if you filter for websites that appear to match your scheme in the examples you'll find all the website with a table on them where the column one column is an addition of the others and I can actually do that so I went and I typed in just a bunch of these things so 98 plus 45 is 143 18 plus 55 is 75 I believe at least and I can find now Google makes it hard because they localized and everything but you can still find what you're going to find are tables and tables and tables and tables and now I actually went to Dr. Go to basically say you know they don't you know really personalize it to me and what's the first thing I find when I type in just these numbers is math skip counting missing sequence number and a website where basically the answers are already given look at that so all the model has to do is recall this particular training example from the samples it already has right and it will it will basically be able in quotes to perform addition like this is financial data and another one where you have to subtract stuff right so I'm pretty sure all the models doing here is interpolating the training data and that's also why it performs worse if if you up the digits because longer digit numbers are simply less frequent in the in the training data multiplication is first of all less frequent and second of all it also results in larger numbers which are less frequent right so it explains a lot so I yeah I have my issues with people saying yeah this this shows some reasoning I don't think it does the same thing here with word scramble so in word scramble they have different things you see okay they they they look whether or not only 17 matches 0.8% of the math things are in their training data like no you haven't searched well enough and the rest of their deduplication by the way is also pretty weak I would say because they just look for like 13 gram overlaps between the training data and the in the and their their test data so they have these words scrambling tasks where they basically scramble words and they ask the model to scrambles for example this word is inevitably scrambled so they always you know they give like anagrams and they give random insertion into the word like this word right here or they reverse the word and they say so this I think this is the thing at the very beginning but if you can see right here also as the model goes up then this improves and they also say well this means maybe some kind of reasoning but I think this is just it's learning the language and it's learning that you know the words in in sorry the letters make up a word and the letters correspond to word pieces or are associated with word pieces and it always learns to English a good task to check this would actually be to scramble words so if you unscramble words you always end up with an English word so all it has to do is basically check which word has the highest overlap in word pieces but you could do something like please scramble this word and then always counted correctly when any of the scrambling of the words so instead of going from this to this which you can simply solve by knowing the English language but you would have basically no clue what the task is that you don't have to understand that as a model you could ask it to go from this to this given a few examples right then it would really need to understand what the task is that it's supposed to actually scramble a word and would need to learn that from its context given examples but they as far as I see they don't do that and again I think it's recalling the training data the training data this is sat analogies so the SAT or this test that the US high schoolers take to get into college and the this they say a typical example this is dying on me no it's scrolled a typical example is the following this I find I find pretty hilarious all dishes is to boldness as sanctimonious is to hypocrisy anonymous is to identity remorseful is to misdeed deleterious is to result or impressionable is to temptation this is a as as a okay I'm not a native speaker but this is a hard question right and you have to you know see that these these high schoolers they're stressed like this is very much a time based test so you need to make a decision quickly well the model of course is basically able to sift through its entire training data in the time it takes the GPUs to perform inference but it's still funny that GPT 3 achieves 50 65% in the few shots setting and 15% in one shot setting 53% is zero shot setting whereas the average score among college applicants was 57% so it outperforms the average college applicant it's pretty funny but you would expect the language model to have a pretty good grasp of these kind of synonyms and relations between words because these are just absolutely statistical associations between words so yeah this I found this to be pretty pretty funny and the last thing and this is what everyone's freaking out over is this news article generation where basically they give it the beginning of a few of a news article and then they let humans decide whether or not the news article is written by a machine or by a human and they say here by contrast mean human accuracy at detecting articles that were produced by the 175 billion parameter model was barely above chance at 52% human abilities to detect model generated text appear to decrease as model size increases there appears to be a trend towards chance accuracy with model size and human detection of GPT 3 is close to chance okay so what they do is they give and they have some examples right here they give the model the following input the title the subtitle of an article and then this word article and the model is supposed to complete the rest of the article right here and you can also you know give to this in a few short setting such that the model basically knows that it's if you give it a few examples the model knows it is supposed to produce a news article right okay so there are two two ways that you can think of this first way the model has learned the language so well and it writes code it has learned to write coherent language and so on to learn to reason keep context blah blah blah okay second way the model sees this thing right here it sees the few you know K few shot examples that it has before in the context it will take them filter the training data to in this case it just sees news articles so to just news articles it will take this thing filter the training data even more to just the news articles that pertain largely to topics or words that appear in here and then lastly will interpolate the few training examples to produce this thing now they argue that this isn't really possible because they have actually checked that this news article is not in the training data but I have simply gone and taken a I've really taken a random substring here I've taken this substring voted to strengthen a ban on the ordination of just this substring and I've put it into Google and Babri Ba I find a book with voted to strengthen prohibitions to ban LGBTQ people from being ordained and ministers so it's you know I find this it's not the same article but it's talking about the same incident the article talks about and it is using the same language probably read the article and the authors like I can't really you know copy paste that would be you know not really cool so I'll just kind of you know write it in my own words but largely the same thing the associate press here also a different article you know see different title than this one right here but about the same thing and also with the same language right here voted to stay distraint the faiths device of bands on same set marriage and ordination of LGBT clergy and generally so the argument this article wasn't in the training data is just not really something I buy in this in this case so I think it the article as such wasn't there but many articles about this topics were and I think this will just interpolate these now they say this was the hardest article for the humans to decide and this here was the easiest so it's it says I don't know start talks promise draws Megan Kelly's sarcasm as a year ago joking Phoenix made headlines when you appeared on the red carpet and going lots wearing a tuxedo with a paper bag over his head that red I'm a shape shifter global you you would guess that joking Phoenix would do something like this but they say they're human Raiders were us based right and you see right here it says men Kelly was not impressed and she let him have it on the to night show now that to night show is not what men Kelly is and us based people would I guess know something like this and would immediately feel like this is wrong so I think this thing is interpolated from is interpolated from a bunch of different news articles about this and the interpolation just let it like this let it like made it to that this person is on this show which they aren't and the humans noticed right but it doesn't change the fact that it probably just went to the training data filter the bunch of articles about these words and then interpolated like mash them together it is a good language model right it can grammar it's very good at grammar so we can interpolate different passages of text and I feel that the really really useful application of this will be sort of as a search engine as a fuzzy search engine so now I can like input for example my machine learning research ideas and what will output will be sort of an abstract of a paper that's kind of a mush together of other papers on the same thing and that that you know you can think of many applications I don't think we have built something really intelligent here and what this is this is though is pretty cool they they give examples like this here where they make up a word and then ask the model to use the word in a sentence so to be free is something sorry to scree something is to swing a sword at it an example of a sentence that uses the word scree is and of course the model what's the model is going to do is it's going to take this it's going to filter the training data for all of the instances where sort of this construction appears like an example of using the words which is mostly dictionaries then it's going to not know that word but it's it can interpolate from interpolate it from all this data right here and the cool thing is it actually conjugates the word we screened at each other for several minutes and then we went outside and eight ice cream so you can see how this is comes to be but I think it would really be fun to have a model that tells us which training data samples were used here it can also correct English grammar which is pretty obvious though again it can never correct so the input always here is poor English good English poor English poor good poor English and then good English and that's what the model is asked to to output and I'm actually not sure pretty sure this here shouldn't be bold I'm fairly sure this shouldn't be bold this is given to the model the model is only asked to produce this otherwise it be I'd be actually impressed but yes nothing task specific is provided aside from the examples from few examples as conditioning and the poor English input good English output framing so the good English output thing here should not be in bold authors if you're listening this should not be bold thank you okay but again it is always as you can see it's too good English it's always the target is good English whereas if the model really understood the task it should also be able to do the inverse it should be able to to produce something poor from something good because then you eliminate the fact that it's just a good English language model right because it can basically produce something like this without having a clue what the task is it will simply you condition on this input and it will simply output this sentence because it's very likely because it's already almost here and it will output it in better English because it's a good language model right it's a good English language model so yeah that so they measure this overfitting the degree to which they're training to which their test data is in this common crawl thing and they say they have a conservative bound on how many percent of the data in the data set are clean and as you can see here they measure then how much the performance differs to to up or down if you only evaluate on the clean portion of this data set but again their d2 application is so weak they do like n gram d2 application whereas I think you should really like in the news articles you should really do much more fuzzy d2 application much more of a meaning d2 application if you then want to argue that the model has learned to reason like if you simply want to argue that the model is a good language model fine right but yeah and also look at this like I would expect of a data set a test data set if you know if you have like a natural questions data set is constructed from Wikipedia pages and you have the Wikipedia page in there you can either either the entire thing is clean or none of it is clean and also these we know grud data set if this data set somehow leaked into the common crawl corpus either the entire thing is clean or none of it is clean I just have kind of problems with the fact that there are so many in between things right here and yeah so I'm not I'm not convinced here that this d2 application I still think it's a cool thing but I don't I think it's mostly a training data filter and interpolator rather than actual reasoning and they go through some of the limitations here and the broader in this broader impact statements like five pages long and yeah okay you can do you can you know bad people take the model to do bad things okay and that's pretty much it so what I appreciate here is at the bottom they have basically all the results but also a lot of task descriptions like how they framed each tasks more outputs and they give more outputs on their website right so you can see here how each of the tasks was framed where you always have this is what this here is what the model sees and then this is what it's asked to produce right so you have this for for all many of these things and so on squad you have this context and the question okay so the context is actually in there I've didn't know that but you have the context and the question and the model is asked to complete something right here so you can look at how the model sees tasks and maybe you can evaluate for yourself how you think how difficult you think these tasks or all right I hope this was informative it is a long paper therefore it is a long video if you're still here and haven't subscribed yet do maybe if you like this if you want more give it a like tell me in the comments what you think of it whether you think it's actually a G.I. or not and I'll see you next time bye bye | [{"start": 0.0, "end": 14.0, "text": " Hello there. Today we're looking at language models, our few shop learners by Tom B. Brown, Benjamin Mann, Nick Rider, and Melanie Sibaya, and a whole slew of authors from OpenAI."}, {"start": 14.0, "end": 34.0, "text": " This paper also called GPT-3 just came out recently. GPT-3 is a model that is a language model, and it comes out of a succession of language models of OpenAI. This paper is basically an investigation into what you can do with giant language models."}, {"start": 34.0, "end": 44.0, "text": " This language model is an order of magnitude larger than anyone has ever built a language model, and it can do some absolutely crazy things."}, {"start": 44.0, "end": 51.0, "text": " So we'll basically go over the architecture, over what the model does, and over the experimental results."}, {"start": 51.0, "end": 62.0, "text": " It turns out that if you train a language model on enough data, it is able to solve NLP tasks that it has never seen just out of the box."}, {"start": 62.0, "end": 67.0, "text": " And we're going to look into this very cool kind of formulation of the problem."}, {"start": 67.0, "end": 75.0, "text": " As you can see here, the paper is 40 pages long without the appendix. It needs its own table of contents, which is crazy."}, {"start": 75.0, "end": 78.0, "text": " So we're going to skip a fair bit of things."}, {"start": 78.0, "end": 91.0, "text": " So first of all, what is a language model? For those of you who don't know, I've done a bunch of videos, and you can see those in my natural language processing playlist about language models, and specifically about transformer language models."}, {"start": 91.0, "end": 105.0, "text": " So a language model, let's just take an example, this sentence right here, just the sentence as such, like third, humans do not require to do not require large supervised data sets to learn most language tasks."}, {"start": 105.0, "end": 119.0, "text": " But this is an English sentence, and a language model would be a model that if you cross out a portion from the end here, like this right here, it would be able to tell you what comes next."}, {"start": 119.0, "end": 127.0, "text": " So in a language model, you would input this part right here, and it will tell you the next word is data sets."}, {"start": 127.0, "end": 136.0, "text": " So that's basically all the language model does. And once you've trained one, you can basically generate word after word after word from it."}, {"start": 136.0, "end": 150.0, "text": " Or you can ask it a question like which word is most likely to come next or more likely. So a language model is nothing but a model that can kind of generate language in a probabilistic way."}, {"start": 150.0, "end": 158.0, "text": " And the cool thing about language models is that you can train it on any sort of text data. And that's what they do here."}, {"start": 158.0, "end": 167.0, "text": " So they train a language model on giant amounts of data, specifically right here, they go into the data sets they use."}, {"start": 167.0, "end": 176.0, "text": " They use this, let's skip down, they use this common crawl data set, which they filter down for quality."}, {"start": 176.0, "end": 181.0, "text": " And this is basically a crawl of the entire internet, if you will."}, {"start": 181.0, "end": 195.0, "text": " Together with these books, data sets and the web text data set and the Wikipedia data set. So they throw all of this text that they scrape from the internet together and then train a language model on that."}, {"start": 195.0, "end": 212.0, "text": " Now the language model right here is called GPT3 and they train various sizes of it. And we'll get into how it's built in a second, but just compare this to a language model like Bert."}, {"start": 212.0, "end": 228.0, "text": " Bert required this much flops to train and these, this is a log scale. So this is right here. This is several orders of magnitude larger and bigger model and is trained for way longer on this text."}, {"start": 228.0, "end": 233.0, "text": " So naturally it is going to be a lot better at language modeling."}, {"start": 233.0, "end": 250.0, "text": " You can see right here the size of these models that they trained on. Remember the previous largest language model, the touring NLG of Microsoft, had something like 17 billion parameters. So it would be comparable to this right here."}, {"start": 250.0, "end": 263.0, "text": " Whereas GPT3 has 175 billion parameters, which this is absolutely crazy. This is an order of magnitude higher than anything that's ever existed."}, {"start": 263.0, "end": 280.0, "text": " And if you look at the last GPT, the GPT2 model that if you remember, I've made a video about it, is too dangerous to be released. Well now it has been released, but was too dangerous to be released. It clocked in at about 1.5 billion parameters."}, {"start": 280.0, "end": 296.0, "text": " So compared to this GPT3 XL model right here, they trained these multiple models to basically estimate the effect of the model size. And you can see here the largest model has 96 attention layers."}, {"start": 296.0, "end": 312.0, "text": " Each layer has 96 attention heads and each head is 128 dimensional. And it trains on batches of size 3.2 million. This is the batch size. Absolutely crazy."}, {"start": 312.0, "end": 323.0, "text": " So they trained this on a giant distributed cluster that apparently is provided by Microsoft. And yes, crazy, crazy things."}, {"start": 323.0, "end": 334.0, "text": " So how does this model look? This model is a transformer model. And right here, we don't even have like a description of a transformer model. It's just assumed you know what that is."}, {"start": 334.0, "end": 346.0, "text": " I have made several videos on transformer models and especially things like attention is all you need or burped or something like this. But for those who don't know if I have a transformer model."}, {"start": 346.0, "end": 357.0, "text": " And I want to build a language model from it. Let's take this sentence right here. I would input a what's called a context, which is the thing I already have. Right."}, {"start": 357.0, "end": 372.0, "text": " I would input that into a transformer model and a transformer model is just several layers of attention mechanism. Now an attention mechanism is basically a way where information is routed in between the different tokens right here."}, {"start": 372.0, "end": 396.0, "text": " And as it goes up the layer, basically the information is routed around and the model can make various inferences. And at the end, the model is supposed to come up with the next word that you're going to put here specifically in this paper. They use sub words like word piece tokens like it is common in NLP right now."}, {"start": 396.0, "end": 415.0, "text": " Actually, this is an auto regressive language model. So it's not like bird. It's not bidirectional. It is auto regressive. It goes from left to right. It always produces the next word. It is like GPT2. They even say this. They say we use the same model and architecture as GPT2."}, {"start": 415.0, "end": 436.0, "text": " They just have more layers and wider layers and more data to train it on. So how do they train it? Okay, that's we already said they train it in simply in simply a language modeling way. Just next word prediction. That's it."}, {"start": 436.0, "end": 453.0, "text": " Okay, so it's not even something fancy like bird. The interesting part is when you do the now the single tasks. So what you usually did with something like bird. So with something like bird, you would do first pre-train."}, {"start": 453.0, "end": 467.0, "text": " So there you would. This is the language modeling right here. This pre-training phase where you teach bird about the English language by just feeding it a lot of data. And then second, you had a step called fine tuning."}, {"start": 467.0, "end": 480.0, "text": " Fine. I can't even write tuning. So on the second one, you'd have something like the task you're actually interested in. And let's say the task you're actually interested in is sentiment classification."}, {"start": 480.0, "end": 492.0, "text": " So in sentiment classification, you have like a sentence like blah, blah, blah. And you want to know is that a positive sentiment like is a happy sentence or is it a sad sentence."}, {"start": 492.0, "end": 504.0, "text": " And you would have a database of labeled instances of that. So in this database, you'd have a bunch of sentences. And for each one, you would know, is it good? Is it positive or is it negative?"}, {"start": 504.0, "end": 524.0, "text": " And then you'd have like a smaller test set right here. And you would you would train you would basically take this pre-trained model, train it on this data set in a supervised machine learning way. And then test it on this test set right here. This is called fine tuning. That's what they display here."}, {"start": 524.0, "end": 545.0, "text": " So in fine tuning, the model is trained via repeated gradient updates using a large corpus of example tasks. Right. So the example task right here could be translating to French. So in your training database of the translation task would be this would be see order is called l'outre de mer."}, {"start": 545.0, "end": 564.0, "text": " And then you'd actually change your model. You do a gradient update. I mean, if if you're in the NLP world, this seems very natural, but they are going to argue in a second that this isn't the only way that you can teach a model a task."}, {"start": 564.0, "end": 583.0, "text": " So this this seems very natural, right? You're going to change your model. You take your pre-trained model and you're going to fine tune it on this task. And if you have a different task, right? If you have now question answering task, you're going to have a different data set right here with a train and test data set."}, {"start": 583.0, "end": 602.0, "text": " And you're going to take the pre-trained model and then fine tune it on that data set and evaluate it on that test set. So this gives you basically with as many models as you have tasks and you for each one, you need a big, big training date set in order to perform well."}, {"start": 602.0, "end": 614.0, "text": " Sometimes we have this. Sometimes we don't. What they are interested in is basically to take the pre-trained model and directly go and evaluate it on the test data set in a sort of a zero shot fashion."}, {"start": 614.0, "end": 621.0, "text": " Now it is not zero shot as they will argue. So what are they doing in a true zero shot fashion."}, {"start": 621.0, "end": 633.0, "text": " You would just take your your language model that you pre-trained and you just input the following text you input what they call a task description and a prompt."}, {"start": 633.0, "end": 650.0, "text": " So this is the input and you're simply asked the model as a language model to predict the next word. It's just what comes here. Now what you're counting on is basically that in the training data, the model has seen a structure like this enough to understand what's going on."}, {"start": 650.0, "end": 666.0, "text": " So that in the training data somewhere in the internet, there was this structure of translate something to something and then there would be a word here of something and you know it kind of has to realize that this goes here like that the next word."}, {"start": 666.0, "end": 685.0, "text": " So basically what you're asking is if you were to find this text on a website or on Wikipedia or in any of the books data set, if you were to find this piece of text, what would be the next word in that piece of text."}, {"start": 685.0, "end": 698.0, "text": " And you kind of hope that this is enough if you've trained a good language model that this is enough to actually produce the French translation here."}, {"start": 698.0, "end": 708.0, "text": " Now before I realize I've said the language modeling is to teach the model the English language. Actually not true in this common crawl corpus, you also have many foreign languages."}, {"start": 708.0, "end": 725.0, "text": " So you basically teach it a general model of the internet. Now they they contrast this to what they call one shot learning. So in one shot learning, you not only do you have the task description right here."}, {"start": 725.0, "end": 733.0, "text": " And this is this is a string, right? You don't specifically tell the model that this is now a translation task. You simply input this as a string."}, {"start": 733.0, "end": 748.0, "text": " So not only do you have the task description and the prompt right here, but you also have one example and the example and this is where they this is where they bring in the where they say it's not exactly zero shot."}, {"start": 748.0, "end": 762.0, "text": " Where's my little drawing here. So the example is going to come from the training data set of the task that you're interested in. But the important part is you never train on it."}, {"start": 762.0, "end": 787.0, "text": " You never explicitly train on that example. You simply put it in the context. So you simply put this string. So translate English to French, new line, see order is loot the mayor, new line, cheese is what you simply input that string into the model as a language model and you ask it what's the next word right here."}, {"start": 787.0, "end": 802.0, "text": " Okay. So I hope this is clear. This is what they call kind of one shot generalization and by one shot, they basically mean you simply provide this thing in the context of the model as a language model."}, {"start": 802.0, "end": 825.0, "text": " Now the advantage here is immediately clear that you only have to train one model then and then basically at inference time, you can just input the task description and the sort of training data for the task into its its evaluation context and the task itself."}, {"start": 825.0, "end": 839.0, "text": " And it will if it is if it really does what they claim it does, it would be able to sort of understand the prompt here understand what it means to translate from English to French."}, {"start": 839.0, "end": 855.0, "text": " So I would look at this example and say, oh, that's what you want me to do. Okay. And then it would be able to generalize to this input right here to say, okay, from the task description and the example, I get what you want me to do."}, {"start": 855.0, "end": 862.0, "text": " I will the next word here is cheese. What's cheese in French? I don't remember."}, {"start": 862.0, "end": 880.0, "text": " Now the way the language model is going to interpret that is slightly different. As we said before, the way the language model is going to interpret is if you were to find the following text on a website somewhere, the text is called translating"}, {"start": 880.0, "end": 903.0, "text": " to French new line see order goes to the main new line cheese goes to what would be the next word on that website. So that's what the model sees right you have to differentiate between what the human wants and what the model sees the model is just a language model that is going to take the next that is just going to determine if I were to see this text somewhere what will be the most likely next word."}, {"start": 903.0, "end": 922.0, "text": " So you have to phrase your tasks in a way that makes sense in that thing. And they also have this few shot thing where you not only provide one context, but you provide a bunch of context to basically tell the model more of what it what it should do."}, {"start": 922.0, "end": 935.0, "text": " Now this doesn't only work in a free mode where you basically say what's the next word here what you can also do if you have such a language with the exact same model you can give it basically a couple of possibilities."}, {"start": 935.0, "end": 946.0, "text": " So you can give it it's you can say like it's either shot or it's from a or it's hotel. I think that has like this."}, {"start": 946.0, "end": 961.0, "text": " So you can you can basically restrict it to only produce one of these three things. So in translation this might not be you know the way to go but in if you have like yes no answers questions you can restrict it to that."}, {"start": 961.0, "end": 971.0, "text": " So in a lot of these NLP tasks you have some options given for a given question and you can also restrict it. So don't you know you always have to go with the task at hand."}, {"start": 971.0, "end": 983.0, "text": " But this is in essence what the model does and this is I think this is the new well not the new per se but this is one of the core ideas of this paper if you take anything from it."}, {"start": 983.0, "end": 993.0, "text": " There's no new architecture right here. There's no new wisdom in training. They train in a standard way in a standard language modeling fashion a standard transformer architecture."}, {"start": 993.0, "end": 1006.0, "text": " This just happens to be ginormous. Okay. This right here this thing where they say most of these things would fine tune and then basically end up with one model per task and you need a big data set per task."}, {"start": 1006.0, "end": 1029.0, "text": " But we simply can do this since we have such a large language model it is basically already basically already knows how to do this tasks as long as we formulate them in a language model way we can have the model perform these tasks and they will show that this works surprisingly well throughout this paper."}, {"start": 1029.0, "end": 1041.0, "text": " Now we get into the experimental results right here and the experimental results first of all on language modeling as you can see here."}, {"start": 1041.0, "end": 1056.0, "text": " Now basically say as you go up with the parameters you see the more you want are the parameters you go into your validation loss goes down and down and down and down and I believe this is sort of a log scale as well."}, {"start": 1056.0, "end": 1071.0, "text": " So this is the log probability so the the perplexity and that the this basically follows a trend. Oh no, this is a log scale. This is a log scale."}, {"start": 1071.0, "end": 1089.0, "text": " It follows a trend where as you scale up the model and as you scale up the compute that the model gets and we know for these big language models we basically know you have to scale up model size compute time and data set size in the same fashion for them to make these gains."}, {"start": 1089.0, "end": 1112.0, "text": " But if you do that it follows like a parallel where as you scale up these things the model basically gets better and better and better and the question of course is you know how far how far can we go with this but for now it seems to hold quite well that you can just make improvements by scaling up your model on language modeling at least."}, {"start": 1112.0, "end": 1133.0, "text": " So where do we where do we basically go from here so before we dive into the actual results of the individual tasks and other going to formulate these individual tasks so they have like pure language modeling tasks right here like Alice was friends with Bob Alice went to visit our friend and then it's like what's the next word."}, {"start": 1133.0, "end": 1145.0, "text": " Okay, this Bob and George bought some baseball equipment of all a glove and a what's the next word and I guess this should be had sorry bat right here."}, {"start": 1145.0, "end": 1162.0, "text": " But we're going to go into the into the tasks and one of them is for example question answering so in question answering you simply get either you get just a pure question or a context and a question."}, {"start": 1162.0, "end": 1187.0, "text": " And they do the fact that they they test where a situation where you just get the question so you just get I don't know who is the Queen of England or something like this and the model is simply to produce either the result direct or to choose from a bunch of answers which one is the most likely as a language model."}, {"start": 1187.0, "end": 1203.0, "text": " And as you can see as you scale up the language model the zero shot one shot and few shot predictions so in few shot you give 64 different examples from the training set in the context so you always have."}, {"start": 1203.0, "end": 1232.0, "text": " So your context is going to look something like this and they have examples at the bottom and haven't looked at the QA task but the the examples going to be something like this you have a task description like answer the following questions answer the question and then you have your example so in zero shot that zero and one shot it's one that's what I like and then you say how tall who sorry who."}, {"start": 1232.0, "end": 1261.0, "text": " I don't know who climbed Everest the first the first and then you say Hillary I think it was Hillary no I don't remember and then you say I don't know how tall is the Empire State building and then you have like some number here and at the end you say what was the was a question from before."}, {"start": 1261.0, "end": 1290.0, "text": " I don't know who is the Queen of England who is the Queen of England and then you ask the model to predict the next word right here okay and you do this in a closed book setting which means you have no access to Wikipedia or whatever like usually these systems they can go and query Wikipedia but this system doesn't so you just you just want to know what has the model learned about the world."}, {"start": 1290.0, "end": 1319.0, "text": " By simply absorbing giant amounts of text so if somewhere in the training data the fact that the Queen of England is Elizabeth the second is present it should complete this right here and it performs surprisingly well as you can see here so it manages to outperform a fine tuned state of the art model that is actually that is fine tuned on question answering right this has it has been built for question answering and this model is the same as the one that I was talking about."}, {"start": 1319.0, "end": 1348.0, "text": " And this model outperforms it by simply having a lot of of language so this here is the results on on these open domain QA tasks and you you see right here it it this this few shot it outperforms this open domain it open domain means that the model can go and look at some Wikipedia page"}, {"start": 1348.0, "end": 1376.0, "text": " and yeah so so this is pretty cool but there are other things like the natural questions where it underperforms compared to this open domain thing and they say this is mainly due to the natural questions being like it's very much about factual Wikipedia knowledge and so on maybe like the question"}, {"start": 1376.0, "end": 1391.0, "text": " we just made maybe is more of a natural question type of thing and since and the model is apparently not as good at that but it's still impressive that the model is able to do this out of the box."}, {"start": 1391.0, "end": 1420.0, "text": " Okay so before I said something like before we go into the experiments I want the following so I have like some sort of hypothesis it's not it's not an uncommon hypothesis that basically these things these giant language models right they're just these transformers layer after layer after layer with their connections in here what I think is happening is they are simply storing the training data right they are simply"}, {"start": 1420.0, "end": 1445.0, "text": " storing the training data in these connections right here so usually you think of storing the training data in some form of maybe we have like some module right here some database module in the neural network and it learns to query the module but ultimately if you train a neural network what you have is data and you train a function with parameters on that data"}, {"start": 1445.0, "end": 1463.0, "text": " and ultimately what you're doing is you're distilling the data into these parameters and you kind of hope to learn some regularities from it but ultimately the information about your training data influences or determines your final parameters of your function."}, {"start": 1463.0, "end": 1490.0, "text": " Now I can imagine that if you have such a giant neural network with so many weights like 17 sorry 170 billion weights that you can pretty efficiently actually store the training data in that model and when you ask this model now to do something what it basically does is what these people sort of argue is that it has learned these language"}, {"start": 1490.0, "end": 1508.0, "text": " task is learned to reason over language and so on what I think is happening much more is it will simply go to the training data since it has stored the entire training data in its weights and it will sort of pull out the five to ten to 50 training"}, {"start": 1508.0, "end": 1528.0, "text": " examples that are most relevant to what you put in and it will sort of interpolate right you go to the training data and it will pull out a bunch of training samples that are relevant to the context you put in right now and then it will sort of integrate those into the next word that's going to come out right here"}, {"start": 1528.0, "end": 1555.0, "text": " and I think if you look at this paper in terms of this so you always read you input a context and the context is split into a task description and then it is split into K different examples and then it is it is it has a prompt sorry this is the prompt so the task description is please translate from English to French and the K different things are K different translations"}, {"start": 1555.0, "end": 1576.0, "text": " and then the prompt is you know what what you should do so it's like half of a cake half of one of these boxes right here so these boxes are have blah blah blah turns to blah blah blah and then the prompt is simply without the the right side I think what it does is it will simply take all of this"}, {"start": 1576.0, "end": 1602.0, "text": " and it will go to its own training data which it has stored in its weights and it will filter the training data and basically take out the things that sort of pattern match sort of reg X match in a fuzzy way to this context and then it will kind of interpolate these training examples in order to come up with the answer I don't think there is reasoning happening here"}, {"start": 1602.0, "end": 1620.0, "text": " and we're going to if you go through the paper with this view then you can a lot of things actually make sense and I actually I think that we need we need what we need when think people think of like explainable machine learning"}, {"start": 1620.0, "end": 1649.0, "text": " they often think that if I'm going to input something like I'm going to input an image into a classifier that and it comes out a certain class car I like the explainability should be a which part of this image was it the wheels was it the hood which part of the image which part of the input image is responsible for making that determination what I think in especially these language models what we should do is if the model predicts something right here the next word"}, {"start": 1649.0, "end": 1672.0, "text": " I think we should somehow have a method of determining which of the training examples that the model used to interpolate given this context because I'm pretty sure these training is you will find so if you'll find that for example this weight and this weight and this weight was very responsible for making this prediction happen"}, {"start": 1672.0, "end": 1697.0, "text": " I'm pretty sure you can somehow during training build an index of which of the which five training examples had most influence on that particular weight or on this combination of weights and then you can sort of go backwards and say you made this decision right here model please tell me which of the training data samples were responsible for making that decision"}, {"start": 1697.0, "end": 1726.0, "text": " actually pretty sure that already exists like I'm never the first one to think of these things though if I am sight me sight the channel no but just an interesting way to think about this model and an interesting way to think about kind of what does what would explain ability even mean in a model like this and my argument is since it interpolates the training data the interpretability should come out and I'm going to explain this"}, {"start": 1726.0, "end": 1746.0, "text": " interpretability should come from the fact of which training samples does it interpolate okay let's go to translation so in translation as we said they simply input the like the task and then the few examples and then"}, {"start": 1746.0, "end": 1766.0, "text": " the output okay and you can see right here what you can see is that again as the model goes up in parameters the performance generally increases and also you can see that the performance is pretty good every time that this model goes to English"}, {"start": 1766.0, "end": 1783.0, "text": " so it goes if it if the target language is English which sort of makes sense because like a large part of the corpus they train on is English so being an English language model it should be pretty good if it is asked to produce English"}, {"start": 1783.0, "end": 1800.0, "text": " and it's not as good if it is asked to go into the different direction now what you also see is that it is not really a difference whether you translate from from which language you translate but if you go to English but it very much"}, {"start": 1800.0, "end": 1824.0, "text": " very much matters to which language you go if it is from English so this sort of makes sense in that it is just trained on a lot of English data and right here sometimes they are on par with the with the state of the art supervised methods and also other times they out perform these methods"}, {"start": 1824.0, "end": 1844.0, "text": " right here and these methods are unsupervised but are specifically so they don't have a supervised training data set that goes let's say from English to French but they are built with this in mind that they need to translate later so they are sort of tasks specific but don't have a supervised training set"}, {"start": 1844.0, "end": 1866.0, "text": " and this model right here it just learns whatever it learns and it just does this language model learning and at the end just because it has seen some websites where language of both things appear it can now translate reasonably well"}, {"start": 1866.0, "end": 1889.0, "text": " okay now yeah so the results here are a bit noisy but it is still interesting to see that it sometimes even gets close to the supervised thing though they say that they are not familiar with the literature and are not sure that these models that these numbers are good okay"}, {"start": 1889.0, "end": 1912.0, "text": " okay the next thing is these we know grud schemes where you do have where is the text here is a classic NLP task that involves determining which word a pronoun refers to when the pronoun is grammatically ambiguous but semantically unambiguous to a human"}, {"start": 1912.0, "end": 1939.0, "text": " so these are sort of human produced sentences where it's kind of a pronoun could refer to multiple things I don't have a example present but where do we have the right here you can see that this model will out produce a fine tuned birth large but will not out produce a fine tuned"}, {"start": 1939.0, "end": 1956.0, "text": " a Roberto large so it is going to it is going to come it is competing at least with the fine tuned models that were made specifically for that task right again this is pretty pretty interesting"}, {"start": 1956.0, "end": 1967.0, "text": " and you also see that the larger models here it starts to make a difference whether or not you give it one zero or one or more examples"}, {"start": 1967.0, "end": 1996.0, "text": " okay so we'll get into we'll get into the more interesting things right here in this thing right here where is it yes this is the kind of a physical physical question physical qa where it is a bit of common sense reasoning"}, {"start": 1996.0, "end": 2016.0, "text": " so you're asked to I don't yeah these are like science questions multiple choice questions collected from a third to ninth grade exams and the physical qa is physical qa"}, {"start": 2016.0, "end": 2038.0, "text": " they ask common sense question about how the physical word world works and is intended as a probe of grounded understanding of the world so it has questions as I understand it it has questions like if a drop a ball will it fall on the ground or where will it fall or something like this"}, {"start": 2038.0, "end": 2058.0, "text": " and they say that they can outperform a fine tuned state of the art model on this if they go just high enough and you can also see that there isn't much of a difference between zero one and few shot the methods of this model"}, {"start": 2058.0, "end": 2074.0, "text": " even those zero shot is even higher than one shot so this is probably just noise but then you find out that they have an asterisk here and this means that this is potentially a contaminated data set"}, {"start": 2074.0, "end": 2094.0, "text": " so they have potential contamination issues so what they found was there was a significant overlap between the data set this data set and their training data set and they they only realized this too late because there was a bug in their d du application code"}, {"start": 2094.0, "end": 2108.0, "text": " and then they couldn't change it anymore because this model is so large that they couldn't restart the training because they've already spent like so much money and energy on it"}, {"start": 2108.0, "end": 2120.0, "text": " this is crazy I think these language models are getting so large that we should building them we should more think of it like we build the international space station or something like this"}, {"start": 2120.0, "end": 2128.0, "text": " this is a project where humanity sort of collaborates or there's a big effort and you build it once and whatever you have you have right"}, {"start": 2128.0, "end": 2142.0, "text": " so these good numbers here are simply or not simply are because or could be influenced by this contamination and I think that's what's happening right here"}, {"start": 2142.0, "end": 2153.0, "text": " and though they will make the case that this contamination isn't really an issue I can probably show you that it might be it may be actually is an issue"}, {"start": 2153.0, "end": 2164.0, "text": " because on the other data sets act the fine tune state of the art model outperform the GPT3 quite a bit"}, {"start": 2164.0, "end": 2173.0, "text": " and also the fact that the you know if you provide a demonstration or many demonstrations it doesn't actually change that much"}, {"start": 2173.0, "end": 2180.0, "text": " it kind of tells me that the model sort of already knows the answer is and doesn't really need demonstrations because it doesn't help"}, {"start": 2180.0, "end": 2189.0, "text": " if you have the training data stored or the test data you don't really have to get demonstrations right"}, {"start": 2189.0, "end": 2202.0, "text": " so they have a few other a few other things right here where on this cocoa task they perform pretty poorly compared to others or poorly"}, {"start": 2202.0, "end": 2210.0, "text": " let's say they perform well but not particularly more well than a state of the art"}, {"start": 2210.0, "end": 2219.0, "text": " and they perform especially poorly on the reading comprehension sorry that's the that's the cocoa"}, {"start": 2219.0, "end": 2228.0, "text": " so in reading comprehension what you have to do is abstractive multiple choice and span based"}, {"start": 2228.0, "end": 2240.0, "text": " answer formats in both dialogue and single question settings so basically have to read a piece of text like this and then answer a question about the piece of text"}, {"start": 2240.0, "end": 2252.0, "text": " now this is something where I think you cannot really interpolate the training data super well and therefore so you can't really just pattern match an interpreter"}, {"start": 2252.0, "end": 2265.0, "text": " because you have to do actual reasoning and I think that's why the model performs poorly here they do measure this on super glue which is a NLP benchmark"}, {"start": 2265.0, "end": 2279.0, "text": " and also here you can see it doesn't outperform a fine tuned state of the art model on these tasks but it does outperform a fine tuned birth model slightly"}, {"start": 2279.0, "end": 2291.0, "text": " so the birth model is fine tuned on these things whereas GPT3 isn't but notice the tasks in which it does well and in which it doesn't do well compared to the state of the art model"}, {"start": 2291.0, "end": 2301.0, "text": " so for example in the bull queue it doesn't do particularly well right the state of the art is 91 and only has 76 that's quite a large difference"}, {"start": 2301.0, "end": 2314.0, "text": " and actually have the glue benchmark open here and you can see this is the bull queue so an example here would be is France the same time zone as the UK"}, {"start": 2314.0, "end": 2324.0, "text": " and then there is like a passage and you need to reason about from this passage about whether or not this answer is true or false"}, {"start": 2324.0, "end": 2337.0, "text": " this is very much not language modeling this is reasoning and that's why the model is doing poorly here whereas in another thing you see this for example this Copa right here"}, {"start": 2337.0, "end": 2349.0, "text": " the model is doing almost as good as a fine tuned state of the art and I have to stress this model has never actually learned this task in a supervised way it's simply a language model"}, {"start": 2349.0, "end": 2365.0, "text": " and I have this Copa task right here and these are the examples so one example is the premise the man broke his toe what was the cause of this and you have two different things that it could be"}, {"start": 2365.0, "end": 2375.0, "text": " either he got a hole in his sock or he dropped a hammer on his foot and the way you phrase it in this model is you would give the premise as the context"}, {"start": 2375.0, "end": 2389.0, "text": " simply ask the model since it's a language model which of these two things is more probable to come and of course it is going to select the thing that can have happened more often in the training data"}, {"start": 2389.0, "end": 2400.0, "text": " and you know broke his toe the cause of breaking his toe that is a hammer this is entirely conceivable that a language model would know this"}, {"start": 2400.0, "end": 2414.0, "text": " and with enough training data could sort of pull from the training data examples where hammer on foot and broke toe appear a bunch of times and hole in sock would be rather unrelated"}, {"start": 2414.0, "end": 2421.0, "text": " so as long as these questions are not too adversarial constructed specifically that a language model can't solve them"}, {"start": 2421.0, "end": 2437.0, "text": " the model is going to perform pretty well right here right so it is very interesting to see that if you view this as interpolating the training data it suddenly makes sense where it's good and where it isn't good"}, {"start": 2437.0, "end": 2449.0, "text": " so this was the super glue and and NLI it is performing particularly poorly on NLI"}, {"start": 2449.0, "end": 2465.0, "text": " which is the ability to understand the relationship between two sentences right so where the model classifies whether the second sentence logically follows from the first contradicts the first or is possibly true neutral"}, {"start": 2465.0, "end": 2475.0, "text": " okay so this is the reasoning part of this model is not given it is simply recalling the training data and doing language modeling"}, {"start": 2475.0, "end": 2488.0, "text": " now they say oh we can test this we can test this with synthetic and qualitative tasks so they invent some own tasks since you know now it's pretty easy since you don't have to find to in the model you don't have to"}, {"start": 2488.0, "end": 2503.0, "text": " to generate an actual training set for a task so you can focus on generating a test set and and you know that's what they do so they do something like arithmetic"}, {"start": 2503.0, "end": 2524.0, "text": " so they say okay can we come up with a bunch of arithmetic tasks for example two digit digit edition so what the model would see would this is an example and what the model would see is simply this as a context right here for the prompt and if you give it examples"}, {"start": 2524.0, "end": 2543.0, "text": " so if this is like one shot learning you would input add the following numbers the following numbers as a string right then a new line and then you would give it one example like what is 11 plus 12"}, {"start": 2543.0, "end": 2565.0, "text": " and with the answer together with the answer answer is I don't know 23 and then you the prompt goes here so what is 48 plus 76 and then you ask what is the next word right here what is the next string token that comes here now the"}, {"start": 2565.0, "end": 2580.0, "text": " the inference here is that if the model manages to do this it can't simply because these are all strings the model basically has no clue how to do math these are numbers to the model these are just tokens as strings and the"}, {"start": 2580.0, "end": 2594.0, "text": " references if the model can do this it must have learned you know some kind of reasoning ability must have learned to like perform some logic inside so they go into two digit edition free digit"}, {"start": 2594.0, "end": 2612.0, "text": " edition five digit edition and even multiplication and subtraction and the results are right here so as you can see the lower parameter models they perform pretty poorly but as you go up the"}, {"start": 2612.0, "end": 2629.0, "text": " parameters the big model is performing really well in the two digit range is performing also really well so accuracy of look that accuracy 80 90% in three digit edition and subtraction but then if as soon as you get to the"}, {"start": 2629.0, "end": 2647.0, "text": " four digit or the two digit multiplication and so on the performance drops now they say that's because multiplication is harder and you know it's is logically very computationally you know but the two digit edition and so on model has learned something about the world I"}, {"start": 2647.0, "end": 2663.0, "text": " disagree because so here's the because what you will do is you will simply and this you simply recall the training data so look at the two digit"}, {"start": 2663.0, "end": 2678.0, "text": " edition with zero shot you already get 76% but with one shot you get 99% and with few shot you get a hundred percent so if you interpret this model is simply filtering the training data to"}, {"start": 2678.0, "end": 2699.0, "text": " pattern match then it makes a lot of sense that the one shot would like the examples here would give you a much improvement because if you have a bunch of examples where please add right add and then oh I raised our example again so you have"}, {"start": 2699.0, "end": 2716.0, "text": " 48 plus 72 equals blah blah blah you have these all this if you give more and more example all of a sudden this looks like a table and they say we made sure that the strings here these particular"}, {"start": 2716.0, "end": 2733.0, "text": " strings were not in our training data right so these strings never appeared but I just have an issue with this deduplication stuff because what can appear actually is not the what can appear is a table"}, {"start": 2733.0, "end": 2753.0, "text": " and then table often you have columns and then another column will be the sum of these columns on the left and if you are asked to pattern match you'll naturally find websites right if you have a few of these examples you'll find websites where the columns exactly refer to these things and then you'll find the"}, {"start": 2753.0, "end": 2772.0, "text": " sum here and if you filter for websites that appear to match your scheme in the examples you'll find all the website with a table on them where the column one column is an addition of the others and I can actually do that so I went and I typed in just a bunch of"}, {"start": 2772.0, "end": 2795.0, "text": " these things so 98 plus 45 is 143 18 plus 55 is 75 I believe at least and I can find now Google makes it hard because they localized and everything but you can still find what you're going to find are tables and tables and tables and tables and now I actually went to"}, {"start": 2795.0, "end": 2815.0, "text": " Dr. Go to basically say you know they don't you know really personalize it to me and what's the first thing I find when I type in just these numbers is math skip counting missing sequence number and a website where basically the answers are already"}, {"start": 2815.0, "end": 2835.0, "text": " given look at that so all the model has to do is recall this particular training example from the samples it already has right and it will it will basically be able in quotes to perform addition like this is financial data and another one where you have to subtract stuff right so I'm"}, {"start": 2835.0, "end": 2864.0, "text": " pretty sure all the models doing here is interpolating the training data and that's also why it performs worse if if you up the digits because longer digit numbers are simply less frequent in the in the training data multiplication is first of all less frequent and second of all it also results in larger numbers which are less frequent right so"}, {"start": 2864.0, "end": 2883.0, "text": " it explains a lot so I yeah I have my issues with people saying yeah this this shows some reasoning I don't think it does the same thing here with word scramble so in word scramble they have different things you see"}, {"start": 2883.0, "end": 2901.0, "text": " okay they they they look whether or not only 17 matches 0.8% of the math things are in their training data like no you haven't searched well enough and the rest of their deduplication by the way is also pretty weak I"}, {"start": 2901.0, "end": 2918.0, "text": " would say because they just look for like 13 gram overlaps between the training data and the in the and their their test data so they have these words scrambling tasks where they basically scramble words and they ask the model to"}, {"start": 2918.0, "end": 2947.0, "text": " scrambles for example this word is inevitably scrambled so they always you know they give like anagrams and they give random insertion into the word like this word right here or they reverse the word and they say so this I think this is the thing at the very beginning but if you can see right here also as the model goes up then"}, {"start": 2947.0, "end": 2972.0, "text": " this improves and they also say well this means maybe some kind of reasoning but I think this is just it's learning the language and it's learning that you know the words in in sorry the letters make up a word and the letters correspond to word pieces or are associated with word pieces and it always learns"}, {"start": 2972.0, "end": 3001.0, "text": " to English a good task to check this would actually be to scramble words so if you unscramble words you always end up with an English word so all it has to do is basically check which word has the highest overlap in word pieces but you could do something like please scramble this word and then always counted correctly when any of the scrambling of the words so instead of going from this to this which you can simply solve by knowing the English language"}, {"start": 3001.0, "end": 3018.0, "text": " but you would have basically no clue what the task is that you don't have to understand that as a model you could ask it to go from this to this given a few examples right then it would really need to understand what the task is that it's supposed to actually scramble a word"}, {"start": 3018.0, "end": 3030.0, "text": " and would need to learn that from its context given examples but they as far as I see they don't do that and again I think it's recalling the training data"}, {"start": 3030.0, "end": 3049.0, "text": " the training data this is sat analogies so the SAT or this test that the US high schoolers take to get into college and the this they say a typical example this is dying on me no it's scrolled"}, {"start": 3049.0, "end": 3065.0, "text": " a typical example is the following this I find I find pretty hilarious all dishes is to boldness as sanctimonious is to hypocrisy anonymous is to identity remorseful is to misdeed"}, {"start": 3065.0, "end": 3084.0, "text": " deleterious is to result or impressionable is to temptation this is a as as a okay I'm not a native speaker but this is a hard question right and you have to you know see that these these high schoolers they're stressed like this is very much a time based test so you need to make a decision quickly"}, {"start": 3084.0, "end": 3103.0, "text": " well the model of course is basically able to sift through its entire training data in the time it takes the GPUs to perform inference but it's still funny that GPT 3 achieves 50 65% in the few shots setting and 15% in one shot setting"}, {"start": 3103.0, "end": 3111.0, "text": " 53% is zero shot setting whereas the average score among college applicants was 57% so it outperforms the average college applicant"}, {"start": 3111.0, "end": 3131.0, "text": " it's pretty funny but you would expect the language model to have a pretty good grasp of these kind of synonyms and relations between words because these are just absolutely statistical associations between words so yeah this I found this to be pretty pretty funny"}, {"start": 3131.0, "end": 3152.0, "text": " and the last thing and this is what everyone's freaking out over is this news article generation where basically they give it the beginning of a few of a news article and then they let humans decide whether or not the news article is written by a machine or by a human"}, {"start": 3152.0, "end": 3166.0, "text": " and they say here by contrast mean human accuracy at detecting articles that were produced by the 175 billion parameter model was barely above chance at 52%"}, {"start": 3166.0, "end": 3180.0, "text": " human abilities to detect model generated text appear to decrease as model size increases there appears to be a trend towards chance accuracy with model size and human detection of GPT 3 is close to chance"}, {"start": 3180.0, "end": 3201.0, "text": " okay so what they do is they give and they have some examples right here they give the model the following input the title the subtitle of an article and then this word article and the model is supposed to complete the rest of the article right here"}, {"start": 3201.0, "end": 3216.0, "text": " and you can also you know give to this in a few short setting such that the model basically knows that it's if you give it a few examples the model knows it is supposed to produce a news article right okay"}, {"start": 3216.0, "end": 3229.0, "text": " so there are two two ways that you can think of this first way the model has learned the language so well and it writes code it has learned to write coherent language and so on"}, {"start": 3229.0, "end": 3250.0, "text": " to learn to reason keep context blah blah blah okay second way the model sees this thing right here it sees the few you know K few shot examples that it has before in the context it will take them filter the training data to in this case it just sees news articles"}, {"start": 3250.0, "end": 3266.0, "text": " so to just news articles it will take this thing filter the training data even more to just the news articles that pertain largely to topics or words that appear in here and then lastly will interpolate the few training examples to produce this thing"}, {"start": 3266.0, "end": 3285.0, "text": " now they argue that this isn't really possible because they have actually checked that this news article is not in the training data but I have simply gone and taken a I've really taken a random substring here I've taken this substring"}, {"start": 3285.0, "end": 3311.0, "text": " voted to strengthen a ban on the ordination of just this substring and I've put it into Google and Babri Ba I find a book with voted to strengthen prohibitions to ban LGBTQ people from being ordained and ministers so it's you know I find this it's not the same article but it's talking about the same incident the article talks about"}, {"start": 3311.0, "end": 3337.0, "text": " and it is using the same language probably read the article and the authors like I can't really you know copy paste that would be you know not really cool so I'll just kind of you know write it in my own words but largely the same thing the associate press here also a different article you know see different title than this one right here but about the same thing"}, {"start": 3337.0, "end": 3360.0, "text": " and also with the same language right here voted to stay distraint the faiths device of bands on same set marriage and ordination of LGBT clergy and generally so the argument this article wasn't in the training data is just not really something I buy in this in this case"}, {"start": 3360.0, "end": 3389.0, "text": " so I think it the article as such wasn't there but many articles about this topics were and I think this will just interpolate these now they say this was the hardest article for the humans to decide and this here was the easiest so it's it says I don't know start talks promise draws Megan Kelly's sarcasm as a year ago joking Phoenix made headlines when you appeared on the red carpet"}, {"start": 3389.0, "end": 3402.0, "text": " and going lots wearing a tuxedo with a paper bag over his head that red I'm a shape shifter global you you would guess that joking Phoenix would do something like this but they say they're human Raiders were us based right and you see right here it says"}, {"start": 3402.0, "end": 3431.0, "text": " men Kelly was not impressed and she let him have it on the to night show now that to night show is not what men Kelly is and us based people would I guess know something like this and would immediately feel like this is wrong so I think this thing is interpolated from is interpolated from a bunch of different news articles about this and the interpolation just let it like this"}, {"start": 3431.0, "end": 3452.0, "text": " let it like made it to that this person is on this show which they aren't and the humans noticed right but it doesn't change the fact that it probably just went to the training data filter the bunch of articles about these words and then interpolated like mash them together it is a good language model right it can grammar it's very good at grammar so we can"}, {"start": 3452.0, "end": 3479.0, "text": " interpolate different passages of text and I feel that the really really useful application of this will be sort of as a search engine as a fuzzy search engine so now I can like input for example my machine learning research ideas and what will output will be sort of an abstract of a paper that's kind of a mush together of other papers on the same thing and that that"}, {"start": 3479.0, "end": 3499.0, "text": " you know you can think of many applications I don't think we have built something really intelligent here and what this is this is though is pretty cool they they give examples like this here where they make up a word and then ask the model to use the word in a sentence so to"}, {"start": 3499.0, "end": 3522.0, "text": " be free is something sorry to scree something is to swing a sword at it an example of a sentence that uses the word scree is and of course the model what's the model is going to do is it's going to take this it's going to filter the training data for all of the instances where sort of this construction appears like an example of using the words which is mostly"}, {"start": 3522.0, "end": 3548.0, "text": " dictionaries then it's going to not know that word but it's it can interpolate from interpolate it from all this data right here and the cool thing is it actually conjugates the word we screened at each other for several minutes and then we went outside and eight ice cream so you can see how this is comes to be but I think it would really be fun to have a model that"}, {"start": 3548.0, "end": 3567.0, "text": " tells us which training data samples were used here it can also correct English grammar which is pretty obvious though again it can never correct so the input always here is poor English good English poor English"}, {"start": 3567.0, "end": 3587.0, "text": " poor good poor English and then good English and that's what the model is asked to to output and I'm actually not sure pretty sure this here shouldn't be bold I'm fairly sure this shouldn't be bold this is given to the model the model is only asked to produce this otherwise it be I'd be actually impressed"}, {"start": 3587.0, "end": 3606.0, "text": " but yes nothing task specific is provided aside from the examples from few examples as conditioning and the poor English input good English output framing so the good English output thing here should not be in bold"}, {"start": 3606.0, "end": 3634.0, "text": " authors if you're listening this should not be bold thank you okay but again it is always as you can see it's too good English it's always the target is good English whereas if the model really understood the task it should also be able to do the inverse it should be able to to produce something poor from something good because then you eliminate the fact that it's just a good English language model right"}, {"start": 3634.0, "end": 3661.0, "text": " because it can basically produce something like this without having a clue what the task is it will simply you condition on this input and it will simply output this sentence because it's very likely because it's already almost here and it will output it in better English because it's a good language model right it's a good English language model so yeah"}, {"start": 3661.0, "end": 3682.0, "text": " that so they measure this overfitting the degree to which they're training to which their test data is in this common crawl thing and they say they have a conservative bound on how many percent of the data in the data set are clean and as you can see here they measure"}, {"start": 3682.0, "end": 3699.0, "text": " then how much the performance differs to to up or down if you only evaluate on the clean portion of this data set but again their d2 application is so weak they do like n gram d2 application whereas I think you should really like in the news articles you should really do"}, {"start": 3699.0, "end": 3716.0, "text": " much more fuzzy d2 application much more of a meaning d2 application if you then want to argue that the model has learned to reason like if you simply want to argue that the model is a good language model fine right but yeah"}, {"start": 3716.0, "end": 3735.0, "text": " and also look at this like I would expect of a data set a test data set if you know if you have like a natural questions data set is constructed from Wikipedia pages and you have the Wikipedia page in there you can either either the entire thing is clean or none of it is clean"}, {"start": 3735.0, "end": 3751.0, "text": " and also these we know grud data set if this data set somehow leaked into the common crawl corpus either the entire thing is clean or none of it is clean I just have kind of problems with the fact that there are so many in between things right here"}, {"start": 3751.0, "end": 3770.0, "text": " and yeah so I'm not I'm not convinced here that this d2 application I still think it's a cool thing but I don't I think it's mostly a training data filter and interpolator rather than actual reasoning"}, {"start": 3770.0, "end": 3788.0, "text": " and they go through some of the limitations here and the broader in this broader impact statements like five pages long and yeah okay you can do you can you know bad people take the model to do bad things okay"}, {"start": 3788.0, "end": 3816.0, "text": " and that's pretty much it so what I appreciate here is at the bottom they have basically all the results but also a lot of task descriptions like how they framed each tasks more outputs and they give more outputs on their website right so you can see here how each of the tasks was framed where you always have this is what this here is what the model sees and then this is what it's asked to produce right"}, {"start": 3816.0, "end": 3845.0, "text": " so you have this for for all many of these things and so on squad you have this context and the question okay so the context is actually in there I've didn't know that but you have the context and the question and the model is asked to complete something right here so you can look at how the model sees tasks and maybe you can evaluate for yourself how you think how difficult you think"}, {"start": 3845.0, "end": 3870.0, "text": " these tasks or all right I hope this was informative it is a long paper therefore it is a long video if you're still here and haven't subscribed yet do maybe if you like this if you want more give it a like tell me in the comments what you think of it whether you think it's actually a G.I. or not and I'll see you next time bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=T35ba_VXkMY | DETR: End-to-End Object Detection with Transformers (Paper Explained) | Object detection in images is a notoriously hard task! Objects can be of a wide variety of classes, can be numerous or absent, they can occlude each other or be out of frame. All of this makes it even more surprising that the architecture in this paper is so simple. Thanks to a clever loss function, a single Transformer stacked on a CNN is enough to handle the entire task!
OUTLINE:
0:00 - Intro & High-Level Overview
0:50 - Problem Formulation
2:30 - Architecture Overview
6:20 - Bipartite Match Loss Function
15:55 - Architecture in Detail
25:00 - Object Queries
31:00 - Transformer Properties
35:40 - Results
ERRATA:
When I introduce bounding boxes, I say they consist of x and y, but you also need the width and height.
My Video on Transformers: https://youtu.be/iDulhoQ2pro
Paper: https://arxiv.org/abs/2005.12872
Blog: https://ai.facebook.com/blog/end-to-end-object-detection-with-transformers/
Code: https://github.com/facebookresearch/detr
Abstract:
We present a new method that views object detection as a direct set prediction problem. Our approach streamlines the detection pipeline, effectively removing the need for many hand-designed components like a non-maximum suppression procedure or anchor generation that explicitly encode our prior knowledge about the task. The main ingredients of the new framework, called DEtection TRansformer or DETR, are a set-based global loss that forces unique predictions via bipartite matching, and a transformer encoder-decoder architecture. Given a fixed small set of learned object queries, DETR reasons about the relations of the objects and the global image context to directly output the final set of predictions in parallel. The new model is conceptually simple and does not require a specialized library, unlike many other modern detectors. DETR demonstrates accuracy and run-time performance on par with the well-established and highly-optimized Faster RCNN baseline on the challenging COCO object detection dataset. Moreover, DETR can be easily generalized to produce panoptic segmentation in a unified manner. We show that it significantly outperforms competitive baselines. Training code and pretrained models are available at this https URL.
Authors: Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko
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 going to look at end-to-end object detection with transformers by Nicolas Carillon from Chiscomasa and others at Facebook AI research. So on a high level this paper does object detection in images using first a CNN and then a transformer to detect objects and it does so via a bipartite matching training objective. And this leaves you basically with an architecture that is super super simple compared to the previous architectures that had all kinds of engineering hurdles and thresholds and hyperparameters. So really excited for this. As always if you like content like this consider leaving a like comment or subscribing. Let's get into it. So let's say you have a picture like this here and you're supposed to detect all the objects in it and also where they are and what they are. This task is called object detection. So a good classifier here would say there's a bird right here and so this is a bird and then this here is also a bird. Right they can be overlapping these bounding boxes. So this is you see the the first problem that bird. Why is that green? Nevermind. Okay and those are the only two objects. So there's a number of very difficult things here. First of all you need to sort of detect the objects. You need to know how many there are. It's all it's not always the same in each image. There can be multiple objects of the same class. There can be multiple objects of different classes. They can be anywhere of any size. They can be overlapping in the background small or across the entire image. They can occlude each other partially. So the problem is a very very difficult problem. And previous work has done a lot of engineering on this like building detectors and then kind of you want to classify every single pixel here and then you you get like two detections right here that are very close for the same class. You say ah that must maybe be the same instance right. So there's only one thing here and not two things. That's one. So there there used to be very complicated architectures that solve these problems. And this paper here comes up with a super simple architecture. And we'll kind of go from the high level to the low to the implementation of each of the parts. So what does this paper propose? How do we solve a task like this? First of all we put the image and the image here without the labels of course. We put it through a convolutional neural network encoder. Since this is an image task it's you know kind of understandable that we do this mostly because CNN's just works so well for images. So this gives us this set of image features. And I think this this vector here is not really representative of what's happening. So let's actually take this picture right here and throw it in kind of an angled way. And what we'll do with CNN is we'll simply sort of scale it down but have it multiple. So here it's three channels right. It's red, green and blue like this three channels. But we'll scale it down but we make it more channels. So yeah. So more channels. Okay. But it's still sort of an image right here. It still has the image form. Okay. So the CNN basically gives us this thing which is sort of a higher level representation of the image with many more feature channels but still kind of information where and the image those features are. And this is going to be important in a second because now this thing which is this set of image features goes into a transformer encoder decoder and this is sort of the magic thing here as a component. We'll look into that in a second but what they get out right here is this set of box predictions. So out comes each of these boxes here is going to be consisting of a tuple and the tuple is going to be the class and the bounding box. Okay. So an example for this could be bird, bird at x equals 2 y equals 5. Okay. That's an example. Another example of this could also be there is nothing at x equals 7 y equals 9. Okay. So nothing the nothing class is a valid class right here and that's also important. But safe to say there is this set of box predictions and then that is basically your output right. These things are your output. If you have those things you can draw these bounding boxes you can assign the labels. The question is how do you train it? Now what you're given is a database of images and these images as you see here on the right. These images already have by human annotators drawn these bounding boxes in and also labels. So this here would be annotated with bird and this here would be annotated with bird. But it doesn't have any of these like it doesn't annotate the nothing classes or and so on. So the question is how do you compare the two? Can you simply say okay if the first one here is the bird and then the second one is this bird then it's good but then you know the ordering shouldn't matter. You simply simply care whether you have the correct bounding boxes. You don't care whether you output them in the correct order. And also what if your classifier does something like this it outputs those two boxes we see here but it also outputs this here and says bird or like one that is slightly off and says bird and so on. So how do you deal with all of these cases? So the way that this paper deals with all of these cases is with their bipartite matching loss. This thing right here. So how does it work? Let's say your work and we go. Let's say your classifier so here is an image. I'm have to wait for this to catch up. Here is an image and we put it through this entire pipeline right and we get a set of predictions right and they're going to be class bounding box class bounding box. Now the first thing you need to know is that there are always the same amount of predictions right there are always this size here is fixed that's large n. That is sort of that's kind of a maximum of predictions. Since you can always predict either a class or the nothing class in this case you could predict anywhere from zero to five objects in the scene. And then the second thing is from your from your database you get out an image with its bounding box annotations that are made by human lablers. Let's say these two and you also do class bounding box class bounding box. But now you see we only have two two instances. So here we just pad with the nothing class. So I don't know what the bounding box should be for the nothing class. It doesn't really matter nothing no bounding box nothing no bounding box. So your ground truth labels if you will are also of size n. So you always compare n things here on the left that your classifier output with n things on the right. Now as we already said the question is how do you deal with you can't simply compare one by one because the ordering should not be important. But also you don't want to encourage your classifier to always kind of if there is if if the one bird is very prominent right you don't want to encourage your classifier to say to say here's a bird here's a bird there's a bird right here hey hey there's a bird there's a bird there's a bird and basically just because the signal for that bird is strong and basically ignore the other bird. What you want to do is you want to encourage some sort of your classifier to detect if it has already detected an object it shouldn't detect it again in a slightly different place. So what the way you do this is with this bipartite matching loss. So at the time when you compute a loss you go here and you compute what's called a maximum matching. Now what you have to provide is a loss function. So we can there's a loss function L and L will take two of these things L will take the red the predicted thing of your model and L will take the true under one of the true underlying things and L will compute a number and we'll say how well do these two agree. So you can say for example if either of them is the nothing class then I have no loss like I don't care about them that gives you no loss but if the two if the two classes agree and the two bounding boxes agree then it's very good right then we maybe even gives like some negative loss or give loss zero but if if the bounding boxes agree but the classes don't agree then you say that's bad or the other way around if the classes agree in the bounding or even if if everything disagrees it's the worst what what you're basically saying is if if these two would correspond to each other right if the thing on the left were the prediction for the thing on the right which we don't know right it could be that the thing on the right refers to the bird on the right and the thing on the left refers to the bird on the left so it would be natural that the bounding boxes are in the same but you say if these were corresponding to each other what what would the loss be how well would they do and now if you compute this bipartite matching what you want I guess it's a it's a minimum matching in this case what you want is you want to find an assignment of things on the left two things on the right I want to one assignment this is an example of a one-to-one assignment everything on the left is assigned exactly one thing on the right such that the total loss is minimized right so you're going to say I'm going to align the things on the left with the things on the right such that it's maximally favorable right I give you the maximum benefit of the doubt by aligning these things and what so in the best possible case what's the loss okay I hope this is this is somehow clear so this you're trying to find the assignment from the left to the right that makes that basically is the best case for this output right here where you really say oh okay here you output it output a bird very close to the bird here in the in the ground truth label that's this here so I'm going to connect I'm going to connect these two because that's sort of it's it's it gives a model the most benefit of the doubt and the loss that you have at the end of that matching so this loss here would only then count wherever these connections are that loss is going to be your training loss okay so this solves the problems we had before it is not dependent on the order because if you reorder the things your minimum matching will simply find will simply swap with it it is it is if you output the same bird multiple times only one of these is going to be assigned so if if this here is that bird only one of them only this one maybe is going to be assigned to that one and the other ones can't be assigned to that one are forced to be assigned to a different one let's say this one here and are going to incur a loss so you encourage your model to outputs let's say diverse bounding boxes different bounding boxes for things okay so this this solves these problems and it's very clever and there are algorithms to compute these these minimum matchings they they use the Hungarian algorithm which will give you exactly such a matching again this is possible because you have n things on each side and the n is in effect here is the maximum of objects that you can detect at once I guess if there is less you can simply pad right here and then the model of course is encouraged to come up with the equal number of no-class predictions because if it outputs a prediction where it shouldn't right if it already predicts two things and these are assigned to these two things and then it outputs one more thing it is going to be penalized because it should output three things with no class but it has output one too many with a with a class is going to be penalized okay so the this is a pretty pretty cool thing it again it relies on the fact that you have n on both sides but you can make n so large that basically it covers all of the cases so you can make n like 50 so you can detect up to 50 things in a scene all right that's the algorithm in a high level they do show their loss here you see the loss ultimately is going to be so it's going to be over this matching right here that's the minimum a bipartite assignment that basically minimizes this total loss over your prediction and label matchings and the loss they come up with here yeah I said you have to give the algorithm a loss is this one and they kind of go into how they do it I don't think it's super important so the class algorithm sorry the the loss on the class labels I think it's going to be a softmax or a sorry a cross entropy loss like an usual classification and the loss on the to say whether two bounding boxes agree is a mixture of the L1 loss that compares to bounding boxes and this IOU loss which is not dependent on the scale of the bounding boxes it kind of computes how much fraction of the two bounding boxes overlap but in any case the loss basically consists of saying how how how much do the labels agree and how much do the bounding boxes agree okay again this is only possible because after that you compute this matching otherwise you would have no clue which boxes to which predictions to compare to which other predictions so let's look at this architecture a bit more in detail as we said you have this what they call the backbone which is a convolutional neural network and with that you put in some positional encodings now already said the you you should look at the these features right here as just smaller feature versions of the image but they still have some image nature then they are flattened so once they are put in the transformer encoder because the transformer is naturally a sequence processing unit okay so it takes in just a sequence of vectors right here and since an image is not a sequence what you'll do is if you have your image features and we said we have a bunch of channels let's say we have four channels and they're of height and width and C you're going to unroll and flatten that into one sequence so this is height times width you basically unroll across these axis right here into this axis and its channels eyes so basically you have a sequence here of of C dimensional feature vectors that you then put into your encoder okay so your encoder will now transform this sequence into an equally long sequence yet again of features and the good thing about a transformer because why do you use a transformer the good thing about the transformer is that in such a sequence and I've done videos on transformers it you can basically mainly look at the video attention is all you need if you want to understand this more fully this thing can basically have attention so it has attention layers it can attend from each position to each position in a one shot manner so as it transforms this representation up the transformer layers at each step it can basically aggregate information from everywhere in the sequence to earn anywhere else and therefore it's very it's very powerful if you have a sequence and you need sort of global connections across the sequence this is very good for language processing because in a sentence let's look at this sentence the input images are batched together right applying blah blah blah blah blah blah blah blah and then there is they right the word they and you need you need to know that they refers to the input images okay and but you see this is very very far away in the sentence so you need a model that makes use of long-range dependencies and they make the case that in such a task right here you also need the long-range dependencies because these bounding boxes as you see right here they can be quite large so if you have an image you need that this part here communicates with these and this and this and this and this part basically anywhere in the bounding box and these bounding boxes can be quite large so the transformer architecture actually makes sense here now I want to go a bit later into why I think it actually makes even more sense for a bounding box detection but right now I just want to keep going through this through this architecture right here so if my computer here decides to come back yes we can go on so what we'll get out is yet another so in here we put this thing we put down here we put into the transformer encoder and we get an equally sized equally shaped sequence out of the transformer encoder and you see that this thing here goes as a side input into this transformer decoder so the transformer encoder here is just a bit more of a feature mapping technically just for the architecture you could think of just putting this into here but of course it's gonna go better with the transformer encoder the transformer decoder now does something similar but you see it has the encoder as a side input this is very much like this is not like birth birth is like a only encoder transformer whereas this is much like the original attention is all you need transformer that has an encoder and then the decoder as a side input basically as conditioning information has the encoder output what does the decoder do again since it's a transformer it's going to take a sequence and output a sequence the sequence it takes is right here is what they call object queries and this also is different from the attention is all you need papers and they don't do it auto-regressively they just do it one shot what does it mean it means that you start with a sequence here of four things and these are these are the this is this big n and you output the sequence of a sequence of four things and it's important to see what they're gonna end up so these things are then directly going through a classifier that now outputs the so these things here are these class label bounding box outputs okay so each of these things is going to after transformation end up being one of these bounding boxes either defining an object or saying that there isn't an object somewhere okay you see here this bounding box refers to this bird this bounding box refers to this bird so each of these things is going to to be one bounding box and the what they call object queries is the question of course is what do you input here right I actually I want to transform this image information that comes from the left here I want to transform that into the bounding boxes what do I input here and the answer is you just input at the start you just input n random vectors because what's that gonna give you is basically an output you want an outputs because you want n of these bounding box classifications so you need n things and if I input n things into a transformer it's going to give me n things as an output and then in each step I can simply condition on the information that comes in the images and it it'll give me right then I can incorporate that information it's a very deep learning way of thinking about it actually that you just need the information somewhere in there and I need n things now they go more into detail into this transformer architecture help help in a helpful fashion in the appendix and we'll go there quickly so this I think here makes more sense so the image features come in here right and you see this is just a transformer stack an encoder stack of multi-head self-attention and feed forward instance-wise or like token-wise feed forward network and then that information is taken and is given as conditioning information over here now in here as I said you input this object queries which at the beginning are just n random vectors and what you're going to do you are also going to feature and code them and then you combine it with this image information so ultimately if you think of this one of these things one of these things is going to be a vector right and then that vector is going to be transformed and then it will have as it is transformed it will have the opportunity to basically look at features that come from here the arrow is in the wrong direction so you have already taken the image and you've transformed it into a feature representation which is also a vector right you have the features of the image right here now as you transform this vector this object query queue you have the opportunity to look at the image features right and that's how you get the image information in there so the image features will come in here transform that through attention so this is an attention mechanism on the image and then what you will output is a bounding box and a class label it's really hard to explain I would guess you need to understand really what attention mechanisms are and of course the crucial part of of course is what what's this what do you input at the beginning and these object queries aren't actually random as I said they are learned so what you're going to do is you're going to learn independent of the input image you're going to learn in different object queries and these object queries now it's very it's very interesting because these object queries are sort of going to be different it's like you have different people that can ask the input image different questions right and this they have so their N is 100 but they show 20 of these object queries that they learn and so they they have visualization of all bounding box predictions on all images so it's it's sort of like you have N different people at your disposal and you train these N different people to kind of ask different questions of the input image okay you say this person up here will always ask irrespective of what the input image is will always ask sort of hey input image what's what's on your bottom left right that's I'm really interested what's on your bottom left and sometimes I'm a bit interested in what's here but I'm mainly interested what's on the bottom left of the image whereas this person right here sorry this person right here is more interested in what's in the center now the different colors here is refer to different sizes of bounding boxes so this person is also interested so the person on the top left is interested mainly in I think small bounding boxes that are on the bottom left and the person here is mostly interested in what's I'm really interested what's in the center what's large in the center I won't give me large things that are in the center right and then this person right here is really interested on stuff that's on the right side of the image so you see in order to get different sort of a difference in bounding box predictions you train in different people to ask different questions of the of the input image and this asking of questions is exactly what an attention mechanism is so this person right here let's let's take this this person and I'm saying person these are vectors these are learned object queries but this person first they will simply ask the question what's on what's on the right side and then the the image features right the image features it will have an attention mechanism to this part of the image features and then it will get back some signal right and then it will transform that with its own signal up and then it will ask maybe again okay now that I know more because you see that person is interested in multiple things it's interesting those things and those things so at first it will focus on these things but then it says now I'm now I know more right there is there I know I see there is actually something on the right side so in the higher layers it can then go back and ask the image more questions by sending these queue vectors of the attention mechanism and it will get back the V vectors from the image features that correspond to these Q things so up and up the layers this person can ask more refined questions about what that particular person is interested in okay and since you have the different people here that ask different questions you basically learn the people in a way such that across the dataset they all together they cover every possible image pretty well again these people what they're interested in initially is not dependent on the picture you simply learn this in a global manner all right this is the best way I have of describing it it basically learn and people that are each one is interested in different things different classes and different regions in the image and each one of these people is going to output their best guess of what is where based on what they're interested in so that person might say I'm you know I'm the person that's interested kind of in the left side of things so I am going to output that there is a bird right here now these people if this is a transformer right and everything can attend to everything they can actually communicate with each other as they incorporate information from the image so in each layer they can do both they can incorporate information from the image and they can communicate with each other and then in the next layer they can do it again and again and again and thereby they can sort of they can sort of say well you already got the left side I will take the right side you already got the bird class I will take the elephant class and so on so you see here how the the architecture of the transformer actually is also very conducive to doing this bounding box prediction in that these different things can sort of attend to each other and therefore communicate with each other all right I hope that sort of makes sense now before we get into the experiments I want to list a third reason of why the transformer especially the encoders might actually also make a giant amount of sense here since you unroll the image into height and width and you have to imagine what does the transformer do the transformer as we said here has this notion of attention where from any point in the sequence it can gather information from any other point in the sequence and this that's usually one of the downsides of the transformers is done via a quadratic attention mechanism so if I just list one feature channel I'll go over here if I just list one feature channel right here this is height times width of the image right this is this is the entire image unrolled in one vector height times width and here I unroll it again height times width then this this matrix that I can build right here which is called the attention matrix right here it will tell me which parts of the sequence attend to which other parts okay so if you have an image that has the let's say the number three and you really want to figure out whether or not this is a three then the bow up here must communicate with the bow down here right they need to share information is it oh there's a bow here there's a bow here and there is a a spiky thing here that must be a three so you want something this is rather at the beginning of the sequence you want this to attend first of all it will attend itself so you get fairly high values along the diagonal maybe ten ten ten eleven eleven twelve I saw this oligee skit a hundred million nine nine but it also like this this part here at the beginning of the sequence let's say it's here because this is unrolled right needs to attend to the end so this needs to attend to the end which we will put an eleven here and the other way around doesn't always need to be symmetrical by the way okay but in any case this is going to be a h times w squared matrix because everything can attend to everything and that's the attention mechanism why do I think this is so good for bounding boxes because let's let's imagine you actually have a matrix that is like this okay high times with times high times with every single point in here actually defines a bounding box because this point this point right here in this dimension corresponds to one location in the image and on this axis it corresponds to another location now in the attention matrix simply means these two points need to communicate but if you have two pixels you actually have defined a bounding box right here right you you're actually you're defining a bounding box and the the fact that this is happening in the exact same matrices could mean that the transformers are uniquely well the transformers across sequences of these high times with unrolled images are uniquely well conducive to these bounding box prediction tasks and actually a bit astounded because when I first just read the title this immediately popped to my mind I'm like oh yes of course and they're going to predict the bounding boxes by simply training so what you would do what I thought this was going to be is out you output an actual matrix like this and then you simply each point you can you can simply classify right so you can classify here whether whether or not like at in this direction there is a bird right and then if you have two points like this for example you and you also classify whether in this direction there is a bird right and this naturally defines a bounding box or you could like take this matrix and actually just classify individual points in this matrix to be the bounding boxes because they already define bounding boxes so I just I think these these quadratic things are are uniquely I mean someone must have thought of this or if not cite the YouTube channel it would be funny first paper ever to actually have to cite the YouTube channel but again yeah so transformers seem to be a good idea for these kinds of things so how do they do of course they do well and they are on par with these other much much much more complex architectures these faster RCNN models they are apparently much more complex but they are on par with this they do however train forever I think they train for like six days on AGPUs is not that much if you compare to like language models on hundreds of TPUs but still okay I don't want to go into the numbers of experiments but what is pretty cool is that they can now visualize this sort of attention and you can see right here that if they look at a particular point in the image and visualize the attention it will actually attend to the instance itself so it will like these are usually the problems for these detection algorithms when things overlap and are partially occluded but you can see right here that the attention is on the part of the image that makes the instance in the back and the attention here is in the part of this and it doesn't sort of overlap into the others so that is one thing that's pretty impressive about these architectures the other thing they show is for example can generalize to many many instances so here it has never seen 24 giraffes in one image but yet it can absolutely do that and giraffe giraffe giraffe giraffe giraffe and the one of the coolest images I find are these here where you can see right here again attention visualization and you see that even within the bounding box of the front elephant here you see that the attention on this foot of the back elephant is assigned to this blue bounding box so this is the blue basically the blue bounding box person that is attending to that back foot that means they these things really sort of understand or they learn these things like occlusion and you know I just hard if I have a hard time describing it but you can see it visually here right like how it clearly learns that these are two instances that are sort of occluding each other but this this this instance can actually appear within the bounding box of the other instance and the same goes for the zebra here that are partially occluding each other and you can see that the attention is correctly like even here that this back foot of this zebra is correctly labeled so all in all that is pretty cool and they take it a step further and they say well with this architecture we can actually pretty easily do pixel wise classification so this is this cocoa stuff and things dataset where I don't know which one is the stuff and which one is the things I think things is the objects and stuff is like sky and mountains and so on and so this is a classification task where you actually have to label every single pixel so what they do is they simply input this through their detector and they detect the instances they take the attention maps of the instances and then they scale it up this right here is just a CNN sort of in reverse that scales up the image because they have scaled it down as we said they scale it up again and then they can simply classify each pixel where each of these remember we had these different people here that that cared about different things in the image each of these people will classify their respective pixels the pixels they feel responsible for and then you simply merge all of these people's predictions together into this prediction and again this gives pretty pretty impressive results I am I mean this is this is fun this looks like it sort of works I haven't they do quantitative analysis of course but I'm just impressed by the examples right here all right that was sort of it I really enjoyed reading this papers this simplicity is pretty cool they do have not only do they have code in the paper to show how ridiculously easy it is to get this to run this is all you need in PyTorch but they do actually have code and as I understand they also have pre-trained models so they have this model zoo right here where they give you the pre-trained models so you can play with it and you can even load it from Torch Hub yourself and you can train it yourself they have a colab all is there all right again if you enjoyed this video consider leaving a like subscribing and I'll see you next time bye bye | [{"start": 0.0, "end": 4.44, "text": " Hi there. Today we're going to look at end-to-end object detection with"}, {"start": 4.44, "end": 9.72, "text": " transformers by Nicolas Carillon from Chiscomasa and others at Facebook AI"}, {"start": 9.72, "end": 16.8, "text": " research. So on a high level this paper does object detection in images using"}, {"start": 16.8, "end": 23.0, "text": " first a CNN and then a transformer to detect objects and it does so via a"}, {"start": 23.0, "end": 28.52, "text": " bipartite matching training objective. And this leaves you basically with an"}, {"start": 28.52, "end": 33.28, "text": " architecture that is super super simple compared to the previous architectures"}, {"start": 33.28, "end": 39.28, "text": " that had all kinds of engineering hurdles and thresholds and hyperparameters."}, {"start": 39.28, "end": 44.84, "text": " So really excited for this. As always if you like content like this consider"}, {"start": 44.84, "end": 51.36, "text": " leaving a like comment or subscribing. Let's get into it. So let's say you have a"}, {"start": 51.36, "end": 56.120000000000005, "text": " picture like this here and you're supposed to detect all the objects in it and"}, {"start": 56.12, "end": 61.72, "text": " also where they are and what they are. This task is called object detection. So a"}, {"start": 61.72, "end": 67.52, "text": " good classifier here would say there's a bird right here and so this is a bird"}, {"start": 67.52, "end": 75.32, "text": " and then this here is also a bird. Right they can be overlapping these"}, {"start": 75.32, "end": 81.47999999999999, "text": " bounding boxes. So this is you see the the first problem that bird. Why is that"}, {"start": 81.48, "end": 86.60000000000001, "text": " green? Nevermind. Okay and those are the only two objects. So there's a number of"}, {"start": 86.60000000000001, "end": 91.64, "text": " very difficult things here. First of all you need to sort of detect the objects."}, {"start": 91.64, "end": 95.4, "text": " You need to know how many there are. It's all it's not always the same in each"}, {"start": 95.4, "end": 99.24000000000001, "text": " image. There can be multiple objects of the same class. There can be multiple"}, {"start": 99.24000000000001, "end": 103.2, "text": " objects of different classes. They can be anywhere of any size. They can be"}, {"start": 103.2, "end": 108.48, "text": " overlapping in the background small or across the entire image. They can"}, {"start": 108.48, "end": 113.16, "text": " occlude each other partially. So the problem is a very very difficult problem."}, {"start": 113.16, "end": 118.4, "text": " And previous work has done a lot of engineering on this like building"}, {"start": 118.4, "end": 123.36, "text": " detectors and then kind of you want to classify every single pixel here and"}, {"start": 123.36, "end": 127.76, "text": " then you you get like two detections right here that are very close for the"}, {"start": 127.76, "end": 132.32, "text": " same class. You say ah that must maybe be the same instance right. So there's"}, {"start": 132.32, "end": 138.6, "text": " only one thing here and not two things. That's one. So there there used to be very"}, {"start": 138.6, "end": 142.16, "text": " complicated architectures that solve these problems. And this paper here comes"}, {"start": 142.16, "end": 146.64, "text": " up with a super simple architecture. And we'll kind of go from the high level"}, {"start": 146.64, "end": 151.4, "text": " to the low to the implementation of each of the parts. So what does this paper"}, {"start": 151.4, "end": 157.32, "text": " propose? How do we solve a task like this? First of all we put the image and the"}, {"start": 157.32, "end": 161.56, "text": " image here without the labels of course. We put it through a convolutional"}, {"start": 161.56, "end": 165.56, "text": " neural network encoder. Since this is an image task it's you know kind of"}, {"start": 165.56, "end": 173.64000000000001, "text": " understandable that we do this mostly because CNN's just works so well for"}, {"start": 173.64000000000001, "end": 178.2, "text": " images. So this gives us this set of image features. And I think this this"}, {"start": 178.2, "end": 182.8, "text": " vector here is not really representative of what's happening. So let's actually"}, {"start": 182.8, "end": 189.0, "text": " take this picture right here and throw it in kind of an angled way. And what"}, {"start": 189.0, "end": 194.2, "text": " we'll do with CNN is we'll simply sort of scale it down but have it multiple."}, {"start": 194.2, "end": 199.0, "text": " So here it's three channels right. It's red, green and blue like this three"}, {"start": 199.0, "end": 212.08, "text": " channels. But we'll scale it down but we make it more channels. So yeah. So more"}, {"start": 212.08, "end": 218.12, "text": " channels. Okay. But it's still sort of an image right here. It still has the"}, {"start": 218.12, "end": 223.88, "text": " image form. Okay. So the CNN basically gives us this thing which is sort of a"}, {"start": 223.88, "end": 229.28, "text": " higher level representation of the image with many more feature channels but"}, {"start": 229.28, "end": 233.04, "text": " still kind of information where and the image those features are. And this is"}, {"start": 233.04, "end": 238.36, "text": " going to be important in a second because now this thing which is this set of"}, {"start": 238.36, "end": 244.64000000000001, "text": " image features goes into a transformer encoder decoder and this is sort of the"}, {"start": 244.64, "end": 252.76, "text": " magic thing here as a component. We'll look into that in a second but what they"}, {"start": 252.76, "end": 259.52, "text": " get out right here is this set of box predictions. So out comes each of these"}, {"start": 259.52, "end": 264.56, "text": " boxes here is going to be consisting of a tuple and the tuple is going to be"}, {"start": 264.56, "end": 271.4, "text": " the class and the bounding box. Okay. So an example for this could be bird, bird"}, {"start": 271.4, "end": 280.03999999999996, "text": " at x equals 2 y equals 5. Okay. That's an example. Another example of this could"}, {"start": 280.03999999999996, "end": 291.03999999999996, "text": " also be there is nothing at x equals 7 y equals 9. Okay. So nothing the nothing"}, {"start": 291.03999999999996, "end": 296.0, "text": " class is a valid class right here and that's also important. But safe to say"}, {"start": 296.0, "end": 302.76, "text": " there is this set of box predictions and then that is basically your output"}, {"start": 302.76, "end": 306.72, "text": " right. These things are your output. If you have those things you can draw these"}, {"start": 306.72, "end": 310.2, "text": " bounding boxes you can assign the labels. The question is how do you train it?"}, {"start": 310.2, "end": 316.76, "text": " Now what you're given is a database of images and these images as you see here"}, {"start": 316.76, "end": 321.64, "text": " on the right. These images already have by human annotators drawn these"}, {"start": 321.64, "end": 327.0, "text": " bounding boxes in and also labels. So this here would be annotated with bird and"}, {"start": 327.0, "end": 332.8, "text": " this here would be annotated with bird. But it doesn't have any of these like"}, {"start": 332.8, "end": 340.32, "text": " it doesn't annotate the nothing classes or and so on. So the question is how do"}, {"start": 340.32, "end": 346.68, "text": " you compare the two? Can you simply say okay if the first one here is the bird"}, {"start": 346.68, "end": 352.04, "text": " and then the second one is this bird then it's good but then you know the"}, {"start": 352.04, "end": 355.76, "text": " ordering shouldn't matter. You simply simply care whether you have the correct"}, {"start": 355.76, "end": 358.88, "text": " bounding boxes. You don't care whether you output them in the correct order."}, {"start": 358.88, "end": 365.64, "text": " And also what if your classifier does something like this it outputs those two"}, {"start": 365.64, "end": 371.4, "text": " boxes we see here but it also outputs this here and says bird or like one"}, {"start": 371.4, "end": 377.2, "text": " that is slightly off and says bird and so on. So how do you deal with all of these"}, {"start": 377.2, "end": 383.03999999999996, "text": " cases? So the way that this paper deals with all of these cases is with their"}, {"start": 383.03999999999996, "end": 388.88, "text": " bipartite matching loss. This thing right here. So how does it work? Let's say"}, {"start": 388.88, "end": 397.4, "text": " your work and we go. Let's say your classifier so here is an image. I'm"}, {"start": 397.4, "end": 401.47999999999996, "text": " have to wait for this to catch up. Here is an image and we put it through this"}, {"start": 401.47999999999996, "end": 407.79999999999995, "text": " entire pipeline right and we get a set of predictions right and they're going to"}, {"start": 407.79999999999995, "end": 415.23999999999995, "text": " be class bounding box class bounding box. Now the first thing you need to know"}, {"start": 415.23999999999995, "end": 421.15999999999997, "text": " is that there are always the same amount of predictions right there are always"}, {"start": 421.16, "end": 427.20000000000005, "text": " this size here is fixed that's large n. That is sort of that's kind of a"}, {"start": 427.20000000000005, "end": 431.44, "text": " maximum of predictions. Since you can always predict either a class or the"}, {"start": 431.44, "end": 436.64000000000004, "text": " nothing class in this case you could predict anywhere from zero to five objects"}, {"start": 436.64000000000004, "end": 444.12, "text": " in the scene. And then the second thing is from your from your database you get"}, {"start": 444.12, "end": 449.68, "text": " out an image with its bounding box annotations that are made by human"}, {"start": 449.68, "end": 458.64, "text": " lablers. Let's say these two and you also do class bounding box class bounding"}, {"start": 458.64, "end": 464.68, "text": " box. But now you see we only have two two instances. So here we just pad with"}, {"start": 464.68, "end": 468.76, "text": " the nothing class. So I don't know what the bounding box should be for the"}, {"start": 468.76, "end": 474.96000000000004, "text": " nothing class. It doesn't really matter nothing no bounding box nothing no"}, {"start": 474.96, "end": 486.88, "text": " bounding box. So your ground truth labels if you will are also of size n. So you"}, {"start": 486.88, "end": 493.52, "text": " always compare n things here on the left that your classifier output with n"}, {"start": 493.52, "end": 499.15999999999997, "text": " things on the right. Now as we already said the question is how do you deal with"}, {"start": 499.15999999999997, "end": 504.32, "text": " you can't simply compare one by one because the ordering should not be"}, {"start": 504.32, "end": 510.04, "text": " important. But also you don't want to encourage your classifier to always kind"}, {"start": 510.04, "end": 514.3199999999999, "text": " of if there is if if the one bird is very prominent right you don't want to"}, {"start": 514.3199999999999, "end": 518.48, "text": " encourage your classifier to say to say here's a bird here's a bird there's a"}, {"start": 518.48, "end": 521.84, "text": " bird right here hey hey there's a bird there's a bird there's a bird and"}, {"start": 521.84, "end": 525.96, "text": " basically just because the signal for that bird is strong and basically ignore"}, {"start": 525.96, "end": 530.48, "text": " the other bird. What you want to do is you want to encourage some sort of your"}, {"start": 530.48, "end": 535.12, "text": " classifier to detect if it has already detected an object it shouldn't detect it"}, {"start": 535.12, "end": 542.24, "text": " again in a slightly different place. So what the way you do this is with this"}, {"start": 542.24, "end": 547.28, "text": " bipartite matching loss. So at the time when you compute a loss you go here and"}, {"start": 547.28, "end": 553.72, "text": " you compute what's called a maximum matching. Now what you have to provide is a"}, {"start": 553.72, "end": 561.32, "text": " loss function. So we can there's a loss function L and L will take two of these"}, {"start": 561.32, "end": 569.64, "text": " things L will take the red the predicted thing of your model and L will take the"}, {"start": 569.64, "end": 575.84, "text": " true under one of the true underlying things and L will compute a number and"}, {"start": 575.84, "end": 584.0400000000001, "text": " we'll say how well do these two agree. So you can say for example if either of"}, {"start": 584.0400000000001, "end": 589.12, "text": " them is the nothing class then I have no loss like I don't care about them that"}, {"start": 589.12, "end": 594.6800000000001, "text": " gives you no loss but if the two if the two classes agree and the two"}, {"start": 594.6800000000001, "end": 598.64, "text": " bounding boxes agree then it's very good right then we maybe even gives like"}, {"start": 598.64, "end": 605.48, "text": " some negative loss or give loss zero but if if the bounding boxes agree but the"}, {"start": 605.48, "end": 610.6, "text": " classes don't agree then you say that's bad or the other way around if the"}, {"start": 610.6, "end": 614.44, "text": " classes agree in the bounding or even if if everything disagrees it's the worst"}, {"start": 614.44, "end": 621.8000000000001, "text": " what what you're basically saying is if if these two would correspond to each"}, {"start": 621.8000000000001, "end": 626.0, "text": " other right if the thing on the left were the prediction for the thing on the"}, {"start": 626.0, "end": 629.6800000000001, "text": " right which we don't know right it could be that the thing on the right refers"}, {"start": 629.6800000000001, "end": 633.84, "text": " to the bird on the right and the thing on the left refers to the bird on the"}, {"start": 633.84, "end": 638.96, "text": " left so it would be natural that the bounding boxes are in the same but you say"}, {"start": 638.96, "end": 646.1600000000001, "text": " if these were corresponding to each other what what would the loss be how well"}, {"start": 646.1600000000001, "end": 652.4, "text": " would they do and now if you compute this bipartite matching what you want I"}, {"start": 652.4, "end": 656.32, "text": " guess it's a it's a minimum matching in this case what you want is you want to"}, {"start": 656.32, "end": 660.12, "text": " find an assignment of things on the left two things on the right I want to"}, {"start": 660.12, "end": 665.64, "text": " one assignment this is an example of a one-to-one assignment everything on the"}, {"start": 665.64, "end": 671.4, "text": " left is assigned exactly one thing on the right such that the total loss is"}, {"start": 671.4, "end": 678.24, "text": " minimized right so you're going to say I'm going to align the things on the left"}, {"start": 678.24, "end": 683.08, "text": " with the things on the right such that it's maximally favorable right I give you"}, {"start": 683.08, "end": 690.24, "text": " the maximum benefit of the doubt by aligning these things and what so in the"}, {"start": 690.24, "end": 696.6, "text": " best possible case what's the loss okay I hope this is this is somehow clear"}, {"start": 696.6, "end": 700.8000000000001, "text": " so this you're trying to find the assignment from the left to the right that"}, {"start": 700.8000000000001, "end": 705.9200000000001, "text": " makes that basically is the best case for this output right here where you"}, {"start": 705.92, "end": 714.12, "text": " really say oh okay here you output it output a bird very close to the bird here"}, {"start": 714.12, "end": 718.16, "text": " in the in the ground truth label that's this here so I'm going to connect I'm"}, {"start": 718.16, "end": 723.8399999999999, "text": " going to connect these two because that's sort of it's it's it gives a model the"}, {"start": 723.8399999999999, "end": 729.16, "text": " most benefit of the doubt and the loss that you have at the end of that"}, {"start": 729.16, "end": 735.7199999999999, "text": " matching so this loss here would only then count wherever these connections are"}, {"start": 735.7199999999999, "end": 741.8399999999999, "text": " that loss is going to be your training loss okay so this solves the problems we"}, {"start": 741.8399999999999, "end": 745.6, "text": " had before it is not dependent on the order because if you reorder the things"}, {"start": 745.6, "end": 752.68, "text": " your minimum matching will simply find will simply swap with it it is it is"}, {"start": 752.68, "end": 758.8399999999999, "text": " if you output the same bird multiple times only one of these is going to be"}, {"start": 758.84, "end": 765.1600000000001, "text": " assigned so if if this here is that bird only one of them only this one maybe"}, {"start": 765.1600000000001, "end": 768.76, "text": " is going to be assigned to that one and the other ones can't be assigned to"}, {"start": 768.76, "end": 773.0400000000001, "text": " that one are forced to be assigned to a different one let's say this one here"}, {"start": 773.0400000000001, "end": 777.6800000000001, "text": " and are going to incur a loss so you encourage your model to outputs let's say"}, {"start": 777.6800000000001, "end": 783.7800000000001, "text": " diverse bounding boxes different bounding boxes for things okay so this"}, {"start": 783.78, "end": 788.4, "text": " this solves these problems and it's very clever and there are algorithms to"}, {"start": 788.4, "end": 792.9599999999999, "text": " compute these these minimum matchings they they use the Hungarian algorithm"}, {"start": 792.9599999999999, "end": 797.24, "text": " which will give you exactly such a matching again this is possible because you"}, {"start": 797.24, "end": 803.48, "text": " have n things on each side and the n is in effect here is the maximum of"}, {"start": 803.48, "end": 808.92, "text": " objects that you can detect at once I guess if there is less you can simply"}, {"start": 808.92, "end": 814.1999999999999, "text": " pad right here and then the model of course is encouraged to come up with the"}, {"start": 814.1999999999999, "end": 821.04, "text": " equal number of no-class predictions because if it outputs a prediction"}, {"start": 821.04, "end": 825.5999999999999, "text": " where it shouldn't right if it already predicts two things and these are"}, {"start": 825.5999999999999, "end": 829.68, "text": " assigned to these two things and then it outputs one more thing it is going to"}, {"start": 829.68, "end": 834.4, "text": " be penalized because it should output three things with no class but it has"}, {"start": 834.4, "end": 844.48, "text": " output one too many with a with a class is going to be penalized okay so the"}, {"start": 844.48, "end": 849.0799999999999, "text": " this is a pretty pretty cool thing it again it relies on the fact that you have"}, {"start": 849.0799999999999, "end": 856.72, "text": " n on both sides but you can make n so large that basically it covers all of the"}, {"start": 856.72, "end": 862.96, "text": " cases so you can make n like 50 so you can detect up to 50 things in a scene"}, {"start": 862.96, "end": 871.36, "text": " all right that's the algorithm in a high level they do show their loss here you"}, {"start": 871.36, "end": 876.36, "text": " see the loss ultimately is going to be so it's going to be over this matching"}, {"start": 876.36, "end": 882.0, "text": " right here that's the minimum a bipartite assignment that basically minimizes"}, {"start": 882.0, "end": 888.9200000000001, "text": " this total loss over your prediction and label matchings and the loss they"}, {"start": 888.92, "end": 895.8399999999999, "text": " come up with here yeah I said you have to give the algorithm a loss is this one"}, {"start": 895.8399999999999, "end": 902.4799999999999, "text": " and they kind of go into how they do it I don't think it's super important so"}, {"start": 902.4799999999999, "end": 907.8, "text": " the class algorithm sorry the the loss on the class labels I think it's going to"}, {"start": 907.8, "end": 914.28, "text": " be a softmax or a sorry a cross entropy loss like an usual classification and"}, {"start": 914.28, "end": 919.64, "text": " the loss on the to say whether two bounding boxes agree is a mixture of the L1"}, {"start": 919.64, "end": 926.92, "text": " loss that compares to bounding boxes and this IOU loss which is not dependent on"}, {"start": 926.92, "end": 931.28, "text": " the scale of the bounding boxes it kind of computes how much fraction of the"}, {"start": 931.28, "end": 936.68, "text": " two bounding boxes overlap but in any case the loss basically consists of"}, {"start": 936.68, "end": 941.24, "text": " saying how how how much do the labels agree and how much do the bounding"}, {"start": 941.24, "end": 946.44, "text": " boxes agree okay again this is only possible because after that you compute"}, {"start": 946.44, "end": 950.92, "text": " this matching otherwise you would have no clue which boxes to which predictions"}, {"start": 950.92, "end": 956.16, "text": " to compare to which other predictions so let's look at this architecture a bit"}, {"start": 956.16, "end": 961.32, "text": " more in detail as we said you have this what they call the backbone which is a"}, {"start": 961.32, "end": 967.72, "text": " convolutional neural network and with that you put in some positional encodings"}, {"start": 967.72, "end": 973.84, "text": " now already said the you you should look at the these features right here as"}, {"start": 973.84, "end": 980.08, "text": " just smaller feature versions of the image but they still have some image nature"}, {"start": 980.08, "end": 986.88, "text": " then they are flattened so once they are put in the transformer encoder because"}, {"start": 986.88, "end": 994.88, "text": " the transformer is naturally a sequence processing unit okay so it takes in just"}, {"start": 994.88, "end": 999.84, "text": " a sequence of vectors right here and since an image is not a sequence what you'll"}, {"start": 999.84, "end": 1005.08, "text": " do is if you have your image features and we said we have a bunch of channels"}, {"start": 1005.08, "end": 1010.12, "text": " let's say we have four channels and they're of height and width and C you're"}, {"start": 1010.12, "end": 1020.08, "text": " going to unroll and flatten that into one sequence so this is height times"}, {"start": 1020.08, "end": 1027.44, "text": " width you basically unroll across these axis right here into this axis and its"}, {"start": 1027.44, "end": 1037.3600000000001, "text": " channels eyes so basically you have a sequence here of of C"}, {"start": 1037.3600000000001, "end": 1043.32, "text": " dimensional feature vectors that you then put into your encoder okay so your"}, {"start": 1043.32, "end": 1049.44, "text": " encoder will now transform this sequence into an equally long sequence"}, {"start": 1049.44, "end": 1056.6000000000001, "text": " yet again of features and the good thing about a transformer because why do you"}, {"start": 1056.6000000000001, "end": 1060.96, "text": " use a transformer the good thing about the transformer is that in such a"}, {"start": 1060.96, "end": 1066.16, "text": " sequence and I've done videos on transformers it you can basically mainly look"}, {"start": 1066.16, "end": 1070.6000000000001, "text": " at the video attention is all you need if you want to understand this more"}, {"start": 1070.6000000000001, "end": 1078.96, "text": " fully this thing can basically have attention so it has attention layers it"}, {"start": 1078.96, "end": 1086.4, "text": " can attend from each position to each position in a one shot manner so as it"}, {"start": 1086.4, "end": 1092.4, "text": " transforms this representation up the transformer layers at each step it can"}, {"start": 1092.4, "end": 1096.52, "text": " basically aggregate information from everywhere in the sequence to earn"}, {"start": 1096.52, "end": 1103.1200000000001, "text": " anywhere else and therefore it's very it's very powerful if you have a"}, {"start": 1103.1200000000001, "end": 1108.3600000000001, "text": " sequence and you need sort of global connections across the sequence this is"}, {"start": 1108.36, "end": 1112.84, "text": " very good for language processing because in a sentence let's look at this"}, {"start": 1112.84, "end": 1120.12, "text": " sentence the input images are batched together right applying blah blah blah"}, {"start": 1120.12, "end": 1126.1599999999999, "text": " blah blah blah blah blah and then there is they right the word they and you"}, {"start": 1126.1599999999999, "end": 1132.84, "text": " need you need to know that they refers to the input images okay and but you see"}, {"start": 1132.84, "end": 1139.04, "text": " this is very very far away in the sentence so you need a model that makes use of"}, {"start": 1139.04, "end": 1143.6799999999998, "text": " long-range dependencies and they make the case that in such a task right here you"}, {"start": 1143.6799999999998, "end": 1148.28, "text": " also need the long-range dependencies because these bounding boxes as you see"}, {"start": 1148.28, "end": 1154.12, "text": " right here they can be quite large so if you have an image you need that this"}, {"start": 1154.12, "end": 1158.48, "text": " part here communicates with these and this and this and this and this part"}, {"start": 1158.48, "end": 1162.1999999999998, "text": " basically anywhere in the bounding box and these bounding boxes can be quite"}, {"start": 1162.2, "end": 1168.2, "text": " large so the transformer architecture actually makes sense here now I want to go"}, {"start": 1168.2, "end": 1172.48, "text": " a bit later into why I think it actually makes even more sense for a"}, {"start": 1172.48, "end": 1176.56, "text": " bounding box detection but right now I just want to keep going through this"}, {"start": 1176.56, "end": 1184.04, "text": " through this architecture right here so if my computer here decides to come"}, {"start": 1184.04, "end": 1192.04, "text": " back yes we can go on so what we'll get out is yet another so in here we put"}, {"start": 1192.04, "end": 1197.8, "text": " this thing we put down here we put into the transformer encoder and we get an"}, {"start": 1197.8, "end": 1203.3999999999999, "text": " equally sized equally shaped sequence out of the transformer encoder and you see"}, {"start": 1203.3999999999999, "end": 1209.44, "text": " that this thing here goes as a side input into this transformer decoder so the"}, {"start": 1209.44, "end": 1214.52, "text": " transformer encoder here is just a bit more of a feature mapping technically"}, {"start": 1214.52, "end": 1219.52, "text": " just for the architecture you could think of just putting this into here but of"}, {"start": 1219.52, "end": 1224.08, "text": " course it's gonna go better with the transformer encoder the transformer decoder"}, {"start": 1224.08, "end": 1230.72, "text": " now does something similar but you see it has the encoder as a side input this"}, {"start": 1230.72, "end": 1235.2, "text": " is very much like this is not like birth birth is like a only encoder"}, {"start": 1235.2, "end": 1241.0, "text": " transformer whereas this is much like the original attention is all you need"}, {"start": 1241.0, "end": 1246.48, "text": " transformer that has an encoder and then the decoder as a side input basically"}, {"start": 1246.48, "end": 1252.28, "text": " as conditioning information has the encoder output what does the decoder do"}, {"start": 1252.28, "end": 1256.32, "text": " again since it's a transformer it's going to take a sequence and output a"}, {"start": 1256.32, "end": 1262.52, "text": " sequence the sequence it takes is right here is what they call object queries and"}, {"start": 1262.52, "end": 1266.56, "text": " this also is different from the attention is all you need papers and they don't"}, {"start": 1266.56, "end": 1271.28, "text": " do it auto-regressively they just do it one shot what does it mean it means that"}, {"start": 1271.28, "end": 1276.92, "text": " you start with a sequence here of four things and these are these are the this"}, {"start": 1276.92, "end": 1285.48, "text": " is this big n and you output the sequence of a sequence of four things and it's"}, {"start": 1285.48, "end": 1289.24, "text": " important to see what they're gonna end up so these things are then directly"}, {"start": 1289.24, "end": 1296.68, "text": " going through a classifier that now outputs the so these things here are these"}, {"start": 1296.68, "end": 1304.48, "text": " class label bounding box outputs okay so each of these things is going to"}, {"start": 1304.48, "end": 1309.1200000000001, "text": " after transformation end up being one of these bounding boxes either defining an"}, {"start": 1309.1200000000001, "end": 1313.88, "text": " object or saying that there isn't an object somewhere okay you see here this"}, {"start": 1313.88, "end": 1318.64, "text": " bounding box refers to this bird this bounding box refers to this bird so each"}, {"start": 1318.64, "end": 1327.68, "text": " of these things is going to to be one bounding box and the what they call object"}, {"start": 1327.68, "end": 1332.64, "text": " queries is the question of course is what do you input here right I actually I"}, {"start": 1332.64, "end": 1336.0400000000002, "text": " want to transform this image information that comes from the left here I want"}, {"start": 1336.0400000000002, "end": 1341.3200000000002, "text": " to transform that into the bounding boxes what do I input here and the answer"}, {"start": 1341.3200000000002, "end": 1348.16, "text": " is you just input at the start you just input n random vectors because what's"}, {"start": 1348.16, "end": 1352.4, "text": " that gonna give you is basically an output you want an outputs because you want"}, {"start": 1352.4, "end": 1359.28, "text": " n of these bounding box classifications so you need n things and if I input"}, {"start": 1359.28, "end": 1363.8000000000002, "text": " n things into a transformer it's going to give me n things as an output and then"}, {"start": 1363.8000000000002, "end": 1367.4, "text": " in each step I can simply condition on the information that comes in the"}, {"start": 1367.4, "end": 1373.6000000000001, "text": " images and it it'll give me right then I can incorporate that information it's"}, {"start": 1373.6000000000001, "end": 1378.0800000000002, "text": " a very deep learning way of thinking about it actually that you just need the"}, {"start": 1378.08, "end": 1381.76, "text": " information somewhere in there and I need n things now they go more into"}, {"start": 1381.76, "end": 1388.4399999999998, "text": " detail into this transformer architecture help help in a helpful fashion in the"}, {"start": 1388.4399999999998, "end": 1396.6, "text": " appendix and we'll go there quickly so this I think here makes more sense so the"}, {"start": 1396.6, "end": 1401.48, "text": " image features come in here right and you see this is just a transformer stack"}, {"start": 1401.48, "end": 1409.32, "text": " an encoder stack of multi-head self-attention and feed forward instance-wise"}, {"start": 1409.32, "end": 1416.3600000000001, "text": " or like token-wise feed forward network and then that information is taken and"}, {"start": 1416.3600000000001, "end": 1422.72, "text": " is given as conditioning information over here now in here as I said you"}, {"start": 1422.72, "end": 1428.92, "text": " input this object queries which at the beginning are just n random vectors and"}, {"start": 1428.92, "end": 1434.2, "text": " what you're going to do you are also going to feature and code them and then you"}, {"start": 1434.2, "end": 1439.88, "text": " combine it with this image information so ultimately if you think of this one"}, {"start": 1439.88, "end": 1445.4, "text": " of these things one of these things is going to be a vector right and then that"}, {"start": 1445.4, "end": 1451.4, "text": " vector is going to be transformed and then it will have as it is transformed it"}, {"start": 1451.4, "end": 1457.2, "text": " will have the opportunity to basically look at features that come from here"}, {"start": 1457.2, "end": 1462.24, "text": " the arrow is in the wrong direction so you have already taken the image and"}, {"start": 1462.24, "end": 1467.3600000000001, "text": " you've transformed it into a feature representation which is also a vector"}, {"start": 1467.3600000000001, "end": 1472.6000000000001, "text": " right you have the features of the image right here now as you transform this"}, {"start": 1472.6000000000001, "end": 1479.72, "text": " vector this object query queue you have the opportunity to look at the image"}, {"start": 1479.72, "end": 1485.4, "text": " features right and that's how you get the image information in there so the"}, {"start": 1485.4, "end": 1491.44, "text": " image features will come in here transform that through attention so this is"}, {"start": 1491.44, "end": 1497.3200000000002, "text": " an attention mechanism on the image and then what you will output is a"}, {"start": 1497.3200000000002, "end": 1506.4, "text": " bounding box and a class label it's really hard to explain I would guess you"}, {"start": 1506.4, "end": 1509.6000000000001, "text": " need to understand really what attention mechanisms are and of course the"}, {"start": 1509.6000000000001, "end": 1513.68, "text": " crucial part of of course is what what's this what do you input at the"}, {"start": 1513.68, "end": 1518.16, "text": " beginning and these object queries aren't actually random as I said they are"}, {"start": 1518.16, "end": 1524.72, "text": " learned so what you're going to do is you're going to learn independent of the"}, {"start": 1524.72, "end": 1531.04, "text": " input image you're going to learn in different object queries and these object"}, {"start": 1531.04, "end": 1539.1200000000001, "text": " queries now it's very it's very interesting because these object queries are"}, {"start": 1539.12, "end": 1545.2399999999998, "text": " sort of going to be different it's like you have different people that can ask"}, {"start": 1545.2399999999998, "end": 1551.6, "text": " the input image different questions right and this they have so their N is"}, {"start": 1551.6, "end": 1560.2399999999998, "text": " 100 but they show 20 of these object queries that they learn and so they"}, {"start": 1560.2399999999998, "end": 1565.1999999999998, "text": " they have visualization of all bounding box predictions on all images so it's"}, {"start": 1565.2, "end": 1572.24, "text": " it's sort of like you have N different people at your disposal and you train"}, {"start": 1572.24, "end": 1577.0, "text": " these N different people to kind of ask different questions of the input"}, {"start": 1577.0, "end": 1583.16, "text": " image okay you say this person up here will always ask irrespective of what the"}, {"start": 1583.16, "end": 1587.72, "text": " input image is will always ask sort of hey input image what's what's on your"}, {"start": 1587.72, "end": 1592.32, "text": " bottom left right that's I'm really interested what's on your bottom left and"}, {"start": 1592.32, "end": 1596.9199999999998, "text": " sometimes I'm a bit interested in what's here but I'm mainly interested what's"}, {"start": 1596.9199999999998, "end": 1602.28, "text": " on the bottom left of the image whereas this person right here sorry this"}, {"start": 1602.28, "end": 1607.2, "text": " person right here is more interested in what's in the center now the different"}, {"start": 1607.2, "end": 1614.0, "text": " colors here is refer to different sizes of bounding boxes so this person is"}, {"start": 1614.0, "end": 1618.6, "text": " also interested so the person on the top left is interested mainly in I think"}, {"start": 1618.6, "end": 1623.84, "text": " small bounding boxes that are on the bottom left and the person here is"}, {"start": 1623.84, "end": 1629.04, "text": " mostly interested in what's I'm really interested what's in the center what's"}, {"start": 1629.04, "end": 1633.7199999999998, "text": " large in the center I won't give me large things that are in the center right and"}, {"start": 1633.7199999999998, "end": 1640.12, "text": " then this person right here is really interested on stuff that's on the"}, {"start": 1640.12, "end": 1645.7199999999998, "text": " right side of the image so you see in order to get different sort of a"}, {"start": 1645.72, "end": 1651.1200000000001, "text": " difference in bounding box predictions you train in different people to ask"}, {"start": 1651.1200000000001, "end": 1658.08, "text": " different questions of the of the input image and this asking of questions is"}, {"start": 1658.08, "end": 1665.92, "text": " exactly what an attention mechanism is so this person right here let's let's"}, {"start": 1665.92, "end": 1669.88, "text": " take this this person and I'm saying person these are vectors these are learned"}, {"start": 1669.88, "end": 1676.92, "text": " object queries but this person first they will simply ask the question what's"}, {"start": 1676.92, "end": 1685.68, "text": " on what's on the right side and then the the image features right the image"}, {"start": 1685.68, "end": 1691.96, "text": " features it will have an attention mechanism to this part of the image"}, {"start": 1691.96, "end": 1697.3200000000002, "text": " features and then it will get back some signal right and then it will transform"}, {"start": 1697.32, "end": 1703.24, "text": " that with its own signal up and then it will ask maybe again okay now that I"}, {"start": 1703.24, "end": 1707.96, "text": " know more because you see that person is interested in multiple things it's"}, {"start": 1707.96, "end": 1711.96, "text": " interesting those things and those things so at first it will focus on these"}, {"start": 1711.96, "end": 1717.36, "text": " things but then it says now I'm now I know more right there is there I know I"}, {"start": 1717.36, "end": 1721.96, "text": " see there is actually something on the right side so in the higher layers it"}, {"start": 1721.96, "end": 1726.6, "text": " can then go back and ask the image more questions by sending these queue"}, {"start": 1726.6, "end": 1732.6799999999998, "text": " vectors of the attention mechanism and it will get back the V vectors from the"}, {"start": 1732.6799999999998, "end": 1738.28, "text": " image features that correspond to these Q things so up and up the layers this"}, {"start": 1738.28, "end": 1743.36, "text": " person can ask more refined questions about what that particular person is"}, {"start": 1743.36, "end": 1748.32, "text": " interested in okay and since you have the different people here that ask"}, {"start": 1748.32, "end": 1754.76, "text": " different questions you basically learn the people in a way such that across the"}, {"start": 1754.76, "end": 1761.64, "text": " dataset they all together they cover every possible image pretty well again"}, {"start": 1761.64, "end": 1766.28, "text": " these people what they're interested in initially is not dependent on the"}, {"start": 1766.28, "end": 1770.8799999999999, "text": " picture you simply learn this in a global manner all right this is the best"}, {"start": 1770.8799999999999, "end": 1777.04, "text": " way I have of describing it it basically learn and people that are each one is"}, {"start": 1777.04, "end": 1781.96, "text": " interested in different things different classes and different regions in the"}, {"start": 1781.96, "end": 1789.28, "text": " image and each one of these people is going to output their best guess of what"}, {"start": 1789.28, "end": 1794.28, "text": " is where based on what they're interested in so that person might say I'm"}, {"start": 1794.28, "end": 1798.6000000000001, "text": " you know I'm the person that's interested kind of in the left side of things so"}, {"start": 1798.6000000000001, "end": 1804.1200000000001, "text": " I am going to output that there is a bird right here now these people if this is"}, {"start": 1804.1200000000001, "end": 1808.8, "text": " a transformer right and everything can attend to everything they can actually"}, {"start": 1808.8, "end": 1814.96, "text": " communicate with each other as they incorporate information from the image so"}, {"start": 1814.96, "end": 1819.24, "text": " in each layer they can do both they can incorporate information from the"}, {"start": 1819.24, "end": 1823.04, "text": " image and they can communicate with each other and then in the next layer they"}, {"start": 1823.04, "end": 1828.12, "text": " can do it again and again and again and thereby they can sort of they can sort of"}, {"start": 1828.12, "end": 1832.76, "text": " say well you already got the left side I will take the right side you already"}, {"start": 1832.76, "end": 1838.32, "text": " got the bird class I will take the elephant class and so on so you see here"}, {"start": 1838.32, "end": 1844.08, "text": " how the the architecture of the transformer actually is also very conducive to"}, {"start": 1844.08, "end": 1849.9199999999998, "text": " doing this bounding box prediction in that these different things can sort of"}, {"start": 1849.9199999999998, "end": 1855.72, "text": " attend to each other and therefore communicate with each other all right I"}, {"start": 1855.72, "end": 1860.84, "text": " hope that sort of makes sense now before we get into the experiments I want to"}, {"start": 1860.84, "end": 1866.6, "text": " list a third reason of why the transformer especially the encoders might"}, {"start": 1866.6, "end": 1873.52, "text": " actually also make a giant amount of sense here since you unroll the image into"}, {"start": 1873.52, "end": 1879.28, "text": " height and width and you have to imagine what does the transformer do the"}, {"start": 1879.28, "end": 1884.6799999999998, "text": " transformer as we said here has this notion of attention where from any point in"}, {"start": 1884.6799999999998, "end": 1889.08, "text": " the sequence it can gather information from any other point in the sequence and"}, {"start": 1889.08, "end": 1895.0, "text": " this that's usually one of the downsides of the transformers is done via a"}, {"start": 1895.0, "end": 1900.72, "text": " quadratic attention mechanism so if I just list one feature channel I'll go over"}, {"start": 1900.72, "end": 1907.56, "text": " here if I just list one feature channel right here this is height times width of"}, {"start": 1907.56, "end": 1913.36, "text": " the image right this is this is the entire image unrolled in one vector height"}, {"start": 1913.36, "end": 1921.96, "text": " times width and here I unroll it again height times width then this this matrix"}, {"start": 1921.96, "end": 1928.72, "text": " that I can build right here which is called the attention matrix right here it"}, {"start": 1928.72, "end": 1934.28, "text": " will tell me which parts of the sequence attend to which other parts okay so if"}, {"start": 1934.28, "end": 1940.08, "text": " you have an image that has the let's say the number three and you really want to"}, {"start": 1940.08, "end": 1945.28, "text": " figure out whether or not this is a three then the bow up here must communicate"}, {"start": 1945.28, "end": 1949.04, "text": " with the bow down here right they need to share information is it oh there's a"}, {"start": 1949.04, "end": 1953.6399999999999, "text": " bow here there's a bow here and there is a a spiky thing here that must be a"}, {"start": 1953.6399999999999, "end": 1958.0, "text": " three so you want something this is rather at the beginning of the sequence you"}, {"start": 1958.0, "end": 1962.8799999999999, "text": " want this to attend first of all it will attend itself so you get fairly high"}, {"start": 1962.8799999999999, "end": 1969.84, "text": " values along the diagonal maybe ten ten ten eleven eleven twelve I saw this"}, {"start": 1969.84, "end": 1978.08, "text": " oligee skit a hundred million nine nine but it also like this this part here at the"}, {"start": 1978.08, "end": 1981.28, "text": " beginning of the sequence let's say it's here because this is unrolled right"}, {"start": 1981.28, "end": 1986.8799999999999, "text": " needs to attend to the end so this needs to attend to the end which we will put"}, {"start": 1986.8799999999999, "end": 1991.72, "text": " an eleven here and the other way around doesn't always need to be symmetrical"}, {"start": 1991.72, "end": 1999.8, "text": " by the way okay but in any case this is going to be a h times w squared matrix"}, {"start": 1999.8, "end": 2004.1599999999999, "text": " because everything can attend to everything and that's the attention mechanism"}, {"start": 2004.1599999999999, "end": 2010.2, "text": " why do I think this is so good for bounding boxes because let's let's imagine"}, {"start": 2010.2, "end": 2015.72, "text": " you actually have a matrix that is like this okay high times with times high"}, {"start": 2015.72, "end": 2020.9199999999998, "text": " times with every single point in here actually defines a bounding box because"}, {"start": 2020.9199999999998, "end": 2027.96, "text": " this point this point right here in this dimension corresponds to one location"}, {"start": 2027.96, "end": 2033.04, "text": " in the image and on this axis it corresponds to another location now in the"}, {"start": 2033.04, "end": 2037.28, "text": " attention matrix simply means these two points need to communicate but if you"}, {"start": 2037.28, "end": 2042.68, "text": " have two pixels you actually have defined a bounding box right here right you"}, {"start": 2042.68, "end": 2049.52, "text": " you're actually you're defining a bounding box and the the fact that this is"}, {"start": 2049.52, "end": 2054.6, "text": " happening in the exact same matrices could mean that the transformers are"}, {"start": 2054.6, "end": 2059.64, "text": " uniquely well the transformers across sequences of these high times with"}, {"start": 2059.64, "end": 2066.7599999999998, "text": " unrolled images are uniquely well conducive to these bounding box prediction"}, {"start": 2066.7599999999998, "end": 2072.44, "text": " tasks and actually a bit astounded because when I first just read the title"}, {"start": 2072.44, "end": 2076.3199999999997, "text": " this immediately popped to my mind I'm like oh yes of course and they're going"}, {"start": 2076.3199999999997, "end": 2080.88, "text": " to predict the bounding boxes by simply training so what you would do what I"}, {"start": 2080.88, "end": 2085.84, "text": " thought this was going to be is out you output an actual matrix like this and then"}, {"start": 2085.84, "end": 2091.6400000000003, "text": " you simply each point you can you can simply classify right so you can"}, {"start": 2091.6400000000003, "end": 2098.04, "text": " classify here whether whether or not like at in this direction there is a bird"}, {"start": 2098.04, "end": 2104.32, "text": " right and then if you have two points like this for example you and you also"}, {"start": 2104.32, "end": 2107.6400000000003, "text": " classify whether in this direction there is a bird right and this naturally"}, {"start": 2107.64, "end": 2111.72, "text": " defines a bounding box or you could like take this matrix and actually just"}, {"start": 2111.72, "end": 2117.7999999999997, "text": " classify individual points in this matrix to be the bounding boxes because they"}, {"start": 2117.7999999999997, "end": 2124.08, "text": " already define bounding boxes so I just I think these these quadratic things are"}, {"start": 2124.08, "end": 2128.2799999999997, "text": " are uniquely I mean someone must have thought of this or if not cite the"}, {"start": 2128.2799999999997, "end": 2132.92, "text": " YouTube channel it would be funny first paper ever to actually have to cite"}, {"start": 2132.92, "end": 2140.2000000000003, "text": " the YouTube channel but again yeah so transformers seem to be a good idea for"}, {"start": 2140.2000000000003, "end": 2146.36, "text": " these kinds of things so how do they do of course they do well and they are on"}, {"start": 2146.36, "end": 2152.54, "text": " par with these other much much much more complex architectures these faster"}, {"start": 2152.54, "end": 2158.28, "text": " RCNN models they are apparently much more complex but they are on par with"}, {"start": 2158.28, "end": 2164.6000000000004, "text": " this they do however train forever I think they train for like six days on"}, {"start": 2164.6000000000004, "end": 2170.44, "text": " AGPUs is not that much if you compare to like language models on hundreds of"}, {"start": 2170.44, "end": 2177.0800000000004, "text": " TPUs but still okay I don't want to go into the numbers of experiments but what"}, {"start": 2177.0800000000004, "end": 2181.96, "text": " is pretty cool is that they can now visualize this sort of attention and you"}, {"start": 2181.96, "end": 2187.7200000000003, "text": " can see right here that if they look at a particular point in the image and"}, {"start": 2187.72, "end": 2193.16, "text": " visualize the attention it will actually attend to the instance itself so it"}, {"start": 2193.16, "end": 2197.08, "text": " will like these are usually the problems for these detection algorithms when"}, {"start": 2197.08, "end": 2201.72, "text": " things overlap and are partially occluded but you can see right here that"}, {"start": 2201.72, "end": 2206.52, "text": " the attention is on the part of the image that makes the instance in the back"}, {"start": 2206.52, "end": 2210.8399999999997, "text": " and the attention here is in the part of this and it doesn't sort of overlap"}, {"start": 2210.8399999999997, "end": 2216.68, "text": " into the others so that is one thing that's pretty impressive about these"}, {"start": 2216.68, "end": 2221.3999999999996, "text": " architectures the other thing they show is for example can generalize to many"}, {"start": 2221.3999999999996, "end": 2227.56, "text": " many instances so here it has never seen 24 giraffes in one image but yet it can"}, {"start": 2227.56, "end": 2236.44, "text": " absolutely do that and giraffe giraffe giraffe giraffe giraffe and the one of"}, {"start": 2236.44, "end": 2242.8399999999997, "text": " the coolest images I find are these here where you can see right here again"}, {"start": 2242.84, "end": 2250.04, "text": " attention visualization and you see that even within the bounding box of the"}, {"start": 2250.04, "end": 2257.88, "text": " front elephant here you see that the attention on this foot of the back"}, {"start": 2257.88, "end": 2265.4, "text": " elephant is assigned to this blue bounding box so this is the blue basically the"}, {"start": 2265.4, "end": 2271.88, "text": " blue bounding box person that is attending to that back foot that means they"}, {"start": 2271.88, "end": 2278.6, "text": " these things really sort of understand or they learn these things like occlusion"}, {"start": 2278.6, "end": 2286.12, "text": " and you know I just hard if I have a hard time describing it but you can see"}, {"start": 2286.12, "end": 2290.28, "text": " it visually here right like how it clearly learns that these are two instances"}, {"start": 2290.28, "end": 2295.4, "text": " that are sort of occluding each other but this this this instance can actually"}, {"start": 2295.4, "end": 2301.0, "text": " appear within the bounding box of the other instance and the same goes for the"}, {"start": 2301.0, "end": 2305.56, "text": " zebra here that are partially occluding each other and you can see that the"}, {"start": 2305.56, "end": 2311.88, "text": " attention is correctly like even here that this back foot of this zebra is"}, {"start": 2311.88, "end": 2320.28, "text": " correctly labeled so all in all that is pretty cool and they take it a step"}, {"start": 2320.28, "end": 2324.92, "text": " further and they say well with this architecture we can actually pretty easily"}, {"start": 2324.92, "end": 2333.32, "text": " do pixel wise classification so this is this cocoa stuff and things dataset where"}, {"start": 2333.32, "end": 2336.6800000000003, "text": " I don't know which one is the stuff and which one is the things I think things"}, {"start": 2336.6800000000003, "end": 2343.8, "text": " is the objects and stuff is like sky and mountains and so on and so this is a"}, {"start": 2343.8, "end": 2347.16, "text": " classification task where you actually have to label every single pixel so what"}, {"start": 2347.16, "end": 2352.6800000000003, "text": " they do is they simply input this through their detector and they detect the"}, {"start": 2352.68, "end": 2358.52, "text": " instances they take the attention maps of the instances and then they scale it"}, {"start": 2358.52, "end": 2364.2, "text": " up this right here is just a CNN sort of in reverse that scales up the image"}, {"start": 2364.2, "end": 2369.3199999999997, "text": " because they have scaled it down as we said they scale it up again"}, {"start": 2369.3199999999997, "end": 2376.9199999999996, "text": " and then they can simply classify each pixel where each of these remember we"}, {"start": 2376.9199999999996, "end": 2380.7599999999998, "text": " had these different people here that that cared about different things in the"}, {"start": 2380.76, "end": 2386.0400000000004, "text": " image each of these people will classify their respective pixels the pixels"}, {"start": 2386.0400000000004, "end": 2390.2000000000003, "text": " they feel responsible for and then you simply merge all of these people's"}, {"start": 2390.2000000000003, "end": 2396.44, "text": " predictions together into this prediction and again this gives pretty"}, {"start": 2396.44, "end": 2403.8, "text": " pretty impressive results I am I mean this is this is fun this looks like it"}, {"start": 2403.8, "end": 2409.0800000000004, "text": " sort of works I haven't they do quantitative analysis of course but I'm just"}, {"start": 2409.08, "end": 2416.04, "text": " impressed by the examples right here all right that was sort of it I really"}, {"start": 2416.04, "end": 2420.36, "text": " enjoyed reading this papers this simplicity is pretty cool they do have not"}, {"start": 2420.36, "end": 2425.72, "text": " only do they have code in the paper to show how ridiculously easy it is to get"}, {"start": 2425.72, "end": 2431.24, "text": " this to run this is all you need in PyTorch but they do actually have code"}, {"start": 2431.24, "end": 2436.2799999999997, "text": " and as I understand they also have pre-trained models so they have this model"}, {"start": 2436.28, "end": 2441.0, "text": " zoo right here where they give you the pre-trained models so you can play"}, {"start": 2441.0, "end": 2444.0400000000004, "text": " with it and you can even load it from Torch Hub"}, {"start": 2444.0400000000004, "end": 2448.76, "text": " yourself and you can train it yourself they have a colab all is there"}, {"start": 2448.76, "end": 2453.4, "text": " all right again if you enjoyed this video consider leaving a like"}, {"start": 2453.4, "end": 2468.28, "text": " subscribing and I'll see you next time bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=a-VQfQqIMrE | mixup: Beyond Empirical Risk Minimization (Paper Explained) | Neural Networks often draw hard boundaries in high-dimensional space, which makes them very brittle. Mixup is a technique that linearly interpolates between data and labels at training time and achieves much smoother and more regular class boundaries.
OUTLINE:
0:00 - Intro
0:30 - The problem with ERM
2:50 - Mixup
6:40 - Code
9:35 - Results
https://arxiv.org/abs/1710.09412
Abstract:
Large deep neural networks are powerful, but exhibit undesirable behaviors such as memorization and sensitivity to adversarial examples. In this work, we propose mixup, a simple learning principle to alleviate these issues. In essence, mixup trains a neural network on convex combinations of pairs of examples and their labels. By doing so, mixup regularizes the neural network to favor simple linear behavior in-between training examples. Our experiments on the ImageNet-2012, CIFAR-10, CIFAR-100, Google commands and UCI datasets show that mixup improves the generalization of state-of-the-art neural network architectures. We also find that mixup reduces the memorization of corrupt labels, increases the robustness to adversarial examples, and stabilizes the training of generative adversarial networks.
Authors: Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz
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'll look at mix up beyond empirical risk minimization by Hongyi Changmushstaffa Sis, Yan, and Do Fan and David Lopez pass. So this paper is actually pretty simple, but it introduces a technique that apparently helps with training classifiers and I have it seen it used in practice. So there must be at least something to it. It is ultimately very simple. So usually you input a data point x into your neural network in deep learning. So f of x that's your neural network, neural network has parameters theta. You get some output y hat and along with the x you also have a y at true label. And then you have a loss function that compares what you output with your true label. And then you just try to make that loss smaller. You want to adjust your parameters. So next time you see data point x its output will be a little closer to the true label y. And we call this empirical risk minimization. Because you don't actually what you think is that your x comes from some distribution, from some data distribution d like the space of all natural images or the space of all of language. But what you actually have is you have a data set of finite amount of data that you can put a that you can sample x and y from. And so instead of you're minimizing your true risk, you minimize your empirical risk. The empirical miscarinimization right here. Now what's the problem with that? The problem is that you can get overly confident about your data points and nothing else. And that will hurt your generalization. So if you have a data point, let's say right here and another one right here, your network is basically, so this is a this is class one, this is class two. Your network is going to maybe make decision boundaries like this and like this where it says, okay, here is class one and here is class two. But it could, you know, it's very conceivable that here it says, here is class four and over here is class seven. And right here through is class nine. And by the way, here class four again. So the empirical risk minimization leaves everything in between the data points open. Now what this paper proposes is that we should not only train our classifier on these data points, but on all the data points sort of in between the two. And this is the mix up data points. So this data point here might be constructed if this is a and this is b from 0.1 times b, right? And plus 0.9 times a because it's mostly a it's a little bit b. And now you think what are the labels here if a belongs to class one and b belongs to class two. And of course, the label of this data point is 0.1 times the class of b, which is two plus 0.9 times the class of a, which is one. Ultimately, because what you do is you input a class like class number two. If you want to input this into a machine learning model, you just, you don't say it's class number two. What you input is a distribution that is basically has zeros everywhere. So these small things, they're zero, zero, zero, one, zero. And this here is at class number two. So this would be class number one, class number two, class number three, right? You input a distribution like this if you want to express class number two. Now in our sample right here, what we would input as a label is simply a mix between class one. So 0.9, 0.9 of class one, 0.1 of class two, and then zero everywhere else. So this would be our label for the data point that we construct right here. This would be our, sorry, the top one would be our data point. Formerly you take two data points and you mix them using this lambda mixing factor. That'll give you a new data point that's in between the other data points. And you take the two corresponding labels and you mix them accordingly as well. And that will give you the label for that data point. And now your model will learn to basically smoothly interpolate. So you will teach your model. The thing on the left here is class number one, right? That's class number one. The thing on the right is class number two. This here is half of class one and a half of class two. So the model basically learns a smooth interpolation where the situation that's here on top is probably not going to happen anymore. But what it would do is it would sort of create these ISO lines around class two and then around class one where it's sort of smoothly getting less and less sure about the class of the data points. But on the way it is always either class one or class two. And they say that can help the generalization performance. And it's visible a while, right? It's just the only thing that's not clear from the beginning is that this kind of interpolation actually makes sense. Because if this means we sort of linearly interpolate between two images. So if we have two images, we just take half of one and half of the other. And that will be not a natural image. It will be kind of a blurry thing, otherwise, you know, all our problems would be solved. We could just linearly classify things. But in any case, in practice, it actually seems to help probably because interpolations of two images, linear interpolations are still much more like something like an actual image than any random noise you could come up with. So they say this in code right here code is pretty simple. Simply want to mix the two things. And the mixing factor, this lambda here, comes from a beta distribution. And they use a beta, I believe, of 0.4 or something. Just want to quickly show you this is the red line here. So the red line, as you can see, mostly, most of the time, they're going to either sample the thing on the very left or the thing on the very right. That means they either sample the first or the second data point. But some of the time, they actually sample something in the middle. And it's fairly uniform in the middle. So it appears like a good distribution to sample from if you want to sample these mixing coefficients. And by adjusting the actual number of alpha and beta here, you can determine how many times you sample the original data points versus how many times you sample something in the middle. OK, on this toy dataset right here, they showcase what mixup can do. So in a classic model, you have the orange and the green data points. And blue is basically where the classifier believes it's class one. You see this very hard border here. It's quite a hard border. Now you only have two classes here. And so the hard border is sort of a problem in itself. Because if you think of, for example, adversarial examples, all they have to do is basically get over that one inch and the classifier is already super duper sure it's the orange class. Right. Whereas if you mix up your border is much, much, much more fuzzy. It's like, yeah, it's only really sure here and out, out here everywhere. But in the middle, it's sort of like, I don't know. And so that's kind of a more desirable situation. Now, of course, this here works particularly in this linear 2D setting. But as we can see, the same reasoning applies to sort of higher, higher layers and higher dimensionality data points. Right. I have seemed to lost the ability to zoom. Oh no, it's back. Okay. And that's basically it for this paper. This is all they do. They propose this method and then they test it. They say something interesting here that mix up converges to the classical method as alpha approaches zero. So that would push your beta distribution basically in the middle all the way down. And you would only sample from the very left or the very right. So you can smoothly interpolate between this mixing and the classic method. So their main results are we apply this to classifiers. And what I like is, since again, is also a classifier. So the discriminator is a classifier. They also apply it to GANS and they outperform and stabilize the classic training on GANS. They show that it's more robust towards adversarial attacks because it's not so sure about intermediate things. And they generally outperform other methods. But also they do this nice investigation here where they measure the prediction error of in between data. And what it means is they say a prediction is counted as a miss if it does not belong to YI or YJ. So you have a sample right here XI and a sample right here XJ. And you look at what the classifier says in between the two data points. So you just interpolate the two data points and just measure what the classifier says. And whenever the classifier either says YI or YJ, either either label of those two data points, you count it as correct. And you only count it as incorrect if it says something else. And you can see here if you train with the classic method ERM, these errors happen much more often. That's exactly the situation I pointed out at the beginning where in the high dimensions it can occur that all sorts of decision boundaries sneak here in between the two data points. And by interpolating between them during training, you sort of much reduce that you reduce that effect a lot. Now, they also say that the gradient norm of the gradients of the model with respect to input in between training data happens the same thing. The norm of the gradients in the middle is also much, much lower. And this, yeah, this investigation I find pretty cool. I have to say I have seen mix up in practice. So it might be useful. I've read a paper where they basically say, oh, it was a big transfer paper. Yeah, where they basically say it is useful if you have, for example, if you have little data and the big model, so you can sort of regularize the model and is also useful to know that they did test this with dropout. So they compared it with dropout. And the conclusion is basically that this is something else than dropout. So it's not doing the same thing. Dropout, of course, it means you drop out some of the data points in intermediate activations and that sort of gives you a noisy version of the data point. This here can actually be combined with dropout, which means that it gives you an additional benefit. You see right here, most of the best numbers happen when you use mix up plus dropout. So it seems to be just an additional regularization on top of dropout. Pretty cool, pretty cool investigation also. Alright, so if you like this, I invite you to read the paper. If you liked the video, please subscribe and like and comment. And yeah, have a nice day. Bye-bye. | [{"start": 0.0, "end": 7.54, "text": " Hi there, today we'll look at mix up beyond empirical risk minimization by Hongyi Changmushstaffa"}, {"start": 7.54, "end": 12.96, "text": " Sis, Yan, and Do Fan and David Lopez pass."}, {"start": 12.96, "end": 19.76, "text": " So this paper is actually pretty simple, but it introduces a technique that apparently"}, {"start": 19.76, "end": 26.52, "text": " helps with training classifiers and I have it seen it used in practice."}, {"start": 26.52, "end": 30.08, "text": " So there must be at least something to it."}, {"start": 30.08, "end": 32.8, "text": " It is ultimately very simple."}, {"start": 32.8, "end": 41.08, "text": " So usually you input a data point x into your neural network in deep learning."}, {"start": 41.08, "end": 48.480000000000004, "text": " So f of x that's your neural network, neural network has parameters theta."}, {"start": 48.480000000000004, "end": 56.28, "text": " You get some output y hat and along with the x you also have a y at true label."}, {"start": 56.28, "end": 62.64, "text": " And then you have a loss function that compares what you output with your true label."}, {"start": 62.64, "end": 65.24000000000001, "text": " And then you just try to make that loss smaller."}, {"start": 65.24000000000001, "end": 67.8, "text": " You want to adjust your parameters."}, {"start": 67.8, "end": 75.92, "text": " So next time you see data point x its output will be a little closer to the true label y."}, {"start": 75.92, "end": 82.4, "text": " And we call this empirical risk minimization."}, {"start": 82.4, "end": 88.28, "text": " Because you don't actually what you think is that your x comes from some distribution,"}, {"start": 88.28, "end": 93.56, "text": " from some data distribution d like the space of all natural images or the space of all"}, {"start": 93.56, "end": 94.56, "text": " of language."}, {"start": 94.56, "end": 100.36000000000001, "text": " But what you actually have is you have a data set of finite amount of data that you can"}, {"start": 100.36000000000001, "end": 103.76, "text": " put a that you can sample x and y from."}, {"start": 103.76, "end": 112.08000000000001, "text": " And so instead of you're minimizing your true risk, you minimize your empirical risk."}, {"start": 112.08, "end": 117.16, "text": " The empirical miscarinimization right here."}, {"start": 117.16, "end": 118.72, "text": " Now what's the problem with that?"}, {"start": 118.72, "end": 124.24, "text": " The problem is that you can get overly confident about your data points and nothing else."}, {"start": 124.24, "end": 126.28, "text": " And that will hurt your generalization."}, {"start": 126.28, "end": 133.4, "text": " So if you have a data point, let's say right here and another one right here, your network"}, {"start": 133.4, "end": 137.8, "text": " is basically, so this is a this is class one, this is class two."}, {"start": 137.8, "end": 143.32000000000002, "text": " Your network is going to maybe make decision boundaries like this and like this where it"}, {"start": 143.32000000000002, "end": 146.88000000000002, "text": " says, okay, here is class one and here is class two."}, {"start": 146.88000000000002, "end": 153.68, "text": " But it could, you know, it's very conceivable that here it says, here is class four and"}, {"start": 153.68, "end": 156.0, "text": " over here is class seven."}, {"start": 156.0, "end": 159.12, "text": " And right here through is class nine."}, {"start": 159.12, "end": 162.8, "text": " And by the way, here class four again."}, {"start": 162.8, "end": 171.8, "text": " So the empirical risk minimization leaves everything in between the data points open."}, {"start": 171.8, "end": 179.56, "text": " Now what this paper proposes is that we should not only train our classifier on these data"}, {"start": 179.56, "end": 187.24, "text": " points, but on all the data points sort of in between the two."}, {"start": 187.24, "end": 190.92000000000002, "text": " And this is the mix up data points."}, {"start": 190.92, "end": 201.23999999999998, "text": " So this data point here might be constructed if this is a and this is b from 0.1 times"}, {"start": 201.23999999999998, "end": 202.83999999999997, "text": " b, right?"}, {"start": 202.83999999999997, "end": 209.27999999999997, "text": " And plus 0.9 times a because it's mostly a it's a little bit b."}, {"start": 209.27999999999997, "end": 213.6, "text": " And now you think what are the labels here if a belongs to class one and b belongs to"}, {"start": 213.6, "end": 215.32, "text": " class two."}, {"start": 215.32, "end": 222.88, "text": " And of course, the label of this data point is 0.1 times the class of b, which is two plus"}, {"start": 222.88, "end": 228.07999999999998, "text": " 0.9 times the class of a, which is one."}, {"start": 228.07999999999998, "end": 233.2, "text": " Ultimately, because what you do is you input a class like class number two."}, {"start": 233.2, "end": 237.44, "text": " If you want to input this into a machine learning model, you just, you don't say it's class"}, {"start": 237.44, "end": 238.44, "text": " number two."}, {"start": 238.44, "end": 245.24, "text": " What you input is a distribution that is basically has zeros everywhere."}, {"start": 245.24, "end": 250.36, "text": " So these small things, they're zero, zero, zero, one, zero."}, {"start": 250.36, "end": 252.32000000000002, "text": " And this here is at class number two."}, {"start": 252.32000000000002, "end": 255.60000000000002, "text": " So this would be class number one, class number two, class number three, right?"}, {"start": 255.60000000000002, "end": 261.64, "text": " You input a distribution like this if you want to express class number two."}, {"start": 261.64, "end": 267.44, "text": " Now in our sample right here, what we would input as a label is simply a mix between class"}, {"start": 267.44, "end": 269.52, "text": " one."}, {"start": 269.52, "end": 279.0, "text": " So 0.9, 0.9 of class one, 0.1 of class two, and then zero everywhere else."}, {"start": 279.0, "end": 284.35999999999996, "text": " So this would be our label for the data point that we construct right here."}, {"start": 284.35999999999996, "end": 288.44, "text": " This would be our, sorry, the top one would be our data point."}, {"start": 288.44, "end": 296.68, "text": " Formerly you take two data points and you mix them using this lambda mixing factor."}, {"start": 296.68, "end": 301.08, "text": " That'll give you a new data point that's in between the other data points."}, {"start": 301.08, "end": 304.88, "text": " And you take the two corresponding labels and you mix them accordingly as well."}, {"start": 304.88, "end": 308.04, "text": " And that will give you the label for that data point."}, {"start": 308.04, "end": 313.84000000000003, "text": " And now your model will learn to basically smoothly interpolate."}, {"start": 313.84000000000003, "end": 315.44, "text": " So you will teach your model."}, {"start": 315.44, "end": 319.24, "text": " The thing on the left here is class number one, right?"}, {"start": 319.24, "end": 320.56, "text": " That's class number one."}, {"start": 320.56, "end": 323.04, "text": " The thing on the right is class number two."}, {"start": 323.04, "end": 329.44, "text": " This here is half of class one and a half of class two."}, {"start": 329.44, "end": 335.40000000000003, "text": " So the model basically learns a smooth interpolation where the situation that's here on top is probably"}, {"start": 335.40000000000003, "end": 337.08000000000004, "text": " not going to happen anymore."}, {"start": 337.08000000000004, "end": 343.92, "text": " But what it would do is it would sort of create these ISO lines around class two and then"}, {"start": 343.92, "end": 349.72, "text": " around class one where it's sort of smoothly getting less and less sure about the class of"}, {"start": 349.72, "end": 350.96000000000004, "text": " the data points."}, {"start": 350.96, "end": 354.52, "text": " But on the way it is always either class one or class two."}, {"start": 354.52, "end": 357.23999999999995, "text": " And they say that can help the generalization performance."}, {"start": 357.23999999999995, "end": 359.4, "text": " And it's visible a while, right?"}, {"start": 359.4, "end": 366.4, "text": " It's just the only thing that's not clear from the beginning is that this kind of interpolation"}, {"start": 366.4, "end": 367.67999999999995, "text": " actually makes sense."}, {"start": 367.67999999999995, "end": 372.44, "text": " Because if this means we sort of linearly interpolate between two images."}, {"start": 372.44, "end": 375.59999999999997, "text": " So if we have two images, we just take half of one and half of the other."}, {"start": 375.59999999999997, "end": 377.71999999999997, "text": " And that will be not a natural image."}, {"start": 377.72, "end": 382.56, "text": " It will be kind of a blurry thing, otherwise, you know, all our problems would be solved."}, {"start": 382.56, "end": 385.72, "text": " We could just linearly classify things."}, {"start": 385.72, "end": 391.12, "text": " But in any case, in practice, it actually seems to help probably because interpolations"}, {"start": 391.12, "end": 397.04, "text": " of two images, linear interpolations are still much more like something like an actual"}, {"start": 397.04, "end": 403.36, "text": " image than any random noise you could come up with."}, {"start": 403.36, "end": 407.92, "text": " So they say this in code right here code is pretty simple."}, {"start": 407.92, "end": 410.6, "text": " Simply want to mix the two things."}, {"start": 410.6, "end": 415.0, "text": " And the mixing factor, this lambda here, comes from a beta distribution."}, {"start": 415.0, "end": 419.28000000000003, "text": " And they use a beta, I believe, of 0.4 or something."}, {"start": 419.28000000000003, "end": 422.52000000000004, "text": " Just want to quickly show you this is the red line here."}, {"start": 422.52000000000004, "end": 429.52000000000004, "text": " So the red line, as you can see, mostly, most of the time, they're going to either sample"}, {"start": 429.52, "end": 433.91999999999996, "text": " the thing on the very left or the thing on the very right."}, {"start": 433.91999999999996, "end": 438.15999999999997, "text": " That means they either sample the first or the second data point."}, {"start": 438.15999999999997, "end": 442.08, "text": " But some of the time, they actually sample something in the middle."}, {"start": 442.08, "end": 445.71999999999997, "text": " And it's fairly uniform in the middle."}, {"start": 445.71999999999997, "end": 450.52, "text": " So it appears like a good distribution to sample from if you want to sample these mixing"}, {"start": 450.52, "end": 451.79999999999995, "text": " coefficients."}, {"start": 451.79999999999995, "end": 458.28, "text": " And by adjusting the actual number of alpha and beta here, you can determine how many times"}, {"start": 458.28, "end": 462.35999999999996, "text": " you sample the original data points versus how many times you sample something in the"}, {"start": 462.35999999999996, "end": 464.35999999999996, "text": " middle."}, {"start": 464.35999999999996, "end": 472.03999999999996, "text": " OK, on this toy dataset right here, they showcase what mixup can do."}, {"start": 472.03999999999996, "end": 476.35999999999996, "text": " So in a classic model, you have the orange and the green data points."}, {"start": 476.35999999999996, "end": 479.76, "text": " And blue is basically where the classifier believes it's class one."}, {"start": 479.76, "end": 482.2, "text": " You see this very hard border here."}, {"start": 482.2, "end": 484.52, "text": " It's quite a hard border."}, {"start": 484.52, "end": 486.84, "text": " Now you only have two classes here."}, {"start": 486.84, "end": 491.79999999999995, "text": " And so the hard border is sort of a problem in itself."}, {"start": 491.79999999999995, "end": 496.4, "text": " Because if you think of, for example, adversarial examples, all they have to do is basically get"}, {"start": 496.4, "end": 505.0, "text": " over that one inch and the classifier is already super duper sure it's the orange class."}, {"start": 505.0, "end": 506.0, "text": " Right."}, {"start": 506.0, "end": 510.03999999999996, "text": " Whereas if you mix up your border is much, much, much more fuzzy."}, {"start": 510.03999999999996, "end": 516.3199999999999, "text": " It's like, yeah, it's only really sure here and out, out here everywhere."}, {"start": 516.32, "end": 520.12, "text": " But in the middle, it's sort of like, I don't know."}, {"start": 520.12, "end": 523.88, "text": " And so that's kind of a more desirable situation."}, {"start": 523.88, "end": 530.0, "text": " Now, of course, this here works particularly in this linear 2D setting."}, {"start": 530.0, "end": 537.5600000000001, "text": " But as we can see, the same reasoning applies to sort of higher, higher layers and higher"}, {"start": 537.5600000000001, "end": 539.5600000000001, "text": " dimensionality data points."}, {"start": 539.5600000000001, "end": 540.5600000000001, "text": " Right."}, {"start": 540.5600000000001, "end": 542.9200000000001, "text": " I have seemed to lost the ability to zoom."}, {"start": 542.9200000000001, "end": 544.96, "text": " Oh no, it's back."}, {"start": 544.96, "end": 547.0, "text": " Okay."}, {"start": 547.0, "end": 549.2, "text": " And that's basically it for this paper."}, {"start": 549.2, "end": 550.2, "text": " This is all they do."}, {"start": 550.2, "end": 554.96, "text": " They propose this method and then they test it."}, {"start": 554.96, "end": 559.8000000000001, "text": " They say something interesting here that mix up converges to the classical method as alpha"}, {"start": 559.8000000000001, "end": 560.8000000000001, "text": " approaches zero."}, {"start": 560.8000000000001, "end": 565.96, "text": " So that would push your beta distribution basically in the middle all the way down."}, {"start": 565.96, "end": 570.76, "text": " And you would only sample from the very left or the very right."}, {"start": 570.76, "end": 579.12, "text": " So you can smoothly interpolate between this mixing and the classic method."}, {"start": 579.12, "end": 584.48, "text": " So their main results are we apply this to classifiers."}, {"start": 584.48, "end": 588.28, "text": " And what I like is, since again, is also a classifier."}, {"start": 588.28, "end": 589.84, "text": " So the discriminator is a classifier."}, {"start": 589.84, "end": 595.76, "text": " They also apply it to GANS and they outperform and stabilize the classic training on GANS."}, {"start": 595.76, "end": 603.4399999999999, "text": " They show that it's more robust towards adversarial attacks because it's not so sure about intermediate"}, {"start": 603.4399999999999, "end": 604.92, "text": " things."}, {"start": 604.92, "end": 608.64, "text": " And they generally outperform other methods."}, {"start": 608.64, "end": 615.12, "text": " But also they do this nice investigation here where they measure the prediction error"}, {"start": 615.12, "end": 617.68, "text": " of in between data."}, {"start": 617.68, "end": 622.2, "text": " And what it means is they say a prediction is counted as a miss if it does not belong"}, {"start": 622.2, "end": 625.08, "text": " to YI or YJ."}, {"start": 625.08, "end": 630.4000000000001, "text": " So you have a sample right here XI and a sample right here XJ."}, {"start": 630.4000000000001, "end": 635.2800000000001, "text": " And you look at what the classifier says in between the two data points."}, {"start": 635.2800000000001, "end": 640.2800000000001, "text": " So you just interpolate the two data points and just measure what the classifier says."}, {"start": 640.2800000000001, "end": 646.72, "text": " And whenever the classifier either says YI or YJ, either either label of those two data"}, {"start": 646.72, "end": 648.88, "text": " points, you count it as correct."}, {"start": 648.88, "end": 652.8000000000001, "text": " And you only count it as incorrect if it says something else."}, {"start": 652.8, "end": 659.56, "text": " And you can see here if you train with the classic method ERM, these errors happen much"}, {"start": 659.56, "end": 660.56, "text": " more often."}, {"start": 660.56, "end": 665.28, "text": " That's exactly the situation I pointed out at the beginning where in the high dimensions"}, {"start": 665.28, "end": 672.24, "text": " it can occur that all sorts of decision boundaries sneak here in between the two data points."}, {"start": 672.24, "end": 681.8399999999999, "text": " And by interpolating between them during training, you sort of much reduce that you reduce"}, {"start": 681.84, "end": 685.08, "text": " that effect a lot."}, {"start": 685.08, "end": 693.1600000000001, "text": " Now, they also say that the gradient norm of the gradients of the model with respect to"}, {"start": 693.1600000000001, "end": 696.84, "text": " input in between training data happens the same thing."}, {"start": 696.84, "end": 703.12, "text": " The norm of the gradients in the middle is also much, much lower."}, {"start": 703.12, "end": 705.6800000000001, "text": " And this, yeah, this investigation I find pretty cool."}, {"start": 705.6800000000001, "end": 709.08, "text": " I have to say I have seen mix up in practice."}, {"start": 709.08, "end": 711.08, "text": " So it might be useful."}, {"start": 711.08, "end": 716.6, "text": " I've read a paper where they basically say, oh, it was a big transfer paper."}, {"start": 716.6, "end": 720.64, "text": " Yeah, where they basically say it is useful if you have, for example, if you have little"}, {"start": 720.64, "end": 725.6, "text": " data and the big model, so you can sort of regularize the model and is also useful to know"}, {"start": 725.6, "end": 728.6, "text": " that they did test this with dropout."}, {"start": 728.6, "end": 730.8000000000001, "text": " So they compared it with dropout."}, {"start": 730.8000000000001, "end": 734.5200000000001, "text": " And the conclusion is basically that this is something else than dropout."}, {"start": 734.5200000000001, "end": 736.32, "text": " So it's not doing the same thing."}, {"start": 736.32, "end": 743.6800000000001, "text": " Dropout, of course, it means you drop out some of the data points in intermediate activations"}, {"start": 743.6800000000001, "end": 748.0400000000001, "text": " and that sort of gives you a noisy version of the data point."}, {"start": 748.0400000000001, "end": 753.6400000000001, "text": " This here can actually be combined with dropout, which means that it gives you an additional"}, {"start": 753.6400000000001, "end": 754.6400000000001, "text": " benefit."}, {"start": 754.6400000000001, "end": 760.6800000000001, "text": " You see right here, most of the best numbers happen when you use mix up plus dropout."}, {"start": 760.68, "end": 766.9599999999999, "text": " So it seems to be just an additional regularization on top of dropout."}, {"start": 766.9599999999999, "end": 769.52, "text": " Pretty cool, pretty cool investigation also."}, {"start": 769.52, "end": 774.04, "text": " Alright, so if you like this, I invite you to read the paper."}, {"start": 774.04, "end": 778.76, "text": " If you liked the video, please subscribe and like and comment."}, {"start": 778.76, "end": 780.8, "text": " And yeah, have a nice day."}, {"start": 780.8, "end": 790.8, "text": " Bye-bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=l5he9JNJqHA | A critical analysis of self-supervision, or what we can learn from a single image (Paper Explained) | Does self-supervision really need a lot of data? How low can you go? This paper shows that a single image is enough to learn the lower layers of a deep neural network. Interestingly, more data does not appear to help as long as enough data augmentation is applied.
OUTLINE:
0:00 - Overview
1:40 - What is self-supervision
4:20 - What does this paper do
7:00 - Linear probes
11:15 - Linear probe results
17:10 - Results
22:25 - Learned Features
https://arxiv.org/abs/1904.13132
Abstract:
We look critically at popular self-supervision techniques for learning deep convolutional neural networks without manual labels. We show that three different and representative methods, BiGAN, RotNet and DeepCluster, can learn the first few layers of a convolutional network from a single image as well as using millions of images and manual labels, provided that strong data augmentation is used. However, for deeper layers the gap with manual supervision cannot be closed even if millions of unlabelled images are used for training. We conclude that: (1) the weights of the early layers of deep networks contain limited information about the statistics of natural images, that (2) such low-level statistics can be learned through self-supervision just as well as through strong supervision, and that (3) the low-level statistics can be captured via synthetic transformations instead of using a large image dataset.
Authors: Yuki M. Asano, Christian Rupprecht, Andrea Vedaldi
Thumbnail Image: https://commons.wikimedia.org/wiki/File:Golden_Gate_Bridge_during_blue_hour_(16_x_10).jpg
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 | All right, today we'll look at a critical analysis of self-supervision or what we can learn from a single image by Yuki M. Asano, Christian Ruprecht and Andrea Vidaldi. This paper I really was excited when I saw this paper because the outset is so cool and the experiments have a very promising. So we'll take a look. Basically we show that three different and representative methods by GAN, Rotnet and Deep Cluster, so this is self-supervision techniques, can learn the first few layers of a convolutional network from a single image as well as using millions of images and manual labels, provided that strong data augmentation is used. However, for deeper layers, the gap with manual supervision cannot be closed, even if millions of unlabeled images are used for training. We conclude that first, the weights of the early layers of deep networks contain limited information about the statistics of natural images, that second, such low-level statistics can be learned through self-supervision, just as well as through strong supervision, and at three, the low-level statistics can be captured via synthetic transformations instead of using large image data set. So, as I said, I was kind of excited when I saw this and what they're talking about is self-supervision. So, really quickly, for those who don't know self-supervision is a technique where if you have images but no labels and you would still like to learn something from them, you can do a pre-training step for your network. So basically, you have your neural network, F, and what you would like to do is you would like F of X to be close to Y for X and Y to your training data set. But you can, if you have a much larger data set of just X's, right, here you have pairs of X and Y, of just X, that are sort of similar to the X in your label data set. You can kind of get your network used to the data by doing the self-supervision. So what you would do is you would sort of come up with your own labels for the data points. And one way is this, we'll take just this rot net as an example. So what you'll do is you'll input an image. So maybe an image of the number three in handwritten digit recognition, but you'll flip it, you'll flip it to its side, right? So it's the number three right here. And then you ask the network to come up with an answer, is it upright? Is it flipped to the right? Is it flipped to the left? Or is it turned on its head? Which one is it? And of course, you, who did the transformation know the correct label, right? So this is how you come up with sort of fake labels for your data. And this works surprisingly well. And what this paper basically says is that you do not actually need this giant database here. It's actually sufficient. Sometimes if you have one single image, where you do this on. Now the claim is a bit of a cheat, I have to say, but we'll go into that. And further they say, okay, it's enough to have one single image is to learn the features of the lower layers of the neural network, because they usually tend to extract low level features that you can learn from a single image, but the higher level features, you really need the supervised data set. It's not enough to have these self supervision techniques. And even if you have many, many, many self supervision samples, so if you actually do have this giant data set, it still doesn't help you for the higher layers. Just causing to question this, you have a giant data set of unlabeled things. A notion that is often presented, including by me. Okay, so what do they do? They do, they take either single images or just very few images. So they also have a setting where they take 10 images. For the single image, they hand select it. So they hand select the following three images. So this image right here, they select because it's very crowded. There's a lot going on, right? There's people, there's objects, there's lighting, and so on. There's houses, these lines, there's perspective. So that's why they select image A. Image B here, they also experiment with image B, is a drawn image. As you can see, there's also lots of stuff going on, but they basically want to research how does a natural image compare to a artificial image. And then in C, they have this as sort of a control because there's lots of parts here where there's not much going on compared to here. And most of the image, there's lots of stuff going on. And this image on the image number C, letter C, has large areas where there's nothing going on. OK, so these are the single images. Now, why I say it's a bit of a cheat is that these images are actually super large. They, so for ImageNet and for C410, they, you know, this might be one of the samples of the C410 or ImageNet classifier. Now, of course, C410 is a lot smaller than ImageNet, but still for ImageNet, these are, you know, there are many pictures here, not just one. So to say this is from a single image, it's technically true, but then if you split it into multiple images, it's technically not true. So it would have been fun to see what actually happens with a single image when you downscale it. But OK, so how do they investigate this? They have this five layer neural network right here. So this five convolutional, I'm going to guess there's five convolutional layer. After each convolutional layer, I think there is some batch norm and relu, and then to the next convolutional layer and so on. And then at the end, maybe there is, or there's also some pooling here, max pool. At the end, there is going to be some linear classifier that classifies it into either a 10 or 100 or a 1000 classes, whatever you want. The way to investigate this is through linear probes, so called. Now linear probes are somewhat of a technique to inspect how much each of the layers learn. So if we again draw our network right here, and this is the input x, right? So you have the hidden representation, one hidden representation, two hidden representation three. And here you output it to the y hat. And that you compare with the y from your data set, right? The x is from your data set and the y is from your data set. Now linear probe wants to investigate how useful a given hidden representation is to classify the output. So what a linear probe would do is it would take the hidden representation here and learn one single linear classifier to classify that hidden representation to come up with a y hat given h1 or something like this. So the important part here is that this is linear, right? This is a, this is a linear classifier. You do nothing more. You take the representation and instead of this entire giant neural network on top of it, you simply build a linear classifier. And you can build these linear probes from any layer right here. You can build a linear classifier on top of this, on top of this. And then you basically look how good is your linear classifier when trained on that hidden representation that the network comes up with. And that's how you estimate how much information about the target or let's say, now how optimal the representation already is because at the end of the network, right, you do have a linear classifier. So at some point, this representation must go into a form where it is now linearly well classifiable. And the assumption is basically that these layers of the neural network successfully make a representation that is more and more linearly classifiable. And that is a strong assumption, right? And this paper here uses linear probes exclusively. And that is a bit worrisome to me because I have my troubles with this linear probe approach because this strong assumption that more linearly classifiable is better, it just rubs me in the wrong way, right? We know that the information content can never increase from layer to layer about the label. So any information about the label that is in H1, sorry, that is in H2 must also have been present in H1. So technically, if we just built the correct classifier, we could predict from H1 just as well as from H2, right? Because we're actually doing it. We're building the neural network. But the fact that we cannot predict linearly as well using H1. So the fact that this classifier here performs worse than this classifier here because H1 is a less optimal representation in a linear sense. And the fact that, I mean, yes, but then to use that and to estimate, oh, how useful is a representation you're equating usefulness with linearly classifiable? And that I disagree. A representation can be extremely useful if the following layers manage to do something useful with it. And that can be something completely different or it can even be the opposite of the linear classifiability, right? So this is kind of my problem here and they don't do a good work of convincing me otherwise. So they don't employ different techniques other than these linear probes. In any case, when they do this linear probe, you can see right here that the percent supervised performance. How much percent of supervised performance do you get? Oh, single image self-supervision. We show that several self-supervision methods can be used to train first few layers of a deep neural networks using a single training image, such as this image A, B or even C provided that sufficient data augmentation is used. So what they do here is they use this self-supervision, then they take the signal from the convolutional layer one, the hidden representation, that's H1 right here. They train this linear probe on it and they see how well does it perform. After, and this is after the network has been self-supervised with RobNet, for example. And then they compare that to the linear probe at layer one of the supervised network. Right? So you take the supervised network and you do the same thing. And there they find, okay, this RobNet and all the other techniques, they perform very well. And especially if you only do a single image, they perform better as you can see right here. I mean, if I interpret this correctly, this one RobNet, one by again, one deep cluster, these are these top things right here. And the 100 is the comparison to the supervised performance. Right? So 100 means 100% of the performance of the supervised representation. This is absolutely crazy to me. And this, in fact, so let's just interpret it from their perspective, right? So you also have a random. So if you, I guess if you randomly initialize a network, then with the linear, with training, a linear classifier on the hidden representation one, you could reach something like 60% accuracy, which is impressive. Okay, but if you do the linear probed layer two, you reach a lower accuracy. Now remember, this is lower accuracy compared to the supervised performance, right? So the, the, there are two effects at play here. The supervised performance is going to go up because the, well, if you believe the assumption that the successive layers make the representation more and more linear, linearly classifiable. But also it could be that just at the same time, the self supervised performance, the performance of the self supervised representation is going down. So the graph here is sort of, I don't really know how to interpret it. And it really goes down after that. That's why they say you can learn the first layers fairly well with self supervision, even from a single image, but you cannot learn the upper layers. And they're basically just measuring this, using this linear probe method compared to the supervised performance. What I would somewhat like to see is that you train, let's say you train a self supervised network, fine, but then you freeze this layer and then you fine tune the rest of your network on top of that representation. That would actually give you an estimate of how useful is that representation if I had an, you know, all powerful function approximator, which is a neural network. And then of course, you're probably not going to get supervised performance. But by the way, you'd have to compare that also to supervised with and without pre training using self supervision. And then you actually get a good estimate of what, how well, what kind of a representation do these things learn? In this case, all we, you know, all we get out of this is this linear probe thing compared to the supervised representation. And it just seems a bit uninterpretable, honestly. And the fact that here you can go beyond 100%, you can actually be better than supervised, should already tell you that the linear, this linear probe thing might not be a good instrument to might not be such a good instrument, especially in the lower layers. The lower layers will be most inaccurate with these linear probe measurement. But that's, that's their finding basically. They can learn the features of the lower layers as well in terms of this linear probe formulation as the supervised learning. Again, they never compare this to fine tuning on top of these representation or compare it to self supervision plus supervision, which I would really expect. All right. So they say they do lots and lots of data augmentation. Of course, they only have a single image. They basically supercharge data augmentation and they show that this helps. Now I don't want to actually go into the, into the very, into the very details of what they're doing because they just have different methods of augmentation. They just have different networks. But here are the results. So if this is on, on image net, if we use full supervision, we use the entire data set and we do these linear probe evaluation, we get a 20% accuracy after layer one, a 36 after layer two and so on. This goes up as we go through the layer. So this kind of gives credence to the hypothesis that these layers sort of make the representation more linear. Then they have a bunch of scattering and random networks and K means pre-training, which doesn't get you a lot. But that's what they compare it to basically the self supervision to just the scattering transforms and things like that. But then they get into their methods and here we'll look at, for example, this rod net. So if you train on just one image, this image A, of course, if you have one image, then you get this many, this, this much of the layer one. Now, okay. So now that I see this here, they have this column right here, which uses the full data set. What I think this is is the self supervised training using this many images. So what if you do rod net self supervision on this many? Could also be the performance after supervised training after pre-training with this method. But I think it is the performance after just after self supervision again with no fine tuning on top. And then evaluating these linear probes. That's why this number is lower than this number right here. But astonishingly, after you do it with just one image, you get a higher number. And if you do it with a thousand images, you get an even higher number. But if you do it with many more images, you do, you, you somehow don't get a higher number. This all seems a bit, it seems a bit weird honestly. And basically means that, okay, it is more important to augment the same thing over and over and over in different ways than it is to incorporate different images. I mean, there's ways I can believe that, but I'm not sure. But you basically see that after a while, the performance compared to the first of all to the supervised method. So yes, if you look, for example, here, up here drops dramatically. And even if you have the full, you know, now I'm convinced that this, this is just self supervision using the full data set. Even if you have the full data set, but only do self supervision, your performance still suffers compared to the supervised training. So that's why they claim, they have these two claims, you can learn the first layer representations fairly well with self supervision. That's comparing this number to this number. You can do so even from a single image that's comparing this number to this number. And noticing that it's almost the same, these two numbers are almost the same. Actually one is a bit higher. You can learn that fairly well. But if you go down the layers, you will basically suffer with your single image and with your full image self supervision. So you need the supervised signal to learn the features of these later layers. And that's all evaluated with these linear probe things. Yeah. So that is their main claims right here. They kind of analyze image A and image B. So they come to the conclusion that image A works much better because it's natural and image B is not working so well, but this depends on the self supervision used. And image C still apparently works quite well, even though it has these large areas of nothing. Which all of this is a bit weird, but it's definitely cool to see these results. Now again, I would like to see something like you freeze these representations and then you actually train an neural network on top of that and look how that performs. That would actually be an interesting thing though. Maybe they've done this and I'm just unaware right here. They look at the filters that these methods have learned just from self supervision on a single image. And you can see these are the types of filters that we would see using even supervised learning. If you look at the filters, they turn out to look pretty much like this. Of course, I can't decide if these particular things are good or bad filters or not. They do some qualitative analysis and here they have fine tuning. Okay fine tuning experiments. The pre-trained models first two convolutions are left frozen or replaced by the scattering transform and the network is retrained using ImageNet training set. Okay. Here we go. So if you do this fully supervised, you get to a 59.4. Now okay, this seems very low accuracy honestly for even like for ImageNet but maybe this is their thing. But if they do this on top of the these self supervised methods, they do get a fairly good okay. Very fairly good accuracy right here. I would have liked to have this evaluation right here be applied in the table above and not these linear probes. They just seem kind of kind of wonky. But you can see that it is possible to learn this to learn this using just a single image to learn the features of the lower layers. Now how you exactly would put this into a training procedure, how you exactly make use of this during training if you already know that it's not going to help for the deeper layers. I'm not so sure because at least you always have your own data set right. So you always have at least that many images that you can self supervised train on. But it's certainly interesting, interesting results. And with that, I think I'm going to leave it at that and thanks for listening. I hope you enjoyed this and bye bye. | [{"start": 0.0, "end": 7.12, "text": " All right, today we'll look at a critical analysis of self-supervision or what we can learn"}, {"start": 7.12, "end": 15.4, "text": " from a single image by Yuki M. Asano, Christian Ruprecht and Andrea Vidaldi."}, {"start": 15.4, "end": 24.68, "text": " This paper I really was excited when I saw this paper because the outset is so cool and"}, {"start": 24.68, "end": 29.12, "text": " the experiments have a very promising."}, {"start": 29.12, "end": 31.84, "text": " So we'll take a look."}, {"start": 31.84, "end": 37.88, "text": " Basically we show that three different and representative methods by GAN, Rotnet and"}, {"start": 37.88, "end": 45.72, "text": " Deep Cluster, so this is self-supervision techniques, can learn the first few layers of a convolutional"}, {"start": 45.72, "end": 52.760000000000005, "text": " network from a single image as well as using millions of images and manual labels, provided"}, {"start": 52.760000000000005, "end": 56.24, "text": " that strong data augmentation is used."}, {"start": 56.24, "end": 63.64, "text": " However, for deeper layers, the gap with manual supervision cannot be closed, even if millions"}, {"start": 63.64, "end": 66.8, "text": " of unlabeled images are used for training."}, {"start": 66.8, "end": 71.08, "text": " We conclude that first, the weights of the early layers of deep networks contain limited"}, {"start": 71.08, "end": 76.28, "text": " information about the statistics of natural images, that second, such low-level statistics"}, {"start": 76.28, "end": 82.08, "text": " can be learned through self-supervision, just as well as through strong supervision, and"}, {"start": 82.08, "end": 87.08, "text": " at three, the low-level statistics can be captured via synthetic transformations instead"}, {"start": 87.08, "end": 91.32, "text": " of using large image data set."}, {"start": 91.32, "end": 98.47999999999999, "text": " So, as I said, I was kind of excited when I saw this and what they're talking about is"}, {"start": 98.47999999999999, "end": 99.48, "text": " self-supervision."}, {"start": 99.48, "end": 105.64, "text": " So, really quickly, for those who don't know self-supervision is a technique where if you"}, {"start": 105.64, "end": 110.72, "text": " have images but no labels and you would still like to learn something from them, you can"}, {"start": 110.72, "end": 114.76, "text": " do a pre-training step for your network."}, {"start": 114.76, "end": 120.12, "text": " So basically, you have your neural network, F, and what you would like to do is you would"}, {"start": 120.12, "end": 126.64, "text": " like F of X to be close to Y for X and Y to your training data set."}, {"start": 126.64, "end": 132.56, "text": " But you can, if you have a much larger data set of just X's, right, here you have pairs"}, {"start": 132.56, "end": 139.4, "text": " of X and Y, of just X, that are sort of similar to the X in your label data set."}, {"start": 139.4, "end": 146.72, "text": " You can kind of get your network used to the data by doing the self-supervision."}, {"start": 146.72, "end": 152.68, "text": " So what you would do is you would sort of come up with your own labels for the data points."}, {"start": 152.68, "end": 158.12, "text": " And one way is this, we'll take just this rot net as an example."}, {"start": 158.12, "end": 162.68, "text": " So what you'll do is you'll input an image."}, {"start": 162.68, "end": 168.16, "text": " So maybe an image of the number three in handwritten digit recognition, but you'll flip it,"}, {"start": 168.16, "end": 170.24, "text": " you'll flip it to its side, right?"}, {"start": 170.24, "end": 172.07999999999998, "text": " So it's the number three right here."}, {"start": 172.07999999999998, "end": 176.76, "text": " And then you ask the network to come up with an answer, is it upright?"}, {"start": 176.76, "end": 178.0, "text": " Is it flipped to the right?"}, {"start": 178.0, "end": 179.32, "text": " Is it flipped to the left?"}, {"start": 179.32, "end": 180.96, "text": " Or is it turned on its head?"}, {"start": 180.96, "end": 182.51999999999998, "text": " Which one is it?"}, {"start": 182.51999999999998, "end": 187.07999999999998, "text": " And of course, you, who did the transformation know the correct label, right?"}, {"start": 187.07999999999998, "end": 190.88, "text": " So this is how you come up with sort of fake labels for your data."}, {"start": 190.88, "end": 192.88, "text": " And this works surprisingly well."}, {"start": 192.88, "end": 199.68, "text": " And what this paper basically says is that you do not actually need this giant database"}, {"start": 199.68, "end": 200.68, "text": " here."}, {"start": 200.68, "end": 202.12, "text": " It's actually sufficient."}, {"start": 202.12, "end": 206.35999999999999, "text": " Sometimes if you have one single image, where you do this on."}, {"start": 206.35999999999999, "end": 215.48, "text": " Now the claim is a bit of a cheat, I have to say, but we'll go into that."}, {"start": 215.48, "end": 220.32, "text": " And further they say, okay, it's enough to have one single image is to learn the features"}, {"start": 220.32, "end": 225.95999999999998, "text": " of the lower layers of the neural network, because they usually tend to extract low level"}, {"start": 225.95999999999998, "end": 231.76, "text": " features that you can learn from a single image, but the higher level features, you really"}, {"start": 231.76, "end": 235.07999999999998, "text": " need the supervised data set."}, {"start": 235.07999999999998, "end": 238.12, "text": " It's not enough to have these self supervision techniques."}, {"start": 238.12, "end": 245.04, "text": " And even if you have many, many, many self supervision samples, so if you actually do have"}, {"start": 245.04, "end": 249.48, "text": " this giant data set, it still doesn't help you for the higher layers."}, {"start": 249.48, "end": 255.07999999999998, "text": " Just causing to question this, you have a giant data set of unlabeled things."}, {"start": 255.07999999999998, "end": 260.8, "text": " A notion that is often presented, including by me."}, {"start": 260.8, "end": 264.76, "text": " Okay, so what do they do?"}, {"start": 264.76, "end": 270.2, "text": " They do, they take either single images or just very few images."}, {"start": 270.2, "end": 272.48, "text": " So they also have a setting where they take 10 images."}, {"start": 272.48, "end": 276.12, "text": " For the single image, they hand select it."}, {"start": 276.12, "end": 279.28, "text": " So they hand select the following three images."}, {"start": 279.28, "end": 283.15999999999997, "text": " So this image right here, they select because it's very crowded."}, {"start": 283.15999999999997, "end": 285.84, "text": " There's a lot going on, right?"}, {"start": 285.84, "end": 290.59999999999997, "text": " There's people, there's objects, there's lighting, and so on."}, {"start": 290.59999999999997, "end": 296.91999999999996, "text": " There's houses, these lines, there's perspective."}, {"start": 296.91999999999996, "end": 302.84, "text": " So that's why they select image A. Image B here, they also experiment with image B, is"}, {"start": 302.84, "end": 303.84, "text": " a drawn image."}, {"start": 303.84, "end": 309.79999999999995, "text": " As you can see, there's also lots of stuff going on, but they basically want to research"}, {"start": 309.79999999999995, "end": 315.71999999999997, "text": " how does a natural image compare to a artificial image."}, {"start": 315.71999999999997, "end": 321.4, "text": " And then in C, they have this as sort of a control because there's lots of parts here where"}, {"start": 321.4, "end": 323.84, "text": " there's not much going on compared to here."}, {"start": 323.84, "end": 327.2, "text": " And most of the image, there's lots of stuff going on."}, {"start": 327.2, "end": 333.4, "text": " And this image on the image number C, letter C, has large areas where there's nothing"}, {"start": 333.4, "end": 334.67999999999995, "text": " going on."}, {"start": 334.67999999999995, "end": 337.91999999999996, "text": " OK, so these are the single images."}, {"start": 337.91999999999996, "end": 343.47999999999996, "text": " Now, why I say it's a bit of a cheat is that these images are actually super large."}, {"start": 343.47999999999996, "end": 351.12, "text": " They, so for ImageNet and for C410, they, you know, this might be one of the samples"}, {"start": 351.12, "end": 354.47999999999996, "text": " of the C410 or ImageNet classifier."}, {"start": 354.47999999999996, "end": 360.23999999999995, "text": " Now, of course, C410 is a lot smaller than ImageNet, but still for ImageNet, these are,"}, {"start": 360.24, "end": 363.84000000000003, "text": " you know, there are many pictures here, not just one."}, {"start": 363.84000000000003, "end": 369.2, "text": " So to say this is from a single image, it's technically true, but then if you split"}, {"start": 369.2, "end": 374.72, "text": " it into multiple images, it's technically not true."}, {"start": 374.72, "end": 379.6, "text": " So it would have been fun to see what actually happens with a single image when you downscale"}, {"start": 379.6, "end": 381.16, "text": " it."}, {"start": 381.16, "end": 383.8, "text": " But OK, so how do they investigate this?"}, {"start": 383.8, "end": 387.12, "text": " They have this five layer neural network right here."}, {"start": 387.12, "end": 391.52, "text": " So this five convolutional, I'm going to guess there's five convolutional layer."}, {"start": 391.52, "end": 397.2, "text": " After each convolutional layer, I think there is some batch norm and relu, and then to"}, {"start": 397.2, "end": 400.8, "text": " the next convolutional layer and so on."}, {"start": 400.8, "end": 406.32, "text": " And then at the end, maybe there is, or there's also some pooling here, max pool."}, {"start": 406.32, "end": 412.08, "text": " At the end, there is going to be some linear classifier that classifies it into either"}, {"start": 412.08, "end": 415.92, "text": " a 10 or 100 or a 1000 classes, whatever you want."}, {"start": 415.92, "end": 420.48, "text": " The way to investigate this is through linear probes, so called."}, {"start": 420.48, "end": 429.64000000000004, "text": " Now linear probes are somewhat of a technique to inspect how much each of the layers learn."}, {"start": 429.64000000000004, "end": 435.76, "text": " So if we again draw our network right here, and this is the input x, right?"}, {"start": 435.76, "end": 440.28000000000003, "text": " So you have the hidden representation, one hidden representation, two hidden representation"}, {"start": 440.28000000000003, "end": 441.28000000000003, "text": " three."}, {"start": 441.28000000000003, "end": 444.08000000000004, "text": " And here you output it to the y hat."}, {"start": 444.08, "end": 448.35999999999996, "text": " And that you compare with the y from your data set, right?"}, {"start": 448.35999999999996, "end": 452.91999999999996, "text": " The x is from your data set and the y is from your data set."}, {"start": 452.91999999999996, "end": 459.76, "text": " Now linear probe wants to investigate how useful a given hidden representation is to classify"}, {"start": 459.76, "end": 460.76, "text": " the output."}, {"start": 460.76, "end": 465.91999999999996, "text": " So what a linear probe would do is it would take the hidden representation here and learn"}, {"start": 465.92, "end": 474.36, "text": " one single linear classifier to classify that hidden representation to come up with a y"}, {"start": 474.36, "end": 478.16, "text": " hat given h1 or something like this."}, {"start": 478.16, "end": 482.6, "text": " So the important part here is that this is linear, right?"}, {"start": 482.6, "end": 488.6, "text": " This is a, this is a linear classifier."}, {"start": 488.6, "end": 489.6, "text": " You do nothing more."}, {"start": 489.6, "end": 494.64, "text": " You take the representation and instead of this entire giant neural network on top of it,"}, {"start": 494.64, "end": 496.68, "text": " you simply build a linear classifier."}, {"start": 496.68, "end": 500.59999999999997, "text": " And you can build these linear probes from any layer right here."}, {"start": 500.59999999999997, "end": 504.76, "text": " You can build a linear classifier on top of this, on top of this."}, {"start": 504.76, "end": 512.24, "text": " And then you basically look how good is your linear classifier when trained on that hidden"}, {"start": 512.24, "end": 515.88, "text": " representation that the network comes up with."}, {"start": 515.88, "end": 524.16, "text": " And that's how you estimate how much information about the target or let's say, now how optimal"}, {"start": 524.16, "end": 529.4399999999999, "text": " the representation already is because at the end of the network, right, you do have a"}, {"start": 529.4399999999999, "end": 531.0799999999999, "text": " linear classifier."}, {"start": 531.0799999999999, "end": 537.56, "text": " So at some point, this representation must go into a form where it is now linearly well"}, {"start": 537.56, "end": 539.0799999999999, "text": " classifiable."}, {"start": 539.0799999999999, "end": 545.48, "text": " And the assumption is basically that these layers of the neural network successfully make"}, {"start": 545.48, "end": 552.36, "text": " a representation that is more and more linearly classifiable."}, {"start": 552.36, "end": 554.96, "text": " And that is a strong assumption, right?"}, {"start": 554.96, "end": 562.2, "text": " And this paper here uses linear probes exclusively."}, {"start": 562.2, "end": 567.6, "text": " And that is a bit worrisome to me because I have my troubles with this linear probe approach"}, {"start": 567.6, "end": 575.04, "text": " because this strong assumption that more linearly classifiable is better, it just rubs me in"}, {"start": 575.04, "end": 577.08, "text": " the wrong way, right?"}, {"start": 577.08, "end": 584.1600000000001, "text": " We know that the information content can never increase from layer to layer about the label."}, {"start": 584.1600000000001, "end": 591.2800000000001, "text": " So any information about the label that is in H1, sorry, that is in H2 must also have"}, {"start": 591.2800000000001, "end": 592.84, "text": " been present in H1."}, {"start": 592.84, "end": 598.36, "text": " So technically, if we just built the correct classifier, we could predict from H1 just"}, {"start": 598.36, "end": 600.76, "text": " as well as from H2, right?"}, {"start": 600.76, "end": 602.24, "text": " Because we're actually doing it."}, {"start": 602.24, "end": 604.6400000000001, "text": " We're building the neural network."}, {"start": 604.64, "end": 611.16, "text": " But the fact that we cannot predict linearly as well using H1."}, {"start": 611.16, "end": 618.12, "text": " So the fact that this classifier here performs worse than this classifier here because H1"}, {"start": 618.12, "end": 623.28, "text": " is a less optimal representation in a linear sense."}, {"start": 623.28, "end": 632.08, "text": " And the fact that, I mean, yes, but then to use that and to estimate, oh, how useful"}, {"start": 632.08, "end": 638.44, "text": " is a representation you're equating usefulness with linearly classifiable?"}, {"start": 638.44, "end": 639.9200000000001, "text": " And that I disagree."}, {"start": 639.9200000000001, "end": 646.84, "text": " A representation can be extremely useful if the following layers manage to do something"}, {"start": 646.84, "end": 648.08, "text": " useful with it."}, {"start": 648.08, "end": 653.64, "text": " And that can be something completely different or it can even be the opposite of the linear"}, {"start": 653.64, "end": 657.12, "text": " classifiability, right?"}, {"start": 657.12, "end": 665.28, "text": " So this is kind of my problem here and they don't do a good work of convincing me otherwise."}, {"start": 665.28, "end": 670.72, "text": " So they don't employ different techniques other than these linear probes."}, {"start": 670.72, "end": 683.16, "text": " In any case, when they do this linear probe, you can see right here that the percent supervised"}, {"start": 683.16, "end": 684.16, "text": " performance."}, {"start": 684.16, "end": 693.28, "text": " How much percent of supervised performance do you get?"}, {"start": 693.28, "end": 695.9599999999999, "text": " Oh, single image self-supervision."}, {"start": 695.9599999999999, "end": 700.92, "text": " We show that several self-supervision methods can be used to train first few layers of"}, {"start": 700.92, "end": 707.24, "text": " a deep neural networks using a single training image, such as this image A, B or even C provided"}, {"start": 707.24, "end": 709.6, "text": " that sufficient data augmentation is used."}, {"start": 709.6, "end": 717.28, "text": " So what they do here is they use this self-supervision, then they take the signal from the convolutional"}, {"start": 717.28, "end": 721.64, "text": " layer one, the hidden representation, that's H1 right here."}, {"start": 721.64, "end": 728.6800000000001, "text": " They train this linear probe on it and they see how well does it perform."}, {"start": 728.6800000000001, "end": 735.44, "text": " After, and this is after the network has been self-supervised with RobNet, for example."}, {"start": 735.44, "end": 743.6400000000001, "text": " And then they compare that to the linear probe at layer one of the supervised network."}, {"start": 743.6400000000001, "end": 744.6400000000001, "text": " Right?"}, {"start": 744.6400000000001, "end": 748.84, "text": " So you take the supervised network and you do the same thing."}, {"start": 748.84, "end": 757.24, "text": " And there they find, okay, this RobNet and all the other techniques, they perform very"}, {"start": 757.24, "end": 758.6400000000001, "text": " well."}, {"start": 758.64, "end": 766.84, "text": " And especially if you only do a single image, they perform better as you can see right here."}, {"start": 766.84, "end": 771.92, "text": " I mean, if I interpret this correctly, this one RobNet, one by again, one deep cluster,"}, {"start": 771.92, "end": 774.24, "text": " these are these top things right here."}, {"start": 774.24, "end": 778.64, "text": " And the 100 is the comparison to the supervised performance."}, {"start": 778.64, "end": 779.64, "text": " Right?"}, {"start": 779.64, "end": 785.4399999999999, "text": " So 100 means 100% of the performance of the supervised representation."}, {"start": 785.44, "end": 789.36, "text": " This is absolutely crazy to me."}, {"start": 789.36, "end": 796.0, "text": " And this, in fact, so let's just interpret it from their perspective, right?"}, {"start": 796.0, "end": 798.0, "text": " So you also have a random."}, {"start": 798.0, "end": 804.5200000000001, "text": " So if you, I guess if you randomly initialize a network, then with the linear, with training,"}, {"start": 804.5200000000001, "end": 810.08, "text": " a linear classifier on the hidden representation one, you could reach something like 60% accuracy,"}, {"start": 810.08, "end": 813.8800000000001, "text": " which is impressive."}, {"start": 813.88, "end": 821.64, "text": " Okay, but if you do the linear probed layer two, you reach a lower accuracy."}, {"start": 821.64, "end": 830.76, "text": " Now remember, this is lower accuracy compared to the supervised performance, right?"}, {"start": 830.76, "end": 834.96, "text": " So the, the, there are two effects at play here."}, {"start": 834.96, "end": 841.12, "text": " The supervised performance is going to go up because the, well, if you believe the assumption"}, {"start": 841.12, "end": 847.44, "text": " that the successive layers make the representation more and more linear, linearly classifiable."}, {"start": 847.44, "end": 854.24, "text": " But also it could be that just at the same time, the self supervised performance, the performance"}, {"start": 854.24, "end": 859.28, "text": " of the self supervised representation is going down."}, {"start": 859.28, "end": 864.0, "text": " So the graph here is sort of, I don't really know how to interpret it."}, {"start": 864.0, "end": 867.44, "text": " And it really goes down after that."}, {"start": 867.44, "end": 874.8800000000001, "text": " That's why they say you can learn the first layers fairly well with self supervision, even"}, {"start": 874.8800000000001, "end": 880.5600000000001, "text": " from a single image, but you cannot learn the upper layers."}, {"start": 880.5600000000001, "end": 885.6400000000001, "text": " And they're basically just measuring this, using this linear probe method compared to the"}, {"start": 885.6400000000001, "end": 887.36, "text": " supervised performance."}, {"start": 887.36, "end": 894.24, "text": " What I would somewhat like to see is that you train, let's say you train a self supervised"}, {"start": 894.24, "end": 902.5600000000001, "text": " network, fine, but then you freeze this layer and then you fine tune the rest of your network"}, {"start": 902.5600000000001, "end": 904.6, "text": " on top of that representation."}, {"start": 904.6, "end": 908.64, "text": " That would actually give you an estimate of how useful is that representation if I had"}, {"start": 908.64, "end": 914.64, "text": " an, you know, all powerful function approximator, which is a neural network."}, {"start": 914.64, "end": 919.24, "text": " And then of course, you're probably not going to get supervised performance."}, {"start": 919.24, "end": 925.52, "text": " But by the way, you'd have to compare that also to supervised with and without pre training"}, {"start": 925.52, "end": 928.24, "text": " using self supervision."}, {"start": 928.24, "end": 934.44, "text": " And then you actually get a good estimate of what, how well, what kind of a representation"}, {"start": 934.44, "end": 936.2, "text": " do these things learn?"}, {"start": 936.2, "end": 942.52, "text": " In this case, all we, you know, all we get out of this is this linear probe thing compared"}, {"start": 942.52, "end": 945.04, "text": " to the supervised representation."}, {"start": 945.04, "end": 949.12, "text": " And it just seems a bit uninterpretable, honestly."}, {"start": 949.12, "end": 955.8, "text": " And the fact that here you can go beyond 100%, you can actually be better than supervised,"}, {"start": 955.8, "end": 964.76, "text": " should already tell you that the linear, this linear probe thing might not be a good instrument"}, {"start": 964.76, "end": 969.28, "text": " to might not be such a good instrument, especially in the lower layers."}, {"start": 969.28, "end": 974.44, "text": " The lower layers will be most inaccurate with these linear probe measurement."}, {"start": 974.44, "end": 976.48, "text": " But that's, that's their finding basically."}, {"start": 976.48, "end": 984.48, "text": " They can learn the features of the lower layers as well in terms of this linear probe formulation"}, {"start": 984.48, "end": 987.04, "text": " as the supervised learning."}, {"start": 987.04, "end": 992.76, "text": " Again, they never compare this to fine tuning on top of these representation or compare"}, {"start": 992.76, "end": 999.64, "text": " it to self supervision plus supervision, which I would really expect."}, {"start": 999.64, "end": 1001.5600000000001, "text": " All right."}, {"start": 1001.5600000000001, "end": 1005.48, "text": " So they say they do lots and lots of data augmentation."}, {"start": 1005.48, "end": 1007.48, "text": " Of course, they only have a single image."}, {"start": 1007.48, "end": 1014.64, "text": " They basically supercharge data augmentation and they show that this helps."}, {"start": 1014.64, "end": 1021.24, "text": " Now I don't want to actually go into the, into the very, into the very details of what"}, {"start": 1021.24, "end": 1025.84, "text": " they're doing because they just have different methods of augmentation."}, {"start": 1025.84, "end": 1028.96, "text": " They just have different networks."}, {"start": 1028.96, "end": 1032.68, "text": " But here are the results."}, {"start": 1032.68, "end": 1041.8400000000001, "text": " So if this is on, on image net, if we use full supervision, we use the entire data set and"}, {"start": 1041.8400000000001, "end": 1050.0, "text": " we do these linear probe evaluation, we get a 20% accuracy after layer one, a 36 after"}, {"start": 1050.0, "end": 1051.68, "text": " layer two and so on."}, {"start": 1051.68, "end": 1053.68, "text": " This goes up as we go through the layer."}, {"start": 1053.68, "end": 1060.68, "text": " So this kind of gives credence to the hypothesis that these layers sort of make the representation"}, {"start": 1060.68, "end": 1062.8, "text": " more linear."}, {"start": 1062.8, "end": 1072.64, "text": " Then they have a bunch of scattering and random networks and K means pre-training, which"}, {"start": 1072.64, "end": 1076.72, "text": " doesn't get you a lot."}, {"start": 1076.72, "end": 1081.8, "text": " But that's what they compare it to basically the self supervision to just the scattering"}, {"start": 1081.8, "end": 1084.68, "text": " transforms and things like that."}, {"start": 1084.68, "end": 1091.44, "text": " But then they get into their methods and here we'll look at, for example, this rod net."}, {"start": 1091.44, "end": 1102.2, "text": " So if you train on just one image, this image A, of course, if you have one image, then you"}, {"start": 1102.2, "end": 1105.92, "text": " get this many, this, this much of the layer one."}, {"start": 1105.92, "end": 1108.16, "text": " Now, okay."}, {"start": 1108.16, "end": 1118.8400000000001, "text": " So now that I see this here, they have this column right here, which uses the full data set."}, {"start": 1118.8400000000001, "end": 1128.8000000000002, "text": " What I think this is is the self supervised training using this many images."}, {"start": 1128.8000000000002, "end": 1134.0800000000002, "text": " So what if you do rod net self supervision on this many?"}, {"start": 1134.08, "end": 1142.08, "text": " Could also be the performance after supervised training after pre-training with this method."}, {"start": 1142.08, "end": 1148.56, "text": " But I think it is the performance after just after self supervision again with no fine tuning"}, {"start": 1148.56, "end": 1150.52, "text": " on top."}, {"start": 1150.52, "end": 1152.8, "text": " And then evaluating these linear probes."}, {"start": 1152.8, "end": 1157.96, "text": " That's why this number is lower than this number right here."}, {"start": 1157.96, "end": 1165.08, "text": " But astonishingly, after you do it with just one image, you get a higher number."}, {"start": 1165.08, "end": 1170.52, "text": " And if you do it with a thousand images, you get an even higher number."}, {"start": 1170.52, "end": 1179.96, "text": " But if you do it with many more images, you do, you, you somehow don't get a higher number."}, {"start": 1179.96, "end": 1184.28, "text": " This all seems a bit, it seems a bit weird honestly."}, {"start": 1184.28, "end": 1190.36, "text": " And basically means that, okay, it is more important to augment the same thing over and"}, {"start": 1190.36, "end": 1194.52, "text": " over and over in different ways than it is to incorporate different images."}, {"start": 1194.52, "end": 1199.6, "text": " I mean, there's ways I can believe that, but I'm not sure."}, {"start": 1199.6, "end": 1208.2, "text": " But you basically see that after a while, the performance compared to the first of all"}, {"start": 1208.2, "end": 1209.8, "text": " to the supervised method."}, {"start": 1209.8, "end": 1217.96, "text": " So yes, if you look, for example, here, up here drops dramatically."}, {"start": 1217.96, "end": 1222.96, "text": " And even if you have the full, you know, now I'm convinced that this, this is just self"}, {"start": 1222.96, "end": 1225.36, "text": " supervision using the full data set."}, {"start": 1225.36, "end": 1230.0, "text": " Even if you have the full data set, but only do self supervision, your performance still"}, {"start": 1230.0, "end": 1236.1599999999999, "text": " suffers compared to the supervised training."}, {"start": 1236.16, "end": 1242.0400000000002, "text": " So that's why they claim, they have these two claims, you can learn the first layer representations"}, {"start": 1242.0400000000002, "end": 1245.0, "text": " fairly well with self supervision."}, {"start": 1245.0, "end": 1248.88, "text": " That's comparing this number to this number."}, {"start": 1248.88, "end": 1256.3200000000002, "text": " You can do so even from a single image that's comparing this number to this number."}, {"start": 1256.3200000000002, "end": 1261.68, "text": " And noticing that it's almost the same, these two numbers are almost the same."}, {"start": 1261.68, "end": 1266.1200000000001, "text": " Actually one is a bit higher."}, {"start": 1266.12, "end": 1268.12, "text": " You can learn that fairly well."}, {"start": 1268.12, "end": 1277.0, "text": " But if you go down the layers, you will basically suffer with your single image and with your"}, {"start": 1277.0, "end": 1280.1999999999998, "text": " full image self supervision."}, {"start": 1280.1999999999998, "end": 1286.0, "text": " So you need the supervised signal to learn the features of these later layers."}, {"start": 1286.0, "end": 1290.3999999999999, "text": " And that's all evaluated with these linear probe things."}, {"start": 1290.3999999999999, "end": 1291.3999999999999, "text": " Yeah."}, {"start": 1291.3999999999999, "end": 1293.9199999999998, "text": " So that is their main claims right here."}, {"start": 1293.92, "end": 1300.68, "text": " They kind of analyze image A and image B. So they come to the conclusion that image A works"}, {"start": 1300.68, "end": 1307.64, "text": " much better because it's natural and image B is not working so well, but this depends on"}, {"start": 1307.64, "end": 1311.52, "text": " the self supervision used."}, {"start": 1311.52, "end": 1319.52, "text": " And image C still apparently works quite well, even though it has these large areas of"}, {"start": 1319.52, "end": 1320.76, "text": " nothing."}, {"start": 1320.76, "end": 1326.48, "text": " Which all of this is a bit weird, but it's definitely cool to see these results."}, {"start": 1326.48, "end": 1330.6, "text": " Now again, I would like to see something like you freeze these representations and then"}, {"start": 1330.6, "end": 1335.24, "text": " you actually train an neural network on top of that and look how that performs."}, {"start": 1335.24, "end": 1339.48, "text": " That would actually be an interesting thing though."}, {"start": 1339.48, "end": 1345.76, "text": " Maybe they've done this and I'm just unaware right here."}, {"start": 1345.76, "end": 1352.0, "text": " They look at the filters that these methods have learned just from self supervision on a"}, {"start": 1352.0, "end": 1353.0, "text": " single image."}, {"start": 1353.0, "end": 1358.84, "text": " And you can see these are the types of filters that we would see using even supervised learning."}, {"start": 1358.84, "end": 1363.36, "text": " If you look at the filters, they turn out to look pretty much like this."}, {"start": 1363.36, "end": 1371.32, "text": " Of course, I can't decide if these particular things are good or bad filters or not."}, {"start": 1371.32, "end": 1379.72, "text": " They do some qualitative analysis and here they have fine tuning."}, {"start": 1379.72, "end": 1383.04, "text": " Okay fine tuning experiments."}, {"start": 1383.04, "end": 1389.52, "text": " The pre-trained models first two convolutions are left frozen or replaced by the scattering"}, {"start": 1389.52, "end": 1395.9199999999998, "text": " transform and the network is retrained using ImageNet training set."}, {"start": 1395.9199999999998, "end": 1397.3999999999999, "text": " Okay."}, {"start": 1397.3999999999999, "end": 1398.76, "text": " Here we go."}, {"start": 1398.76, "end": 1406.36, "text": " So if you do this fully supervised, you get to a 59.4."}, {"start": 1406.36, "end": 1415.08, "text": " Now okay, this seems very low accuracy honestly for even like for ImageNet but maybe this"}, {"start": 1415.08, "end": 1416.8799999999999, "text": " is their thing."}, {"start": 1416.8799999999999, "end": 1425.8, "text": " But if they do this on top of the these self supervised methods, they do get a fairly"}, {"start": 1425.8, "end": 1426.8, "text": " good okay."}, {"start": 1426.8, "end": 1429.04, "text": " Very fairly good accuracy right here."}, {"start": 1429.04, "end": 1434.68, "text": " I would have liked to have this evaluation right here be applied in the table above and"}, {"start": 1434.68, "end": 1436.28, "text": " not these linear probes."}, {"start": 1436.28, "end": 1441.08, "text": " They just seem kind of kind of wonky."}, {"start": 1441.08, "end": 1449.8, "text": " But you can see that it is possible to learn this to learn this using just a single image"}, {"start": 1449.8, "end": 1452.48, "text": " to learn the features of the lower layers."}, {"start": 1452.48, "end": 1460.76, "text": " Now how you exactly would put this into a training procedure, how you exactly make use"}, {"start": 1460.76, "end": 1464.68, "text": " of this during training if you already know that it's not going to help for the deeper"}, {"start": 1464.68, "end": 1465.68, "text": " layers."}, {"start": 1465.68, "end": 1473.08, "text": " I'm not so sure because at least you always have your own data set right."}, {"start": 1473.08, "end": 1479.48, "text": " So you always have at least that many images that you can self supervised train on."}, {"start": 1479.48, "end": 1483.92, "text": " But it's certainly interesting, interesting results."}, {"start": 1483.92, "end": 1492.76, "text": " And with that, I think I'm going to leave it at that and thanks for listening."}, {"start": 1492.76, "end": 1519.48, "text": " I hope you enjoyed this and bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=YrO1v7-KcXs | Deep image reconstruction from human brain activity (Paper Explained) | Can you peek into people's brains? Reading human thoughts is a long-standing dream of the AI field. This paper reads fMRI signals from a person and then reconstructs what that person's eyes currently see. This is achieved by translating the fMRI signal to features of a Deep Neural Network and then iteratively optimizing the input of the network to match those features. The results are impressive.
OUTLINE:
0:00 - Overview
1:35 - Pipeline
4:00 - Training
5:20 - Image Reconstruction
7:00 - Deep Generator Network
8:15 - Results
Paper: https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006633
My Video on OpenAI Microscope (what I called Atlas): https://youtu.be/Ok44otx90D4
Abstract:
The mental contents of perception and imagery are thought to be encoded in hierarchical representations in the brain, but previous attempts to visualize perceptual contents have failed to capitalize on multiple levels of the hierarchy, leaving it challenging to reconstruct internal imagery. Recent work showed that visual cortical activity measured by functional magnetic resonance imaging (fMRI) can be decoded (translated) into the hierarchical features of a pre-trained deep neural network (DNN) for the same input image, providing a way to make use of the information from hierarchical visual features. Here, we present a novel image reconstruction method, in which the pixel values of an image are optimized to make its DNN features similar to those decoded from human brain activity at multiple layers. We found that our method was able to reliably produce reconstructions that resembled the viewed natural images. A natural image prior introduced by a deep generator neural network effectively rendered semantically meaningful details to the reconstructions. Human judgment of the reconstructions supported the effectiveness of combining multiple DNN layers to enhance the visual quality of generated images. While our model was solely trained with natural images, it successfully generalized to artificial shapes, indicating that our model was not simply matching to exemplars. The same analysis applied to mental imagery demonstrated rudimentary reconstructions of the subjective content. Our results suggest that our method can effectively combine hierarchical neural representations to reconstruct perceptual and subjective images, providing a new window into the internal contents of the brain.
Authors: Guohua Shen, Tomoyasu Horikawa, Kei Majima, Yukiyasu Kamitani
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 deep imagery construction from human brain activity by guawa Shen, Tomoyasu, Horikawa, Kai Majima and Yukiyazu Kamitani. This is like reading thoughts. So I was excited when I saw this paper, I saw this on Reddit and it is a bit older, it is from the beginning of last year. So I'm sure there have been developments in this area. But basically what this paper does is it will have a human look at a picture, as you can see, for example, right up here. It will measure the MRI activity. Then it will use a what they call a feature decoder in order to map that MRI activity to features of a deep neural network. And then they will reconstruct the image that is closest to those features in the neural network. And by reconstruction they get basically, they get out an image of what the human sees. So we're going to explore this pipeline right here. But it's pretty cool and if it works, you know, it basically means that we can read someone's thoughts. But of course there's going to be issues and problems. So first of all, this is all visual. They measure the activity in the visual cortex right here. So let's break it down to the individual parts. The individual parts here, they are MRI, that is a machine we cannot control. So you measure the FMRI activity and that's basically measures which of the cells in your brain use oxygen. It's functional FMRI, it's not structural. So it measures which ones are active. And that's how you would see which parts of the brain are active. And I think the resolution on these things has gotten very, very good. So you can make out very fine-grained activation patterns in the neurons. And they measure the visual cortex, which is the part responsible for basically visual stimuli, so for seeing things. Now they need this feature decoder, but because ultimately what they want to do is they want to have these features correspond to features in a neural network. This DNN here is like a VGG, I think a VGG 16 or a VGG 19. It's called a VGG 16 network. This is a couple of years ago, these architectures were very popular for ImageNet. And they're fairly basic, so what that means, it's not like a super duper inception net where you have like layers within layers and so on. They're pretty straightforward convolutional neural networks with non-linearities and pooling here. You can see there is a bunch of layers, then there's pooling, there is a bunch of layers, there's pooling and so on. So what you want to look at are these layers of the deep neural network, right? The individual layers. And you want to basically put an image right here into the neural network and then observe its features in the neural network. And then you want to put the same image through the human and then you observe the MRI features. And you know that this is the same image. So you can basically learn a feature decoder. This is going to be another sort of machine learned maybe in neural network. I haven't actually read this could be just like a linear regression or a neural network. Just regression from that maps the FMRI to the features. So this is what you have to learn. Basically they took a bunch of humans, stuck them in an MRI machine, right? They got out their their FMRI data for the same image. So for a given image X, they got the human FMRI data. And they got the VGG, VGG. They got the features when they put the X, the image through the neural network. And now they learn a function that minimizes the error. So there is an error. So basically they run this on a test set of images and then you end up with a function that can basically map FMRI features to neural network features. Now the second step now you can you can give the human let's say this works. You can give the human an arbitrary image and if the human will basically interpret it through its visual cortex, you measure the activity individual cortex. And then you can predict the neural network features if that image were given to the neural network. But now you don't give the image to the neural network. Instead of what you do, you do something like deep dream does. That means you start from a noisy image at the beginning and you try to find the image. So you start from this noisy image right here. And through iterative gradient descent, you refine this image. And that's this arrow right here. You try to find the image that as closely as possible in the internal representation matches the features that you predict from the FMRI signal. Because these are the features that the neural network should see right if you if your feature decoder is good, these are the features that the neural network should output for that image. So you're basically trying to find this image right here, but you're not looking at it. You only look at the features that should be in the neural network. So after a bunch of steps of refining that image, you hope you basically end up with an image that corresponds to these features. And then you, you can look at it. And it usually looks something like this. We're used to these kind of things from the neural networks. And if I invite you to look at something like the open AI at less, if you want to understand how this is done, but basically we can get the image that most faithfully corresponds to these features. Now this doesn't always work super well because there are actually since the neural network is sort of a dimension reduction technique. There are many images that correspond to the same features. And they often end up like really weird. So what they do is they have this deep generator network as a prior. Basically, this is the generator from a GAN from a generative adversarial network. So this network right here is really good at just producing naturally looking images. And now, because we have that, our task is not going to be to start from this image right here. Our task will be to do the exact same thing, but with the input to the deep generator network. So basically what we're trying to do is we're trying to find the input vector to the deep generator network such that these features right here correspond to the features that we predict from the FMI activity. And because the deep generator network is trained to produce natural looking images, this will always give us sort of a natural looking image, no matter what our input vector is. So thereby we basically constrain the optimization procedure to only output natural looking images. So let's see how well this works. So these are the reconstructions. I have to say they're training set, they're training and testing set. So up here, this procedure where we learned right here, this would be done on a training set of images. And then they expose the humans to testing set of images. So this reconstruction right here would happen on images that the feature decoder wasn't trained on. But the humans are looking at it. So the humans are would be looking at the picture here on the left. And then this would be to the right, you'll see as more and more iterations of this process of reconstructing happens. The image gets basically clearer and clearer. And you can see on the right, you get pretty good looking images for the ones on the left. Now, these researchers, they tend to, they tout the success like they say, oh, look, look at this. But, you know, honestly, like this is a leopard. This is a dog sheep. This is an owl. This is a dog. So, so, you know, this is a fish. And this is a shell, like a muscle. So, and you can go through these. And basically, you know, this is a sled. And then this is a truck. So, they go basically and they say, wow, the accuracy is really good. So, they do a pixel correlation accuracy, which is, you know, you just try to pixel correlate things, but they have human judgment. The accuracy via human judgment is over 95%. And that's crazy. But how do they do it? So, basically, they tell you, okay, see, this is the image at the beginning. No, sorry, they give you this image right here as a human radar. And then they give you two other images. They say, okay, here are two images. Let's say these two. Which one did it come from? And if the human can determine it correctly counts as a hit. So, the baseline probability here is 50%. So, basically, right, is so, so this right here, is it rather the owl or is it rather the VCR? And I mean, in that respect, it's pretty impressive what you can read from a brain, but in no way, like zero way, this is reading your thoughts. This isn't like, it seems to basically just reconstruct a example from the ImageNet training set. And the ImageNet Explorer is down right now. So, I try to look at this, but it seems to me, it's just kind of reconstructing something it knows that sort of bit resembles the image on the left. Yeah, but it is not, it is not reconstructing that image, not at all. Like, look, like a bit, but vaguely, vaguely. But they do some more investigation into this. Okay, so, well, first of all, here you can see what happens without this deep generator network. So when you have unconstrained search, then it is even worse, right? You get like big pixel meshes right here. So you need this kind of prior over natural images, but the prior, I think the prior here comes through a bit much because the prior might be in part responsible for why the images just show something else than you see. They go into an investigation of if, and they discover if you use more layers to reconstruct the reconstruction gets better. So here according to human judgment, if you just reconstruct from the first layer, you don't get very good reconstruction. But if you incorporate the signal across many layers of the neural networks, you're basically trying to match to predict many layers of signal, different layers, then the reconstruction gets really good. You know, we know this from things like style transfer, you can modify how close you are to the original or to the target by basically seeing which layers and how many you reconstruct to which accuracy. So this makes kind of sense. So if you only take the first layer to match the features, then you get basically this blob here. But if you get layers one through seven, you get pretty, pretty okay-ish thing that looks like this thing. I guess these are without the deep generator network so far. But now that that is interesting. And I think the novel thing here is one of the novel things that they actually use multiple layers of the neural network to reconstruct. The interesting thing is, and I think this is pretty cool. They can now do this with these shapes. So these shapes aren't natural images and they have not been seen in training. But still, as you can see, when the human sees, for example, the plus shape, it will get you a pretty clear plus shape. And it happens for a lot of these things right here. So these are actually, I would say, fairly okay-ish reconstructions of what the human sees here neuron that is fairly neat. And for the alphabetical letters and shapes you see again, the pixel correlation now is pretty high, but the human judgment again high. And here the human judgment kind of makes sense, right? If you ask, is it like this shape or this shape, then it makes more sense to evaluate it like this. So the shapes, I am fairly impressed that they can reconstruct these shapes. And what they're now trying to do is they're trying to infer imagined images. So basically they're telling a human, please imagine an image and they show it to the human. So it's not really imagining, it's basically recalling. They show you this image and then you, whatever, close your eyes, they take the image away and you just try to imagine that. And you can see through the reconstruction process, that works out, you know, sort of-ish. Right, you can see that the cross here, it kind of comes through. And this plus kind of- it sort of comes through. And so these are the high accuracy, these are actually the samples where it worked. And there are also samples where it didn't work like here, where you see it doesn't really come through. Either there is, you know, really a difference between imagining something and seeing something or this method just isn't very good per se. And you actually need, or humans aren't really good at imagining, like there's lots of explanations. And here is the same thing if you imagine these images. Now they report that if humans just recall or imagine these images, then the reconstruction doesn't work at all. So that might be to the fact that, you know, you cannot in your recollection, you basically just remember the important things about something. You don't remember the exact pixel values and therefore your visual cortex doesn't respond in the same way. I mean, it's interesting even per se to think about it. But I have my doubts about, you know, this entire system. So I don't want to make too many conclusions here about these things. So if I used to say that sometimes it actually can read your thoughts because if you just think, so this is this stuff up here, if you just think of a shape, it can sort of kind of a bit make out the shape that you're thinking about. Alright, this was it for this paper. I'm basically mainly wanted to show you what I found and I'm I have to say I'm pretty impressed with this even though like this is a laptop. This is not a VCR. This is a VCR. It's it's more of a nearest neighbor thing really than I reconstruction. I think that's my opinion, right? Yes, so if you like this, give it a like, subscribe if you're still here and I look forward to next time. Bye bye. | [{"start": 0.0, "end": 7.0, "text": " Hi there. Today we're looking at deep imagery construction from human brain activity by guawa"}, {"start": 7.0, "end": 20.0, "text": " Shen, Tomoyasu, Horikawa, Kai Majima and Yukiyazu Kamitani. This is like reading thoughts."}, {"start": 20.0, "end": 29.0, "text": " So I was excited when I saw this paper, I saw this on Reddit and it is a bit older, it is from the beginning of last year."}, {"start": 29.0, "end": 42.0, "text": " So I'm sure there have been developments in this area. But basically what this paper does is it will have a human look at a picture, as you can see, for example, right up here."}, {"start": 42.0, "end": 56.0, "text": " It will measure the MRI activity. Then it will use a what they call a feature decoder in order to map that MRI activity to features of a deep neural network."}, {"start": 56.0, "end": 65.0, "text": " And then they will reconstruct the image that is closest to those features in the neural network."}, {"start": 65.0, "end": 72.0, "text": " And by reconstruction they get basically, they get out an image of what the human sees."}, {"start": 72.0, "end": 83.0, "text": " So we're going to explore this pipeline right here. But it's pretty cool and if it works, you know, it basically means that we can read someone's thoughts."}, {"start": 83.0, "end": 93.0, "text": " But of course there's going to be issues and problems. So first of all, this is all visual. They measure the activity in the visual cortex right here."}, {"start": 93.0, "end": 106.0, "text": " So let's break it down to the individual parts. The individual parts here, they are MRI, that is a machine we cannot control."}, {"start": 106.0, "end": 115.0, "text": " So you measure the FMRI activity and that's basically measures which of the cells in your brain use oxygen."}, {"start": 115.0, "end": 125.0, "text": " It's functional FMRI, it's not structural. So it measures which ones are active. And that's how you would see which parts of the brain are active."}, {"start": 125.0, "end": 135.0, "text": " And I think the resolution on these things has gotten very, very good. So you can make out very fine-grained activation patterns in the neurons."}, {"start": 135.0, "end": 145.0, "text": " And they measure the visual cortex, which is the part responsible for basically visual stimuli, so for seeing things."}, {"start": 145.0, "end": 155.0, "text": " Now they need this feature decoder, but because ultimately what they want to do is they want to have these features correspond to features in a neural network."}, {"start": 155.0, "end": 169.0, "text": " This DNN here is like a VGG, I think a VGG 16 or a VGG 19. It's called a VGG 16 network. This is a couple of years ago, these architectures were very popular for ImageNet."}, {"start": 169.0, "end": 180.0, "text": " And they're fairly basic, so what that means, it's not like a super duper inception net where you have like layers within layers and so on."}, {"start": 180.0, "end": 194.0, "text": " They're pretty straightforward convolutional neural networks with non-linearities and pooling here. You can see there is a bunch of layers, then there's pooling, there is a bunch of layers, there's pooling and so on."}, {"start": 194.0, "end": 203.0, "text": " So what you want to look at are these layers of the deep neural network, right? The individual layers."}, {"start": 203.0, "end": 214.0, "text": " And you want to basically put an image right here into the neural network and then observe its features in the neural network."}, {"start": 214.0, "end": 224.0, "text": " And then you want to put the same image through the human and then you observe the MRI features. And you know that this is the same image."}, {"start": 224.0, "end": 236.0, "text": " So you can basically learn a feature decoder. This is going to be another sort of machine learned maybe in neural network. I haven't actually read this could be just like a linear regression or a neural network."}, {"start": 236.0, "end": 250.0, "text": " Just regression from that maps the FMRI to the features. So this is what you have to learn. Basically they took a bunch of humans, stuck them in an MRI machine, right?"}, {"start": 250.0, "end": 265.0, "text": " They got out their their FMRI data for the same image. So for a given image X, they got the human FMRI data. And they got the VGG, VGG."}, {"start": 265.0, "end": 281.0, "text": " They got the features when they put the X, the image through the neural network. And now they learn a function that minimizes the error. So there is an error."}, {"start": 281.0, "end": 294.0, "text": " So basically they run this on a test set of images and then you end up with a function that can basically map FMRI features to neural network features."}, {"start": 294.0, "end": 317.0, "text": " Now the second step now you can you can give the human let's say this works. You can give the human an arbitrary image and if the human will basically interpret it through its visual cortex, you measure the activity individual cortex. And then you can predict the neural network features if that image were given to the neural network."}, {"start": 317.0, "end": 333.0, "text": " But now you don't give the image to the neural network. Instead of what you do, you do something like deep dream does. That means you start from a noisy image at the beginning and you try to find the image."}, {"start": 333.0, "end": 356.0, "text": " So you start from this noisy image right here. And through iterative gradient descent, you refine this image. And that's this arrow right here. You try to find the image that as closely as possible in the internal representation matches the features that you predict from the FMRI signal."}, {"start": 356.0, "end": 367.0, "text": " Because these are the features that the neural network should see right if you if your feature decoder is good, these are the features that the neural network should output for that image."}, {"start": 367.0, "end": 377.0, "text": " So you're basically trying to find this image right here, but you're not looking at it. You only look at the features that should be in the neural network."}, {"start": 377.0, "end": 391.0, "text": " So after a bunch of steps of refining that image, you hope you basically end up with an image that corresponds to these features. And then you, you can look at it."}, {"start": 391.0, "end": 411.0, "text": " And it usually looks something like this. We're used to these kind of things from the neural networks. And if I invite you to look at something like the open AI at less, if you want to understand how this is done, but basically we can get the image that most faithfully corresponds to these features."}, {"start": 411.0, "end": 426.0, "text": " Now this doesn't always work super well because there are actually since the neural network is sort of a dimension reduction technique. There are many images that correspond to the same features. And they often end up like really weird."}, {"start": 426.0, "end": 436.0, "text": " So what they do is they have this deep generator network as a prior. Basically, this is the generator from a GAN from a generative adversarial network."}, {"start": 436.0, "end": 451.0, "text": " So this network right here is really good at just producing naturally looking images. And now, because we have that, our task is not going to be to start from this image right here."}, {"start": 451.0, "end": 472.0, "text": " Our task will be to do the exact same thing, but with the input to the deep generator network. So basically what we're trying to do is we're trying to find the input vector to the deep generator network such that these features right here correspond to the features that we predict from the FMI activity."}, {"start": 472.0, "end": 486.0, "text": " And because the deep generator network is trained to produce natural looking images, this will always give us sort of a natural looking image, no matter what our input vector is."}, {"start": 486.0, "end": 497.0, "text": " So thereby we basically constrain the optimization procedure to only output natural looking images. So let's see how well this works."}, {"start": 497.0, "end": 509.0, "text": " So these are the reconstructions. I have to say they're training set, they're training and testing set. So up here, this procedure where we learned right here, this would be done on a training set of images."}, {"start": 509.0, "end": 520.0, "text": " And then they expose the humans to testing set of images. So this reconstruction right here would happen on images that the feature decoder wasn't trained on."}, {"start": 520.0, "end": 534.0, "text": " But the humans are looking at it. So the humans are would be looking at the picture here on the left. And then this would be to the right, you'll see as more and more iterations of this process of reconstructing happens."}, {"start": 534.0, "end": 543.0, "text": " The image gets basically clearer and clearer. And you can see on the right, you get pretty good looking images for the ones on the left."}, {"start": 543.0, "end": 559.0, "text": " Now, these researchers, they tend to, they tout the success like they say, oh, look, look at this. But, you know, honestly, like this is a leopard."}, {"start": 559.0, "end": 579.0, "text": " This is a dog sheep. This is an owl. This is a dog. So, so, you know, this is a fish. And this is a shell, like a muscle."}, {"start": 579.0, "end": 593.0, "text": " So, and you can go through these. And basically, you know, this is a sled. And then this is a truck."}, {"start": 593.0, "end": 611.0, "text": " So, they go basically and they say, wow, the accuracy is really good. So, they do a pixel correlation accuracy, which is, you know, you just try to pixel correlate things, but they have human judgment. The accuracy via human judgment is over 95%."}, {"start": 611.0, "end": 624.0, "text": " And that's crazy. But how do they do it? So, basically, they tell you, okay, see, this is the image at the beginning. No, sorry, they give you this image right here as a human radar."}, {"start": 624.0, "end": 634.0, "text": " And then they give you two other images. They say, okay, here are two images. Let's say these two. Which one did it come from?"}, {"start": 634.0, "end": 651.0, "text": " And if the human can determine it correctly counts as a hit. So, the baseline probability here is 50%. So, basically, right, is so, so this right here, is it rather the owl or is it rather the VCR?"}, {"start": 651.0, "end": 672.0, "text": " And I mean, in that respect, it's pretty impressive what you can read from a brain, but in no way, like zero way, this is reading your thoughts. This isn't like, it seems to basically just reconstruct a example from the ImageNet training set. And the ImageNet Explorer is down right now."}, {"start": 672.0, "end": 689.0, "text": " So, I try to look at this, but it seems to me, it's just kind of reconstructing something it knows that sort of bit resembles the image on the left. Yeah, but it is not, it is not reconstructing that image, not at all."}, {"start": 689.0, "end": 696.0, "text": " Like, look, like a bit, but vaguely, vaguely."}, {"start": 696.0, "end": 711.0, "text": " But they do some more investigation into this. Okay, so, well, first of all, here you can see what happens without this deep generator network. So when you have unconstrained search, then it is even worse, right?"}, {"start": 711.0, "end": 732.0, "text": " You get like big pixel meshes right here. So you need this kind of prior over natural images, but the prior, I think the prior here comes through a bit much because the prior might be in part responsible for why the images just show something else than you see."}, {"start": 732.0, "end": 749.0, "text": " They go into an investigation of if, and they discover if you use more layers to reconstruct the reconstruction gets better. So here according to human judgment, if you just reconstruct from the first layer, you don't get very good reconstruction."}, {"start": 749.0, "end": 763.0, "text": " But if you incorporate the signal across many layers of the neural networks, you're basically trying to match to predict many layers of signal, different layers, then the reconstruction gets really good."}, {"start": 763.0, "end": 779.0, "text": " You know, we know this from things like style transfer, you can modify how close you are to the original or to the target by basically seeing which layers and how many you reconstruct to which accuracy. So this makes kind of sense."}, {"start": 779.0, "end": 793.0, "text": " So if you only take the first layer to match the features, then you get basically this blob here. But if you get layers one through seven, you get pretty, pretty okay-ish thing that looks like this thing."}, {"start": 793.0, "end": 808.0, "text": " I guess these are without the deep generator network so far. But now that that is interesting. And I think the novel thing here is one of the novel things that they actually use multiple layers of the neural network to reconstruct."}, {"start": 808.0, "end": 822.0, "text": " The interesting thing is, and I think this is pretty cool. They can now do this with these shapes. So these shapes aren't natural images and they have not been seen in training."}, {"start": 822.0, "end": 833.0, "text": " But still, as you can see, when the human sees, for example, the plus shape, it will get you a pretty clear plus shape. And it happens for a lot of these things right here."}, {"start": 833.0, "end": 844.0, "text": " So these are actually, I would say, fairly okay-ish reconstructions of what the human sees here neuron that is fairly neat."}, {"start": 844.0, "end": 855.0, "text": " And for the alphabetical letters and shapes you see again, the pixel correlation now is pretty high, but the human judgment again high."}, {"start": 855.0, "end": 866.0, "text": " And here the human judgment kind of makes sense, right? If you ask, is it like this shape or this shape, then it makes more sense to evaluate it like this."}, {"start": 866.0, "end": 881.0, "text": " So the shapes, I am fairly impressed that they can reconstruct these shapes. And what they're now trying to do is they're trying to infer imagined images."}, {"start": 881.0, "end": 890.0, "text": " So basically they're telling a human, please imagine an image and they show it to the human. So it's not really imagining, it's basically recalling."}, {"start": 890.0, "end": 897.0, "text": " They show you this image and then you, whatever, close your eyes, they take the image away and you just try to imagine that."}, {"start": 897.0, "end": 905.0, "text": " And you can see through the reconstruction process, that works out, you know, sort of-ish."}, {"start": 905.0, "end": 914.0, "text": " Right, you can see that the cross here, it kind of comes through. And this plus kind of- it sort of comes through."}, {"start": 914.0, "end": 927.0, "text": " And so these are the high accuracy, these are actually the samples where it worked. And there are also samples where it didn't work like here, where you see it doesn't really come through."}, {"start": 927.0, "end": 940.0, "text": " Either there is, you know, really a difference between imagining something and seeing something or this method just isn't very good per se."}, {"start": 940.0, "end": 947.0, "text": " And you actually need, or humans aren't really good at imagining, like there's lots of explanations."}, {"start": 947.0, "end": 959.0, "text": " And here is the same thing if you imagine these images. Now they report that if humans just recall or imagine these images, then the reconstruction doesn't work at all."}, {"start": 959.0, "end": 967.0, "text": " So that might be to the fact that, you know, you cannot in your recollection, you basically just remember the important things about something."}, {"start": 967.0, "end": 978.0, "text": " You don't remember the exact pixel values and therefore your visual cortex doesn't respond in the same way. I mean, it's interesting even per se to think about it."}, {"start": 978.0, "end": 986.0, "text": " But I have my doubts about, you know, this entire system. So I don't want to make too many conclusions here about these things."}, {"start": 986.0, "end": 1005.0, "text": " So if I used to say that sometimes it actually can read your thoughts because if you just think, so this is this stuff up here, if you just think of a shape, it can sort of kind of a bit make out the shape that you're thinking about."}, {"start": 1005.0, "end": 1018.0, "text": " Alright, this was it for this paper. I'm basically mainly wanted to show you what I found and I'm I have to say I'm pretty impressed with this even though like this is a laptop."}, {"start": 1018.0, "end": 1022.0, "text": " This is not a VCR. This is a VCR."}, {"start": 1022.0, "end": 1032.0, "text": " It's it's more of a nearest neighbor thing really than I reconstruction. I think that's my opinion, right?"}, {"start": 1032.0, "end": 1044.0, "text": " Yes, so if you like this, give it a like, subscribe if you're still here and I look forward to next time. Bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=UjJU13GdL94 | Regularizing Trajectory Optimization with Denoising Autoencoders (Paper Explained) | Can you plan with a learned model of the world? Yes, but there's a catch: The better your planning algorithm is, the more the errors of your world model will hurt you! This paper solves this problem by regularizing the planning algorithm to stay in high probability regions, given its experience.
https://arxiv.org/abs/1903.11981
Interview w/ Harri: https://youtu.be/HnZDmxYnpg4
Abstract:
Trajectory optimization using a learned model of the environment is one of the core elements of model-based reinforcement learning. This procedure often suffers from exploiting inaccuracies of the learned model. We propose to regularize trajectory optimization by means of a denoising autoencoder that is trained on the same trajectories as the model of the environment. We show that the proposed regularization leads to improved planning with both gradient-based and gradient-free optimizers. We also demonstrate that using regularized trajectory optimization leads to rapid initial learning in a set of popular motor control tasks, which suggests that the proposed approach can be a useful tool for improving sample efficiency.
Authors: Rinu Boney, Norman Di Palo, Mathias Berglund, Alexander Ilin, Juho Kannala, Antti Rasmus, Harri Valpola
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 regularizing trajectory optimization with denoising auto encoders by Renew Bonay, Normand de Paolo and others of various places but a lot of the people are from Curious AI and we actually had a discussion with Hari who is the CEO of Curious AI and this was on our machine learning street talk podcast. So this is another YouTube channel for those of you who don't know where every week or so we try to have either an interesting discussion or a guest like sort of an interview or talk about comment on the talk. So if it is not out yet I'll link to it as soon as it comes out but if you're watching this video later make sure to check out our conversation with Hari because it was absolutely fantastic and in general if you like videos like this consider subscribing liking sharing if you're still here at the end and liked it. Okay so this paper on a high level deals with model-based reinforcement learning. Model-based reinforcement learning means that you are using a model of the world to do reinforcement learning. So in essence if you have your reinforcement learning setup where you are an agent and you have to interact with the world you have to do so in many steps in like a round trip fashion. So you put an action you act and the world gives you back an observation and you have to act in the world over and over and over such that you will be able to maximize your reward. Now what is model-based reinforcement learning? Model-based reinforcement learning basically means that the agent here has internally a model of the world. So it sort of understands how the world works. Situations where you have a accurate model of the world are things like chess. So in chess the rules are very clear you know how the world's gonna behave if you perform a certain action but in real world applications it's very very hard to actually make a model so people usually rely on learned models. So what does it mean? You basically learn a neural network that tries to predict how the world is going to act. So this here is going to be a deep neural network that you learn from what you see in the world. Now trajectory optimization basically means that you are now you now have this world model and you use it to look ahead as I said. So you are in the state like here and you can do let's say three different actions and you use your world model here world and you see you think how's the world going to react if I do either of those three things. And then you get into three different states and then again after each one you consider three actions three actions here three actions here and so on. So ultimately you're going to kind of have an overview over at planning horizon which here we call H. You kind of look ahead a couple of steps or there are various ways of doing this but ultimately you will basically find that this path here is really good so I think I'm going to take this as a first action. So trajectory optimization considers finding the best green path here in this tree of possibilities that your your world model gives you. Okay. Now what does what do these people say? They say this procedure often suffers from exploiting inaccuracies of the learned model. What does that mean? That basically means that if I have a world model and it is not accurate then it is basically basically the thing that tries to find the best green path here the optimizer is sort of trying to find the the best path against this world model. Now if that world model is inaccurate that can lead to devastating consequences. So what do we mean by this? I'll give you an example. If you have a room right and the room is let's take our classic room like this and you are here and you would like to go here. And so you're a reinforcement learning agent. You do some exploration right? You explore a bit here the next episode you might go here and you might go here and so on and over time in this framework you're going to build a model of the world. So at the beginning we won't tell you how these rooms look you have to discover it by yourself. So maybe at the beginning we only tell you there's these four walls the rest you have to figure out. So on and on you're gonna fill in your blanks. You do your first explorations and you have a there's a bit of a wall here right and there might be some wall here I crashed into that right? You're going to hear the crashing to wall you saw there's a wall here and here oh there's a wall here you go maybe here oh there's no wall so you go further there's no wall anywhere here you crash here okay we already knew there's a wall maybe you crash here. Alright so right now you have okay you go here you have you have a model of the world in this situation where there's a wall here a wall down and if you now try to do trajectory optimization remember you have to go from here to here if you try to do trajectory optimization what is it going to turn out? It's going to turn out like look there you go that works just fine and that's because you're so good at planning I mean you are good at planning but because your model is inaccurate here because it has never seen this your entire training distribution that you trained the world model on only explored the area over here alright so you see how the more efficient this planning algorithm is like the blue arrow the thing that finds the blue arrow the more efficient that is the more consequential it is when you're a learned world model has mistakes because it will exactly exploit these mistakes in order to get the shortest path possible or the highest reward in that case and this they call this like almost an adversarial attack on the world model which is a pretty good way of framing it they propose actually to solve this problem they say we propose to regularize trajectory optimization by means of a denoising autoencoder that is trained on the same trajectories as the model of the environment we show that the proposed regularization leads to improve planning with both gradient based and gradient free optimizers we also demonstrate that using regularized trajectory optimization leads to rapid initial learning in a set of popular motor control tasks which suggests that the proposed approach can be useful tool for improving sample efficiency so in essence what do they do they basically say okay we want to regularize this using a denoising autoencoder and I think it's best if we if we look at the at the math for doing this so the math here starts off as follows saying you want to learn a world model this is F here F is the world model it takes in a state and an action and it gives you the next state or an approximation to it and the parameters here indicate that this is some sort of function that you learn like a deep neural network you can do this in fully or partially observed environments now when you plan what you want to do is you say I have a planning horizon H right and I have a reward function and the reward function is going to give me a reward for each state action pair so if I'm in a state and I do a certain action I'm going to get some reward this could be you have reached the target or this could be you know how much money you've collected or what not so you're going to look a horizon age you're going to look age steps into the future and you want to maximize the sum of all the rewards here so in the limit this reduces to simply like for example reaching the target in our room's case if if H is infinite but you can consider a lower planning horizon so you want to find the action sequence that maximizes this reward in the future okay and now this reward relies on your environment model okay so here's the the algorithm first you collect some data okay that's how you start off then train the dynamics model the world model using the data you've already collected then for each time step t you want to optimize this trajectory so you want to find the best next action sequence and take the first action implement the first action and get the new observation and do you do this in a loop until the end and at the end you say at this data to D so that's what that's what you do you use your world model to get the best action sequence that's how you optimize the trajectory and then at the end of the episode you've you've done an episode right you went somewhere you put all of this into your training data to make the world model better important to note here is that the world model will only learn about things that you have done right so there is kind of an interaction effect that's the green area here the world model only knows the paths the world model only can accurately estimate the world where you have been and that's going to turn out to be the entire problem because the these blue arrow finder can now go away from the from that that's explained here potential inaccuracies of the trained model cause substantial difficulties for the planning process rather than optimizing what really happens planning can easily end up exploiting the weaknesses of the predictive model planning is effectively an adversarial attack against the agent's own forward model this results in a wide gap between expectations based on the model and what actually happens okay and they have this this example here where it's like an industrial control process and what you have to imagine there's like some sort of a container here with a liquid liquid in it and there are two two pipes that lead to this container pipe one and pipe two and there are valves here so there's this valve right here and there's this valve right here so these are valve one and valve two and there is also an output pipe right here and that's a another valve right here so you can control these three valves the in two inputs and one output and you have to somehow optimize the reaction in here so this is a chemical reaction made up out of the two liquids that flow in here and you have to somehow optimize a property of that and that's highly non linear and has maybe like time time shifts so when you open a valve it's going to take a while and then it's very non-linear and then you are not supposed to break the pressure limit so you have to also outflow some stuff and if you just do this with a learned model it looks like this so first of all here is a classic controller like people have been doing this stuff in industry and they basically build controllers for it and you can you can do that and that works out really okay-ish as you can see right here this is the product rate what you're supposed to optimize and you see some sort of a smooth you're supposed to actually bring it to this dashed line right here and this is some sort of smooth thing right and you're supposed to I guess bring the pressure here and the A in purge I don't know what these quantities are but you're supposed to bring them to the dashed line and it's very non-linear and very time dependent so that works and you see here kind of the smoothness by which the variables are manipulated now if you just learn a world model and then do this trajectory optimization basically basically this is some sort of a yeah reinforce planning based reinforcement learning with a world model you see right here it works but it's super jittery the pressure spikes here and apparently this here is a pressure limit so it spikes the pressure limit and you can see that the manipulated variables are up and down and up and down and up and down because at each step it basically completely overestimates it's it's potentially rewarded things like wow this is really good but all it does is find a weakness in the model and not a really good action per se now with their method to already take it away you can see that now the control task super smoothly and very quickly converges to these optimal things and you can see that the variables being manipulated are also rather smoothly manipulated and that's an indication that the model is accurately estimating their rewards okay so how do they do it via what they call trajectory we are regularization of trajectory optimization so in essence what do we want to regularize here there are many things we could do to solve this but the way this paper goes is they say we not only do we want the most return we also want a high log probability of our of our taken path so this here as you can see this is observation action and and so on observation action so this is the future this right here is the the future so this this sequence here is going is what is going to give me the reward right here right so G is also dependent on these things but it's not said explicitly here so G is dependent on your plan or maybe let's not call this the future this is the plan okay this is the plan you came up with so this is directly going to influence G and G is the reward you're going to get under your model but also you want the log probability of the plan itself to be high now there I think there is a bit there is something missing here and that is conditioned on your training distribution right here and I think that's a actually a rather crucial part now that's that's the KL thing so this is conditioned on your training so what you want is you want the plan to be basically in your training distribution so you you want what you you want your plan that you're going to execute if that is actually part of your training dataset then you know I have already executed this once before and it's reasonable to assume that therefore my world model has learned from this experience and is going to give me an accurate reward if we go back to our rooms example then here somewhere if we go back to our rooms example right you you see that anywhere in the green area where I have already explored the world model is fairly good right it's going to give me accurate reflection of the world but as soon as I go outside the green area it is not and inside the green area is basically where my training data is now if I in the future actually take a path here crashing to a wall right here right the you saw in the algorithm at the end of an episode I'm going to add my trajectory to the training data for the world model so this green part here expands to include that and now if I go here again if my plan goes there again now I can trust the world model but also now it has it is actually correct because it has a wall here so you see that the regularization basically you not only do I want the biggest reward possible under my world model I also want that the plan that I'm about to execute is has a high probability under my training distribution okay and the way we do this is by denoising auto encoders so I want the log probability here to be high and you do this via a denoising auto encoder what's a denoising auto encoder a denoising auto encoder is basically so if you have for example an image and the image is of a our trusty cat whiskers and a denoising auto encoder is an unsupervised method where you have it's basically an auto encoder so there is a bunch of layers compressing to a hidden representation then uncompressing it again okay and at the end you want to output the same as at the beginning so it's basically an auto encoder but the special part about the denoising auto encoder is that first you take your input and you know you put some noise on it so that could mean could mean anything here but here what they do is they do they make some Gaussian noise on it now I can't really draw Gaussian noise here but it would be kind of convolved with Gaussian Gaussian noise so I'm just going to add some noise like this so noise noise noise noise so there's some noise you see and then you feed that that's now what you feed in here and the algorithm is supposed to reconstruct this this original image so that the algorithm is basically supposed to take away the noise it doesn't see the original image but it's supposed to produce it and you do this with your training data so what does that mean ultimately for our trajectory optimization it means that if I have a trajectory that I did before and it maybe goes here right what I can do is I can make a noisy version of it which would be the black one right here so I put some noise on it some noise right it's kind of the same but okay and the denoising autoencoder is supposed to give me back the red one this will simply give me some sort of a probabilistic model of my training distribution so they go through the math here and show that these denoising autoencoders actually naturally output this log probability sorry the gradient of the log probability because optimal denoising theory says that for zero mean and Gaussian noise the optimal denoising function the optimal the optimal denoising function for zero mean Gaussian corruption is this thing right here so it is if if I if you give me X and you tell me X has been corrupted by zero mean Gaussian noise of size sigma and then the best and and you simply tell me give me back the original image the best thing I can do is to take what you gave me and add this gradient of the log probability of X if if I can if I have a model of the log probability right so that's the best thing I can do and that's the best denoising function and now you have to think a bit of in reverse if we train a denoising autoencoder that is going to approximate this best function that there is okay so we know that the best possible denoising function is this we train a denoising autoencoder which in the optimal case is going to converge to the best denoising function so if we then reformulate and we do denoising autoencoder of X minus or X tilde minus X tilde that is go or divided by this standard deviation sorry the variance that is going to give us this quantity right here the gradient of the log probability and the gradient of the log probability of X is exactly what we need to run gradient descent on our function so here is our function again G plus this regularization now they don't regularize over the entire future but over these windows but in essence it's G plus the log probability of your plan if you take the gradient of that of course you take the gradient of the sum so it's the gradient of G plus the gradient of the log probability with respect to the actions and here simple application of the chain rule will tell you that you have to propagate through the input through the X and you need this quantity the gradient of the log probability with respect to its inputs now as we just saw the optimal denoising autoencoder is going to output that problem that thing so if we train a denoising autoencoder and we suppose it's reaches a good accuracy then we can obtain this quantity basically for free and that's the entire trick here so in essence what does it mean in essence what it means is that if we are in our room again and we have our partial model of the world let's say we have this model because we are here and all we've ever explored is so we've explored this these things right here okay and this now when I go and do my trajectory optimization and my trajectory optimization wants to go here I simply say no I don't know that I haven't seen that yet you can only plan basically within the space where we have already been so you can plan like here so here now there is of course there is going to be some exploration so some probability that you can go away of it but not too much right so in this case it would result in the planning only to happen in spaces where we've actually been so it might go here and then here because okay here we haven't been anywhere but then that would lead me to take the first step in this direction and not in this direction and if I take my first step in this first direction then of course I'm going to be already a bit on the correct path right here whereas I if I take the first step into this direction then after that I'm gonna have to if once I crash here I'm gonna have to correct really hard and that's exactly what's going to give you this super trajectory control whereas if you only plan where you've already been you won't the probability that you're going to have to do like a 180 is going to be much much lower okay that seems like that's about it let's look at the experiments so their experiments basically I actually want to go down here to this industry sorry not the industrial control process but to the mujouco experiment so these are kind of continues control tasks you might have seen it so there's some like one is a a the anterior is basically this 3d and there's like a blob and it has I think four legs and each leg has two joints and it just needs to walk as far as possible or reach some sort of goal and the half cheetah is like a 2d thing where I think it's something like this it also has these two legs and it's supposed to walk forward and not fall over and you can put force basically on each of the of the joints here so you see that their baselines are Gaussian processes and this pet thing is a previous baseline to do do also do model based control with a learned model and here they there's is the main their main one is the red one and as you can see that it goes much fast well it basically outperforms the rest in these high in these more complicated tasks and then card pole or something like this is is lower dimensional easier tasks and you can see that at least it does not hurt they make they say here something they don't they don't show in the plots they say that if you let this run for a while then basically the their method doesn't make any improvement anymore whereas the baseline methods will sort of at some points or pass it and the reason that is and I'm not sure if it's on this exact task but they mentioned that which it's it's I respect so far is because they say since we only plan where we know since we only plan where we know we basically do much less exploration than others we we kind of stick to what we know when we plan so inherently we do less exploration and doing our conversation with Hari he basically said that this is intended and the base the intention is that you want to do your planning where you know and then explicitly add a component that does exploration so you have control over so you can basically say huh I I've never been here sort of now you would be in an expression phase you would explicitly go there rather than intermingle your your planning with your exploration and basically rely on your planning to screw up and you're you exploring because if you're planning if you're planning never screws up then you won't explore either right then you will always reach your goal or your planning will always be correct and these other methods that don't have this explicitly they explore every time they're planning screws up and you don't want that you want your planning to be as good as possible and they do that by sticking to what they know and then they the next step which is not in this paper would be to add an explicit exploration policy to reach areas they've never reached before okay so that's the reason why they don't ultimately reach the best accuracy but they do reach a the initial accuracy much faster than the other tasks because they plan better they have a long discussion here of what still problems are like local minima or the planning horizon problem open loop versus closed loop compounding errors in planning but I'm gonna leave this out for now and I thank you for being here I very much invite you to check out the paper for more details it's pretty cool pretty easy to read actually it's very written very well and with that see you next time bye bye | [{"start": 0.0, "end": 4.98, "text": " Hi there. Today we're looking at regularizing trajectory optimization with"}, {"start": 4.98, "end": 11.48, "text": " denoising auto encoders by Renew Bonay, Normand de Paolo and others of various"}, {"start": 11.48, "end": 17.16, "text": " places but a lot of the people are from Curious AI and we actually had a"}, {"start": 17.16, "end": 24.080000000000002, "text": " discussion with Hari who is the CEO of Curious AI and this was on our machine"}, {"start": 24.080000000000002, "end": 28.560000000000002, "text": " learning street talk podcast. So this is another YouTube channel for those of you"}, {"start": 28.56, "end": 34.04, "text": " who don't know where every week or so we try to have either an interesting"}, {"start": 34.04, "end": 39.08, "text": " discussion or a guest like sort of an interview or talk about comment on the"}, {"start": 39.08, "end": 44.599999999999994, "text": " talk. So if it is not out yet I'll link to it as soon as it comes out but if"}, {"start": 44.599999999999994, "end": 49.04, "text": " you're watching this video later make sure to check out our conversation with"}, {"start": 49.04, "end": 54.4, "text": " Hari because it was absolutely fantastic and in general if you like videos like"}, {"start": 54.4, "end": 59.28, "text": " this consider subscribing liking sharing if you're still here at the end and"}, {"start": 59.28, "end": 64.88, "text": " liked it. Okay so this paper on a high level deals with model-based"}, {"start": 64.88, "end": 70.28, "text": " reinforcement learning. Model-based reinforcement learning means that you are"}, {"start": 70.28, "end": 77.8, "text": " using a model of the world to do reinforcement learning. So in essence if you"}, {"start": 77.8, "end": 82.36, "text": " have your reinforcement learning setup where you are an agent and you have to"}, {"start": 82.36, "end": 87.12, "text": " interact with the world you have to do so in many steps in like a round trip"}, {"start": 87.12, "end": 92.44, "text": " fashion. So you put an action you act and the world gives you back an observation"}, {"start": 92.44, "end": 98.56, "text": " and you have to act in the world over and over and over such that you will be"}, {"start": 98.56, "end": 103.8, "text": " able to maximize your reward. Now what is model-based reinforcement learning?"}, {"start": 103.8, "end": 108.48, "text": " Model-based reinforcement learning basically means that the agent here has"}, {"start": 108.48, "end": 117.72, "text": " internally a model of the world. So it sort of understands how the world works."}, {"start": 117.72, "end": 122.08, "text": " Situations where you have a accurate model of the world are things like chess."}, {"start": 122.08, "end": 126.56, "text": " So in chess the rules are very clear you know how the world's gonna behave if"}, {"start": 126.56, "end": 131.88, "text": " you perform a certain action but in real world applications it's very very"}, {"start": 131.88, "end": 137.68, "text": " hard to actually make a model so people usually rely on learned models. So what"}, {"start": 137.68, "end": 142.44, "text": " does it mean? You basically learn a neural network that tries to predict how the"}, {"start": 142.44, "end": 148.36, "text": " world is going to act. So this here is going to be a deep neural network that you"}, {"start": 148.36, "end": 154.68, "text": " learn from what you see in the world. Now trajectory optimization basically"}, {"start": 154.68, "end": 160.52, "text": " means that you are now you now have this world model and you use it to look"}, {"start": 160.52, "end": 164.96, "text": " ahead as I said. So you are in the state like here and you can do let's say"}, {"start": 164.96, "end": 170.96, "text": " three different actions and you use your world model here world and you see"}, {"start": 170.96, "end": 175.08, "text": " you think how's the world going to react if I do either of those three things."}, {"start": 175.08, "end": 179.24, "text": " And then you get into three different states and then again after each one you"}, {"start": 179.24, "end": 184.48000000000002, "text": " consider three actions three actions here three actions here and so on. So"}, {"start": 184.48000000000002, "end": 189.16, "text": " ultimately you're going to kind of have an overview over at planning horizon"}, {"start": 189.16, "end": 195.6, "text": " which here we call H. You kind of look ahead a couple of steps or there are"}, {"start": 195.6, "end": 200.04, "text": " various ways of doing this but ultimately you will basically find that this"}, {"start": 200.04, "end": 207.4, "text": " path here is really good so I think I'm going to take this as a first action."}, {"start": 207.4, "end": 213.68, "text": " So trajectory optimization considers finding the best green path here in this"}, {"start": 213.68, "end": 221.56, "text": " tree of possibilities that your your world model gives you. Okay. Now what does"}, {"start": 221.56, "end": 226.64000000000001, "text": " what do these people say? They say this procedure often suffers from"}, {"start": 226.64000000000001, "end": 232.0, "text": " exploiting inaccuracies of the learned model. What does that mean? That"}, {"start": 232.0, "end": 237.08, "text": " basically means that if I have a world model and it is not accurate then it is"}, {"start": 237.08, "end": 242.4, "text": " basically basically the thing that tries to find the best green path here the"}, {"start": 242.4, "end": 249.48000000000002, "text": " optimizer is sort of trying to find the the best path against this world model."}, {"start": 249.48000000000002, "end": 254.92000000000002, "text": " Now if that world model is inaccurate that can lead to devastating consequences."}, {"start": 254.92000000000002, "end": 260.92, "text": " So what do we mean by this? I'll give you an example. If you have a room right"}, {"start": 260.92, "end": 269.52, "text": " and the room is let's take our classic room like this and you are here and you"}, {"start": 269.52, "end": 274.88, "text": " would like to go here. And so you're a reinforcement learning agent. You do"}, {"start": 274.88, "end": 279.56, "text": " some exploration right? You explore a bit here the next episode you might go"}, {"start": 279.56, "end": 283.88, "text": " here and you might go here and so on and over time in this framework you're"}, {"start": 283.88, "end": 288.64, "text": " going to build a model of the world. So at the beginning we won't tell you how"}, {"start": 288.64, "end": 292.71999999999997, "text": " these rooms look you have to discover it by yourself. So maybe at the beginning"}, {"start": 292.71999999999997, "end": 297.47999999999996, "text": " we only tell you there's these four walls the rest you have to figure out. So"}, {"start": 297.48, "end": 302.20000000000005, "text": " on and on you're gonna fill in your blanks. You do your first explorations and"}, {"start": 302.20000000000005, "end": 307.12, "text": " you have a there's a bit of a wall here right and there might be some wall here I"}, {"start": 307.12, "end": 311.36, "text": " crashed into that right? You're going to hear the crashing to wall you saw there's"}, {"start": 311.36, "end": 315.96000000000004, "text": " a wall here and here oh there's a wall here you go maybe here oh there's no wall"}, {"start": 315.96000000000004, "end": 320.72, "text": " so you go further there's no wall anywhere here you crash here okay we already"}, {"start": 320.72, "end": 326.52000000000004, "text": " knew there's a wall maybe you crash here. Alright so right now you have okay you"}, {"start": 326.52, "end": 331.03999999999996, "text": " go here you have you have a model of the world in this situation where there's a"}, {"start": 331.03999999999996, "end": 337.79999999999995, "text": " wall here a wall down and if you now try to do trajectory optimization remember"}, {"start": 337.79999999999995, "end": 343.12, "text": " you have to go from here to here if you try to do trajectory optimization what"}, {"start": 343.12, "end": 348.88, "text": " is it going to turn out? It's going to turn out like look there you go that works"}, {"start": 348.88, "end": 354.28, "text": " just fine and that's because you're so good at planning I mean you are good"}, {"start": 354.28, "end": 359.44, "text": " at planning but because your model is inaccurate here because it has never seen"}, {"start": 359.44, "end": 363.59999999999997, "text": " this your entire training distribution that you trained the world model on"}, {"start": 363.59999999999997, "end": 370.4, "text": " only explored the area over here alright so you see how the more efficient this"}, {"start": 370.4, "end": 374.79999999999995, "text": " planning algorithm is like the blue arrow the thing that finds the blue arrow"}, {"start": 374.79999999999995, "end": 379.28, "text": " the more efficient that is the more consequential it is when you're a learned"}, {"start": 379.28, "end": 385.2, "text": " world model has mistakes because it will exactly exploit these mistakes in"}, {"start": 385.2, "end": 391.4, "text": " order to get the shortest path possible or the highest reward in that case and"}, {"start": 391.4, "end": 396.79999999999995, "text": " this they call this like almost an adversarial attack on the world model"}, {"start": 396.79999999999995, "end": 406.11999999999995, "text": " which is a pretty good way of framing it they propose actually to solve this"}, {"start": 406.12, "end": 410.8, "text": " problem they say we propose to regularize trajectory optimization by means of a"}, {"start": 410.8, "end": 414.96, "text": " denoising autoencoder that is trained on the same trajectories as the model of"}, {"start": 414.96, "end": 419.72, "text": " the environment we show that the proposed regularization leads to improve"}, {"start": 419.72, "end": 423.96, "text": " planning with both gradient based and gradient free optimizers we also"}, {"start": 423.96, "end": 428.4, "text": " demonstrate that using regularized trajectory optimization leads to rapid"}, {"start": 428.4, "end": 433.56, "text": " initial learning in a set of popular motor control tasks which suggests that"}, {"start": 433.56, "end": 440.28000000000003, "text": " the proposed approach can be useful tool for improving sample efficiency so in"}, {"start": 440.28000000000003, "end": 446.16, "text": " essence what do they do they basically say okay we want to regularize this"}, {"start": 446.16, "end": 453.08, "text": " using a denoising autoencoder and I think it's best if we if we look at the"}, {"start": 453.08, "end": 462.36, "text": " at the math for doing this so the math here starts off as follows saying you"}, {"start": 462.36, "end": 467.04, "text": " want to learn a world model this is F here F is the world model it takes in a"}, {"start": 467.04, "end": 472.92, "text": " state and an action and it gives you the next state or an approximation to it"}, {"start": 472.92, "end": 477.04, "text": " and the parameters here indicate that this is some sort of function that you"}, {"start": 477.04, "end": 481.96000000000004, "text": " learn like a deep neural network you can do this in fully or partially observed"}, {"start": 481.96000000000004, "end": 489.6, "text": " environments now when you plan what you want to do is you say I have a planning"}, {"start": 489.6, "end": 497.12, "text": " horizon H right and I have a reward function and the reward function is going to"}, {"start": 497.12, "end": 502.12, "text": " give me a reward for each state action pair so if I'm in a state and I do a"}, {"start": 502.12, "end": 507.40000000000003, "text": " certain action I'm going to get some reward this could be you have reached the"}, {"start": 507.40000000000003, "end": 511.44, "text": " target or this could be you know how much money you've collected or what not"}, {"start": 511.44, "end": 516.6800000000001, "text": " so you're going to look a horizon age you're going to look age steps into the"}, {"start": 516.68, "end": 522.8399999999999, "text": " future and you want to maximize the sum of all the rewards here so in the limit"}, {"start": 522.8399999999999, "end": 527.8399999999999, "text": " this reduces to simply like for example reaching the target in our room's case"}, {"start": 527.8399999999999, "end": 534.4, "text": " if if H is infinite but you can consider a lower planning horizon so you want"}, {"start": 534.4, "end": 541.4799999999999, "text": " to find the action sequence that maximizes this reward in the future okay and"}, {"start": 541.48, "end": 551.24, "text": " now this reward relies on your environment model okay so here's the the"}, {"start": 551.24, "end": 557.0, "text": " algorithm first you collect some data okay that's how you start off then"}, {"start": 557.0, "end": 561.6800000000001, "text": " train the dynamics model the world model using the data you've already"}, {"start": 561.6800000000001, "end": 568.16, "text": " collected then for each time step t you want to optimize this trajectory so you"}, {"start": 568.16, "end": 572.76, "text": " want to find the best next action sequence and take the first action implement"}, {"start": 572.76, "end": 577.0, "text": " the first action and get the new observation and do you do this in a loop"}, {"start": 577.0, "end": 581.8, "text": " until the end and at the end you say at this data to D so that's what that's"}, {"start": 581.8, "end": 588.24, "text": " what you do you use your world model to get the best action sequence that's how"}, {"start": 588.24, "end": 593.36, "text": " you optimize the trajectory and then at the end of the episode you've you've"}, {"start": 593.36, "end": 597.68, "text": " done an episode right you went somewhere you put all of this into your training"}, {"start": 597.68, "end": 604.3199999999999, "text": " data to make the world model better important to note here is that the world"}, {"start": 604.3199999999999, "end": 610.8, "text": " model will only learn about things that you have done right so there is kind of"}, {"start": 610.8, "end": 615.4799999999999, "text": " an interaction effect that's the green area here the world model only knows the"}, {"start": 615.4799999999999, "end": 620.92, "text": " paths the world model only can accurately estimate the world where you have"}, {"start": 620.92, "end": 627.8, "text": " been and that's going to turn out to be the entire problem because the these"}, {"start": 627.8, "end": 636.8399999999999, "text": " blue arrow finder can now go away from the from that that's explained here"}, {"start": 636.8399999999999, "end": 642.04, "text": " potential inaccuracies of the trained model cause substantial difficulties for"}, {"start": 642.04, "end": 647.0799999999999, "text": " the planning process rather than optimizing what really happens planning can"}, {"start": 647.08, "end": 652.2800000000001, "text": " easily end up exploiting the weaknesses of the predictive model planning is"}, {"start": 652.2800000000001, "end": 656.44, "text": " effectively an adversarial attack against the agent's own forward model this"}, {"start": 656.44, "end": 661.44, "text": " results in a wide gap between expectations based on the model and what actually"}, {"start": 661.44, "end": 667.8000000000001, "text": " happens okay and they have this this example here where it's like an industrial"}, {"start": 667.8000000000001, "end": 671.96, "text": " control process and what you have to imagine there's like some sort of a"}, {"start": 671.96, "end": 679.08, "text": " container here with a liquid liquid in it and there are two two pipes that lead"}, {"start": 679.08, "end": 685.48, "text": " to this container pipe one and pipe two and there are valves here so there's"}, {"start": 685.48, "end": 691.36, "text": " this valve right here and there's this valve right here so these are valve one"}, {"start": 691.36, "end": 696.6, "text": " and valve two and there is also an output pipe right here and that's a"}, {"start": 696.6, "end": 702.16, "text": " another valve right here so you can control these three valves the in two"}, {"start": 702.16, "end": 709.6, "text": " inputs and one output and you have to somehow optimize the reaction in here so"}, {"start": 709.6, "end": 713.96, "text": " this is a chemical reaction made up out of the two liquids that flow in here"}, {"start": 713.96, "end": 717.8000000000001, "text": " and you have to somehow optimize a property of that and that's highly non"}, {"start": 717.8000000000001, "end": 722.6800000000001, "text": " linear and has maybe like time time shifts so when you open a valve it's"}, {"start": 722.68, "end": 727.2399999999999, "text": " going to take a while and then it's very non-linear and then you are not"}, {"start": 727.2399999999999, "end": 732.88, "text": " supposed to break the pressure limit so you have to also outflow some stuff and"}, {"start": 732.88, "end": 738.0, "text": " if you just do this with a learned model it looks like this so first of all"}, {"start": 738.0, "end": 742.4399999999999, "text": " here is a classic controller like people have been doing this stuff in"}, {"start": 742.4399999999999, "end": 748.7199999999999, "text": " industry and they basically build controllers for it and you can you can do"}, {"start": 748.72, "end": 754.48, "text": " that and that works out really okay-ish as you can see right here this is the"}, {"start": 754.48, "end": 758.08, "text": " product rate what you're supposed to optimize and you see some sort of a"}, {"start": 758.08, "end": 763.4, "text": " smooth you're supposed to actually bring it to this dashed line right here"}, {"start": 763.4, "end": 769.36, "text": " and this is some sort of smooth thing right and you're supposed to I guess"}, {"start": 769.36, "end": 774.52, "text": " bring the pressure here and the A in purge I don't know what these quantities"}, {"start": 774.52, "end": 778.48, "text": " are but you're supposed to bring them to the dashed line and it's very non-linear"}, {"start": 778.48, "end": 784.44, "text": " and very time dependent so that works and you see here kind of the smoothness"}, {"start": 784.44, "end": 789.48, "text": " by which the variables are manipulated now if you just learn a world model and"}, {"start": 789.48, "end": 796.6, "text": " then do this trajectory optimization basically basically this is some sort of a"}, {"start": 796.6, "end": 801.36, "text": " yeah reinforce planning based reinforcement learning with a world model you"}, {"start": 801.36, "end": 807.84, "text": " see right here it works but it's super jittery the pressure spikes here and"}, {"start": 807.84, "end": 812.84, "text": " apparently this here is a pressure limit so it spikes the pressure limit and you"}, {"start": 812.84, "end": 816.32, "text": " can see that the manipulated variables are up and down and up and down and up"}, {"start": 816.32, "end": 821.72, "text": " and down because at each step it basically completely overestimates it's"}, {"start": 821.72, "end": 825.6800000000001, "text": " it's potentially rewarded things like wow this is really good but all it does"}, {"start": 825.6800000000001, "end": 831.12, "text": " is find a weakness in the model and not a really good action per se now with"}, {"start": 831.12, "end": 837.48, "text": " their method to already take it away you can see that now the control task super"}, {"start": 837.48, "end": 842.9200000000001, "text": " smoothly and very quickly converges to these optimal things and you can see"}, {"start": 842.9200000000001, "end": 848.12, "text": " that the variables being manipulated are also rather smoothly manipulated and"}, {"start": 848.12, "end": 856.4, "text": " that's an indication that the model is accurately estimating their rewards"}, {"start": 856.4, "end": 864.64, "text": " okay so how do they do it via what they call trajectory we are regularization"}, {"start": 864.64, "end": 869.56, "text": " of trajectory optimization so in essence what do we want to regularize here"}, {"start": 869.56, "end": 875.0, "text": " there are many things we could do to solve this but the way this paper goes is"}, {"start": 875.0, "end": 883.0, "text": " they say we not only do we want the most return we also want a high log"}, {"start": 883.0, "end": 890.4399999999999, "text": " probability of our of our taken path so this here as you can see this is"}, {"start": 890.44, "end": 896.8000000000001, "text": " observation action and and so on observation action so this is the future this"}, {"start": 896.8000000000001, "end": 907.8000000000001, "text": " right here is the the future so this this sequence here is going is what is"}, {"start": 907.8000000000001, "end": 913.2, "text": " going to give me the reward right here right so G is also dependent on these"}, {"start": 913.2, "end": 918.1600000000001, "text": " things but it's not said explicitly here so G is dependent on your plan or"}, {"start": 918.16, "end": 923.56, "text": " maybe let's not call this the future this is the plan okay this is the plan you"}, {"start": 923.56, "end": 928.48, "text": " came up with so this is directly going to influence G and G is the reward you're"}, {"start": 928.48, "end": 933.1999999999999, "text": " going to get under your model but also you want the log probability of the plan"}, {"start": 933.1999999999999, "end": 938.24, "text": " itself to be high now there I think there is a bit there is something missing"}, {"start": 938.24, "end": 944.12, "text": " here and that is conditioned on your training distribution right here and I"}, {"start": 944.12, "end": 949.92, "text": " think that's a actually a rather crucial part now that's that's the KL thing so"}, {"start": 949.92, "end": 956.4, "text": " this is conditioned on your training so what you want is you want the plan to be"}, {"start": 956.4, "end": 964.96, "text": " basically in your training distribution so you you want what you you want your"}, {"start": 964.96, "end": 969.6800000000001, "text": " plan that you're going to execute if that is actually part of your training"}, {"start": 969.68, "end": 976.5999999999999, "text": " dataset then you know I have already executed this once before and it's"}, {"start": 976.5999999999999, "end": 981.64, "text": " reasonable to assume that therefore my world model has learned from this"}, {"start": 981.64, "end": 986.56, "text": " experience and is going to give me an accurate reward if we go back to our"}, {"start": 986.56, "end": 994.56, "text": " rooms example then here somewhere if we go back to our rooms example right you"}, {"start": 994.56, "end": 999.1999999999999, "text": " you see that anywhere in the green area where I have already explored the"}, {"start": 999.2, "end": 1004.1600000000001, "text": " world model is fairly good right it's going to give me accurate reflection of"}, {"start": 1004.1600000000001, "end": 1010.6400000000001, "text": " the world but as soon as I go outside the green area it is not and inside the"}, {"start": 1010.6400000000001, "end": 1016.12, "text": " green area is basically where my training data is now if I in the future"}, {"start": 1016.12, "end": 1021.44, "text": " actually take a path here crashing to a wall right here right the you saw in the"}, {"start": 1021.44, "end": 1025.88, "text": " algorithm at the end of an episode I'm going to add my trajectory to the"}, {"start": 1025.88, "end": 1030.4, "text": " training data for the world model so this green part here expands to include"}, {"start": 1030.4, "end": 1038.8400000000001, "text": " that and now if I go here again if my plan goes there again now I can trust the"}, {"start": 1038.8400000000001, "end": 1042.3600000000001, "text": " world model but also now it has it is actually correct because it has a wall"}, {"start": 1042.3600000000001, "end": 1047.48, "text": " here so you see that the regularization basically you not only do I want the"}, {"start": 1047.48, "end": 1053.0, "text": " biggest reward possible under my world model I also want that the plan that"}, {"start": 1053.0, "end": 1059.12, "text": " I'm about to execute is has a high probability under my training distribution"}, {"start": 1059.12, "end": 1069.2, "text": " okay and the way we do this is by denoising auto encoders so I want the"}, {"start": 1069.2, "end": 1073.4, "text": " log probability here to be high and you do this via a denoising auto encoder"}, {"start": 1073.4, "end": 1082.64, "text": " what's a denoising auto encoder a denoising auto encoder is basically so if"}, {"start": 1082.64, "end": 1090.96, "text": " you have for example an image and the image is of a our trusty cat whiskers and"}, {"start": 1090.96, "end": 1096.2, "text": " a denoising auto encoder is an unsupervised method where you have it's"}, {"start": 1096.2, "end": 1101.44, "text": " basically an auto encoder so there is a bunch of layers compressing to a hidden"}, {"start": 1101.44, "end": 1110.5200000000002, "text": " representation then uncompressing it again okay and at the end you want to"}, {"start": 1110.52, "end": 1116.2, "text": " output the same as at the beginning so it's basically an auto encoder but the"}, {"start": 1116.2, "end": 1121.72, "text": " special part about the denoising auto encoder is that first you take your input"}, {"start": 1121.72, "end": 1128.04, "text": " and you know you put some noise on it so that could mean could mean anything"}, {"start": 1128.04, "end": 1133.48, "text": " here but here what they do is they do they make some Gaussian noise on it now I"}, {"start": 1133.48, "end": 1137.76, "text": " can't really draw Gaussian noise here but it would be kind of convolved with"}, {"start": 1137.76, "end": 1142.84, "text": " Gaussian Gaussian noise so I'm just going to add some noise like this so noise"}, {"start": 1142.84, "end": 1150.72, "text": " noise noise noise so there's some noise you see and then you feed that that's"}, {"start": 1150.72, "end": 1156.96, "text": " now what you feed in here and the algorithm is supposed to reconstruct this"}, {"start": 1156.96, "end": 1161.92, "text": " this original image so that the algorithm is basically supposed to take away"}, {"start": 1161.92, "end": 1166.08, "text": " the noise it doesn't see the original image but it's supposed to produce it and"}, {"start": 1166.08, "end": 1170.48, "text": " you do this with your training data so what does that mean ultimately for our"}, {"start": 1170.48, "end": 1178.0, "text": " trajectory optimization it means that if I have a trajectory that I did before"}, {"start": 1178.0, "end": 1185.6, "text": " and it maybe goes here right what I can do is I can make a noisy version of it"}, {"start": 1185.6, "end": 1192.6, "text": " which would be the black one right here so I put some noise on it some noise"}, {"start": 1192.6, "end": 1198.36, "text": " right it's kind of the same but okay and the denoising autoencoder is"}, {"start": 1198.36, "end": 1204.1999999999998, "text": " supposed to give me back the red one this will simply give me some sort of a"}, {"start": 1204.1999999999998, "end": 1208.32, "text": " probabilistic model of my training distribution so they go through the math"}, {"start": 1208.32, "end": 1212.6399999999999, "text": " here and show that these denoising autoencoders actually naturally output this"}, {"start": 1212.6399999999999, "end": 1220.0, "text": " log probability sorry the gradient of the log probability because optimal"}, {"start": 1220.0, "end": 1227.56, "text": " denoising theory says that for zero mean and Gaussian noise the optimal denoising"}, {"start": 1227.56, "end": 1234.04, "text": " function the optimal the optimal denoising function for zero mean Gaussian"}, {"start": 1234.04, "end": 1242.64, "text": " corruption is this thing right here so it is if if I if you give me X and you"}, {"start": 1242.64, "end": 1252.3600000000001, "text": " tell me X has been corrupted by zero mean Gaussian noise of size sigma and"}, {"start": 1252.3600000000001, "end": 1258.2800000000002, "text": " then the best and and you simply tell me give me back the original image the"}, {"start": 1258.2800000000002, "end": 1264.88, "text": " best thing I can do is to take what you gave me and add this gradient of the"}, {"start": 1264.88, "end": 1272.5200000000002, "text": " log probability of X if if I can if I have a model of the log probability right so"}, {"start": 1272.52, "end": 1279.68, "text": " that's the best thing I can do and that's the best denoising function and now"}, {"start": 1279.68, "end": 1286.36, "text": " you have to think a bit of in reverse if we train a denoising autoencoder that"}, {"start": 1286.36, "end": 1293.16, "text": " is going to approximate this best function that there is okay so we know that"}, {"start": 1293.16, "end": 1297.44, "text": " the best possible denoising function is this we train a denoising autoencoder"}, {"start": 1297.44, "end": 1303.2, "text": " which in the optimal case is going to converge to the best denoising function so"}, {"start": 1303.2, "end": 1313.4, "text": " if we then reformulate and we do denoising autoencoder of X minus or X tilde"}, {"start": 1313.4, "end": 1320.4, "text": " minus X tilde that is go or divided by this standard deviation sorry the"}, {"start": 1320.4, "end": 1327.68, "text": " variance that is going to give us this quantity right here the gradient of the"}, {"start": 1327.68, "end": 1335.3200000000002, "text": " log probability and the gradient of the log probability of X is exactly what we"}, {"start": 1335.3200000000002, "end": 1341.24, "text": " need to run gradient descent on our function so here is our function again G"}, {"start": 1341.24, "end": 1345.4, "text": " plus this regularization now they don't regularize over the entire future but"}, {"start": 1345.4, "end": 1351.44, "text": " over these windows but in essence it's G plus the log probability of your plan"}, {"start": 1351.44, "end": 1356.1200000000001, "text": " if you take the gradient of that of course you take the gradient of the sum so"}, {"start": 1356.1200000000001, "end": 1363.72, "text": " it's the gradient of G plus the gradient of the log probability with respect to"}, {"start": 1363.72, "end": 1367.96, "text": " the actions and here simple application of the chain rule will tell you that"}, {"start": 1367.96, "end": 1372.96, "text": " you have to propagate through the input through the X and you need this"}, {"start": 1372.96, "end": 1382.2, "text": " quantity the gradient of the log probability with respect to its inputs now as"}, {"start": 1382.2, "end": 1387.68, "text": " we just saw the optimal denoising autoencoder is going to output that"}, {"start": 1387.68, "end": 1393.76, "text": " problem that thing so if we train a denoising autoencoder and we suppose it's"}, {"start": 1393.76, "end": 1400.0, "text": " reaches a good accuracy then we can obtain this quantity basically for free and"}, {"start": 1400.0, "end": 1408.88, "text": " that's the entire trick here so in essence what does it mean in essence what it"}, {"start": 1408.88, "end": 1415.12, "text": " means is that if we are in our room again and we have our partial model of the"}, {"start": 1415.12, "end": 1420.64, "text": " world let's say we have this model because we are here and all we've ever"}, {"start": 1420.64, "end": 1429.92, "text": " explored is so we've explored this these things right here okay and this now"}, {"start": 1429.92, "end": 1434.48, "text": " when I go and do my trajectory optimization and my trajectory optimization"}, {"start": 1434.48, "end": 1439.5600000000002, "text": " wants to go here I simply say no I don't know that I haven't seen that yet you"}, {"start": 1439.5600000000002, "end": 1445.96, "text": " can only plan basically within the space where we have already been so you can"}, {"start": 1445.96, "end": 1453.4, "text": " plan like here so here now there is of course there is going to be some"}, {"start": 1453.4, "end": 1458.92, "text": " exploration so some probability that you can go away of it but not too much"}, {"start": 1458.92, "end": 1463.48, "text": " right so in this case it would result in the planning only to happen in"}, {"start": 1463.48, "end": 1469.0800000000002, "text": " spaces where we've actually been so it might go here and then here because"}, {"start": 1469.0800000000002, "end": 1474.3200000000002, "text": " okay here we haven't been anywhere but then that would lead me to take the first"}, {"start": 1474.3200000000002, "end": 1479.5600000000002, "text": " step in this direction and not in this direction and if I take my first step"}, {"start": 1479.5600000000002, "end": 1485.44, "text": " in this first direction then of course I'm going to be already a bit on the"}, {"start": 1485.44, "end": 1489.48, "text": " correct path right here whereas I if I take the first step into this direction"}, {"start": 1489.48, "end": 1493.6000000000001, "text": " then after that I'm gonna have to if once I crash here I'm gonna have to correct"}, {"start": 1493.6000000000001, "end": 1498.4, "text": " really hard and that's exactly what's going to give you this super"}, {"start": 1498.4, "end": 1503.72, "text": " trajectory control whereas if you only plan where you've already been you won't"}, {"start": 1503.72, "end": 1508.1200000000001, "text": " the probability that you're going to have to do like a 180 is going to be much"}, {"start": 1508.12, "end": 1520.12, "text": " much lower okay that seems like that's about it let's look at the"}, {"start": 1520.12, "end": 1529.0, "text": " experiments so their experiments basically I actually want to go down here to"}, {"start": 1529.0, "end": 1535.8, "text": " this industry sorry not the industrial control process but to the mujouco"}, {"start": 1535.8, "end": 1540.04, "text": " experiment so these are kind of continues control tasks you might have seen"}, {"start": 1540.04, "end": 1549.72, "text": " it so there's some like one is a a the anterior is basically this 3d and"}, {"start": 1549.72, "end": 1555.0, "text": " there's like a blob and it has I think four legs and each leg has two joints"}, {"start": 1555.0, "end": 1560.32, "text": " and it just needs to walk as far as possible or reach some sort of goal and the"}, {"start": 1560.32, "end": 1567.36, "text": " half cheetah is like a 2d thing where I think it's something like this it also"}, {"start": 1567.36, "end": 1572.84, "text": " has these two legs and it's supposed to walk forward and not fall over and you"}, {"start": 1572.84, "end": 1580.84, "text": " can put force basically on each of the of the joints here so you see that"}, {"start": 1580.84, "end": 1587.8799999999999, "text": " their baselines are Gaussian processes and this pet thing is a previous"}, {"start": 1587.88, "end": 1597.16, "text": " baseline to do do also do model based control with a learned model and here"}, {"start": 1597.16, "end": 1604.0800000000002, "text": " they there's is the main their main one is the red one and as you can see that"}, {"start": 1604.0800000000002, "end": 1611.0800000000002, "text": " it goes much fast well it basically outperforms the rest in these high in these"}, {"start": 1611.0800000000002, "end": 1617.0, "text": " more complicated tasks and then card pole or something like this is is lower"}, {"start": 1617.0, "end": 1624.68, "text": " dimensional easier tasks and you can see that at least it does not hurt they"}, {"start": 1624.68, "end": 1631.28, "text": " make they say here something they don't they don't show in the plots they say"}, {"start": 1631.28, "end": 1639.6, "text": " that if you let this run for a while then basically the their method doesn't"}, {"start": 1639.6, "end": 1645.24, "text": " make any improvement anymore whereas the baseline methods will sort of at"}, {"start": 1645.24, "end": 1651.4, "text": " some points or pass it and the reason that is and I'm not sure if it's on this"}, {"start": 1651.4, "end": 1658.52, "text": " exact task but they mentioned that which it's it's I respect so far is because"}, {"start": 1658.52, "end": 1668.56, "text": " they say since we only plan where we know since we only plan where we know we"}, {"start": 1668.56, "end": 1674.4, "text": " basically do much less exploration than others we we kind of stick to what we"}, {"start": 1674.4, "end": 1678.4, "text": " know when we plan so inherently we do less exploration and doing our"}, {"start": 1678.4, "end": 1684.8400000000001, "text": " conversation with Hari he basically said that this is intended and the"}, {"start": 1684.8400000000001, "end": 1690.3600000000001, "text": " base the intention is that you want to do your planning where you know and"}, {"start": 1690.3600000000001, "end": 1695.0800000000002, "text": " then explicitly add a component that does exploration so you have control"}, {"start": 1695.0800000000002, "end": 1702.16, "text": " over so you can basically say huh I I've never been here sort of now you would"}, {"start": 1702.16, "end": 1708.1200000000001, "text": " be in an expression phase you would explicitly go there rather than intermingle"}, {"start": 1708.1200000000001, "end": 1714.72, "text": " your your planning with your exploration and basically rely on your planning to"}, {"start": 1714.72, "end": 1720.1200000000001, "text": " screw up and you're you exploring because if you're planning if you're planning"}, {"start": 1720.1200000000001, "end": 1725.52, "text": " never screws up then you won't explore either right then you will always reach"}, {"start": 1725.52, "end": 1729.5600000000002, "text": " your goal or your planning will always be correct and these other methods that"}, {"start": 1729.56, "end": 1733.6399999999999, "text": " don't have this explicitly they explore every time they're planning"}, {"start": 1733.6399999999999, "end": 1737.12, "text": " screws up and you don't want that you want your planning to be as good as"}, {"start": 1737.12, "end": 1742.28, "text": " possible and they do that by sticking to what they know and then they the next"}, {"start": 1742.28, "end": 1746.0, "text": " step which is not in this paper would be to add an explicit exploration"}, {"start": 1746.0, "end": 1752.56, "text": " policy to reach areas they've never reached before okay so that's the"}, {"start": 1752.56, "end": 1759.2, "text": " reason why they don't ultimately reach the best accuracy but they do reach a"}, {"start": 1759.2, "end": 1766.0, "text": " the initial accuracy much faster than the other tasks because they plan better"}, {"start": 1766.0, "end": 1772.16, "text": " they have a long discussion here of what still problems are like local"}, {"start": 1772.16, "end": 1777.64, "text": " minima or the planning horizon problem open loop versus closed loop"}, {"start": 1777.64, "end": 1784.0800000000002, "text": " compounding errors in planning but I'm gonna leave this out for now and I thank"}, {"start": 1784.0800000000002, "end": 1788.4, "text": " you for being here I very much invite you to check out the paper for more"}, {"start": 1788.4, "end": 1792.64, "text": " details it's pretty cool pretty easy to read actually it's very written very"}, {"start": 1792.64, "end": 1822.6000000000001, "text": " well and with that see you next time bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=wcHQ3IutSJg | [News] The NeurIPS Broader Impact Statement | For the first time, all authors submitting to the NeurIPS conference are forced to write a statement about the broader impact of their research on society. The messaging around this and how exactly this can influence the paper acceptance process is highly confusing.
OUTLINE:
0:00 - Intro
0:30 - VentureBeat Article
1:35 - Official Communication
9:55 - Special Ethics Reviewers
11:00 - Unofficial Communication
22:55 - Conclusion
Sources:
https://neurips.cc/Conferences/2020/CallForPapers
https://neurips.cc/Conferences/2020/PaperInformation/ReviewerGuidelines
https://neurips.cc/Conferences/2020/PaperInformation/NeurIPS-FAQ
https://medium.com/@NeurIPSConf/getting-started-with-neurips-2020-e350f9b39c28
https://venturebeat.com/2020/02/24/neurips-requires-ai-researchers-to-account-for-societal-impact-and-financial-conflicts-of-interest/
https://medium.com/@NeurIPSConf/a-note-for-submitting-authors-48cebfebae82
https://medium.com/@BrentH/suggestions-for-writing-neurips-2020-broader-impacts-statements-121da1b765bf
https://acm-fca.org/2018/03/29/negativeimpacts/
https://medium.com/@operations_18894/a-guide-to-writing-the-neurips-impact-statement-4293b723f832
https://gdpr-info.eu/
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 | As many of you might be familiar with, the NURB's 2020 conference now requires authors to include a section in their submissions discussing the broader impact of their work, including possible societal consequences both positive and negative. That was announced in the getting started with NURB's 2020 announcement on Medium-Biby Conference organizers. Shortly after that, in an email to Venture Beat, Michael Littman, the communications chair of NURB's 2020, told Venture Beat that these statements will be published with each paper. However, they'll appear only in the camera-ready versions of the papers so they do not compromise the double-blind nature of the reviewing process. But then those on to say, reviewers and area chairs assessment will be done on the basis of technical contributions only. However, if a paper is flat for potential ethical concerns, then the paper will be sent to another set of reviewers with expertise in ethics and machine learning. The final acceptance of these papers is contingent on the positive assessment by these second set of reviewers as well. So this seems a bit odd for one, the broader impact statement is only published after the double-blind reviewing process is over, but the papers will be assessed based on their ethical and societal impact. So maybe the assessment, without nothing to do with this statement, let's dive in a bit deeper. In the NURB's 2020 FAQ, do I have to complete the broader impact section? The answer is yes, please include the section, but they say, however, if your work is very theoretical or is general enough that there is no particular application for seen, then you are free to write a broader impact discussion is not applicable. So until now, I genuinely feel that the conference organizers view this as some sort of experiment, and it is reasonable if it doesn't apply to you, which is probably the case for most people, then you can simply write, this does not apply to our research. Can my submission be rejected solely on the basis of the broader impact section? Answer no. Reviewers will be asked to write a submission based on the evaluation criteria, not your broader impact section. They will also be asked to check whether the broader impact section is adequately addressed. So reviewers will be able to check the broader impact section, which isn't there or is it there during the double-blind reviewing process, but they only have to say whether it's adequately addressed, and they will not be able to reject a paper on that basis. Again, they repeat, the authors can simply state, this work does not present any foreseeable societal consequences if the authors feel that this is the case. If this is not the case, the conference asks of the authors to discuss along the lines of positive potential impacts and negative potential impacts of the mission. So far, so good. Let's actually look at these evaluation criteria that they ask reviewers to grade the paper by, which, as they say, has nothing to do with the broader impact section. Papers that violate the style have already been published or have fatal flaws may be rejected on that basis. Other submissions will be judged on the basis of their technical quality, novelty, put potential impact and clarity. But one could still think that the potential impact here is a potential technical impact, has nothing to do with this broader impact section. That has nothing to do with you being accepted or rejected. They go on to say submissions will also be considered on ethical grounds, regardless of scientific quality or contribution, and they say a submission may be rejected for ethical considerations. Now, again, one could say that they don't look at your broader impact statement if they feel that there is an ethical violation, they reject it. But before we've already heard that if the reviewers feel that there is an ethical consideration that may include the broader impact section, they can flag the paper and that will go to a set of second reviewers, and these reviewers can actually reject your paper. So it seems like there is a bit of a mixed message here. The entire question sort of hinges on who makes the decision and based on what? And one of the questions is what kind of decisions do the reviewers make? So where else better to go than the reviewer guidelines? Question 11 to the reviewers, have the authors adequately address the broader impact of their work, including potential negative ethical and societal implications of their work? Indicate whether you believe the broader impact section was adequate. So it feels like that the reviewers are simply to evaluate whether this has done with enough work, and not necessarily whether they agree with the broader impact section or not. The question here is if the reviewers think that this has not been done with enough adequacy, but don't necessarily see an ethical problem, or actually do, can it be rejected on the basis that it has not been done adequately? The entire writing here seems like it should, but then also it seems like the reviewers assessment should have nothing to do with the broader impact section. Question 12 of the reviewer guidelines says, does the submission raise potential ethical concerns? Note that this is a different question from question 11, where you're simply asked to judge adequacy. The reviewer guidelines say, note that your rating should be independent of this. If the AC also shares this concern, dedicated reviewers with expertise at the intersection of ethics and machine learning will further review this submission, and your duty is to flag the papers. This now seems that reviewers are to consider the adequacy of the statement, but not its content, and forward its content to another section, which contradicts that the reviewers don't see the statement, or that the statement can't influence the review. And it also contradicts the statement that your paper cannot be rejected based on the broader impact section. Namely, if the second set of reviewers read your broader impact section, find it doesn't address their concerns, they can in fact reject your paper based on that. I guess someone arguing against that would say that these people could also reject it just because they think it's ethically problematic. But if the paper has a broader impact section, I think they are going to look at that with some sort of an open mind, and at least be influenced by that. In a note for submitting authors, the conference organizers again released a statement saying that the broader impact statement should include a statement about the foreseeable positive impact as well as potential risks associated mitigations of the proposed research. Authors can also declare that a broader impact statement is not applicable to their work if they believe this to be the case. And they again repeat, reviewers will also confirm whether the broader impact statement is inadequate, but this assessment will not affect the overall rating. However, the reviewer have the option to flag a paper for ethical concerns, which may relate to the content of the broader impact section. The paper will be sent for additional review to a pool of emergency reviewers with expertise in machine learning and ethics, who will provide an assessment solely on the basis of ethical considerations. We expect very few of any papers to need such further assessment. So the official communication makes a divide between on one hand adequacy and on the other hand real ethical concerns. And their message is basically reviewers will judge the adequacy flag the ethical concerns, and then special reviewers will be able to reject based on ethical concerns. Now what's not really clear is the messaging that reviewers should not base their judgment on the broader impact section, but then where does this adequacy rating go into the process of rejecting or accepting a paper? And with them saying there will only be a few, they expect only a few, it seems like it's sort of an experiment that they do this year. Oh hey, Nurebs organizer. Well hello. So you've decided to make everyone include the broader impact statement, but the broader impact statement will only be visible after the viewing process. Correct. But the reviewers should check its adequacy during the review process. Why they can't see it correct, but it should in no way influence their judgment and you can't be rejected because of that. That is correct. But if it is found to be inadequate or problematic, it is sent to a second set of reviewers, which on the basis of the paper and the broader impact statement will decide if the paper is of ethical concern. Yes. And if the paper is of an ethical concern and the broader impact statement doesn't convince the special reviewers otherwise, they will be able to reject that paper. That is indeed correct. So how are you saying that the broader impact statement has no influence on your score and you can't be rejected because of it? Well as we said, no one's able to see it until the paper is released. Obviously. Let's talk about these special reviewers and for that we broadly have to talk about incentives. Now just imagine for a second that this expectation comes to fruit that no paper is actually flagged and or any paper that is flagged to this committee will come back with a clear no, this is not really an ethical concern or a reason to discard this paper as a scientific contribution. One might almost think that then this program will be abolished in the next year because it's useless. So the more problems the special reviewers find, the more justified their position is. I wonder where that leads. I guess we are very dependent on pretty much every single person in these special reviewers, beings and sort of super honest person that has no incentives and also no strong opinions on these things and generally has gone into this ML ethics just out of interest and not to actually make an impact. I'm sure that will work out just fine. Now the official NURRIPS website actually links to a blog post of brand HECK, suggestions for writing the NURRIPS 2020 broader impact statements. So we can reasonably assume that this is at least in agreement with the organizers of the conference. Brentier says, understanding the societal impacts of your work is going to be hard. It is going to take lots of effort to write NURRIPS broader impact statements. Tons of work has already been done for you. Check out the literature from communities that have studied societal impacts of AI for a long while. Even better, bring a social scientist onto your research team. Remember though, they don't work for free. Hire them into your company. Give them sub-awards. Recruit them as PhD students through interdisciplinary programs. So are you saying the more problems these people find, the more of them will get hired. And again, look at these statements in general. It seems to really be about how much work are you able to put into this. So here's your average PhD student. Now, they pretty much already have to write their papers by themselves or in very, very small teams because they need first authorship. And they have to do all their experiments and they don't have enough resources. And now they're also asked to spend considerable amount of time not only writing this very hard statement, but also reading up on all the literature that there is to read up on. Or alternatively, if you don't want to do that, well just hire someone, of course. Because budgets and salaries and universities and for PhD students is notoriously loose, we can just hire someone that does that. I don't really think it's possible for single PhD students or research labs at universities to just hire someone or put someone full time on this additional required work that is put onto them. I wonder who will be actually able to put additional people on this such that they surely end up with beautiful, well-researched broader impact statements to justify even the most ethically concerning research. I'm wondering, it just can't sound the tip of my tongue, but I was going to have to leave that for another time. For people who do more theoretical work, it is going to be more difficult. Wait a minute, I thought the official communication was you're very free to leave it away if you don't think this applies to you. But here it's basically saying, it's going to be more work for you. Find something that is both rigorous and practical for your research. And the argument is to get funding for any theoretical work, someone had to make an argument about positive societal impact at some point. Not true, some universities simply get money and academic freedom. If that argument is possible, it is probably also possible to make a rigorous statement about some negative societal impacts. You might be tempted to write boilerplate, low information statements. Don't do this. It will undermine the rigor in the rest of your paper. The public will roll its eyes and reviewers may and often should call you out. Now wait a minute, I thought the reviewers are only supposed to judge the adequacy and absolutely have no influence on their judgment of the paper. But the underpinning of this text here is basically that if you as a reviewer feel that this hasn't been done adequately, you sort of should let this swap over into your assessment of the rigor and adequacy of the technical contributions in the paper. But because they're kind of the same, right? And they also say that this might spark a conversation, specifically the author response period will be a decent opportunity to have a bit of a dialogue between author and reviewer on the impact statement. So this basically means that I as a reviewer now have to write in my review something about the broader impact statement and not only judge its adequacy in a special field for it. And the author is forced to spend a bunch of their very, very, very valuable author response on rebuttling the reviewers' assessment of their broader impact statement. Our proposals view is that it's not your job as a reviewer to judge submissions for their impact, rather you should evaluate the rigor with which they just close their impacts. And it's about putting work into it. If you go to the full proposal behind this blog post, you'll find the following snippets. So there is a list of expected outcomes of introducing such mandatory broader impact statements. Now, have a look at this. We expect that action on the above recommendations will lead to a number of desirable outcomes and they're all positive outcomes. Now, haven't we been discussing for the last minutes that it's always important to assess the positive and the negative outcomes of your actions and of your releases? How ironic that none of the organizers of the conference, nor any of these people communicating, were forced to release a broader impact statement discussing the negative consequences that their actions would have on the community and the greater society. They're going to give a list of examples of how you could do such positive and negative aspects of technology. One of them is social media and I would agree that there are ethical considerations if you invent social media. We all know that social media can be some sort of a dopamine feedback loop addiction and have negative consequences in society that are not readily visible. But it goes on, crowd work, a researcher who invents a new crowd work framework likely motivates her work by highlighting the problem that framework solves. But they go on to say that crowd work also has negative externalities such as incentivizing very low pay and the researcher should find ways to engineer her crowd work framework such that these externalities are structurally mitigated and or she might advocate for minimum wage loss to be adapted. So this researcher working out a problem in crowd working now has to basically solve millennia old problems, problems, instructional economics that are thousands of moving parts and no clear consensus on how to solve. But the best example and this is the example they actually tell you to look at if your work is more theoretical or you don't really think it has an impact is the following. Storage and computation recent advances in storage systems and graphical processing unit processing afford the easy storage of massive amounts of data and the real time computation on these data. This has incentivized corporations to collect every possible data point about their users, save this data indefinitely and strive to monetize this data in new ways. While allowing for impressive new capabilities, this trend also presents tremendous risks to privacy. Researchers working in storage and GPU processing should consider these and other foreseeable potential risks in their papers. They should also enumerate technological and policy means by which these risks might be mitigated e.g. technologies to automate general data protection regulation, require capabilities and improvements to GDPR like policies. That is absolutely mad. So here you are making a GPU chip more powerful and you're asked to think ahead about the fact that this can be used to mine data. And not only that, now you're also required to propose improvements to GDPR like policies. The GDPR only an 88 page, very fine print legal document that in addition to all the literature about AI governance, our poor PhD student is now also required to read, understand and be able to improve. How long does this chain of causality go? How do you have to think ahead? This gets ridiculous. It's 200,000 BC and Nuno in his cave just invented fire. Well, fire can be used to cook food, can be used to have less disease, can be used to settle down, expand civilization, build educational facilities, build up a culture, a scientific method, enable massive progress, industrialization, general improvement in health, wealth, education and happiness of society, which ultimately leads to some people building GPUs and saving your data and analyzing all your things. How could Nuno in his cave do this to us? Where is his broader impact statement about the invention of fire for the future data collection algorithms on GPUs? Look, I'm not saying that you should not consider the downstream's effect of your inventions. Of course you should. But at some point it gets ridiculous for most of the work handed into a conference like Nuribs. Either the downstream's effect are so far away that is almost impossible to foresee. Or as any technology you can use it for good and for bad and it is going to be with the application of this technology and not its invention where the good and the bad come in. And what most people are going to do is simply come up with things that mean absolutely nothing and generally make not a lot of difference while it gives a big advantage to big institutions that can spend a lot of time and effort on crafting very rigorous adequate statements. Another release called a guy to writing the Nuribs impact statement that is not linked by Nuribs but as they say was in communication with some of the organizers of the conference. So it's reasonable to assume they also largely agree with these positions here. Says you should discuss, read and reflect time permitting impact assessment will benefit from broad intellectual reflection, discuss potential impacts, follow public discussion, re-case studies and read the scholarly literature on tech governance. Of course time permitting but then again if it's not rigorous enough, a reviewer might be getting the idea that the rest of your paper isn't rigorous enough. So maybe time must permit for this one. And they again say think about impacts even for theoretical work. So the official communication always says that if you don't feel this applies to you, you're very free to write this doesn't apply to me. But the unofficial communication says if this doesn't apply, you're doing something wrong and by the way, we're evaluating the rest of your paper based on the amount of work you put into that statement. Ultimately these statements are just going to boil down to you can do good and bad things with any technology as is visible on this example they give you. Florebus is a superhuman AI for multiplayer poker. They say they're intentionally choose to broaden the focus of their broader impact assessment. Depending who can use this scientific advance such as criminals or well motivated citizens, this technology may be socially harmful or beneficial. If access to this capability is mostly available to the wealthy, it could plausibly promote concentration of wealth. And further on the other side increased skill could increase total welfare. G, if that doesn't apply to every single technology ever, I don't know. Again, my general assessment of this is not that it is absolutely wrong to do this or very useless. It is just shifting the balance a bit more on two large institutions who can actually afford to spend a lot of time and work into crafting beautiful statements. But in general, I don't think it's that big of a deal, but I also don't think it's going to help very much to just force everyone to do this. I guess we'll see how it turns out. In this venture beat article, they link someone named Joe Redmond saying, I stopped doing CV research because I saw the impact my work was having. I love the work, but the military applications and privacy concerns eventually became impossible to ignore, which I respect a lot. But I would ask, did Joe Redmond realize this after being forced to write a broader impact statement or at some other point? That was my two cents. If you like videos like this and paper analysis and other things, then subscribe, like wherever these buttons are, share it with your friends, and see you next time. | [{"start": 0.0, "end": 18.0, "text": " As many of you might be familiar with, the NURB's 2020 conference now requires authors to include a section in their submissions discussing the broader impact of their work, including possible societal consequences both positive and negative."}, {"start": 18.0, "end": 25.0, "text": " That was announced in the getting started with NURB's 2020 announcement on Medium-Biby Conference organizers."}, {"start": 25.0, "end": 38.0, "text": " Shortly after that, in an email to Venture Beat, Michael Littman, the communications chair of NURB's 2020, told Venture Beat that these statements will be published with each paper."}, {"start": 38.0, "end": 48.0, "text": " However, they'll appear only in the camera-ready versions of the papers so they do not compromise the double-blind nature of the reviewing process."}, {"start": 48.0, "end": 56.0, "text": " But then those on to say, reviewers and area chairs assessment will be done on the basis of technical contributions only."}, {"start": 56.0, "end": 67.0, "text": " However, if a paper is flat for potential ethical concerns, then the paper will be sent to another set of reviewers with expertise in ethics and machine learning."}, {"start": 67.0, "end": 76.0, "text": " The final acceptance of these papers is contingent on the positive assessment by these second set of reviewers as well."}, {"start": 76.0, "end": 89.0, "text": " So this seems a bit odd for one, the broader impact statement is only published after the double-blind reviewing process is over, but the papers will be assessed based on their ethical and societal impact."}, {"start": 89.0, "end": 97.0, "text": " So maybe the assessment, without nothing to do with this statement, let's dive in a bit deeper."}, {"start": 97.0, "end": 103.0, "text": " In the NURB's 2020 FAQ, do I have to complete the broader impact section?"}, {"start": 103.0, "end": 120.0, "text": " The answer is yes, please include the section, but they say, however, if your work is very theoretical or is general enough that there is no particular application for seen, then you are free to write a broader impact discussion is not applicable."}, {"start": 120.0, "end": 136.0, "text": " So until now, I genuinely feel that the conference organizers view this as some sort of experiment, and it is reasonable if it doesn't apply to you, which is probably the case for most people, then you can simply write, this does not apply to our research."}, {"start": 136.0, "end": 144.0, "text": " Can my submission be rejected solely on the basis of the broader impact section? Answer no."}, {"start": 144.0, "end": 151.0, "text": " Reviewers will be asked to write a submission based on the evaluation criteria, not your broader impact section."}, {"start": 151.0, "end": 158.0, "text": " They will also be asked to check whether the broader impact section is adequately addressed."}, {"start": 158.0, "end": 171.0, "text": " So reviewers will be able to check the broader impact section, which isn't there or is it there during the double-blind reviewing process, but they only have to say whether it's adequately addressed,"}, {"start": 171.0, "end": 176.0, "text": " and they will not be able to reject a paper on that basis."}, {"start": 176.0, "end": 186.0, "text": " Again, they repeat, the authors can simply state, this work does not present any foreseeable societal consequences if the authors feel that this is the case."}, {"start": 186.0, "end": 198.0, "text": " If this is not the case, the conference asks of the authors to discuss along the lines of positive potential impacts and negative potential impacts of the mission."}, {"start": 198.0, "end": 211.0, "text": " So far, so good. Let's actually look at these evaluation criteria that they ask reviewers to grade the paper by, which, as they say, has nothing to do with the broader impact section."}, {"start": 211.0, "end": 218.0, "text": " Papers that violate the style have already been published or have fatal flaws may be rejected on that basis."}, {"start": 218.0, "end": 227.0, "text": " Other submissions will be judged on the basis of their technical quality, novelty, put potential impact and clarity."}, {"start": 227.0, "end": 236.0, "text": " But one could still think that the potential impact here is a potential technical impact, has nothing to do with this broader impact section."}, {"start": 236.0, "end": 240.0, "text": " That has nothing to do with you being accepted or rejected."}, {"start": 240.0, "end": 253.0, "text": " They go on to say submissions will also be considered on ethical grounds, regardless of scientific quality or contribution, and they say a submission may be rejected for ethical considerations."}, {"start": 253.0, "end": 262.0, "text": " Now, again, one could say that they don't look at your broader impact statement if they feel that there is an ethical violation, they reject it."}, {"start": 262.0, "end": 277.0, "text": " But before we've already heard that if the reviewers feel that there is an ethical consideration that may include the broader impact section, they can flag the paper and that will go to a set of second reviewers, and these reviewers can actually reject your paper."}, {"start": 277.0, "end": 286.0, "text": " So it seems like there is a bit of a mixed message here. The entire question sort of hinges on who makes the decision and based on what?"}, {"start": 286.0, "end": 291.0, "text": " And one of the questions is what kind of decisions do the reviewers make?"}, {"start": 291.0, "end": 295.0, "text": " So where else better to go than the reviewer guidelines?"}, {"start": 295.0, "end": 307.0, "text": " Question 11 to the reviewers, have the authors adequately address the broader impact of their work, including potential negative ethical and societal implications of their work?"}, {"start": 307.0, "end": 311.0, "text": " Indicate whether you believe the broader impact section was adequate."}, {"start": 311.0, "end": 322.0, "text": " So it feels like that the reviewers are simply to evaluate whether this has done with enough work, and not necessarily whether they agree with the broader impact section or not."}, {"start": 322.0, "end": 337.0, "text": " The question here is if the reviewers think that this has not been done with enough adequacy, but don't necessarily see an ethical problem, or actually do, can it be rejected on the basis that it has not been done adequately?"}, {"start": 337.0, "end": 346.0, "text": " The entire writing here seems like it should, but then also it seems like the reviewers assessment should have nothing to do with the broader impact section."}, {"start": 346.0, "end": 353.0, "text": " Question 12 of the reviewer guidelines says, does the submission raise potential ethical concerns?"}, {"start": 353.0, "end": 360.0, "text": " Note that this is a different question from question 11, where you're simply asked to judge adequacy."}, {"start": 360.0, "end": 365.0, "text": " The reviewer guidelines say, note that your rating should be independent of this."}, {"start": 365.0, "end": 379.0, "text": " If the AC also shares this concern, dedicated reviewers with expertise at the intersection of ethics and machine learning will further review this submission, and your duty is to flag the papers."}, {"start": 379.0, "end": 394.0, "text": " This now seems that reviewers are to consider the adequacy of the statement, but not its content, and forward its content to another section, which contradicts that the reviewers don't see the statement, or that the statement can't influence the review."}, {"start": 394.0, "end": 400.0, "text": " And it also contradicts the statement that your paper cannot be rejected based on the broader impact section."}, {"start": 400.0, "end": 411.0, "text": " Namely, if the second set of reviewers read your broader impact section, find it doesn't address their concerns, they can in fact reject your paper based on that."}, {"start": 411.0, "end": 419.0, "text": " I guess someone arguing against that would say that these people could also reject it just because they think it's ethically problematic."}, {"start": 419.0, "end": 429.0, "text": " But if the paper has a broader impact section, I think they are going to look at that with some sort of an open mind, and at least be influenced by that."}, {"start": 429.0, "end": 446.0, "text": " In a note for submitting authors, the conference organizers again released a statement saying that the broader impact statement should include a statement about the foreseeable positive impact as well as potential risks associated mitigations of the proposed research."}, {"start": 446.0, "end": 454.0, "text": " Authors can also declare that a broader impact statement is not applicable to their work if they believe this to be the case."}, {"start": 454.0, "end": 464.0, "text": " And they again repeat, reviewers will also confirm whether the broader impact statement is inadequate, but this assessment will not affect the overall rating."}, {"start": 464.0, "end": 473.0, "text": " However, the reviewer have the option to flag a paper for ethical concerns, which may relate to the content of the broader impact section."}, {"start": 473.0, "end": 486.0, "text": " The paper will be sent for additional review to a pool of emergency reviewers with expertise in machine learning and ethics, who will provide an assessment solely on the basis of ethical considerations."}, {"start": 486.0, "end": 490.0, "text": " We expect very few of any papers to need such further assessment."}, {"start": 490.0, "end": 497.0, "text": " So the official communication makes a divide between on one hand adequacy and on the other hand real ethical concerns."}, {"start": 497.0, "end": 508.0, "text": " And their message is basically reviewers will judge the adequacy flag the ethical concerns, and then special reviewers will be able to reject based on ethical concerns."}, {"start": 508.0, "end": 522.0, "text": " Now what's not really clear is the messaging that reviewers should not base their judgment on the broader impact section, but then where does this adequacy rating go into the process of rejecting or accepting a paper?"}, {"start": 522.0, "end": 530.0, "text": " And with them saying there will only be a few, they expect only a few, it seems like it's sort of an experiment that they do this year."}, {"start": 530.0, "end": 532.0, "text": " Oh hey, Nurebs organizer."}, {"start": 532.0, "end": 533.0, "text": " Well hello."}, {"start": 533.0, "end": 541.0, "text": " So you've decided to make everyone include the broader impact statement, but the broader impact statement will only be visible after the viewing process."}, {"start": 541.0, "end": 546.0, "text": " Correct. But the reviewers should check its adequacy during the review process."}, {"start": 546.0, "end": 553.0, "text": " Why they can't see it correct, but it should in no way influence their judgment and you can't be rejected because of that."}, {"start": 553.0, "end": 554.0, "text": " That is correct."}, {"start": 554.0, "end": 567.0, "text": " But if it is found to be inadequate or problematic, it is sent to a second set of reviewers, which on the basis of the paper and the broader impact statement will decide if the paper is of ethical concern."}, {"start": 567.0, "end": 568.0, "text": " Yes."}, {"start": 568.0, "end": 578.0, "text": " And if the paper is of an ethical concern and the broader impact statement doesn't convince the special reviewers otherwise, they will be able to reject that paper."}, {"start": 578.0, "end": 579.0, "text": " That is indeed correct."}, {"start": 579.0, "end": 587.0, "text": " So how are you saying that the broader impact statement has no influence on your score and you can't be rejected because of it?"}, {"start": 587.0, "end": 591.0, "text": " Well as we said, no one's able to see it until the paper is released."}, {"start": 591.0, "end": 592.0, "text": " Obviously."}, {"start": 592.0, "end": 599.0, "text": " Let's talk about these special reviewers and for that we broadly have to talk about incentives."}, {"start": 599.0, "end": 616.0, "text": " Now just imagine for a second that this expectation comes to fruit that no paper is actually flagged and or any paper that is flagged to this committee will come back with a clear no, this is not really an ethical concern or a reason to discard this paper as a scientific contribution."}, {"start": 616.0, "end": 623.0, "text": " One might almost think that then this program will be abolished in the next year because it's useless."}, {"start": 623.0, "end": 630.0, "text": " So the more problems the special reviewers find, the more justified their position is."}, {"start": 630.0, "end": 632.0, "text": " I wonder where that leads."}, {"start": 632.0, "end": 638.0, "text": " I guess we are very dependent on pretty much every single person in these special reviewers,"}, {"start": 638.0, "end": 652.0, "text": " beings and sort of super honest person that has no incentives and also no strong opinions on these things and generally has gone into this ML ethics just out of interest and not to actually make an impact."}, {"start": 652.0, "end": 655.0, "text": " I'm sure that will work out just fine."}, {"start": 655.0, "end": 665.0, "text": " Now the official NURRIPS website actually links to a blog post of brand HECK, suggestions for writing the NURRIPS 2020 broader impact statements."}, {"start": 665.0, "end": 671.0, "text": " So we can reasonably assume that this is at least in agreement with the organizers of the conference."}, {"start": 671.0, "end": 677.0, "text": " Brentier says, understanding the societal impacts of your work is going to be hard."}, {"start": 677.0, "end": 682.0, "text": " It is going to take lots of effort to write NURRIPS broader impact statements."}, {"start": 682.0, "end": 685.0, "text": " Tons of work has already been done for you."}, {"start": 685.0, "end": 691.0, "text": " Check out the literature from communities that have studied societal impacts of AI for a long while."}, {"start": 691.0, "end": 696.0, "text": " Even better, bring a social scientist onto your research team."}, {"start": 696.0, "end": 698.0, "text": " Remember though, they don't work for free."}, {"start": 698.0, "end": 700.0, "text": " Hire them into your company."}, {"start": 700.0, "end": 702.0, "text": " Give them sub-awards."}, {"start": 702.0, "end": 706.0, "text": " Recruit them as PhD students through interdisciplinary programs."}, {"start": 706.0, "end": 711.0, "text": " So are you saying the more problems these people find, the more of them will get hired."}, {"start": 711.0, "end": 716.0, "text": " And again, look at these statements in general."}, {"start": 716.0, "end": 720.0, "text": " It seems to really be about how much work are you able to put into this."}, {"start": 720.0, "end": 723.0, "text": " So here's your average PhD student."}, {"start": 723.0, "end": 731.0, "text": " Now, they pretty much already have to write their papers by themselves or in very, very small teams because they need first authorship."}, {"start": 731.0, "end": 735.0, "text": " And they have to do all their experiments and they don't have enough resources."}, {"start": 735.0, "end": 741.0, "text": " And now they're also asked to spend considerable amount of time not only writing this very hard statement,"}, {"start": 741.0, "end": 746.0, "text": " but also reading up on all the literature that there is to read up on."}, {"start": 746.0, "end": 751.0, "text": " Or alternatively, if you don't want to do that, well just hire someone, of course."}, {"start": 751.0, "end": 758.0, "text": " Because budgets and salaries and universities and for PhD students is notoriously loose, we can just hire someone that does that."}, {"start": 758.0, "end": 772.0, "text": " I don't really think it's possible for single PhD students or research labs at universities to just hire someone or put someone full time on this additional required work that is put onto them."}, {"start": 772.0, "end": 789.0, "text": " I wonder who will be actually able to put additional people on this such that they surely end up with beautiful, well-researched broader impact statements to justify even the most ethically concerning research."}, {"start": 789.0, "end": 798.0, "text": " I'm wondering, it just can't sound the tip of my tongue, but I was going to have to leave that for another time."}, {"start": 798.0, "end": 803.0, "text": " For people who do more theoretical work, it is going to be more difficult."}, {"start": 803.0, "end": 809.0, "text": " Wait a minute, I thought the official communication was you're very free to leave it away if you don't think this applies to you."}, {"start": 809.0, "end": 813.0, "text": " But here it's basically saying, it's going to be more work for you."}, {"start": 813.0, "end": 817.0, "text": " Find something that is both rigorous and practical for your research."}, {"start": 817.0, "end": 827.0, "text": " And the argument is to get funding for any theoretical work, someone had to make an argument about positive societal impact at some point."}, {"start": 827.0, "end": 832.0, "text": " Not true, some universities simply get money and academic freedom."}, {"start": 832.0, "end": 840.0, "text": " If that argument is possible, it is probably also possible to make a rigorous statement about some negative societal impacts."}, {"start": 840.0, "end": 844.0, "text": " You might be tempted to write boilerplate, low information statements."}, {"start": 844.0, "end": 850.0, "text": " Don't do this. It will undermine the rigor in the rest of your paper."}, {"start": 850.0, "end": 856.0, "text": " The public will roll its eyes and reviewers may and often should call you out."}, {"start": 856.0, "end": 867.0, "text": " Now wait a minute, I thought the reviewers are only supposed to judge the adequacy and absolutely have no influence on their judgment of the paper."}, {"start": 867.0, "end": 883.0, "text": " But the underpinning of this text here is basically that if you as a reviewer feel that this hasn't been done adequately, you sort of should let this swap over into your assessment of the rigor and adequacy of the technical contributions in the paper."}, {"start": 883.0, "end": 898.0, "text": " But because they're kind of the same, right? And they also say that this might spark a conversation, specifically the author response period will be a decent opportunity to have a bit of a dialogue between author and reviewer on the impact statement."}, {"start": 898.0, "end": 910.0, "text": " So this basically means that I as a reviewer now have to write in my review something about the broader impact statement and not only judge its adequacy in a special field for it."}, {"start": 910.0, "end": 922.0, "text": " And the author is forced to spend a bunch of their very, very, very valuable author response on rebuttling the reviewers' assessment of their broader impact statement."}, {"start": 922.0, "end": 934.0, "text": " Our proposals view is that it's not your job as a reviewer to judge submissions for their impact, rather you should evaluate the rigor with which they just close their impacts."}, {"start": 934.0, "end": 943.0, "text": " And it's about putting work into it. If you go to the full proposal behind this blog post, you'll find the following snippets."}, {"start": 943.0, "end": 953.0, "text": " So there is a list of expected outcomes of introducing such mandatory broader impact statements. Now, have a look at this."}, {"start": 953.0, "end": 974.0, "text": " We expect that action on the above recommendations will lead to a number of desirable outcomes and they're all positive outcomes. Now, haven't we been discussing for the last minutes that it's always important to assess the positive and the negative outcomes of your actions and of your releases?"}, {"start": 974.0, "end": 990.0, "text": " How ironic that none of the organizers of the conference, nor any of these people communicating, were forced to release a broader impact statement discussing the negative consequences that their actions would have on the community and the greater society."}, {"start": 990.0, "end": 997.0, "text": " They're going to give a list of examples of how you could do such positive and negative aspects of technology."}, {"start": 997.0, "end": 1014.0, "text": " One of them is social media and I would agree that there are ethical considerations if you invent social media. We all know that social media can be some sort of a dopamine feedback loop addiction and have negative consequences in society that are not readily visible."}, {"start": 1014.0, "end": 1043.0, "text": " But it goes on, crowd work, a researcher who invents a new crowd work framework likely motivates her work by highlighting the problem that framework solves. But they go on to say that crowd work also has negative externalities such as incentivizing very low pay and the researcher should find ways to engineer her crowd work framework such that these externalities are structurally mitigated and or she might advocate for minimum wage loss to be"}, {"start": 1043.0, "end": 1052.0, "text": " adapted. So this researcher working out a problem in crowd working now has to basically solve millennia old problems,"}, {"start": 1052.0, "end": 1070.0, "text": " problems, instructional economics that are thousands of moving parts and no clear consensus on how to solve. But the best example and this is the example they actually tell you to look at if your work is more theoretical or you don't really think it has an impact is the following."}, {"start": 1070.0, "end": 1083.0, "text": " Storage and computation recent advances in storage systems and graphical processing unit processing afford the easy storage of massive amounts of data and the real time computation on these data."}, {"start": 1083.0, "end": 1094.0, "text": " This has incentivized corporations to collect every possible data point about their users, save this data indefinitely and strive to monetize this data in new ways."}, {"start": 1094.0, "end": 1109.0, "text": " While allowing for impressive new capabilities, this trend also presents tremendous risks to privacy. Researchers working in storage and GPU processing should consider these and other foreseeable potential risks in their papers."}, {"start": 1109.0, "end": 1123.0, "text": " They should also enumerate technological and policy means by which these risks might be mitigated e.g. technologies to automate general data protection regulation, require capabilities and improvements to GDPR like policies."}, {"start": 1123.0, "end": 1136.0, "text": " That is absolutely mad. So here you are making a GPU chip more powerful and you're asked to think ahead about the fact that this can be used to mine data."}, {"start": 1136.0, "end": 1151.0, "text": " And not only that, now you're also required to propose improvements to GDPR like policies. The GDPR only an 88 page, very fine print legal document that in addition to all the literature about AI governance,"}, {"start": 1151.0, "end": 1158.0, "text": " our poor PhD student is now also required to read, understand and be able to improve."}, {"start": 1158.0, "end": 1170.0, "text": " How long does this chain of causality go? How do you have to think ahead? This gets ridiculous. It's 200,000 BC and Nuno in his cave just invented fire."}, {"start": 1170.0, "end": 1184.0, "text": " Well, fire can be used to cook food, can be used to have less disease, can be used to settle down, expand civilization, build educational facilities, build up a culture, a scientific method,"}, {"start": 1184.0, "end": 1199.0, "text": " enable massive progress, industrialization, general improvement in health, wealth, education and happiness of society, which ultimately leads to some people building GPUs and saving your data and analyzing all your things."}, {"start": 1199.0, "end": 1214.0, "text": " How could Nuno in his cave do this to us? Where is his broader impact statement about the invention of fire for the future data collection algorithms on GPUs?"}, {"start": 1214.0, "end": 1227.0, "text": " Look, I'm not saying that you should not consider the downstream's effect of your inventions. Of course you should. But at some point it gets ridiculous for most of the work handed into a conference like Nuribs."}, {"start": 1227.0, "end": 1246.0, "text": " Either the downstream's effect are so far away that is almost impossible to foresee. Or as any technology you can use it for good and for bad and it is going to be with the application of this technology and not its invention where the good and the bad come in."}, {"start": 1246.0, "end": 1263.0, "text": " And what most people are going to do is simply come up with things that mean absolutely nothing and generally make not a lot of difference while it gives a big advantage to big institutions that can spend a lot of time and effort on crafting very rigorous adequate statements."}, {"start": 1263.0, "end": 1279.0, "text": " Another release called a guy to writing the Nuribs impact statement that is not linked by Nuribs but as they say was in communication with some of the organizers of the conference. So it's reasonable to assume they also largely agree with these positions here."}, {"start": 1279.0, "end": 1306.0, "text": " Says you should discuss, read and reflect time permitting impact assessment will benefit from broad intellectual reflection, discuss potential impacts, follow public discussion, re-case studies and read the scholarly literature on tech governance. Of course time permitting but then again if it's not rigorous enough, a reviewer might be getting the idea that the rest of your paper isn't rigorous enough. So maybe time must permit for this one."}, {"start": 1306.0, "end": 1328.0, "text": " And they again say think about impacts even for theoretical work. So the official communication always says that if you don't feel this applies to you, you're very free to write this doesn't apply to me. But the unofficial communication says if this doesn't apply, you're doing something wrong and by the way, we're evaluating the rest of your paper based on the amount of work you put into that statement."}, {"start": 1328.0, "end": 1347.0, "text": " Ultimately these statements are just going to boil down to you can do good and bad things with any technology as is visible on this example they give you. Florebus is a superhuman AI for multiplayer poker. They say they're intentionally choose to broaden the focus of their broader impact assessment."}, {"start": 1347.0, "end": 1363.0, "text": " Depending who can use this scientific advance such as criminals or well motivated citizens, this technology may be socially harmful or beneficial. If access to this capability is mostly available to the wealthy, it could plausibly promote concentration of wealth."}, {"start": 1363.0, "end": 1369.0, "text": " And further on the other side increased skill could increase total welfare."}, {"start": 1369.0, "end": 1381.0, "text": " G, if that doesn't apply to every single technology ever, I don't know. Again, my general assessment of this is not that it is absolutely wrong to do this or very useless."}, {"start": 1381.0, "end": 1390.0, "text": " It is just shifting the balance a bit more on two large institutions who can actually afford to spend a lot of time and work into crafting beautiful statements."}, {"start": 1390.0, "end": 1399.0, "text": " But in general, I don't think it's that big of a deal, but I also don't think it's going to help very much to just force everyone to do this."}, {"start": 1399.0, "end": 1409.0, "text": " I guess we'll see how it turns out. In this venture beat article, they link someone named Joe Redmond saying, I stopped doing CV research because I saw the impact my work was having."}, {"start": 1409.0, "end": 1426.0, "text": " I love the work, but the military applications and privacy concerns eventually became impossible to ignore, which I respect a lot. But I would ask, did Joe Redmond realize this after being forced to write a broader impact statement or at some other point? That was my two cents."}, {"start": 1426.0, "end": 1439.0, "text": " If you like videos like this and paper analysis and other things, then subscribe, like wherever these buttons are, share it with your friends, and see you next time."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=IIebBjbBevs | When BERT Plays the Lottery, All Tickets Are Winning (Paper Explained) | BERT is a giant model. Turns out you can prune away many of its components and it still works. This paper analyzes BERT pruning in light of the Lottery Ticket Hypothesis and finds that even the "bad" lottery tickets can be fine-tuned to good accuracy.
OUTLINE:
0:00 - Overview
1:20 - BERT
3:20 - Lottery Ticket Hypothesis
13:00 - Paper Abstract
18:00 - Pruning BERT
23:00 - Experiments
50:00 - Conclusion
https://arxiv.org/abs/2005.00561
ML Street Talk Channel: https://www.youtube.com/channel/UCMLtBahI5DMrt0NPvDSoIRQ
Abstract:
Much of the recent success in NLP is due to the large Transformer-based models such as BERT (Devlin et al, 2019). However, these models have been shown to be reducible to a smaller number of self-attention heads and layers. We consider this phenomenon from the perspective of the lottery ticket hypothesis. For fine-tuned BERT, we show that (a) it is possible to find a subnetwork of elements that achieves performance comparable with that of the full model, and (b) similarly-sized subnetworks sampled from the rest of the model perform worse. However, the "bad" subnetworks can be fine-tuned separately to achieve only slightly worse performance than the "good" ones, indicating that most weights in the pre-trained BERT are potentially useful. We also show that the "good" subnetworks vary considerably across GLUE tasks, opening up the possibilities to learn what knowledge BERT actually uses at inference time.
Authors: Sai Prasanna, Anna Rogers, Anna Rumshisky
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 when Bert plays the lottery. All tickets are winning by Sai, Prasanna, Anna Rogers and Anna Rumsisky. So a high-level overview of this paper is the following. The paper basically looks at Bert in terms of the lottery ticket hypothesis and it says that if you find tune Bert on different downstream tasks then the lottery ticket winners you're going to find are different between the task and also declaim all tickets are winning refers to the fact that if you remove the winning tickets then you can still train the rest to relatively good performance. Therefore all tickets are winning not just the subnetwork. So that was the high-level overview for those who just want to be interested if you want to continue watching this video. If you do like videos like this consider sharing liking subscribing telling your mother, father, brother and friends about it. Alright let's dive in. So Bert it is a language model. Basically if you don't know what Bert is I've done a video on Bert but really quickly what you can do with Bert is you can take a sentence something like hello there and you can put it through this multi-layer neural network and what you'll get out is basically an embedding of that of that sentence. So a vector embedding of it will make it really easy and what is usually done is this is pre-trained on a task called masked language modeling. This is unsupervised training and then you take this embedding and you fine-tune basically you put on a classifier head basically say let's take sentiment classification. So you have two output classes and you want to say is this sentence I put in positive or negative sentiment. So you would train this classifier by basically taking this part from the pre-trained masked language modeling and then training the part here that does the sentiment classification you would sort of add that on top and then fine-tune the entire network to solve this task. Alright so that that is basically Bert fine-tuning on different tasks and there's this benchmark called glue where it has a number of tasks in this case I think they look at nine tasks of glue it has nine of these tasks one is the an example is the sentiment classification and it basically gets a score for each one and thereby you can sort of estimate how good your language model is by how well it is performing on each of those individual tasks. But in the notable difference here too let's say a computer like an image net classifier is the fact that first it is pre-trained right this part here is pre-trained on a large corpus and second there are different downstream tasks that you fine-tune on. So the second part that is important is the lottery ticket hypothesis. So I've also done a video on the lottery ticket hypothesis and if you very quickly what the lottery ticket hypothesis is the following. So let's say you have an image classifier and I have a bunch of layers in my neural network I'm gonna draw them like this and at the end right I can classify it into like ten different or a thousand different classes whatever and the input here is an image. So my neural network is going to have weights so every one of these neurons is connected to each other now this can be a convolutional network or a MLP so all is connected to all and as well here right everything's connected to pretty much everything. So we know first of all we know that we can train these big networks to relatively good accuracy and then second of all so first we can train them. Second we know we can prune them after training. What pruning means is the fact that after I have trained such a thing I can then go and I can figure out which one which of these connections that I have learned are the important ones and maybe I'll say ah these these here actually these these five I don't need more than those let's actually connect them to the end these seven or so I don't need all of the other ones I just need those and I can pretty much get the same accuracy as the full network. Now the important part here is that you can only do pruning after you've trained a network if you try to prune at the beginning it doesn't work so what the lottery ticket hypothesis says is basically so how does training work first you have your parameters let's let's tell them as a list so each of these weights is an entry in the list here first you initialize these randomly then through training training you get to your train state right you get each of the ones into your these are now trained and in the train state you can select the ones you think are important the lottery ticket hypothesis says if I take those that are important and basically go back to the beginning like here here and here and I basically roll them back to that state that they were in when they were initialized so I put the same random number there that I got at initialization I can then make a network where I only have those I can train that network and I can get a good accuracy so what this this basically wasn't possible in the pruning framework because we said we can't prune we can only prune after training because only then do we know which ones are the important ones in fact the lottery ticket hypothesis or the paper shows that you can train the smaller neural network from the beginning but the catch of course is you have to know which ones those are and you have to know what value to set them on at the beginning and you only know that after you've trained the full network but still it kind of gives the it tells you that you don't need all these connections for training you basically only need so many connections such that somewhere in there there's going to be the good ones right and if you knew the good ones from the beginning you could just train those and then only train the smaller sub network so that's the lottery ticket hypothesis naturally these connections here this small network is called the winning a winning ticket because if you knew what it was you could basically train a much smaller network and reach the same accuracy so this paper looks at birth in terms of this lottery ticket hypothesis now it's a bit more complicated than just in these feet forward networks because birth is not a feet forward network birth is a transformer so what does that mean a transformer consists of many layers and each layer let's expand the layer here so each layer consists of let's go over there need some space so again we have our layers of birth and it goes signal goes like this so each layer consists of two things first of all of many attention heads that's called I gonna draw these as blocks right here so for let's call them for attention heads individual attention heads are all parameterized by individual matrices and then on top of that there is an MLP so this is the multi layer perceptron this is one basically a feet forward layer residual actually and so there is a skip connection right here and these are the attention heads okay and then the next layer would again have the same structure for a piece and then one of these and so on with the skip connection all right so the pruning in birth is different than pruning in the feet forward or convolutional or that was that we looked at pruning in birth to what this paper looks at is pruning either an entire attention head like this so kind of leaving out in the entire head away which is this is an entire matrix is not a single weight right this is many many weights or even more drastically leaving away an entire MLP and basically only relying on the skip connection all right so this you have these two these two things you can do you can leave away heads or you can leave away entire MLP so you can combine these things in some way right so the notable difference here to the lottery ticket hypothesis pruning is the fact that here over up here what we prune are connections so prune connections individual connections individual connections and here we prune entire modules now this is a in my opinion this is a qualitative difference a very large qualitative difference actually why why would you do this so this paper basically doesn't invent this kind of pruning they go after already existing literature so what's the advantage in pruning modules well you have to see what's the advantage in pruning per se so in pruning what you're trying to do is obtain a smaller network that gives you the same accuracy but that you can run faster right you that uses less memory and you can you can run it faster and if you prune like this like we did in the lottery ticket hypothesis paper you don't really gain anything because if you have a matrix if you have a matrix matrix multiply right I have two matrices and I multiply them right here if I if I cut out one way tier or one way tier it doesn't help me because I have GPUs and those will parallelize these matrix procedures and it doesn't really help me because we don't really have good hardware for sparse or matrix matrix multiplication or matrix matrix multiplication with holes or things like this so it almost gains me nothing the lottery ticket hypothesis paper is very much a kind of more of a scientific curiosity paper and once we have sparse matrix multiply hardware which I think it already exists but is not super widely distributed once we have that we will be able to make use of this whereas the people that prune birth so these are more let's say industry people if you prune an entire module well that's an entire matrix that falls away so I have to I can basically save an entire matrix matrix multiply in the forward pass here on the and the backward pass well okay I don't prune during training but I can basically save an entire matrix multiply here by pruning an entire module so I'm not sure if if I were an author and I say I want to look at birth in terms of the lottery ticket hypothesis I would find a way I would go away from this literature and find a way to also just prune here individual weights it's not going to be faster but the lottery ticket investigations aren't supposed to be faster as opposed to tell you something about the nature of the things you're investigating and of course how you do this is simply by masking right you simply force these entries to be zero and therefore you don't have forward signal you don't have gradient interestingly they actually do the masking but they do it on the entire module level okay so this was birth and the lottery ticket hypothesis and the all tickets are winning we're going to investigate later let's see what they say in the abstract say much of the recent success in an LP is due to the large transformer based models such as the birth okay they say however these models have been shown to be reducible to a smaller number of self-attention heads and layers so this would be pruning we consider this phenomenon from the perspective of the lottery ticket hypothesis for fine-tuned birth we show that here's the contributions a it is possible to find a sub network of elements that achieves performance comparable with that of the full model so basically this is the pruning objective right you want to to prune it such that the performance holds and in terms of the lottery ticket hypothesis you want to prune reset to the beginning and then also and then train again and that will give you in actually in the lottery ticket hypothesis you can gain performance if you prune by a certain amount in this case here they always lose performance but yeah so second of all similarly sized sub networks sampled from the rest of the model so the non- winning ticket perform worse so if you just read if you just prune away the good parts then the bad parts perform worse of course however the bad sub networks can be fine-tuned separately to achieve only slightly worse performance than the good ones indicating that most weights in the pre-trained bird are potentially useful so this is interesting if they be fine-tuned separately this is exactly what the lottery ticket hypothesis is doing right it's basically fine-tuning only a sub part of the network and here they say even if we take the so the the parts of the network that have low scores for pruning and we retrain those then we can achieve a good performance okay so they further they say we also show that the goods of networks vary considerably across glue tasks this is this bench mark opening up the possibilities to learn what knowledge bird actually uses at inference time all right so there this is the overview of the paper so a last thing to say which I've already kind of alluded to is the fact that in the original lottery ticket hypothesis as I said you had a graph and you had sub sort of here was 100% accuracy and here was how much you prune you of course you start at 100% if you prune nothing but then as you prune the interesting is it kind of goes up and then it goes down right so this is the first thing here it goes up to a certain amount if you if you don't prune and in the original lottery ticket hypothesis here somewhere here would be 50% of the network I think and then once you go down let's say here to 90% of performance you are at something like 5% of the network size or 3% so you can prune away most things and still be like extremely extremely powerful now we're going to see what these essentially what these people do here is here is 100% and they simply prune until they reach 90% so we don't necessarily know what happens in the middle we just know they start here and somehow they get to 90% and what they end up with is something like 50% of the network still at remaining so again see the qualitative difference here between the 5% of the lottery tickets in the original paper and the 50 ish or so percent or considerable amount more in this paper right here and I'm pretty sure that is due to the fact that they prune entire modules here so they don't prune on a fine-grained enough level to investigate these phenomenon because as I said we don't know but me I'm pretty sure this just goes down here and not up first so qualitatively it seems different all right so here they introduce what they do again earth is contained is is is made up of these attention heads and MLP's the MLPs have a skip connection as you can see here and the attention head attention layers are basically made up each of n of these attention heads what they will do is they'll they will look at 12 layer networks each layer will have 12 of these attention heads and one of the MLPs so you have in total 144 heads and 12 MLP layers the way they determine which ones to prune is pretty easy in front of each attention head and in front of each MLP they put one of these binary variables right here these variables can take values 0 or 1 if it's if there's 0 the layers or the head is basically inactive no propagation if they're 1 they're active and they determine what value to set them to by computing important source is determining how important is a head or a layer for the network and that's pretty simple is simply take the gradient of the loss I think they go after yeah they go after this paper right here that's supposed to propose following you derive the loss by the by these variables right here and therefore you get these important scores and then you can simply prune the layers with the lowest important scores because that means that the gradient with respect to them is the smallest that means your loss changes the least if you were to leave them away okay so they here determine their their pruning strategy their constraint here is as I said 90% of the performance of the full model so they train the full model fine to the full model on this task and then they they set themselves a budget of 90% and they simply prune until the model reaches 90% once it goes lower they stop okay so they have three methods of pruning one is heads only where they only cut away these these attention heads as I said there are 144 of them they have the pruning strategy of MLPs only where they only prune the MLPs leave all the attention heads alone and they have this heads and MLPs they say we compute head and MLP important scores in a single backward pass pruning 10% heads and one MLP with the smallest scores until the performance on the dev set is within 90 percent okay then we continue pruning heads alone and then MLPs alone and this I guess until again they are no longer in the 90% so until they reach their budget they so this is a combined strategy this strategy results in a larger number of total components pruned within our performance threshold so this is the this is the thing we should focus on right because in pruning the name of the game is how much can you take away and still be within your budget and this strategy seems to be the viable strategy here so a last thing here is fine tuning so the other difference between this paper and the lottery take a typothesis is that we said that in the original paper here these are randomly initialized weights like you train a class for an image net or something you start from randomly initialized weights and the lottery ticket papers they all they all kind of presuppose random initializations whereas Bert when you do the same thing for Bert these are not random initializations we said in Bert what you usually do is you train the encoder part here you pre-trained with masked language modeling first and then second you train the entire thing let's get the color here a second you train the entire thing you fine tune the entire thing so if we talk about initializations in the Bert task then the initialization would be at this point right here after the masked language modeling would be the initialization so the weights are not random the weights are actually pre-trained on the masked language modeling task which is also a qualitative difference and sort of lets us inspect so the offers say that since we trained with masked language modeling and people sort of claimed that masked language modeling learned something about the language we can now investigate kind of which attention heads which modules in Bert are encoding which parts of the language and this is going to be interesting once we look at which heads which attention heads and which modules survive in the individual tasks we can sort of compare tasks across each other by seeing which of the heads they share in their winning tickets all right so they produce these graphs here these are sort of one of the central graphs here and the way to read this is on the left side here you have the layer oops the boops you have the layer index and on the x axis you simply have the index of the head there are 144 boxes here each one corresponds to one of the attention heads the top number is always the mean number of glue tasks that this head survived in so what they do is they take the pre-trained bird they fine tune it on these nine tasks and for each of the nine tasks they determine the winning tickets right and the number here says how many in how many of these nine tasks is this particular attention head a part of the winning ticket now they repeat it for different random seats that's why you have floating point numbers and the lower part is the standard deviation across that so you can see quite a number of heads make it into a lot of these tasks so you can say this part this thing right here read on red this head right here survives in seven out of the nine tasks so it should be fairly it should it probably encodes something fairly substantial about language that is shared across these seven tasks right you can see some of the heads like this one here doesn't survive in almost any task which basically means that it's you know if that one is not really super important for these tasks it might have been you know important for the pre-training but not for these particular tasks what's interesting so what you can see is that the mean or median or so is like three four or five and that means that a lot of the the heads are sort of somewhat important for some of the tasks and you can see the qualitative difference if this were the like original lottery ticket paper most of these numbers would be at zero because the lottery ticket size is just so much smaller here you can directly see that you are going to retain a large number of things in your network in order to get 90% of the performance and that's probably because you prune entire modules again so they have this for two variants here first for this strategy of masking heads only and the right one is for masking heads and MLPs and the same here on the bottom these are the same numbers but not for attention heads but for MLP layers and you see again this is masking MLPs only this is masking heads and MLPs so if you compare the two you see that for example this here and this here are substantially darker which means more of this stuff survives now we can't really it seems like here for example there's it's darker than here so on the right side more stuff survives but also you have more things to prune right you have you can prune the heads and the MLPs and they claim before that the masking heads and MLP strategy results in more things being prune which doesn't really isn't really congruent with here generally more things surviving but it could be because of the fact maybe the sum of the two is still lower than the sum of each individual individual thing here though it doesn't really look like it so I'm a bit confused about this but I'm just going to assume that the sum of the two is is lower does that make sense if both are darker well it shouldn't be the sum it should be the sum of this plus a completely dark this in terms of masking heads only or vice versa versus the sum of those two right so that should be the the measure but it just seems a bit a bit doesn't work out too much but okay that's what they say so by the way if the authors are here you have a this is cut off yeah this is annoying this is like you're trying to get lot tech to do things and it doesn't comply all right so what you can another thing you can see the authors point out here is that if you mask heads and MLPs you sort of shift more things to the back of the network to the higher up layers and they reason now because you also mask the heads basically they can't do as much work so you so the heads would be masked somewhere here so all that work is going to shift upon the MLPs and mostly to the back of the network because this thing here cannot take over work that this attention head here is now not performing anymore because it was prune because the signal travels this way so the the authors kind of interpret these results right here and I think the most important thing to see is simply the variance of things so most heads are actually important for at least two or three tasks and no head is important for all the tasks consistently I think that's the take home message right here okay and they contrast this to previous research that has basically said this experiment follows up on study by this that showed that only a few transformer heads in machine translation task did the heavy lifting while the rest could be pruned and this paper similarly showed that most of bird self attention head in MNLI task could be pruned and that the good heads were mostly shared between the MNLI matched and mismatched and they basically say yeah that's correct but that's only within one task right if you go beyond if you go to several tasks then the heads that are important differ quite a bit okay so let's continue and go here they ask how task independent or the good subnet works and they basically look at these kinds of graphs right here which are pretty interesting so what this this is heads shared between tasks so what this measures is these are the different tasks in the glue benchmark and they basically look at each task look at its winning lottery ticket and look at which heads survive in the winning ticket and then they put that here on the diagonal so if in Q and L.I a head survives it gets a one here and if it doesn't survive it gets a zero so on average 85 out of the 144 heads survive right 85 heads survive that that's pretty as I said this is somewhat like over 50% of the network it's entirely different than the original lottery ticket hypothesis paper so 85% not 85 of the 144 head survive now they look at the other tasks so for Q and L.I they would look at maybe MNLI task here and ask which of the heads that survived a Q and L.I also survives in MNLI so that gets you the shared heads and again the lower numbers of standard deviation so 62 heads are survive in Q and L.I and the authors here are sort of arguing that from these sort of numbers you should be able to see which of the tasks share different different linguistic knowledge so different linguistic knowledge could be relevant for the for different tasks but if some tasks share a lot of the attention heads that survive in the winning tickets that basically means that the model is using that information that is in that head for both tasks this could be good in that you say oh yeah these tasks really are used similar linguistic features or it could be something that you don't expect and then you might be able to investigate maybe the model is doing something shady here because it really shouldn't shouldn't you know these tasks don't really have much in common so they do this for the heads and the MLP here now the if you ask why the WNLI here has a bunch of zeros that's because it's a wonky task and basically the best thing you can do is predict the most frequent class so you can prove just about anything away on these MLPs because they have the skip connections you don't need them to predict the the most frequent class what I want to go into is the following statement right here so note that figure one so the figure before shows very few heads or MLPs that are universally useless only seven heads that survived in less than two tasks 86% of heads and 67% of MLPs survive in two to seven tasks with relatively high standard deviation they say this means that the good sub networks for different tasks have relatively little in common right so they make this they make this sort of statement again here that these the good sub networks have little in common and it might seem like that for for the for the figure initially but if you look at this figure it actually shows it's something pretty interesting I think so if you look at a number let's say for example this here this 74 and I haven't actually tried yeah let's look at the 74 and this seven this here so let's look at these tasks QQP and RTE okay so if you look at QQP and RTE you could see that these are tasks that already they don't have a lot of heads in common right and you might be able to say well if what they're saying is true that the tasks share relatively little you would expect them to be relatively independent but if I look at this 78 here it means that 78 out of 144 heads survive and here it means that 74 out of 144 heads survive so if I now would think that okay generally for different tasks things are different how many heads would I expect there to be surviving in both if the tasks are independent so that's these two things multiplied right times 144 so I can scratch this here and the seven times seven is whatever 49 let's go seven times eight about this so that's five six do I need to get out a calculator I want to I want to do this calculator sugar beam I'm gonna do this the right way okay I hope you can see that so that's 78 times 74 divided by 144 did I do it right probably did it wrong I divide 78 times 74 divided by 144 all right so that's 40 heads and you see that there's 43 heads and I've actually gone through a bunch of these numbers before not these ones but generally the shared number of heads is higher than what one would expect if you assume that the tasks are independent and I'm sort of missing sort of an analysis of that here because that I find to be a pretty interesting finding of these things and and sort of I mean I get I get the fact that they say based on the graphics up here that the tasks are sort of seem to be relatively independent with respect to the heads that survive and of course relatively independent is a relative term but a sort of an investigation into why we see considerable dependence between tasks here in terms of that so these numbers are always over the what you would assume for independence that seems to be pretty interesting all right so they say they hear go into this figure two and this pairwise comparison and they analyze as a couple of the different tasks here and what you would expect and and I don't want to go too much into these taskers honestly I so I also don't know all of these tasks I don't know which tasks should share a lot of things which ones shouldn't but it is a good way like it is a very smart way to investigate if the model really learns similar tasks to use similar information right the last thing they do right here is the good and the bad sub networks in bird fine tuning so they say our final experiment puts the above evidence of goods up networks in bird fine tuned from the perspective of lottery ticket hypothesis which predicts that the lucky sub networks can be retrained from scratch to match the performance of the full network to test this hypothesis we experiment with the following sub networks so that means I wasn't really sure when I read it the first time but now I'm fairly sure that all of the results so far were just pruning and maybe not retraining so just sort of doing the pruning thing and not doing this lottery ticket retraining which shouldn't make a lot of the difference as we're going to see but just for the understanding because it seems like pruning and retraining doesn't doesn't do that much for the winning tickets as you'll see right now but yeah so now they actually retrain from scratch so good networks the elements selected from the full model by important scores as described in the pre-like in the previous section so here they're going to evaluate these good networks first of all they're going to evaluate them pruned and they're going to evaluate them retrained in the lottery ticket style okay then they're also going to evaluate bad sub networks the elements sampled from those that did not survive the pruning plus a random sample of elements with high important score such as to match the size of the good sub networks so because the good sub networks are 50% or more of the network they want to they're going to sample from the things that did not survive so from the patterns and they plus a random sample of the good sub networks to just match the size okay so we would expect these to perform maybe worse but maybe we can also train them to achieve good performance and then they investigate bad sub networks simple inversion of the good sub networks so these would be just anything but the good they are 5 to 18% smaller in size than the sampled bad sub networks but they do not contain any elements with high important scores and they say okay for all of them they evaluate their performance on all tasks simply after pruning and with fine tuning the same sub network with the same random seeds and with the rest of the model of masks so this is really what the lottery ticket hypothesis does except they of course mask entire modules and not individual weights and here you can see the general results so the general results look like something like this this is a typical example so this is the let's go out oh yeah this here is simply the dumb classifier that always tells the the highest probability class this is the like this is sort of the the idiot's baseline okay this here is the full model full this here is the good pruned and this here is the good after its retrained again okay so you see by retraining you can base again and the original lottery ticket this would sometimes even go up here depending on how much was pruned but you can see that there is a slight gain after you retrain the pruned part okay and the other thing to note here is that you don't lose much basically you you only drop a little bit by pruning which that's what makes it the good part you only drop a little bit however if you have the bad part which are these and let's say the good plus bad these are the bad plus some of the good ones you see that the performance drops pretty heavily almost to the the baseline of the most frequent class and also here so I would actually I would go with this one right here if because that's just the bad ones you see the performance drops considerably but then and that's what the authors claim is pretty interesting if you retrain that part the bad part so to say you can achieve sort of a very comparable performance to what you can achieve with the good parts and this appears to be true for most of the results right here there are some outliers like this one but there the score is also so this is the Matthew's correlation and not the an accuracy so the score is a bit different there but you can see here the good plus bad also gets a fairly high accuracy all right so the authors claim this is I'm really surprising which I guess it is if you look at this but what I want to do is I actually want I have asked the author of the lottery ticket hypothesis this question so this is from our machine learning street talk with Jonathan Franco and this is another channel that I am I'm a part of and I would like to show you this right here when I ask this question another question from Reddit ImNimo asks suppose you try to construct a lottery ticket by taking all the weights that were not part of a winning ticket and retraining from those will that model be unable to learn the task or might there be another winning ticket hiding among them or one one that wasn't originally used so this is the most common question I get by people who read the original paper and I hope that by answering it here in a public forum I can answer it once and for all the challenge in doing this experiment is let's take the MNIST example so suppose that we find a winning ticket on MNIST it's going to be about 3% of the original size of the network so that means that if you remove it you still got 97% of the weights left and so my guess is that if you were to train those 97% of weights you'll get to the same accuracy as you got with 100% of weights because you've barely pruned the network at all you could randomly prune by 3% and it wouldn't affect it and then you could go and find another lottery ticket that's mutually exclusive with the first you still have 94% of the weights and you could probably iterate this for a very long time probably you could you could probably this way find you know 10 15 lottery tickets like this maybe more that are all mutually exclusive and still leave you with a remaining kind of residual that is capable of training to full accuracy so the challenge with this experiment is that the lottery tickets are small which is great but it means that whatever's left is large enough that you know I'm sure there's another lottery ticket in there and another lottery ticket in there and so on and so on and so on so it's a it's an it's an interesting idea in principle but once you kind of look at the sizes of things you still got so much over parameterization left that I think you you just find more lottery tickets you can even probably I'm guessing swap out one weight from a lottery ticket with another weight and it wouldn't matter or swap out a handful of weights and so combinatorially the number of lottery tickets is massive and we're just finding one all right so as you saw this is kind of the most common question that Jonathan gets here and as you can see the difference here of course is that our original tickets are already sort of 50% of the network so what's left is only 50% so this is substantially different now two things I have to remark here first of all if if because because we are pruning modules and not individual weights for the good one it's the reason that we do get these these big winning tickets right but also what I think is happening is that in because we are pruning these entire modules we're actually not fine-grained enough so that means every time we eliminate the module we actually kill some good ones and some bad ones and so in here I'm gonna guess there are some good ones and there are some bad ones but since we can only kill entire modules you know we sort of we we simply kill the one that on average has the most good ones but I'm guessing that in the thing we kill there are simply there are sorry we kill the one that has on average the least good ones but there are still some good weights in there and if you will leave the original lottery ticket hypothesis that means that these actually these very few weights in those modules can still train to full accuracy so the actually what what these authors claim is surprising in light of the original lottery ticket hypothesis I think if you look at it from the perspective of the actual hypothesis which considers individual weight and then you know a very small subset of them the original hypothesis would all would pretty much predict that you could train something where you pruned away a bunch of modules entirely or you could train these bad modules because they are still going to contain a small sized lottery ticket that is going to be responsible for the good performance so that's the kind of the first thing and the second thing in general you heard Jonathan I don't think that is actually even a question of the size of the tickets nothing in the original hypothesis forbids the non-winning ticket from also being trained to good accuracy that it simply says something about the winning ticket it doesn't say anything about the non-winning ticket so those are the two comments and I think the the question and the investigation even though it is interesting I think it's sort of maybe not thought through at least in the perspective of what they go for here I mean it is the result is very interesting but again I think they claim the original hypothesis would sort of say these are the bad parts and you couldn't train them and then they say it's surprising that you can but I would say that the original hypothesis would in fact predicts that you could train those things because you've pruned away these entire modules which is very coarse-grained and that leaves that leaves still good weights in the bad parts okay so they conclude however we can see that both good and bad networks can be retrained with comparable performance on many for many tests the inverted bad networks perform worse than the sampled ones but that could be due to them being smaller in size performance of all inverted bad networks on call is almost zero okay yeah okay very little remains when that mask is inverted that's the task we looked at because they claim that's so small which makes sense right so discussion say does bad have does bird have bad sub networks the key result of this study is that as far as fine tuning is considered bird does not seem to have bad sub networks that cannot be retrained to relatively good performance level suggesting that the way that do not survive pruning are not just inactive however it is important to remember that we consider elements of bird architecture as atomic units while the original lottery ticket work relied on magnitude pruning of individual weight so they I mean they're well aware here of these of these differences which and they can see to that right here so that's good on that level bird probably does have bad sub networks and they show that can be found in the transform model with global iterative pruning we leave it to future research to find out to what extent the effective sub networks overlap with the effective architectural blocks and what that says about the architecture of bird and the other transformers so as you see that they're not they're well aware that all of what I said is the case so it's not it's not like I'm criticizing and saying they're wrong it's just that if you read it you sort of get the impression that this is what they're saying and I think the delight of which a reader goes through it is just a bit such that such that you come off if you don't read until here you come off thinking something else I'll result to just that most architecture blocks of bird are potentially usable in fine tuning this should not be interpreted as proof that they all encode potentially irrelevant linguistic information that's absolutely true yeah it is also possible that pre-training somehow simply made them more amenable to optimization which is another question for future research and they go into what do different bird components do in the different things so again I think the this work here is actually most relevant for investigating this question what do bird components the different bird components do for the different tasks to look which tasks use which things and the the actual recognition that none of these attend none of these modules is useless I would consider pretty pretty cool finding okay so in conclusion they say prior work shows it was possible to prune most self-attention as we extend this to the fully connected layers we show fine tune versus good and bads up networks where the good heads and then the piece alone reach performance comparable with the full network and the bad ones do not perform well however this pattern does not quite conform to lottery ticket hypothesis both good and bad networks can be fine to separately to reach comparable performance we also show that 86% of heads and 15% of peas and goods up that were not universally useful across glue tasks and overlap between good and sub networks do not necessarily correspond to task types so that's that's where they that's where we didn't go into this raises questions about the degree to which fine tune bird relies on task specific or general linguistic knowledge and opens up the possibilities of studying the good sub networks to see what types of knowledge bird actually relies on at inference time so this is sort of future research direction and with that I think we've gone through the paper I hope you got something useful out of this I think it's a pretty cool paper it's a pretty cool methodology and I think a lot of work can build upon this to do interesting analysis of these language models again if you like this video consider sharing it subscribing liking and bye bye | [{"start": 0.0, "end": 5.38, "text": " Hi there. Today we're looking at when Bert plays the lottery. All tickets are"}, {"start": 5.38, "end": 11.58, "text": " winning by Sai, Prasanna, Anna Rogers and Anna Rumsisky. So a high-level"}, {"start": 11.58, "end": 16.26, "text": " overview of this paper is the following. The paper basically looks at Bert in"}, {"start": 16.26, "end": 22.080000000000002, "text": " terms of the lottery ticket hypothesis and it says that if you find"}, {"start": 22.080000000000002, "end": 28.14, "text": " tune Bert on different downstream tasks then the lottery ticket winners you're"}, {"start": 28.14, "end": 35.3, "text": " going to find are different between the task and also declaim all tickets are"}, {"start": 35.3, "end": 40.92, "text": " winning refers to the fact that if you remove the winning tickets then you can"}, {"start": 40.92, "end": 46.88, "text": " still train the rest to relatively good performance. Therefore all tickets are"}, {"start": 46.88, "end": 53.019999999999996, "text": " winning not just the subnetwork. So that was the high-level overview for those"}, {"start": 53.02, "end": 58.7, "text": " who just want to be interested if you want to continue watching this video. If you"}, {"start": 58.7, "end": 63.7, "text": " do like videos like this consider sharing liking subscribing telling your"}, {"start": 63.7, "end": 72.18, "text": " mother, father, brother and friends about it. Alright let's dive in. So Bert it is a"}, {"start": 72.18, "end": 76.06, "text": " language model. Basically if you don't know what Bert is I've done a video on"}, {"start": 76.06, "end": 81.22, "text": " Bert but really quickly what you can do with Bert is you can take a sentence"}, {"start": 81.22, "end": 87.1, "text": " something like hello there and you can put it through this multi-layer neural"}, {"start": 87.1, "end": 93.7, "text": " network and what you'll get out is basically an embedding of that of that"}, {"start": 93.7, "end": 101.58, "text": " sentence. So a vector embedding of it will make it really easy and what is"}, {"start": 101.58, "end": 106.14, "text": " usually done is this is pre-trained on a task called masked language modeling."}, {"start": 106.14, "end": 111.66, "text": " This is unsupervised training and then you take this embedding and you fine-tune"}, {"start": 111.66, "end": 116.78, "text": " basically you put on a classifier head basically say let's take sentiment"}, {"start": 116.78, "end": 121.66, "text": " classification. So you have two output classes and you want to say is this"}, {"start": 121.66, "end": 128.78, "text": " sentence I put in positive or negative sentiment. So you would train this"}, {"start": 128.78, "end": 133.66, "text": " classifier by basically taking this part from the pre-trained masked language"}, {"start": 133.66, "end": 139.14, "text": " modeling and then training the part here that does the sentiment classification"}, {"start": 139.14, "end": 146.22, "text": " you would sort of add that on top and then fine-tune the entire network to solve"}, {"start": 146.22, "end": 152.38, "text": " this task. Alright so that that is basically Bert fine-tuning on different tasks"}, {"start": 152.38, "end": 158.34, "text": " and there's this benchmark called glue where it has a number of tasks in this"}, {"start": 158.34, "end": 164.38, "text": " case I think they look at nine tasks of glue it has nine of these tasks one is"}, {"start": 164.38, "end": 170.86, "text": " the an example is the sentiment classification and it basically gets a score"}, {"start": 170.86, "end": 175.62, "text": " for each one and thereby you can sort of estimate how good your language"}, {"start": 175.62, "end": 182.38, "text": " model is by how well it is performing on each of those individual tasks. But in"}, {"start": 182.38, "end": 186.42000000000002, "text": " the notable difference here too let's say a computer like an image net"}, {"start": 186.42, "end": 191.14, "text": " classifier is the fact that first it is pre-trained right this part here is"}, {"start": 191.14, "end": 196.61999999999998, "text": " pre-trained on a large corpus and second there are different downstream tasks"}, {"start": 196.61999999999998, "end": 205.42, "text": " that you fine-tune on. So the second part that is important is the lottery"}, {"start": 205.42, "end": 211.61999999999998, "text": " ticket hypothesis. So I've also done a video on the lottery ticket hypothesis and"}, {"start": 211.62, "end": 217.3, "text": " if you very quickly what the lottery ticket hypothesis is the following. So let's"}, {"start": 217.3, "end": 222.66, "text": " say you have an image classifier and I have a bunch of layers in my neural"}, {"start": 222.66, "end": 228.9, "text": " network I'm gonna draw them like this and at the end right I can classify it into"}, {"start": 228.9, "end": 234.26, "text": " like ten different or a thousand different classes whatever and the input"}, {"start": 234.26, "end": 240.06, "text": " here is an image. So my neural network is going to have weights so every one of"}, {"start": 240.06, "end": 243.3, "text": " these neurons is connected to each other now this can be a convolutional"}, {"start": 243.3, "end": 250.3, "text": " network or a MLP so all is connected to all and as well here right everything's"}, {"start": 250.3, "end": 256.06, "text": " connected to pretty much everything. So we know first of all we know that we can"}, {"start": 256.06, "end": 263.94, "text": " train these big networks to relatively good accuracy and then second of all"}, {"start": 263.94, "end": 271.94, "text": " so first we can train them. Second we know we can prune them after training. What"}, {"start": 271.94, "end": 276.98, "text": " pruning means is the fact that after I have trained such a thing I can then go"}, {"start": 276.98, "end": 280.46, "text": " and I can figure out which one which of these connections that I have learned"}, {"start": 280.46, "end": 286.02, "text": " are the important ones and maybe I'll say ah these these here actually these"}, {"start": 286.02, "end": 291.06, "text": " these five I don't need more than those let's actually connect them to the end"}, {"start": 291.06, "end": 296.62, "text": " these seven or so I don't need all of the other ones I just need those and I can"}, {"start": 296.62, "end": 301.86, "text": " pretty much get the same accuracy as the full network. Now the important part"}, {"start": 301.86, "end": 306.86, "text": " here is that you can only do pruning after you've trained a network if you try to"}, {"start": 306.86, "end": 311.5, "text": " prune at the beginning it doesn't work so what the lottery ticket hypothesis"}, {"start": 311.5, "end": 316.38, "text": " says is basically so how does training work first you have your parameters let's"}, {"start": 316.38, "end": 320.1, "text": " let's tell them as a list so each of these weights is an entry in the list here"}, {"start": 320.1, "end": 329.66, "text": " first you initialize these randomly then through training training you get to"}, {"start": 329.66, "end": 333.90000000000003, "text": " your train state right you get each of the ones into your these are now trained"}, {"start": 333.90000000000003, "end": 342.94, "text": " and in the train state you can select the ones you think are important the"}, {"start": 342.94, "end": 348.78000000000003, "text": " lottery ticket hypothesis says if I take those that are important and basically go"}, {"start": 348.78, "end": 356.53999999999996, "text": " back to the beginning like here here and here and I basically roll them back to"}, {"start": 356.53999999999996, "end": 361.17999999999995, "text": " that state that they were in when they were initialized so I put the same"}, {"start": 361.17999999999995, "end": 367.38, "text": " random number there that I got at initialization I can then make a network"}, {"start": 367.38, "end": 375.05999999999995, "text": " where I only have those I can train that network and I can get a good"}, {"start": 375.06, "end": 380.34, "text": " accuracy so what this this basically wasn't possible in the pruning framework"}, {"start": 380.34, "end": 385.7, "text": " because we said we can't prune we can only prune after training because only"}, {"start": 385.7, "end": 389.82, "text": " then do we know which ones are the important ones in fact the lottery ticket"}, {"start": 389.82, "end": 395.78, "text": " hypothesis or the paper shows that you can train the smaller neural network from"}, {"start": 395.78, "end": 400.06, "text": " the beginning but the catch of course is you have to know which ones those are"}, {"start": 400.06, "end": 404.58, "text": " and you have to know what value to set them on at the beginning and you only"}, {"start": 404.58, "end": 410.62, "text": " know that after you've trained the full network but still it kind of gives the"}, {"start": 410.62, "end": 416.09999999999997, "text": " it tells you that you don't need all these connections for training you"}, {"start": 416.09999999999997, "end": 420.41999999999996, "text": " basically only need so many connections such that somewhere in there there's"}, {"start": 420.41999999999996, "end": 424.09999999999997, "text": " going to be the good ones right and if you knew the good ones from the beginning"}, {"start": 424.09999999999997, "end": 430.26, "text": " you could just train those and then only train the smaller sub network so that's"}, {"start": 430.26, "end": 434.86, "text": " the lottery ticket hypothesis naturally these connections here this small"}, {"start": 434.86, "end": 440.9, "text": " network is called the winning a winning ticket because if you knew what it was"}, {"start": 440.9, "end": 445.98, "text": " you could basically train a much smaller network and reach the same accuracy so"}, {"start": 445.98, "end": 452.34, "text": " this paper looks at birth in terms of this lottery ticket hypothesis now it's a"}, {"start": 452.34, "end": 456.3, "text": " bit more complicated than just in these feet forward networks because birth is"}, {"start": 456.3, "end": 460.94, "text": " not a feet forward network birth is a transformer so what does that mean a"}, {"start": 460.94, "end": 466.5, "text": " transformer consists of many layers and each layer let's expand the layer"}, {"start": 466.5, "end": 475.14, "text": " here so each layer consists of let's go over there need some space so again we"}, {"start": 475.14, "end": 480.36, "text": " have our layers of birth and it goes signal goes like this so each layer"}, {"start": 480.36, "end": 487.26, "text": " consists of two things first of all of many attention heads that's called I"}, {"start": 487.26, "end": 491.54, "text": " gonna draw these as blocks right here so for let's call them for attention"}, {"start": 491.54, "end": 496.46000000000004, "text": " heads individual attention heads are all parameterized by individual matrices"}, {"start": 496.46000000000004, "end": 502.86, "text": " and then on top of that there is an MLP so this is the multi layer perceptron this"}, {"start": 502.86, "end": 509.66, "text": " is one basically a feet forward layer residual actually and so there is a"}, {"start": 509.66, "end": 516.3000000000001, "text": " skip connection right here and these are the attention heads okay and then the"}, {"start": 516.3000000000001, "end": 520.98, "text": " next layer would again have the same structure for a piece and then one of"}, {"start": 520.98, "end": 528.94, "text": " these and so on with the skip connection all right so the pruning in birth is"}, {"start": 528.94, "end": 533.0600000000001, "text": " different than pruning in the feet forward or convolutional or that was that we"}, {"start": 533.0600000000001, "end": 538.26, "text": " looked at pruning in birth to what this paper looks at is pruning either an"}, {"start": 538.26, "end": 544.7, "text": " entire attention head like this so kind of leaving out in the entire head away"}, {"start": 544.7, "end": 549.22, "text": " which is this is an entire matrix is not a single weight right this is many"}, {"start": 549.22, "end": 554.58, "text": " many weights or even more drastically leaving away an entire MLP and"}, {"start": 554.58, "end": 561.34, "text": " basically only relying on the skip connection all right so this you have"}, {"start": 561.34, "end": 565.02, "text": " these two these two things you can do you can leave away heads or you can"}, {"start": 565.02, "end": 571.3, "text": " leave away entire MLP so you can combine these things in some way right so the"}, {"start": 571.3, "end": 576.9399999999999, "text": " notable difference here to the lottery ticket hypothesis pruning is the fact"}, {"start": 576.9399999999999, "end": 583.8199999999999, "text": " that here over up here what we prune are connections so prune connections"}, {"start": 583.8199999999999, "end": 593.62, "text": " individual connections individual connections and here we prune entire modules"}, {"start": 593.62, "end": 599.38, "text": " now this is a in my opinion this is a qualitative difference a very large"}, {"start": 599.38, "end": 604.74, "text": " qualitative difference actually why why would you do this so this paper"}, {"start": 604.74, "end": 610.42, "text": " basically doesn't invent this kind of pruning they go after already existing"}, {"start": 610.42, "end": 615.22, "text": " literature so what's the advantage in pruning modules well you have to see"}, {"start": 615.22, "end": 619.7, "text": " what's the advantage in pruning per se so in pruning what you're trying to do"}, {"start": 619.7, "end": 625.1, "text": " is obtain a smaller network that gives you the same accuracy but that you can"}, {"start": 625.1, "end": 631.5, "text": " run faster right you that uses less memory and you can you can run it faster"}, {"start": 631.5, "end": 637.34, "text": " and if you prune like this like we did in the lottery ticket hypothesis paper"}, {"start": 637.34, "end": 641.26, "text": " you don't really gain anything because if you have a matrix if you have a matrix"}, {"start": 641.26, "end": 647.38, "text": " matrix multiply right I have two matrices and I multiply them right here"}, {"start": 647.38, "end": 654.78, "text": " if I if I cut out one way tier or one way tier it doesn't help me because I have"}, {"start": 654.78, "end": 661.06, "text": " GPUs and those will parallelize these matrix procedures and it doesn't really"}, {"start": 661.06, "end": 666.46, "text": " help me because we don't really have good hardware for sparse or matrix"}, {"start": 666.46, "end": 670.42, "text": " matrix multiplication or matrix matrix multiplication with holes or things"}, {"start": 670.42, "end": 675.06, "text": " like this so it almost gains me nothing the lottery ticket hypothesis paper is"}, {"start": 675.06, "end": 682.3399999999999, "text": " very much a kind of more of a scientific curiosity paper and once we have"}, {"start": 682.3399999999999, "end": 688.0999999999999, "text": " sparse matrix multiply hardware which I think it already exists but is not"}, {"start": 688.0999999999999, "end": 693.42, "text": " super widely distributed once we have that we will be able to make use of this"}, {"start": 693.42, "end": 699.26, "text": " whereas the people that prune birth so these are more let's say industry people"}, {"start": 699.26, "end": 704.9, "text": " if you prune an entire module well that's an entire matrix that falls away so"}, {"start": 704.9, "end": 710.34, "text": " I have to I can basically save an entire matrix matrix multiply in the"}, {"start": 710.34, "end": 716.98, "text": " forward pass here on the and the backward pass well okay I don't prune during"}, {"start": 716.98, "end": 721.62, "text": " training but I can basically save an entire matrix multiply here by pruning an"}, {"start": 721.62, "end": 728.22, "text": " entire module so I'm not sure if if I were an author and I say I want to look"}, {"start": 728.22, "end": 733.66, "text": " at birth in terms of the lottery ticket hypothesis I would find a way I would"}, {"start": 733.66, "end": 737.98, "text": " go away from this literature and find a way to also just prune here individual"}, {"start": 737.98, "end": 743.74, "text": " weights it's not going to be faster but the lottery ticket investigations aren't"}, {"start": 743.74, "end": 747.54, "text": " supposed to be faster as opposed to tell you something about the nature of the"}, {"start": 747.54, "end": 752.98, "text": " things you're investigating and of course how you do this is simply by"}, {"start": 752.98, "end": 760.9, "text": " masking right you simply force these entries to be zero and therefore you don't"}, {"start": 760.9, "end": 765.34, "text": " have forward signal you don't have gradient interestingly they actually do"}, {"start": 765.34, "end": 770.5799999999999, "text": " the masking but they do it on the entire module level okay so this was"}, {"start": 770.5799999999999, "end": 775.9, "text": " birth and the lottery ticket hypothesis and the all tickets are winning we're"}, {"start": 775.9, "end": 782.42, "text": " going to investigate later let's see what they say in the abstract say much of"}, {"start": 782.42, "end": 786.38, "text": " the recent success in an LP is due to the large transformer based models such as"}, {"start": 786.38, "end": 791.22, "text": " the birth okay they say however these models have been shown to be"}, {"start": 791.22, "end": 794.9, "text": " reducible to a smaller number of self-attention heads and layers so this would"}, {"start": 794.9, "end": 799.86, "text": " be pruning we consider this phenomenon from the perspective of the lottery"}, {"start": 799.86, "end": 804.18, "text": " ticket hypothesis for fine-tuned birth we show that here's the contributions a"}, {"start": 804.18, "end": 809.58, "text": " it is possible to find a sub network of elements that achieves performance"}, {"start": 809.58, "end": 815.06, "text": " comparable with that of the full model so basically this is the pruning objective"}, {"start": 815.06, "end": 819.06, "text": " right you want to to prune it such that the performance holds and in terms of"}, {"start": 819.06, "end": 824.26, "text": " the lottery ticket hypothesis you want to prune reset to the beginning and then"}, {"start": 824.26, "end": 829.78, "text": " also and then train again and that will give you in actually in the lottery"}, {"start": 829.78, "end": 836.14, "text": " ticket hypothesis you can gain performance if you prune by a certain amount"}, {"start": 836.14, "end": 844.6199999999999, "text": " in this case here they always lose performance but yeah so second of all"}, {"start": 844.62, "end": 850.54, "text": " similarly sized sub networks sampled from the rest of the model so the non-"}, {"start": 850.54, "end": 857.9, "text": " winning ticket perform worse so if you just read if you just prune away the good"}, {"start": 857.9, "end": 864.78, "text": " parts then the bad parts perform worse of course however the bad sub networks"}, {"start": 864.78, "end": 870.74, "text": " can be fine-tuned separately to achieve only slightly worse performance than the"}, {"start": 870.74, "end": 876.34, "text": " good ones indicating that most weights in the pre-trained bird are potentially"}, {"start": 876.34, "end": 882.1, "text": " useful so this is interesting if they be fine-tuned separately this is exactly"}, {"start": 882.1, "end": 887.46, "text": " what the lottery ticket hypothesis is doing right it's basically fine-tuning only"}, {"start": 887.46, "end": 893.9, "text": " a sub part of the network and here they say even if we take the so the the parts"}, {"start": 893.9, "end": 901.9399999999999, "text": " of the network that have low scores for pruning and we retrain those then we"}, {"start": 901.9399999999999, "end": 909.78, "text": " can achieve a good performance okay so they further they say we also show that"}, {"start": 909.78, "end": 913.86, "text": " the goods of networks vary considerably across glue tasks this is this bench"}, {"start": 913.86, "end": 920.06, "text": " mark opening up the possibilities to learn what knowledge bird actually uses at"}, {"start": 920.06, "end": 927.7399999999999, "text": " inference time all right so there this is the overview of the paper so a last"}, {"start": 927.7399999999999, "end": 933.02, "text": " thing to say which I've already kind of alluded to is the fact that in the"}, {"start": 933.02, "end": 937.78, "text": " original lottery ticket hypothesis as I said you had a graph and you had sub"}, {"start": 937.78, "end": 943.2199999999999, "text": " sort of here was 100% accuracy and here was how much you prune you of course"}, {"start": 943.2199999999999, "end": 948.4599999999999, "text": " you start at 100% if you prune nothing but then as you prune the interesting"}, {"start": 948.46, "end": 954.1800000000001, "text": " is it kind of goes up and then it goes down right so this is the first thing"}, {"start": 954.1800000000001, "end": 958.82, "text": " here it goes up to a certain amount if you if you don't prune and in the"}, {"start": 958.82, "end": 963.86, "text": " original lottery ticket hypothesis here somewhere here would be 50% of the"}, {"start": 963.86, "end": 971.02, "text": " network I think and then once you go down let's say here to 90% of performance"}, {"start": 971.02, "end": 977.58, "text": " you are at something like 5% of the network size or 3% so you can prune away"}, {"start": 977.58, "end": 985.5400000000001, "text": " most things and still be like extremely extremely powerful now we're going to"}, {"start": 985.5400000000001, "end": 991.74, "text": " see what these essentially what these people do here is here is 100% and they"}, {"start": 991.74, "end": 996.94, "text": " simply prune until they reach 90% so we don't necessarily know what happens"}, {"start": 996.94, "end": 1002.38, "text": " in the middle we just know they start here and somehow they get to 90% and"}, {"start": 1002.38, "end": 1007.7, "text": " what they end up with is something like 50% of the network still at"}, {"start": 1007.7, "end": 1013.42, "text": " remaining so again see the qualitative difference here between the 5% of the"}, {"start": 1013.42, "end": 1019.18, "text": " lottery tickets in the original paper and the 50 ish or so percent or"}, {"start": 1019.18, "end": 1023.74, "text": " considerable amount more in this paper right here and I'm pretty sure that is"}, {"start": 1023.74, "end": 1028.5, "text": " due to the fact that they prune entire modules here so they don't prune on a"}, {"start": 1028.5, "end": 1034.86, "text": " fine-grained enough level to investigate these phenomenon because as I said"}, {"start": 1034.86, "end": 1039.78, "text": " we don't know but me I'm pretty sure this just goes down here and not up first"}, {"start": 1039.78, "end": 1049.02, "text": " so qualitatively it seems different all right so here they introduce what they"}, {"start": 1049.02, "end": 1055.26, "text": " do again earth is contained is is is made up of these attention heads and MLP's"}, {"start": 1055.26, "end": 1060.82, "text": " the MLPs have a skip connection as you can see here and the attention head"}, {"start": 1060.82, "end": 1066.18, "text": " attention layers are basically made up each of n of these attention heads what"}, {"start": 1066.18, "end": 1071.5, "text": " they will do is they'll they will look at 12 layer networks each layer will have"}, {"start": 1071.5, "end": 1077.54, "text": " 12 of these attention heads and one of the MLPs so you have in total 144"}, {"start": 1077.54, "end": 1085.02, "text": " heads and 12 MLP layers the way they determine which ones to prune is"}, {"start": 1085.02, "end": 1090.18, "text": " pretty easy in front of each attention head and in front of each MLP they put"}, {"start": 1090.18, "end": 1096.34, "text": " one of these binary variables right here these variables can take values 0 or"}, {"start": 1096.34, "end": 1102.5, "text": " 1 if it's if there's 0 the layers or the head is basically inactive no"}, {"start": 1102.5, "end": 1108.94, "text": " propagation if they're 1 they're active and they determine what value to set"}, {"start": 1108.94, "end": 1114.22, "text": " them to by computing important source is determining how important is a head"}, {"start": 1114.22, "end": 1118.5, "text": " or a layer for the network and that's pretty simple is simply take the"}, {"start": 1118.5, "end": 1124.54, "text": " gradient of the loss I think they go after yeah they go after this paper right"}, {"start": 1124.54, "end": 1131.3, "text": " here that's supposed to propose following you derive the loss by the by these"}, {"start": 1131.3, "end": 1135.54, "text": " variables right here and therefore you get these important scores and then you"}, {"start": 1135.54, "end": 1140.34, "text": " can simply prune the layers with the lowest important scores because that"}, {"start": 1140.34, "end": 1144.62, "text": " means that the gradient with respect to them is the smallest that means your"}, {"start": 1144.62, "end": 1156.9399999999998, "text": " loss changes the least if you were to leave them away okay so they here determine"}, {"start": 1156.9399999999998, "end": 1164.1399999999999, "text": " their their pruning strategy their constraint here is as I said 90% of the"}, {"start": 1164.1399999999999, "end": 1167.9399999999998, "text": " performance of the full model so they train the full model fine to the full model"}, {"start": 1167.94, "end": 1174.7, "text": " on this task and then they they set themselves a budget of 90% and they"}, {"start": 1174.7, "end": 1183.98, "text": " simply prune until the model reaches 90% once it goes lower they stop okay so"}, {"start": 1183.98, "end": 1189.14, "text": " they have three methods of pruning one is heads only where they only cut away"}, {"start": 1189.14, "end": 1194.8200000000002, "text": " these these attention heads as I said there are 144 of them they have the"}, {"start": 1194.82, "end": 1199.22, "text": " pruning strategy of MLPs only where they only prune the MLPs leave all the"}, {"start": 1199.22, "end": 1206.1399999999999, "text": " attention heads alone and they have this heads and MLPs they say we compute head"}, {"start": 1206.1399999999999, "end": 1212.54, "text": " and MLP important scores in a single backward pass pruning 10% heads and one"}, {"start": 1212.54, "end": 1217.82, "text": " MLP with the smallest scores until the performance on the dev set is within 90"}, {"start": 1217.82, "end": 1226.1, "text": " percent okay then we continue pruning heads alone and then MLPs alone and this"}, {"start": 1226.1, "end": 1231.8999999999999, "text": " I guess until again they are no longer in the 90% so until they reach their"}, {"start": 1231.8999999999999, "end": 1238.3, "text": " budget they so this is a combined strategy this strategy results in a larger"}, {"start": 1238.3, "end": 1243.9399999999998, "text": " number of total components pruned within our performance threshold so this is"}, {"start": 1243.9399999999998, "end": 1247.58, "text": " the this is the thing we should focus on right because in pruning the name of"}, {"start": 1247.58, "end": 1253.54, "text": " the game is how much can you take away and still be within your budget and this"}, {"start": 1253.54, "end": 1263.3, "text": " strategy seems to be the viable strategy here so a last thing here is fine"}, {"start": 1263.3, "end": 1268.78, "text": " tuning so the other difference between this paper and the lottery take a"}, {"start": 1268.78, "end": 1275.26, "text": " typothesis is that we said that in the original paper here these are"}, {"start": 1275.26, "end": 1278.74, "text": " randomly initialized weights like you train a class for an image net or"}, {"start": 1278.74, "end": 1282.58, "text": " something you start from randomly initialized weights and the lottery ticket"}, {"start": 1282.58, "end": 1289.3, "text": " papers they all they all kind of presuppose random initializations whereas"}, {"start": 1289.3, "end": 1293.78, "text": " Bert when you do the same thing for Bert these are not random initializations"}, {"start": 1293.78, "end": 1300.78, "text": " we said in Bert what you usually do is you train the encoder part here you"}, {"start": 1300.78, "end": 1306.8999999999999, "text": " pre-trained with masked language modeling first and then second you train"}, {"start": 1306.8999999999999, "end": 1312.82, "text": " the entire thing let's get the color here a second you train the entire thing"}, {"start": 1312.82, "end": 1322.26, "text": " you fine tune the entire thing so if we talk about initializations in the"}, {"start": 1322.26, "end": 1328.34, "text": " Bert task then the initialization would be at this point right here after the"}, {"start": 1328.34, "end": 1333.3799999999999, "text": " masked language modeling would be the initialization so the weights are not"}, {"start": 1333.3799999999999, "end": 1338.74, "text": " random the weights are actually pre-trained on the masked language modeling"}, {"start": 1338.74, "end": 1345.9399999999998, "text": " task which is also a qualitative difference and sort of lets us inspect so the"}, {"start": 1345.9399999999998, "end": 1351.3, "text": " offers say that since we trained with masked language modeling and people"}, {"start": 1351.3, "end": 1355.82, "text": " sort of claimed that masked language modeling learned something about the"}, {"start": 1355.82, "end": 1361.1399999999999, "text": " language we can now investigate kind of which attention heads which modules in"}, {"start": 1361.1399999999999, "end": 1367.3, "text": " Bert are encoding which parts of the language and this is going to be"}, {"start": 1367.3, "end": 1371.78, "text": " interesting once we look at which heads which attention heads and which modules"}, {"start": 1371.78, "end": 1376.86, "text": " survive in the individual tasks we can sort of compare tasks across each"}, {"start": 1376.86, "end": 1382.86, "text": " other by seeing which of the heads they share in their winning tickets all"}, {"start": 1382.86, "end": 1387.4199999999998, "text": " right so they produce these graphs here these are sort of one of the central"}, {"start": 1387.4199999999998, "end": 1392.5, "text": " graphs here and the way to read this is on the left side here you have the layer"}, {"start": 1392.5, "end": 1400.2199999999998, "text": " oops the boops you have the layer index and on the x axis you simply have the"}, {"start": 1400.2199999999998, "end": 1407.2199999999998, "text": " index of the head there are 144 boxes here each one corresponds to one of the"}, {"start": 1407.22, "end": 1414.26, "text": " attention heads the top number is always the mean number of glue tasks that"}, {"start": 1414.26, "end": 1420.1000000000001, "text": " this head survived in so what they do is they take the pre-trained bird they"}, {"start": 1420.1000000000001, "end": 1425.58, "text": " fine tune it on these nine tasks and for each of the nine tasks they determine"}, {"start": 1425.58, "end": 1434.6200000000001, "text": " the winning tickets right and the number here says how many in how many of these"}, {"start": 1434.62, "end": 1440.5, "text": " nine tasks is this particular attention head a part of the winning ticket now"}, {"start": 1440.5, "end": 1443.82, "text": " they repeat it for different random seats that's why you have floating point"}, {"start": 1443.82, "end": 1450.58, "text": " numbers and the lower part is the standard deviation across that so you can"}, {"start": 1450.58, "end": 1456.7399999999998, "text": " see quite a number of heads make it into a lot of these tasks so you can say this"}, {"start": 1456.7399999999998, "end": 1463.4599999999998, "text": " part this thing right here read on red this head right here survives in seven out"}, {"start": 1463.46, "end": 1469.42, "text": " of the nine tasks so it should be fairly it should it probably encodes"}, {"start": 1469.42, "end": 1474.54, "text": " something fairly substantial about language that is shared across these seven"}, {"start": 1474.54, "end": 1479.94, "text": " tasks right you can see some of the heads like this one here doesn't survive in"}, {"start": 1479.94, "end": 1485.66, "text": " almost any task which basically means that it's you know if that one is not"}, {"start": 1485.66, "end": 1490.78, "text": " really super important for these tasks it might have been you know important"}, {"start": 1490.78, "end": 1496.3, "text": " for the pre-training but not for these particular tasks what's interesting so"}, {"start": 1496.3, "end": 1501.74, "text": " what you can see is that the mean or median or so is like three four or five and"}, {"start": 1501.74, "end": 1509.7, "text": " that means that a lot of the the heads are sort of somewhat important for some"}, {"start": 1509.7, "end": 1513.7, "text": " of the tasks and you can see the qualitative difference if this were the like"}, {"start": 1513.7, "end": 1518.3, "text": " original lottery ticket paper most of these numbers would be at zero because"}, {"start": 1518.3, "end": 1523.3799999999999, "text": " the lottery ticket size is just so much smaller here you can directly see that"}, {"start": 1523.3799999999999, "end": 1530.46, "text": " you are going to retain a large number of things in your network in order to get"}, {"start": 1530.46, "end": 1535.06, "text": " 90% of the performance and that's probably because you prune entire modules"}, {"start": 1535.06, "end": 1542.18, "text": " again so they have this for two variants here first for this strategy of"}, {"start": 1542.18, "end": 1547.4199999999998, "text": " masking heads only and the right one is for masking heads and MLPs and the"}, {"start": 1547.42, "end": 1552.22, "text": " same here on the bottom these are the same numbers but not for attention heads"}, {"start": 1552.22, "end": 1558.42, "text": " but for MLP layers and you see again this is masking MLPs only this is masking"}, {"start": 1558.42, "end": 1568.18, "text": " heads and MLPs so if you compare the two you see that for example this here and"}, {"start": 1568.18, "end": 1575.5, "text": " this here are substantially darker which means more of this stuff survives now"}, {"start": 1575.5, "end": 1582.86, "text": " we can't really it seems like here for example there's it's darker than here so"}, {"start": 1582.86, "end": 1587.02, "text": " on the right side more stuff survives but also you have more things to prune"}, {"start": 1587.02, "end": 1593.38, "text": " right you have you can prune the heads and the MLPs and they claim before that"}, {"start": 1593.38, "end": 1599.74, "text": " the masking heads and MLP strategy results in more things being prune which"}, {"start": 1599.74, "end": 1605.94, "text": " doesn't really isn't really congruent with here generally more things surviving"}, {"start": 1605.94, "end": 1612.82, "text": " but it could be because of the fact maybe the sum of the two is still lower"}, {"start": 1612.82, "end": 1618.86, "text": " than the sum of each individual individual thing here though it doesn't"}, {"start": 1618.86, "end": 1622.54, "text": " really look like it so I'm a bit confused about this but I'm just going to"}, {"start": 1622.54, "end": 1632.34, "text": " assume that the sum of the two is is lower does that make sense if both are"}, {"start": 1632.34, "end": 1639.1399999999999, "text": " darker well it shouldn't be the sum it should be the sum of this plus a"}, {"start": 1639.1399999999999, "end": 1644.3799999999999, "text": " completely dark this in terms of masking heads only or vice versa versus the"}, {"start": 1644.3799999999999, "end": 1650.06, "text": " sum of those two right so that should be the the measure but it just seems a"}, {"start": 1650.06, "end": 1657.02, "text": " bit a bit doesn't work out too much but okay that's what they say so by the way"}, {"start": 1657.02, "end": 1664.4199999999998, "text": " if the authors are here you have a this is cut off yeah this is annoying this"}, {"start": 1664.4199999999998, "end": 1671.3799999999999, "text": " is like you're trying to get lot tech to do things and it doesn't comply"}, {"start": 1671.3799999999999, "end": 1675.98, "text": " all right so what you can another thing you can see the authors point out here"}, {"start": 1675.98, "end": 1683.66, "text": " is that if you mask heads and MLPs you sort of shift more things to the back of"}, {"start": 1683.66, "end": 1688.7, "text": " the network to the higher up layers and they reason now because you also mask"}, {"start": 1688.7, "end": 1696.06, "text": " the heads basically they can't do as much work so you so the heads would be"}, {"start": 1696.06, "end": 1702.22, "text": " masked somewhere here so all that work is going to shift upon the MLPs and"}, {"start": 1702.22, "end": 1708.02, "text": " mostly to the back of the network because this thing here cannot take over work"}, {"start": 1708.02, "end": 1712.9, "text": " that this attention head here is now not performing anymore because it was"}, {"start": 1712.9, "end": 1716.74, "text": " prune because the signal travels this way so the the authors kind of"}, {"start": 1716.74, "end": 1722.34, "text": " interpret these results right here and I think the most important thing to see"}, {"start": 1722.34, "end": 1727.22, "text": " is simply the variance of things so most heads are actually important for at"}, {"start": 1727.22, "end": 1732.78, "text": " least two or three tasks and no head is important for all the tasks"}, {"start": 1732.78, "end": 1742.26, "text": " consistently I think that's the take home message right here okay and they"}, {"start": 1742.26, "end": 1747.3, "text": " contrast this to previous research that has basically said this experiment"}, {"start": 1747.3, "end": 1753.18, "text": " follows up on study by this that showed that only a few transformer heads in"}, {"start": 1753.18, "end": 1757.38, "text": " machine translation task did the heavy lifting while the rest could be pruned"}, {"start": 1757.38, "end": 1762.98, "text": " and this paper similarly showed that most of bird self attention head in MNLI"}, {"start": 1762.98, "end": 1768.3, "text": " task could be pruned and that the good heads were mostly shared between the MNLI"}, {"start": 1768.3, "end": 1774.26, "text": " matched and mismatched and they basically say yeah that's correct but that's"}, {"start": 1774.26, "end": 1779.3, "text": " only within one task right if you go beyond if you go to several tasks then"}, {"start": 1779.3, "end": 1791.94, "text": " the heads that are important differ quite a bit okay so let's continue and go"}, {"start": 1791.94, "end": 1801.74, "text": " here they ask how task independent or the good subnet works and they basically"}, {"start": 1801.74, "end": 1808.34, "text": " look at these kinds of graphs right here which are pretty interesting so"}, {"start": 1808.34, "end": 1815.3, "text": " what this this is heads shared between tasks so what this measures is these are"}, {"start": 1815.3, "end": 1822.06, "text": " the different tasks in the glue benchmark and they basically look at each task"}, {"start": 1822.06, "end": 1828.1799999999998, "text": " look at its winning lottery ticket and look at which heads survive in the"}, {"start": 1828.1799999999998, "end": 1835.82, "text": " winning ticket and then they put that here on the diagonal so if in Q and L.I a"}, {"start": 1835.82, "end": 1841.3, "text": " head survives it gets a one here and if it doesn't survive it gets a zero so on"}, {"start": 1841.3, "end": 1847.9399999999998, "text": " average 85 out of the 144 heads survive right 85 heads survive that that's"}, {"start": 1847.9399999999998, "end": 1854.1399999999999, "text": " pretty as I said this is somewhat like over 50% of the network it's entirely"}, {"start": 1854.1399999999999, "end": 1861.1799999999998, "text": " different than the original lottery ticket hypothesis paper so 85% not"}, {"start": 1861.18, "end": 1868.3, "text": " 85 of the 144 head survive now they look at the other tasks so for Q and L.I they"}, {"start": 1868.3, "end": 1874.9, "text": " would look at maybe MNLI task here and ask which of the heads that survived a"}, {"start": 1874.9, "end": 1880.38, "text": " Q and L.I also survives in MNLI so that gets you the shared heads and again"}, {"start": 1880.38, "end": 1887.14, "text": " the lower numbers of standard deviation so 62 heads are survive in Q and L.I and"}, {"start": 1887.14, "end": 1894.66, "text": " the authors here are sort of arguing that from these sort of numbers you"}, {"start": 1894.66, "end": 1900.8600000000001, "text": " should be able to see which of the tasks share different different linguistic"}, {"start": 1900.8600000000001, "end": 1907.18, "text": " knowledge so different linguistic knowledge could be relevant for the for"}, {"start": 1907.18, "end": 1912.3400000000001, "text": " different tasks but if some tasks share a lot of the attention heads that"}, {"start": 1912.34, "end": 1917.62, "text": " survive in the winning tickets that basically means that the model is using that"}, {"start": 1917.62, "end": 1922.8999999999999, "text": " information that is in that head for both tasks this could be good in that"}, {"start": 1922.8999999999999, "end": 1928.62, "text": " you say oh yeah these tasks really are used similar linguistic features or it"}, {"start": 1928.62, "end": 1931.5, "text": " could be something that you don't expect and then you might be able to"}, {"start": 1931.5, "end": 1935.62, "text": " investigate maybe the model is doing something shady here because it really"}, {"start": 1935.62, "end": 1941.54, "text": " shouldn't shouldn't you know these tasks don't really have much in common so"}, {"start": 1941.54, "end": 1948.46, "text": " they do this for the heads and the MLP here now the if you ask why the WNLI here"}, {"start": 1948.46, "end": 1952.26, "text": " has a bunch of zeros that's because it's a wonky task and basically the best"}, {"start": 1952.26, "end": 1957.1, "text": " thing you can do is predict the most frequent class so you can prove just about"}, {"start": 1957.1, "end": 1961.5, "text": " anything away on these MLPs because they have the skip connections you don't"}, {"start": 1961.5, "end": 1969.82, "text": " need them to predict the the most frequent class what I want to go into is the"}, {"start": 1969.82, "end": 1981.3799999999999, "text": " following statement right here so note that figure one so the figure before"}, {"start": 1981.3799999999999, "end": 1987.62, "text": " shows very few heads or MLPs that are universally useless only seven heads that"}, {"start": 1987.62, "end": 1994.06, "text": " survived in less than two tasks 86% of heads and 67% of MLPs survive in two to"}, {"start": 1994.06, "end": 1999.78, "text": " seven tasks with relatively high standard deviation they say this means that the"}, {"start": 1999.78, "end": 2006.98, "text": " good sub networks for different tasks have relatively little in common right"}, {"start": 2006.98, "end": 2014.4199999999998, "text": " so they make this they make this sort of statement again here that these the"}, {"start": 2014.4199999999998, "end": 2019.58, "text": " good sub networks have little in common and it might seem like that for for"}, {"start": 2019.58, "end": 2026.06, "text": " the for the figure initially but if you look at this figure it actually shows"}, {"start": 2026.06, "end": 2033.82, "text": " it's something pretty interesting I think so if you look at a number let's say"}, {"start": 2033.82, "end": 2042.4199999999998, "text": " for example this here this 74 and I haven't actually tried yeah let's look at"}, {"start": 2042.42, "end": 2052.66, "text": " the 74 and this seven this here so let's look at these tasks QQP and RTE okay so"}, {"start": 2052.66, "end": 2059.14, "text": " if you look at QQP and RTE you could see that these are tasks that already"}, {"start": 2059.14, "end": 2064.94, "text": " they don't have a lot of heads in common right and you might be able to say"}, {"start": 2064.94, "end": 2071.3, "text": " well if what they're saying is true that the tasks share relatively little you"}, {"start": 2071.3, "end": 2078.6200000000003, "text": " would expect them to be relatively independent but if I look at this 78 here it"}, {"start": 2078.6200000000003, "end": 2087.94, "text": " means that 78 out of 144 heads survive and here it means that 74 out of 144"}, {"start": 2087.94, "end": 2096.02, "text": " heads survive so if I now would think that okay generally for different tasks"}, {"start": 2096.02, "end": 2102.3, "text": " things are different how many heads would I expect there to be surviving in both"}, {"start": 2102.3, "end": 2107.3, "text": " if the tasks are independent so that's these two things multiplied right times"}, {"start": 2107.3, "end": 2116.9, "text": " 144 so I can scratch this here and the seven times seven is whatever 49 let's"}, {"start": 2116.9, "end": 2123.74, "text": " go seven times eight about this so that's five six do I need to get out a"}, {"start": 2123.74, "end": 2134.02, "text": " calculator I want to I want to do this calculator sugar beam I'm gonna do this the"}, {"start": 2134.02, "end": 2144.8599999999997, "text": " right way okay I hope you can see that so that's 78 times 74 divided by 144"}, {"start": 2144.86, "end": 2156.6200000000003, "text": " did I do it right probably did it wrong I divide 78 times 74 divided by 144"}, {"start": 2156.6200000000003, "end": 2163.42, "text": " all right so that's 40 heads and you see that there's 43 heads and I've"}, {"start": 2163.42, "end": 2167.78, "text": " actually gone through a bunch of these numbers before not these ones but"}, {"start": 2167.78, "end": 2174.06, "text": " generally the shared number of heads is higher than what one would expect if"}, {"start": 2174.06, "end": 2181.2999999999997, "text": " you assume that the tasks are independent and I'm sort of missing sort of an"}, {"start": 2181.2999999999997, "end": 2186.14, "text": " analysis of that here because that I find to be a pretty interesting finding of"}, {"start": 2186.14, "end": 2193.74, "text": " these things and and sort of I mean I get I get the fact that they say based on"}, {"start": 2193.74, "end": 2198.5, "text": " the graphics up here that the tasks are sort of seem to be relatively"}, {"start": 2198.5, "end": 2201.94, "text": " independent with respect to the heads that survive and of course relatively"}, {"start": 2201.94, "end": 2209.62, "text": " independent is a relative term but a sort of an investigation into why we see"}, {"start": 2209.62, "end": 2215.7400000000002, "text": " considerable dependence between tasks here in terms of that so"}, {"start": 2215.7400000000002, "end": 2222.58, "text": " these numbers are always over the what you would assume for independence that"}, {"start": 2222.58, "end": 2232.86, "text": " seems to be pretty interesting all right so they say they hear go into this"}, {"start": 2232.86, "end": 2239.7799999999997, "text": " figure two and this pairwise comparison and they analyze as a couple of the"}, {"start": 2239.7799999999997, "end": 2246.38, "text": " different tasks here and what you would expect and and I don't want to go too"}, {"start": 2246.38, "end": 2250.2599999999998, "text": " much into these taskers honestly I so I also don't know all of these tasks I"}, {"start": 2250.26, "end": 2254.82, "text": " don't know which tasks should share a lot of things which ones shouldn't but it"}, {"start": 2254.82, "end": 2259.5, "text": " is a good way like it is a very smart way to investigate if the model really"}, {"start": 2259.5, "end": 2265.6600000000003, "text": " learns similar tasks to use similar information right the last thing they do"}, {"start": 2265.6600000000003, "end": 2272.94, "text": " right here is the good and the bad sub networks in bird fine tuning so they say"}, {"start": 2272.94, "end": 2276.1800000000003, "text": " our final experiment puts the above evidence of goods up networks in bird"}, {"start": 2276.18, "end": 2281.54, "text": " fine tuned from the perspective of lottery ticket hypothesis which predicts"}, {"start": 2281.54, "end": 2285.8999999999996, "text": " that the lucky sub networks can be retrained from scratch to match the"}, {"start": 2285.8999999999996, "end": 2292.2999999999997, "text": " performance of the full network to test this hypothesis we experiment with the"}, {"start": 2292.2999999999997, "end": 2297.94, "text": " following sub networks so that means I wasn't really sure when I read it the"}, {"start": 2297.94, "end": 2304.2999999999997, "text": " first time but now I'm fairly sure that all of the results so far were just"}, {"start": 2304.3, "end": 2311.98, "text": " pruning and maybe not retraining so just sort of doing the pruning thing and"}, {"start": 2311.98, "end": 2318.26, "text": " not doing this lottery ticket retraining which shouldn't make a lot of the"}, {"start": 2318.26, "end": 2323.1400000000003, "text": " difference as we're going to see but just for the understanding because it seems"}, {"start": 2323.1400000000003, "end": 2327.98, "text": " like pruning and retraining doesn't doesn't do that much for the winning"}, {"start": 2327.98, "end": 2333.5800000000004, "text": " tickets as you'll see right now but yeah so now they actually retrain from"}, {"start": 2333.58, "end": 2340.22, "text": " scratch so good networks the elements selected from the full model by"}, {"start": 2340.22, "end": 2346.2599999999998, "text": " important scores as described in the pre-like in the previous section so here"}, {"start": 2346.2599999999998, "end": 2349.62, "text": " they're going to evaluate these good networks first of all they're going to"}, {"start": 2349.62, "end": 2354.42, "text": " evaluate them pruned and they're going to evaluate them retrained in the"}, {"start": 2354.42, "end": 2360.8199999999997, "text": " lottery ticket style okay then they're also going to evaluate bad sub networks"}, {"start": 2360.82, "end": 2366.1000000000004, "text": " the elements sampled from those that did not survive the pruning plus a"}, {"start": 2366.1000000000004, "end": 2372.5800000000004, "text": " random sample of elements with high important score such as to match the size"}, {"start": 2372.5800000000004, "end": 2377.1400000000003, "text": " of the good sub networks so because the good sub networks are 50% or more of"}, {"start": 2377.1400000000003, "end": 2385.6200000000003, "text": " the network they want to they're going to sample from the things that did not"}, {"start": 2385.62, "end": 2390.66, "text": " survive so from the patterns and they plus a random sample of the good sub"}, {"start": 2390.66, "end": 2396.5, "text": " networks to just match the size okay so we would expect these to perform"}, {"start": 2396.5, "end": 2403.2599999999998, "text": " maybe worse but maybe we can also train them to achieve good performance and then"}, {"start": 2403.2599999999998, "end": 2408.54, "text": " they investigate bad sub networks simple inversion of the good sub networks so"}, {"start": 2408.54, "end": 2414.2599999999998, "text": " these would be just anything but the good they are 5 to 18% smaller in size"}, {"start": 2414.26, "end": 2419.42, "text": " than the sampled bad sub networks but they do not contain any elements with"}, {"start": 2419.42, "end": 2425.7000000000003, "text": " high important scores and they say okay for all of them they evaluate their"}, {"start": 2425.7000000000003, "end": 2430.94, "text": " performance on all tasks simply after pruning and with fine tuning the same"}, {"start": 2430.94, "end": 2435.86, "text": " sub network with the same random seeds and with the rest of the model of masks so"}, {"start": 2435.86, "end": 2439.5, "text": " this is really what the lottery ticket hypothesis does except they of course"}, {"start": 2439.5, "end": 2444.82, "text": " mask entire modules and not individual weights and here you can see the"}, {"start": 2444.82, "end": 2450.86, "text": " general results so the general results look like something like this this is a"}, {"start": 2450.86, "end": 2459.46, "text": " typical example so this is the let's go out oh yeah this here is simply the"}, {"start": 2459.46, "end": 2464.74, "text": " dumb classifier that always tells the the highest probability class this is"}, {"start": 2464.74, "end": 2469.9399999999996, "text": " the like this is sort of the the idiot's baseline okay this here is the full"}, {"start": 2469.9399999999996, "end": 2478.66, "text": " model full this here is the good pruned and this here is the good after its"}, {"start": 2478.66, "end": 2484.18, "text": " retrained again okay so you see by retraining you can base again and the"}, {"start": 2484.18, "end": 2488.54, "text": " original lottery ticket this would sometimes even go up here depending on how"}, {"start": 2488.54, "end": 2493.9799999999996, "text": " much was pruned but you can see that there is a slight gain after you retrain"}, {"start": 2493.98, "end": 2500.38, "text": " the pruned part okay and the other thing to note here is that you don't lose"}, {"start": 2500.38, "end": 2507.38, "text": " much basically you you only drop a little bit by pruning which that's what"}, {"start": 2507.38, "end": 2512.9, "text": " makes it the good part you only drop a little bit however if you have the bad"}, {"start": 2512.9, "end": 2520.54, "text": " part which are these and let's say the good plus bad these are the bad plus"}, {"start": 2520.54, "end": 2524.98, "text": " some of the good ones you see that the performance drops pretty heavily"}, {"start": 2524.98, "end": 2535.58, "text": " almost to the the baseline of the most frequent class and also here so I would"}, {"start": 2535.58, "end": 2540.22, "text": " actually I would go with this one right here if because that's just the bad"}, {"start": 2540.22, "end": 2545.58, "text": " ones you see the performance drops considerably but then and that's what the"}, {"start": 2545.58, "end": 2551.22, "text": " authors claim is pretty interesting if you retrain that part the bad part so to"}, {"start": 2551.22, "end": 2557.46, "text": " say you can achieve sort of a very comparable performance to what you can"}, {"start": 2557.46, "end": 2562.74, "text": " achieve with the good parts and this appears to be true for most of the"}, {"start": 2562.74, "end": 2568.38, "text": " results right here there are some outliers like this one but there the score is"}, {"start": 2568.38, "end": 2574.18, "text": " also so this is the Matthew's correlation and not the an accuracy so the score"}, {"start": 2574.18, "end": 2578.2999999999997, "text": " is a bit different there but you can see here the good plus bad also gets a"}, {"start": 2578.2999999999997, "end": 2584.02, "text": " fairly high accuracy all right so the authors claim this is I'm really"}, {"start": 2584.02, "end": 2588.1, "text": " surprising which I guess it is if you look at this but what I want to do is I"}, {"start": 2588.1, "end": 2594.46, "text": " actually want I have asked the author of the lottery ticket hypothesis this"}, {"start": 2594.46, "end": 2599.2999999999997, "text": " question so this is from our machine learning street talk with Jonathan"}, {"start": 2599.3, "end": 2606.7400000000002, "text": " Franco and this is another channel that I am I'm a part of and I would like to"}, {"start": 2606.7400000000002, "end": 2612.42, "text": " show you this right here when I ask this question"}, {"start": 2612.42, "end": 2619.1000000000004, "text": " another question from Reddit ImNimo asks suppose you try to construct a lottery"}, {"start": 2619.1000000000004, "end": 2623.78, "text": " ticket by taking all the weights that were not part of a winning ticket and"}, {"start": 2623.78, "end": 2629.38, "text": " retraining from those will that model be unable to learn the task or might"}, {"start": 2629.38, "end": 2633.98, "text": " there be another winning ticket hiding among them or one one that wasn't"}, {"start": 2633.98, "end": 2639.78, "text": " originally used so this is the most common question I get by people who read"}, {"start": 2639.78, "end": 2645.1400000000003, "text": " the original paper and I hope that by answering it here in a public forum I"}, {"start": 2645.1400000000003, "end": 2649.6200000000003, "text": " can answer it once and for all the challenge in doing this experiment is let's"}, {"start": 2649.62, "end": 2654.54, "text": " take the MNIST example so suppose that we find a winning ticket on MNIST it's"}, {"start": 2654.54, "end": 2658.74, "text": " going to be about 3% of the original size of the network so that means that if"}, {"start": 2658.74, "end": 2662.98, "text": " you remove it you still got 97% of the weights left and so my guess is that if"}, {"start": 2662.98, "end": 2666.22, "text": " you were to train those 97% of weights you'll get to the same accuracy as you"}, {"start": 2666.22, "end": 2669.14, "text": " got with 100% of weights because you've barely pruned the network at all you"}, {"start": 2669.14, "end": 2672.2599999999998, "text": " could randomly prune by 3% and it wouldn't affect it and then you could go and"}, {"start": 2672.2599999999998, "end": 2675.7, "text": " find another lottery ticket that's mutually exclusive with the first you still"}, {"start": 2675.7, "end": 2678.9, "text": " have 94% of the weights and you could probably iterate this for a very long"}, {"start": 2678.9, "end": 2685.6600000000003, "text": " time probably you could you could probably this way find you know 10 15 lottery"}, {"start": 2685.6600000000003, "end": 2689.98, "text": " tickets like this maybe more that are all mutually exclusive and still leave you"}, {"start": 2689.98, "end": 2694.42, "text": " with a remaining kind of residual that is capable of training to full accuracy"}, {"start": 2694.42, "end": 2698.1800000000003, "text": " so the challenge with this experiment is that the lottery tickets are small"}, {"start": 2698.1800000000003, "end": 2701.86, "text": " which is great but it means that whatever's left is large enough that you know"}, {"start": 2701.86, "end": 2704.38, "text": " I'm sure there's another lottery ticket in there and another lottery ticket in"}, {"start": 2704.38, "end": 2709.42, "text": " there and so on and so on and so on so it's a it's an it's an interesting idea"}, {"start": 2709.42, "end": 2714.6600000000003, "text": " in principle but once you kind of look at the sizes of things you still got"}, {"start": 2714.6600000000003, "end": 2718.46, "text": " so much over parameterization left that I think you you just find more lottery"}, {"start": 2718.46, "end": 2722.06, "text": " tickets you can even probably I'm guessing swap out one weight from a lottery"}, {"start": 2722.06, "end": 2724.5, "text": " ticket with another weight and it wouldn't matter or swap out a handful of"}, {"start": 2724.5, "end": 2728.6600000000003, "text": " weights and so combinatorially the number of lottery tickets is massive and"}, {"start": 2728.66, "end": 2737.1, "text": " we're just finding one all right so as you saw this is kind of the most common"}, {"start": 2737.1, "end": 2743.62, "text": " question that Jonathan gets here and as you can see the difference here of"}, {"start": 2743.62, "end": 2748.42, "text": " course is that our original tickets are already sort of 50% of the network so"}, {"start": 2748.42, "end": 2755.66, "text": " what's left is only 50% so this is substantially different now two things I"}, {"start": 2755.66, "end": 2762.3399999999997, "text": " have to remark here first of all if if because because we are"}, {"start": 2762.3399999999997, "end": 2766.94, "text": " pruning modules and not individual weights for the good one it's the reason"}, {"start": 2766.94, "end": 2774.42, "text": " that we do get these these big winning tickets right but also what I think is"}, {"start": 2774.42, "end": 2779.94, "text": " happening is that in because we are pruning these entire modules we're actually"}, {"start": 2779.94, "end": 2785.86, "text": " not fine-grained enough so that means every time we eliminate the module we"}, {"start": 2785.86, "end": 2792.7000000000003, "text": " actually kill some good ones and some bad ones and so in here I'm gonna guess"}, {"start": 2792.7000000000003, "end": 2798.78, "text": " there are some good ones and there are some bad ones but since we can only kill"}, {"start": 2798.78, "end": 2805.58, "text": " entire modules you know we sort of we we simply kill the one that on average"}, {"start": 2805.58, "end": 2812.14, "text": " has the most good ones but I'm guessing that in the thing we kill there are"}, {"start": 2812.14, "end": 2818.2599999999998, "text": " simply there are sorry we kill the one that has on average the least good"}, {"start": 2818.2599999999998, "end": 2822.54, "text": " ones but there are still some good weights in there and if you will leave the"}, {"start": 2822.54, "end": 2829.58, "text": " original lottery ticket hypothesis that means that these actually these very few"}, {"start": 2829.58, "end": 2836.7799999999997, "text": " weights in those modules can still train to full accuracy so the actually what"}, {"start": 2836.7799999999997, "end": 2842.2999999999997, "text": " what these authors claim is surprising in light of the original lottery ticket"}, {"start": 2842.2999999999997, "end": 2846.8199999999997, "text": " hypothesis I think if you look at it from the perspective of the actual"}, {"start": 2846.8199999999997, "end": 2851.14, "text": " hypothesis which considers individual weight and then you know a very small"}, {"start": 2851.14, "end": 2857.8199999999997, "text": " subset of them the original hypothesis would all would pretty much predict that"}, {"start": 2857.82, "end": 2862.7400000000002, "text": " you could train something where you pruned away a bunch of modules entirely"}, {"start": 2862.7400000000002, "end": 2870.1800000000003, "text": " or you could train these bad modules because they are still going to contain a"}, {"start": 2870.1800000000003, "end": 2875.5, "text": " small sized lottery ticket that is going to be responsible for the good"}, {"start": 2875.5, "end": 2880.38, "text": " performance so that's the kind of the first thing and the second thing in"}, {"start": 2880.38, "end": 2885.06, "text": " general you heard Jonathan I don't think that is actually even a question of"}, {"start": 2885.06, "end": 2892.06, "text": " the size of the tickets nothing in the original hypothesis forbids the non-winning"}, {"start": 2892.06, "end": 2896.2999999999997, "text": " ticket from also being trained to good accuracy that it simply says something"}, {"start": 2896.2999999999997, "end": 2900.7799999999997, "text": " about the winning ticket it doesn't say anything about the non-winning ticket"}, {"start": 2900.7799999999997, "end": 2907.54, "text": " so those are the two comments and I think the the question and the"}, {"start": 2907.54, "end": 2913.62, "text": " investigation even though it is interesting I think it's sort of maybe not"}, {"start": 2913.62, "end": 2921.22, "text": " thought through at least in the perspective of what they go for here I mean it"}, {"start": 2921.22, "end": 2925.94, "text": " is the result is very interesting but again I think they claim the original"}, {"start": 2925.94, "end": 2930.14, "text": " hypothesis would sort of say these are the bad parts and you couldn't train"}, {"start": 2930.14, "end": 2935.8599999999997, "text": " them and then they say it's surprising that you can but I would say that the"}, {"start": 2935.8599999999997, "end": 2942.02, "text": " original hypothesis would in fact predicts that you could train those things"}, {"start": 2942.02, "end": 2947.14, "text": " because you've pruned away these entire modules which is very coarse-grained"}, {"start": 2947.14, "end": 2953.14, "text": " and that leaves that leaves still good weights in the bad parts okay so they"}, {"start": 2953.14, "end": 2957.5, "text": " conclude however we can see that both good and bad networks can be retrained"}, {"start": 2957.5, "end": 2962.2599999999998, "text": " with comparable performance on many for many tests the inverted bad networks"}, {"start": 2962.2599999999998, "end": 2965.9, "text": " perform worse than the sampled ones but that could be due to them being smaller"}, {"start": 2965.9, "end": 2971.06, "text": " in size performance of all inverted bad networks on call is almost zero"}, {"start": 2971.06, "end": 2978.2999999999997, "text": " okay yeah okay very little remains when that mask is inverted that's the task"}, {"start": 2978.2999999999997, "end": 2985.42, "text": " we looked at because they claim that's so small which makes sense right so"}, {"start": 2985.42, "end": 2990.62, "text": " discussion say does bad have does bird have bad sub networks the key"}, {"start": 2990.62, "end": 2994.42, "text": " result of this study is that as far as fine tuning is considered bird does not"}, {"start": 2994.42, "end": 2998.74, "text": " seem to have bad sub networks that cannot be retrained to relatively good"}, {"start": 2998.74, "end": 3002.9399999999996, "text": " performance level suggesting that the way that do not survive pruning are not"}, {"start": 3002.9399999999996, "end": 3007.2999999999997, "text": " just inactive however it is important to remember that we consider elements of"}, {"start": 3007.2999999999997, "end": 3011.18, "text": " bird architecture as atomic units while the original lottery ticket work relied"}, {"start": 3011.18, "end": 3014.9799999999996, "text": " on magnitude pruning of individual weight so they I mean they're well aware"}, {"start": 3014.9799999999996, "end": 3020.54, "text": " here of these of these differences which and they can see to that right here so"}, {"start": 3020.54, "end": 3026.8599999999997, "text": " that's good on that level bird probably does have bad sub networks and they show"}, {"start": 3026.86, "end": 3031.6600000000003, "text": " that can be found in the transform model with global iterative pruning we leave"}, {"start": 3031.6600000000003, "end": 3035.02, "text": " it to future research to find out to what extent the effective sub networks"}, {"start": 3035.02, "end": 3039.1, "text": " overlap with the effective architectural blocks and what that says about the"}, {"start": 3039.1, "end": 3042.9, "text": " architecture of bird and the other transformers so as you see that they're"}, {"start": 3042.9, "end": 3050.7000000000003, "text": " not they're well aware that all of what I said is the case so it's not it's not"}, {"start": 3050.7, "end": 3057.02, "text": " like I'm criticizing and saying they're wrong it's just that if you read it you"}, {"start": 3057.02, "end": 3065.74, "text": " sort of get the impression that this is what they're saying and I think the"}, {"start": 3065.74, "end": 3070.7799999999997, "text": " delight of which a reader goes through it is just a bit such that such that you"}, {"start": 3070.7799999999997, "end": 3077.7799999999997, "text": " come off if you don't read until here you come off thinking something else"}, {"start": 3077.78, "end": 3081.5800000000004, "text": " I'll result to just that most architecture blocks of bird are potentially"}, {"start": 3081.5800000000004, "end": 3084.98, "text": " usable in fine tuning this should not be interpreted as proof that they all"}, {"start": 3084.98, "end": 3090.34, "text": " encode potentially irrelevant linguistic information that's absolutely true"}, {"start": 3090.34, "end": 3094.86, "text": " yeah it is also possible that pre-training somehow simply made them more"}, {"start": 3094.86, "end": 3101.46, "text": " amenable to optimization which is another question for future research and they"}, {"start": 3101.46, "end": 3106.5800000000004, "text": " go into what do different bird components do in the different things so again I"}, {"start": 3106.58, "end": 3111.06, "text": " think the this work here is actually most relevant for investigating this"}, {"start": 3111.06, "end": 3115.1, "text": " question what do bird components the different bird components do for the"}, {"start": 3115.1, "end": 3120.62, "text": " different tasks to look which tasks use which things and the the actual"}, {"start": 3120.62, "end": 3126.9, "text": " recognition that none of these attend none of these modules is useless I would"}, {"start": 3126.9, "end": 3132.74, "text": " consider pretty pretty cool finding okay so in conclusion they say"}, {"start": 3132.74, "end": 3136.4199999999996, "text": " prior work shows it was possible to prune most self-attention as we extend this"}, {"start": 3136.4199999999996, "end": 3139.8599999999997, "text": " to the fully connected layers we show fine tune versus good and bads up"}, {"start": 3139.8599999999997, "end": 3142.8199999999997, "text": " networks where the good heads and then the piece alone reach performance comparable"}, {"start": 3142.8199999999997, "end": 3146.8599999999997, "text": " with the full network and the bad ones do not perform well however this pattern"}, {"start": 3146.8599999999997, "end": 3150.4599999999996, "text": " does not quite conform to lottery ticket hypothesis both good and bad networks"}, {"start": 3150.4599999999996, "end": 3157.3799999999997, "text": " can be fine to separately to reach comparable performance we also show that"}, {"start": 3157.3799999999997, "end": 3162.5, "text": " 86% of heads and 15% of peas and goods up that were not universally useful"}, {"start": 3162.5, "end": 3166.42, "text": " across glue tasks and overlap between good and sub networks do not necessarily"}, {"start": 3166.42, "end": 3170.98, "text": " correspond to task types so that's that's where they that's where we didn't"}, {"start": 3170.98, "end": 3175.38, "text": " go into this raises questions about the degree to which fine tune bird relies on"}, {"start": 3175.38, "end": 3179.62, "text": " task specific or general linguistic knowledge and opens up the possibilities"}, {"start": 3179.62, "end": 3183.22, "text": " of studying the good sub networks to see what types of knowledge bird actually"}, {"start": 3183.22, "end": 3188.58, "text": " relies on at inference time so this is sort of future research direction and"}, {"start": 3188.58, "end": 3194.02, "text": " with that I think we've gone through the paper I hope you got something useful"}, {"start": 3194.02, "end": 3198.1, "text": " out of this I think it's a pretty cool paper it's a pretty cool methodology"}, {"start": 3198.1, "end": 3202.98, "text": " and I think a lot of work can build upon this to do interesting"}, {"start": 3202.98, "end": 3207.38, "text": " analysis of these language models again if you like this video consider"}, {"start": 3207.38, "end": 3222.58, "text": " sharing it subscribing liking and bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=utuz7wBGjKM | [News] OpenAI Model Generates Python Code | This code completion engine can write an entire function from just the name! OpenAI demonstrates what happens when you learn a language model on thousands of GitHub Python repositories.
Source Clip: https://youtu.be/fZSFNUT6iY8
Full Video: https://www.pscp.tv/Microsoft/1OyKAYWPRrWKb
Kite: https://kite.com/
TabNine: https://www.tabnine.com/
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. So I saw this and probably many of you have seen this. OpenAI was demonstrating at MSBuild, basically a GPT2 language model but trained not on language but on code, on Python code, open source code from GitHub. And so the idea is that the model learns to produce code and we'll just have a short look at the clip they have here. I'll link the entire clip down. So this is what the human types. Def is Palandrome. So the function name, the argument, and the doc string. And now the model is asked to produce the rest of the function and check out. So it's pretty good, right? This is actually to check whether this is a basic check whether a string is a Palandrome as long as you can ensure that s is a string and so on. So the model learned this. You can still say maybe that's just interpolating from, you know, something like this is surely in a GitHub repo somewhere. So they go further and they try to say, okay, please give me a function where the Palandromes, so return a list indices for elements that are Palandromes and at least seven characters. And I personally have searched for this function on GitHub and it does not exist. So what does the model produce? Pretty cool. So this is first of all a list comprehension in Python, which is reasonably complicated, right? And you can see there is this length filter that is greater or equal to seven. And it refers actually back to the is Palandrome function that it wrote before. That's pretty cool. Now this is not like a language model producing as far as I understand producing this basically letter by letter or word by word. This goes over the constraints of abstract syntax trees. So it is I think that's what's happening. They don't have a paper to go along, though I will look into more papers of that sort. They do kind of constrain the model to actually produce valid code, but of course which variables go where and so on. That's that is completely up to the model. And you see here it understands completely what the user wants. Now of course these examples might be cherry picked, right? But it's even for cherry picked examples still pretty impressive. As I said, I could not find this particular function. So they post two classes here, data classes, item and order. And now the model is asked to compute the total order price, which is a method of the of the order class. And they stop here. So this is what the human enters. Human enters that just the name of the function, not even the doc string. And the model comes up with the following compute the total price of the order, including the Palandrome. So it does all of that by itself, including the doc string, just from the method. Now you can see pretty much what's happening here. It's kind of like the GPT-2 language model. So what it does is probably it from the method name it derives this doc string compute total price, right? That's a lot of programmers do this of the order order is of course the name of the class of self. And here it says, including the Palandrome discount. And that is probably somewhat pattern match to other functions that have some sort of discount or something like this or one argument that is a number. But the fact that it is also able, see it adds up the total price per item. And it basically discounts every item. Now it cannot work out that Palandrome discount should mean that every item should be a Palandrome. That's the only thing it can't work out. It just applies a discount to every single item. Now they go ahead and kind of change that and write the doc strings themselves such that it is clear that apply the discount to items whose name or Palandromes. Now the model is again asked to complete this. And absolutely crazy. If it's a Palandrome then multiply it with the discount. And if it's not a Palandrome then just add the price. And this final touch here that's one minus the Palandrome discount is added by the programmer. So you can see that this goes towards kind of a symbiosis of human and machine in this way. I don't think the AI will replace programmers but it certainly is going to be very helpful to automate some of the things or give you suggestions for things that you have to do over and over again. Now I think a lot of of these rely on the fact that a lot of programming is redundant still. A lot of people name the function and then in the doc string they basically repeat the function because they've already intelligently named the function. So technically there doesn't need to be a doc string but then whatever your style guide comes in it says there needs to be a doc string. Every argument must be described. Every argument must have a description and a help string and a type even though it is completely obvious from the names and what they do. So if it is completely obvious I would argue you don't need a doc string. And this is kind of additional information that this model is able to to actually sort of make use of it. Right. So the fact that a lot of these functions you can already the doc string is sort of already the implementation of the function almost. So the distance there is not it's not like you can you can say whatever you want. And yeah. So you can see here when it's asked to print the receipt it just works out. So it's printing it's doing format strings and what not so it's just learn to do that. I would argue again this works you couldn't just put anything like doc string language is a very specific type of language that programmers use where they basically already sort of implement the method in the doc string. And then the the body of the method is just the then really specific code. But as of that yeah there's a lot of information already in the doc string in the naming of the function and it's still pretty impressive right. So yeah I just want to show you that this already is available even though not in you know as big of a form. You can't write giant functions for you can't write function bodies. But there are some machine learning based completions already available. So kite is one of them. And tap nine is the other one that I use for now. Both are close sources I understand it. So that's a bit of a downer there. But these are exactly kind of GPT language models learned on a lot of code. So they can kind of guess what you want and interpolate it with your variables in there and so on. I also found this when I searched this comparison here kite versus tab nine. And you see it starts off yeah but these are I think these are kind of all though generated. So when you look at the video you get tab nine is correct but kite it's an actual video review of a kite. Yeah so you know who knows. But what I wanted to do is basically show you a bit of the power of tab nine. Let me get this out of the way. So a while back ago I live coded this session right here where I implemented a sentiment classifier from scratch using hugging face libraries. And I thought we would just play around in here a bit to see what the tab nine could do for us. Alright so I have tab nine in here together with a bunch of other stuff I have to admit. So I'm not sure how this is going to turn out. So let's say we wanted to compute the loss here. Let's say we wanted to compute square loss. Square loss. You see that tab nine immediately kind of turns up. I've not tried this. I'm impressed. So it says it estimates loss here. And no that's maybe not what I want. So I'll go with square. Now this is a language server suggestion. So and you can see right here even though I don't have these variables kind of tab nine will suggest train loss and validation loss. So let me start a new file right here just to see what we can get this thing to do without doing anything. So and so let's say we'll import OS and we'll say if name. So tab nine auto suggests that and it auto suggests that we should write main here. Right. And it knows that a lot of people then call a function called main. So we should probably do that. Def main. Right. Sorry. Okay let's go with the following. We'll say we'll try the same thing they did. Right. So we'll say we have a data class order. It has let's say price float and a name string. And order one is an order with a price of five and a name of hello. And we can print. So you see tab nine tab nine. If you can see that it's closely suggested to print order dot price order one dot price. So it can it can see that we kind of want that. How do I select that? Right here. See? Order two equals so we'll get another order right here. Seven. Hello. Let's get it with order two. Let's do that. Orders equals order one order two. So total price total price equals zero for order in. Wow. Did you see that? In. No, I can't get it anymore. In orders. That's what tab nine says. Total price plus equals order dot price. So it is already pretty smart. I would argue. Print. And there you saw that total price was suggested. Okay. I don't know how to select this. But I'll figure it out. I'm not that advanced yet. So you can see this already sort of works. And I think it's pretty cool already. And I'm very excited to see what kind of how far people can push this because I think this code generation kind of inferring what you want is only at the beginning right now. And it's for sure going to come more. And yeah with that. Bye. Bye. | [{"start": 0.0, "end": 6.12, "text": " Hi there. So I saw this and probably many of you have seen this. OpenAI was"}, {"start": 6.12, "end": 12.52, "text": " demonstrating at MSBuild, basically a GPT2 language model but trained not on"}, {"start": 12.52, "end": 17.52, "text": " language but on code, on Python code, open source code from GitHub. And so the"}, {"start": 17.52, "end": 22.88, "text": " idea is that the model learns to produce code and we'll just have a short look at"}, {"start": 22.88, "end": 27.52, "text": " the clip they have here. I'll link the entire clip down. So this is what the"}, {"start": 27.52, "end": 31.88, "text": " human types. Def is Palandrome. So the function name, the argument, and the"}, {"start": 31.88, "end": 35.72, "text": " doc string. And now the model is asked to produce the rest of the function and"}, {"start": 35.72, "end": 42.08, "text": " check out. So it's pretty good, right? This is actually to check whether this is a"}, {"start": 42.08, "end": 45.68, "text": " basic check whether a string is a Palandrome as long as you can ensure that"}, {"start": 45.68, "end": 50.8, "text": " s is a string and so on. So the model learned this. You can still say maybe"}, {"start": 50.8, "end": 54.7, "text": " that's just interpolating from, you know, something like this is surely in a"}, {"start": 54.7, "end": 59.800000000000004, "text": " GitHub repo somewhere. So they go further and they try to say, okay, please give me"}, {"start": 59.800000000000004, "end": 66.72, "text": " a function where the Palandromes, so return a list indices for elements that are"}, {"start": 66.72, "end": 70.80000000000001, "text": " Palandromes and at least seven characters. And I personally have searched for this"}, {"start": 70.80000000000001, "end": 76.44, "text": " function on GitHub and it does not exist. So what does the model produce? Pretty"}, {"start": 76.44, "end": 79.48, "text": " cool. So this is first of all a list comprehension in Python, which is"}, {"start": 79.48, "end": 84.4, "text": " reasonably complicated, right? And you can see there is this length filter that"}, {"start": 84.4, "end": 89.84, "text": " is greater or equal to seven. And it refers actually back to the is Palandrome"}, {"start": 89.84, "end": 94.32000000000001, "text": " function that it wrote before. That's pretty cool. Now this is not like a"}, {"start": 94.32000000000001, "end": 98.12, "text": " language model producing as far as I understand producing this basically"}, {"start": 98.12, "end": 103.56, "text": " letter by letter or word by word. This goes over the constraints of abstract syntax"}, {"start": 103.56, "end": 108.28, "text": " trees. So it is I think that's what's happening. They don't have a paper to go"}, {"start": 108.28, "end": 113.28, "text": " along, though I will look into more papers of that sort. They do kind of"}, {"start": 113.28, "end": 116.56, "text": " constrain the model to actually produce valid code, but of course which"}, {"start": 116.56, "end": 121.92, "text": " variables go where and so on. That's that is completely up to the model. And"}, {"start": 121.92, "end": 127.16, "text": " you see here it understands completely what the user wants. Now of course these"}, {"start": 127.16, "end": 130.52, "text": " examples might be cherry picked, right? But it's even for cherry picked examples"}, {"start": 130.52, "end": 136.32, "text": " still pretty impressive. As I said, I could not find this particular function. So"}, {"start": 136.32, "end": 141.4, "text": " they post two classes here, data classes, item and order. And now the model is"}, {"start": 141.4, "end": 149.0, "text": " asked to compute the total order price, which is a method of the of the order"}, {"start": 149.0, "end": 155.44, "text": " class. And they stop here. So this is what the human enters. Human enters that"}, {"start": 155.44, "end": 160.92000000000002, "text": " just the name of the function, not even the doc string. And the model comes up"}, {"start": 160.92000000000002, "end": 164.96, "text": " with the following compute the total price of the order, including the Palandrome."}, {"start": 164.96, "end": 170.8, "text": " So it does all of that by itself, including the doc string, just from the"}, {"start": 170.8, "end": 174.28, "text": " method. Now you can see pretty much what's happening here. It's kind of like the"}, {"start": 174.28, "end": 178.28, "text": " GPT-2 language model. So what it does is probably it from the method name it"}, {"start": 178.28, "end": 182.60000000000002, "text": " derives this doc string compute total price, right? That's a lot of programmers"}, {"start": 182.60000000000002, "end": 188.60000000000002, "text": " do this of the order order is of course the name of the class of self. And here"}, {"start": 188.60000000000002, "end": 192.76000000000002, "text": " it says, including the Palandrome discount. And that is probably somewhat"}, {"start": 192.76000000000002, "end": 197.60000000000002, "text": " pattern match to other functions that have some sort of discount or something"}, {"start": 197.6, "end": 203.4, "text": " like this or one argument that is a number. But the fact that it is also able,"}, {"start": 203.4, "end": 212.6, "text": " see it adds up the total price per item. And it basically discounts every item."}, {"start": 212.6, "end": 216.84, "text": " Now it cannot work out that Palandrome discount should mean that every item"}, {"start": 216.84, "end": 220.0, "text": " should be a Palandrome. That's the only thing it can't work out. It just applies"}, {"start": 220.0, "end": 224.84, "text": " a discount to every single item. Now they go ahead and kind of change that and"}, {"start": 224.84, "end": 229.44, "text": " write the doc strings themselves such that it is clear that apply the discount"}, {"start": 229.44, "end": 234.4, "text": " to items whose name or Palandromes. Now the model is again asked to complete this."}, {"start": 234.4, "end": 240.08, "text": " And absolutely crazy. If it's a Palandrome then multiply it with the discount."}, {"start": 240.08, "end": 244.12, "text": " And if it's not a Palandrome then just add the price. And this final touch here"}, {"start": 244.12, "end": 248.6, "text": " that's one minus the Palandrome discount is added by the programmer. So you can"}, {"start": 248.6, "end": 253.84, "text": " see that this goes towards kind of a symbiosis of human and machine in this"}, {"start": 253.84, "end": 260.04, "text": " way. I don't think the AI will replace programmers but it certainly is going to"}, {"start": 260.04, "end": 264.92, "text": " be very helpful to automate some of the things or give you suggestions for"}, {"start": 264.92, "end": 269.28000000000003, "text": " things that you have to do over and over again. Now I think a lot of of these"}, {"start": 269.28000000000003, "end": 274.12, "text": " rely on the fact that a lot of programming is redundant still. A lot of people"}, {"start": 274.12, "end": 278.72, "text": " name the function and then in the doc string they basically repeat the function"}, {"start": 278.72, "end": 281.96, "text": " because they've already intelligently named the function. So technically there"}, {"start": 281.96, "end": 285.35999999999996, "text": " doesn't need to be a doc string but then whatever your style guide comes in it"}, {"start": 285.35999999999996, "end": 289.23999999999995, "text": " says there needs to be a doc string. Every argument must be described. Every"}, {"start": 289.23999999999995, "end": 294.12, "text": " argument must have a description and a help string and a type even though it is"}, {"start": 294.12, "end": 299.24, "text": " completely obvious from the names and what they do. So if it is completely"}, {"start": 299.24, "end": 304.15999999999997, "text": " obvious I would argue you don't need a doc string. And this is kind of"}, {"start": 304.15999999999997, "end": 309.32, "text": " additional information that this model is able to to actually sort of make use"}, {"start": 309.32, "end": 314.48, "text": " of it. Right. So the fact that a lot of these functions you can already the"}, {"start": 314.48, "end": 318.88, "text": " doc string is sort of already the implementation of the function almost. So the"}, {"start": 318.88, "end": 323.32, "text": " distance there is not it's not like you can you can say whatever you want. And"}, {"start": 323.32, "end": 329.28, "text": " yeah. So you can see here when it's asked to print the receipt it just works out."}, {"start": 329.28, "end": 334.0, "text": " So it's printing it's doing format strings and what not so it's just learn to do"}, {"start": 334.0, "end": 337.96, "text": " that. I would argue again this works you couldn't just put anything like"}, {"start": 337.96, "end": 341.68, "text": " doc string language is a very specific type of language that programmers use"}, {"start": 341.68, "end": 345.64, "text": " where they basically already sort of implement the method in the doc string. And"}, {"start": 345.64, "end": 352.44, "text": " then the the body of the method is just the then really specific code. But as of"}, {"start": 352.44, "end": 356.67999999999995, "text": " that yeah there's a lot of information already in the doc string in the naming"}, {"start": 356.67999999999995, "end": 363.76, "text": " of the function and it's still pretty impressive right. So yeah I just want to"}, {"start": 363.76, "end": 368.84, "text": " show you that this already is available even though not in you know as big of a"}, {"start": 368.84, "end": 373.64, "text": " form. You can't write giant functions for you can't write function bodies. But"}, {"start": 373.64, "end": 377.56, "text": " there are some machine learning based completions already available. So"}, {"start": 377.56, "end": 384.71999999999997, "text": " kite is one of them. And tap nine is the other one that I use for now. Both are"}, {"start": 384.71999999999997, "end": 389.28, "text": " close sources I understand it. So that's a bit of a downer there. But these are"}, {"start": 389.28, "end": 394.76, "text": " exactly kind of GPT language models learned on a lot of code. So they can kind"}, {"start": 394.76, "end": 398.11999999999995, "text": " of guess what you want and interpolate it with your variables in there and so on."}, {"start": 398.11999999999995, "end": 403.28, "text": " I also found this when I searched this comparison here kite versus tab nine. And"}, {"start": 403.28, "end": 406.88, "text": " you see it starts off yeah but these are I think these are kind of all"}, {"start": 406.88, "end": 411.32, "text": " though generated. So when you look at the video you get tab nine is correct but"}, {"start": 411.32, "end": 419.96, "text": " kite it's an actual video review of a kite. Yeah so you know who knows. But what I"}, {"start": 419.96, "end": 426.48, "text": " wanted to do is basically show you a bit of the power of tab nine. Let me get"}, {"start": 426.48, "end": 432.36, "text": " this out of the way. So a while back ago I live coded this session right here"}, {"start": 432.36, "end": 437.08, "text": " where I implemented a sentiment classifier from scratch using hugging face"}, {"start": 437.08, "end": 442.56, "text": " libraries. And I thought we would just play around in here a bit to see what the"}, {"start": 442.56, "end": 447.35999999999996, "text": " tab nine could do for us. Alright so I have tab nine in here together with a bunch"}, {"start": 447.35999999999996, "end": 450.8, "text": " of other stuff I have to admit. So I'm not sure how this is going to turn out."}, {"start": 450.8, "end": 460.0, "text": " So let's say we wanted to compute the loss here. Let's say we wanted to"}, {"start": 460.0, "end": 467.72, "text": " compute square loss. Square loss. You see that tab nine immediately kind of turns"}, {"start": 467.72, "end": 477.28, "text": " up. I've not tried this. I'm impressed. So it says it estimates loss here. And"}, {"start": 477.28, "end": 482.96, "text": " no that's maybe not what I want. So I'll go with square. Now this is a language"}, {"start": 482.96, "end": 489.68, "text": " server suggestion. So and you can see right here even though I don't have these"}, {"start": 489.68, "end": 494.44, "text": " variables kind of tab nine will suggest train loss and validation loss. So"}, {"start": 494.44, "end": 500.47999999999996, "text": " let me start a new file right here just to see what we can get this thing to do"}, {"start": 500.47999999999996, "end": 509.44, "text": " without doing anything. So and so let's say we'll import OS and we'll say if"}, {"start": 509.44, "end": 517.88, "text": " name. So tab nine auto suggests that and it auto suggests that we should write"}, {"start": 517.88, "end": 524.6, "text": " main here. Right. And it knows that a lot of people then call a function called"}, {"start": 524.6, "end": 532.12, "text": " main. So we should probably do that. Def main. Right. Sorry. Okay let's go with"}, {"start": 532.12, "end": 536.88, "text": " the following. We'll say we'll try the same thing they did. Right. So we'll say"}, {"start": 536.88, "end": 548.88, "text": " we have a data class order. It has let's say price float and a name string. And"}, {"start": 548.88, "end": 559.28, "text": " order one is an order with a price of five and a name of hello. And we can"}, {"start": 559.28, "end": 567.0, "text": " print. So you see tab nine tab nine. If you can see that it's closely suggested"}, {"start": 567.0, "end": 571.9599999999999, "text": " to print order dot price order one dot price. So it can it can see that we kind of"}, {"start": 571.9599999999999, "end": 583.56, "text": " want that. How do I select that? Right here. See? Order two equals so we'll get"}, {"start": 583.56, "end": 591.56, "text": " another order right here. Seven. Hello. Let's get it with order two. Let's do"}, {"start": 591.56, "end": 604.52, "text": " that. Orders equals order one order two. So total price total price equals zero"}, {"start": 604.52, "end": 613.0, "text": " for order in. Wow. Did you see that? In. No, I can't get it anymore. In orders."}, {"start": 613.0, "end": 622.64, "text": " That's what tab nine says. Total price plus equals order dot price. So it is"}, {"start": 622.64, "end": 630.68, "text": " already pretty smart. I would argue. Print. And there you saw that total price"}, {"start": 630.68, "end": 637.88, "text": " was suggested. Okay. I don't know how to select this. But I'll figure it out. I'm"}, {"start": 637.88, "end": 642.4, "text": " not that advanced yet. So you can see this already sort of works. And I think it's"}, {"start": 642.4, "end": 647.24, "text": " pretty cool already. And I'm very excited to see what kind of how far people can"}, {"start": 647.24, "end": 650.6, "text": " push this because I think this code generation kind of inferring what you want"}, {"start": 650.6, "end": 657.04, "text": " is only at the beginning right now. And it's for sure going to come more. And yeah"}, {"start": 657.04, "end": 674.76, "text": " with that. Bye. Bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=Nfry2b4RFI4 | Investigating Human Priors for Playing Video Games (Paper & Demo) | Why are humans so good at video games? Maybe it's because a lot of games are designed with humans in mind. What happens if we change that? This paper removes the influence of human priors from a game and ends up with a pretty fun experience.
Paper: https://arxiv.org/abs/1802.10217
Website: https://rach0012.github.io/humanRL_website/
Code: https://github.com/rach0012/humanRL_prior_games
Abstract:
What makes humans so good at solving seemingly complex video games? Unlike computers, humans bring in a great deal of prior knowledge about the world, enabling efficient decision making. This paper investigates the role of human priors for solving video games. Given a sample game, we conduct a series of ablation studies to quantify the importance of various priors on human performance. We do this by modifying the video game environment to systematically mask different types of visual information that could be used by humans as priors. We find that removal of some prior knowledge causes a drastic degradation in the speed with which human players solve the game, e.g. from 2 minutes to over 20 minutes. Furthermore, our results indicate that general priors, such as the importance of objects and visual consistency, are critical for efficient game-play. Videos and the game manipulations are available at this https URL
Authors: Rachit Dubey, Pulkit Agrawal, Deepak Pathak, Thomas L. Griffiths, Alexei A. Efros
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 | Hey there, what's going on today? We're looking at investigating human priors for playing video games by Ratchet Dubi, Pukit, Agrawal, Deepak Patak, Tom Griffiths, and Alexei, IEfras. So there is a paper to go with this, but I actually don't want to get into the paper too much, in order to not reveal too much of what's coming, but basically they're trying to investigate what makes video games work for humans. So what do humans pay attention to? What priors bring humans into a video game? And the fun thing is they've created these games where they ablate these individual priors, and we are going to play them. So the original game right here, as you can see, is kind of this Montezuma's revenge type of game, so you only need the arrow keys. If you go to a bad blob like this, then you die, and you can jump on them, and you can use the ladders, and the spikes still hurt you if you jump on them, and also if you fall down between the platforms. So what you've got to do is basically get the key, then go to the door over here, and badabum. Cool. So let's try out. So they basically ablate different things here. Masked semantics means that you don't know what the objects are anymore. So you might go over here, and you might be, what's the screen thing? Can I jump on it? Oh. So we're probably a bit biased because we've seen the game before, so we know that these are the pink ones are the bad ones, and that's the key, so we should probably get it. But you can imagine that it is a bit harder, but you could still solve it, right? Reverse semantics is very interesting if you play it for the first time, because all of a sudden now, there's the coins. Oh, and the fire. But I think humans could probably still figure it out with like some minimal trial and error, right? This ice cream cone, you realize, okay. Now it gets interesting, because right now we've always had sort of, we know that there's an object, and there's no object on the platforms, but now these are masks. So basically you don't know what's like a relevant object and what isn't. So I know that there's like a bad thing here, and a bad thing down to the left. So I'm gonna guess these light, these light pink things are the bad things. Yeah, yeah, yeah, these are the ladders. Cool, bad thing right here. We are rocking this, okay. Key, where's the key? And the door. So it gets harder because you kind of have to remember the colors, right? I know that the light pink ones are the bad squares. Still, still solvable. So let's jump over these on the left because these really, actually it's going to here. So mask affordances. If what they're saying is that, okay, you can kind of from the way something looks, you can tell what you can do with it. For example, the platforms, you can, you know, jump on them and the background is sort of empty space. So you know that there's nothing much happening there. So they trying to take that away by simply retexturing all the objects here such that you don't know how you can interact with them. And it does get significantly harder because, okay, so these green ones are, these green ones are the platforms right here. So, but I can still see that. That must be the ladder, right? You can imagine if you were playing this again for the first time that this is significantly more difficult, but you still see the key and the green ones being the platforms we got this. Now it gets harder. Masked visual similarity. So this is where they say maybe as we did so far, maybe you as a human can kind of make out that things that are visually similar to each other. You can do the same things with like we said, all the green ones are probably the platforms. So they took it away. Oh, gee, okay. So that must be, okay, I can't go here, fell down. Let's try again. This is a platform. Is this one here? Yes, these are platforms. That was easy, too easy, too easy running into that blob there. Okay, the ladders are still like this, but then, okay, it's awesome. Yeah, this gets harder as you can, gee, okay, I'm too dumb to remember from before. I'm like the ideal subject because I don't remember. How did this work? That's it. I'm going to solve this just so you know, even if this video gets to 50 minutes, I'm going to make it through this. Okay, here we can, okay. See, my short term memory is so bad. Okay, we got the key. Now just get over to the door. Door's over there. Yeah. Okay. Now let's wipe the short term memory again. Here, change ladder interaction. Where they basically say, okay, one of the things that you could know from the real world is how, you know, these objects work in the real world. So there's not really any pink blobs with evil faces. There might be spikes, yes, but ladder is something you know that works. So if you want to go up here, that doesn't work. So you kind of have to figure, okay, so you have to go kind of left and right to go up the ladders. And so that one I actually tried before and I figured that out pretty quickly. I think humans are able to figure that out fairly quickly because you kind of on the ladder, right? You can actually go down easily. You're on the ladder and then it kind of doesn't work and then you kind of try to wiggle because there's two of them. I don't think that's necessarily super hard. And now it feels a bit like, you know, this super Mario maker thing where people just try to make levels as hard as possible and trick you with trick blocks and invisible stuff. This is hard. So the direction of gravity. So now the left key jumps, right? And here this key, so this is, like this is extremely, extremely hard. Because I have to like think about every move I make before I do it. And okay, no, no, no, this is so unintuitive for real. Yeah, got it, got it. Okay, really try this out. This is crazy. Yeah, you. Yeah. Okay. So the last thing is we combine all of it. I guess except the changed gravity and changed interaction. So now all the priors, all the visual object priors removed. This is, this is King's discipline right here. Okay. So we figured out where the blue, cool. So where's the next, this is the next platform. Where's the, okay? Okay, there must be like a, you take that. Okay, but we know the next, so we can't really generalize from this because we know the next bad blob isn't going to be the same color, right? Okay. Um, the white, then this, I know there's a bad thing here, but we have to figure this out. So basically kind of the point of the paper, I think is to say that this is what you're doing to or no spikes. This is what you're doing to our algorithms. Um, if you're in, in the most case, so they simply have to go and to basically try every single thing and remember what worked and what didn't work. Now, of course, the our algorithms can also exhibit like can also use the visual similarity. That was the key. Yeah. Yeah. Let's go to the door door door door. No. There is a, there's like a bad thing here, right? No spikes. Okay. So either we build these priors into the oral algorithms, if we want to get them to human level, or we have some sort of learning these priors before we let the people go, you know, onto a paper, or I don't know, or we just, you know, take it that oral algorithms, you know, have to figure all of this out by themselves. So they ablate these things right here. You can see the masked object identity makes kind of the biggest difference in terms of time, number of deaths, the number of states explored, reverse semantics. I believe these are humans that are, you know, trying it for the first time and they're just like, ooh, an ice cream. So it can also hurt, right? The oral algorithm wouldn't be super impressed by it looking like an ice cream. But the human is very much. And the crazy thing here, you can see exploration, the original game, and then exploration in the no object prior game, especially if you play this for the first time. This is just mad, like no freaking way. I would actually, like, love to see video games like this coming out. This will be the worst selling video game of all times, where dynamically it just removes these kind of priors. But it's a, I think it's a really fun way to investigate what humans learn and what they already bring into the game. So here they have another game and they do this same thing on an oral agent. And you see here, the oral agent just don't care about any of these things, except visual similarity. So visual similarity helps the oral agent to generalize across the game. So if you see a bad blob, the next bad blob will look similar. And that's sort of kind of an invariance that we know they can exploit since they're using convolution on their networks and so on. But I think it is really drawing attention to the importance of priors, prior knowledge in reinforcement learning and human knowledge. So in this game right here, where you have these hidden rewards that the human doesn't see, right? But if they kind of touch it, they're kind of coins. And the human performs way worse than the oral agent because the oral agent will actually try those things out. And the human having the prior that the black thing is, they don't see the yellow boxes, that the black thing is just empty space. They won't even explore that. So maybe, you know, that is something to think about with respect to building oral agents. All right, I don't want to go into the paper too much. It's a very cool paper, but we're here to play games. And I invite you to read the paper. Check out the website. Try these games for yourself. There are a lot of fun, especially if you try them first time. And bye bye. | [{"start": 0.0, "end": 5.16, "text": " Hey there, what's going on today? We're looking at investigating human priors for playing video games by Ratchet Dubi,"}, {"start": 5.16, "end": 10.72, "text": " Pukit, Agrawal, Deepak Patak, Tom Griffiths, and Alexei, IEfras."}, {"start": 10.72, "end": 15.24, "text": " So there is a paper to go with this, but I actually don't want to get into the paper too much,"}, {"start": 15.24, "end": 23.84, "text": " in order to not reveal too much of what's coming, but basically they're trying to investigate what makes video games work for humans."}, {"start": 23.84, "end": 29.64, "text": " So what do humans pay attention to? What priors bring humans into a video game?"}, {"start": 29.64, "end": 36.88, "text": " And the fun thing is they've created these games where they ablate these individual priors, and we are going to play them."}, {"start": 36.88, "end": 42.04, "text": " So the original game right here, as you can see, is kind of this Montezuma's revenge type of game,"}, {"start": 42.04, "end": 49.88, "text": " so you only need the arrow keys. If you go to a bad blob like this, then you die, and you can jump on them,"}, {"start": 49.88, "end": 56.28, "text": " and you can use the ladders, and the spikes still hurt you if you jump on them, and also if you fall down between the platforms."}, {"start": 56.28, "end": 63.56, "text": " So what you've got to do is basically get the key, then go to the door over here, and badabum. Cool."}, {"start": 63.56, "end": 69.56, "text": " So let's try out. So they basically ablate different things here."}, {"start": 69.56, "end": 74.2, "text": " Masked semantics means that you don't know what the objects are anymore."}, {"start": 74.2, "end": 78.36, "text": " So you might go over here, and you might be, what's the screen thing? Can I jump on it? Oh."}, {"start": 78.36, "end": 86.04, "text": " So we're probably a bit biased because we've seen the game before, so we know that these are the pink ones"}, {"start": 86.04, "end": 92.76, "text": " are the bad ones, and that's the key, so we should probably get it. But you can imagine that it is a bit harder,"}, {"start": 92.76, "end": 99.0, "text": " but you could still solve it, right? Reverse semantics is very interesting if you play it for the first time,"}, {"start": 99.0, "end": 106.2, "text": " because all of a sudden now, there's the coins. Oh, and the fire. But I think humans could probably still"}, {"start": 106.2, "end": 112.28, "text": " figure it out with like some minimal trial and error, right? This ice cream cone, you realize, okay."}, {"start": 112.28, "end": 119.64, "text": " Now it gets interesting, because right now we've always had sort of, we know that there's an object,"}, {"start": 119.64, "end": 124.6, "text": " and there's no object on the platforms, but now these are masks. So basically you don't know what's"}, {"start": 124.6, "end": 132.52, "text": " like a relevant object and what isn't. So I know that there's like a bad thing here, and a bad thing"}, {"start": 132.52, "end": 139.0, "text": " down to the left. So I'm gonna guess these light, these light pink things are the bad things. Yeah,"}, {"start": 139.0, "end": 146.04, "text": " yeah, yeah, these are the ladders. Cool, bad thing right here. We are rocking this, okay. Key,"}, {"start": 146.04, "end": 152.92, "text": " where's the key? And the door. So it gets harder because you kind of have to remember the colors,"}, {"start": 152.92, "end": 160.12, "text": " right? I know that the light pink ones are the bad squares. Still, still solvable. So let's jump"}, {"start": 160.12, "end": 165.32, "text": " over these on the left because these really, actually it's going to here. So mask affordances."}, {"start": 165.32, "end": 170.68, "text": " If what they're saying is that, okay, you can kind of from the way something looks, you can tell"}, {"start": 170.68, "end": 175.79999999999998, "text": " what you can do with it. For example, the platforms, you can, you know, jump on them and the background"}, {"start": 175.79999999999998, "end": 181.16, "text": " is sort of empty space. So you know that there's nothing much happening there. So they trying to"}, {"start": 181.16, "end": 186.92, "text": " take that away by simply retexturing all the objects here such that you don't know how you can"}, {"start": 186.92, "end": 195.56, "text": " interact with them. And it does get significantly harder because, okay, so these green ones are, these"}, {"start": 195.56, "end": 201.16, "text": " green ones are the platforms right here. So, but I can still see that. That must be the ladder,"}, {"start": 201.16, "end": 206.92, "text": " right? You can imagine if you were playing this again for the first time that this is significantly"}, {"start": 206.92, "end": 212.6, "text": " more difficult, but you still see the key and the green ones being the platforms we got this."}, {"start": 212.6, "end": 220.35999999999999, "text": " Now it gets harder. Masked visual similarity. So this is where they say maybe as we did so far,"}, {"start": 220.35999999999999, "end": 226.2, "text": " maybe you as a human can kind of make out that things that are visually similar to each other."}, {"start": 226.92, "end": 230.6, "text": " You can do the same things with like we said, all the green ones are probably the platforms. So"}, {"start": 230.6, "end": 240.2, "text": " they took it away. Oh, gee, okay. So that must be, okay, I can't go here, fell down. Let's try"}, {"start": 240.2, "end": 244.92, "text": " again. This is a platform. Is this one here? Yes, these are platforms."}, {"start": 248.67999999999998, "end": 254.35999999999999, "text": " That was easy, too easy, too easy running into that blob there. Okay, the ladders are still like"}, {"start": 254.35999999999999, "end": 263.88, "text": " this, but then, okay, it's awesome. Yeah, this gets harder as you can, gee, okay, I'm too dumb to"}, {"start": 263.88, "end": 270.76, "text": " remember from before. I'm like the ideal subject because I don't remember. How did this work?"}, {"start": 270.76, "end": 277.56, "text": " That's it. I'm going to solve this just so you know, even if this video gets to 50 minutes,"}, {"start": 277.56, "end": 285.4, "text": " I'm going to make it through this. Okay, here we can, okay. See, my short term memory is so bad."}, {"start": 285.4, "end": 294.52, "text": " Okay, we got the key. Now just get over to the door. Door's over there. Yeah. Okay. Now let's wipe"}, {"start": 294.52, "end": 299.88, "text": " the short term memory again. Here, change ladder interaction. Where they basically say, okay,"}, {"start": 299.88, "end": 304.91999999999996, "text": " one of the things that you could know from the real world is how, you know, these objects work"}, {"start": 304.91999999999996, "end": 310.35999999999996, "text": " in the real world. So there's not really any pink blobs with evil faces. There might be spikes,"}, {"start": 310.36, "end": 315.32, "text": " yes, but ladder is something you know that works. So if you want to go up here, that doesn't work."}, {"start": 315.32, "end": 320.92, "text": " So you kind of have to figure, okay, so you have to go kind of left and right to go up the ladders."}, {"start": 320.92, "end": 327.08000000000004, "text": " And so that one I actually tried before and I figured that out pretty quickly. I think humans"}, {"start": 327.08000000000004, "end": 330.68, "text": " are able to figure that out fairly quickly because you kind of on the ladder, right? You can"}, {"start": 330.68, "end": 335.72, "text": " actually go down easily. You're on the ladder and then it kind of doesn't work and then you kind"}, {"start": 335.72, "end": 341.48, "text": " of try to wiggle because there's two of them. I don't think that's necessarily super hard."}, {"start": 343.56, "end": 351.24, "text": " And now it feels a bit like, you know, this super Mario maker thing where people just try to make"}, {"start": 351.24, "end": 355.88000000000005, "text": " levels as hard as possible and trick you with trick blocks and invisible stuff. This is hard."}, {"start": 356.44000000000005, "end": 363.16, "text": " So the direction of gravity. So now the left key jumps, right? And here this key, so this is,"}, {"start": 363.16, "end": 371.16, "text": " like this is extremely, extremely hard. Because I have to like think about every move I make"}, {"start": 371.96000000000004, "end": 381.0, "text": " before I do it. And okay, no, no, no, this is so unintuitive for real."}, {"start": 382.92, "end": 390.20000000000005, "text": " Yeah, got it, got it. Okay, really try this out. This is crazy. Yeah, you."}, {"start": 390.2, "end": 397.08, "text": " Yeah. Okay. So the last thing is we combine all of it. I guess except the changed gravity"}, {"start": 397.08, "end": 403.48, "text": " and changed interaction. So now all the priors, all the visual object priors removed. This is,"}, {"start": 405.4, "end": 409.48, "text": " this is King's discipline right here. Okay. So we figured out where the blue,"}, {"start": 410.44, "end": 415.15999999999997, "text": " cool. So where's the next, this is the next platform. Where's the, okay?"}, {"start": 415.16, "end": 422.68, "text": " Okay, there must be like a, you take that. Okay, but we know the next, so we can't really"}, {"start": 422.68, "end": 428.68, "text": " generalize from this because we know the next bad blob isn't going to be the same color, right?"}, {"start": 429.32000000000005, "end": 437.88, "text": " Okay. Um, the white, then this, I know there's a bad thing here, but we have to figure this out."}, {"start": 437.88, "end": 442.52000000000004, "text": " So basically kind of the point of the paper, I think is to say that this is what you're doing to"}, {"start": 442.52, "end": 451.24, "text": " or no spikes. This is what you're doing to our algorithms. Um, if you're in, in the most case,"}, {"start": 452.84, "end": 459.32, "text": " so they simply have to go and to basically try every single thing and remember what worked and"}, {"start": 459.32, "end": 464.84, "text": " what didn't work. Now, of course, the our algorithms can also exhibit like can also use the"}, {"start": 464.84, "end": 471.15999999999997, "text": " visual similarity. That was the key. Yeah. Yeah. Let's go to the door door door door. No. There is a,"}, {"start": 471.16, "end": 481.08000000000004, "text": " there's like a bad thing here, right? No spikes. Okay."}, {"start": 481.08, "end": 505.96, "text": " So either we build these priors into the oral algorithms, if we want to get them to human level,"}, {"start": 505.96, "end": 512.12, "text": " or we have some sort of learning these priors before we let the people go, you know, onto a paper,"}, {"start": 513.0, "end": 519.64, "text": " or I don't know, or we just, you know, take it that oral algorithms, you know, have to figure"}, {"start": 519.64, "end": 525.96, "text": " all of this out by themselves. So they ablate these things right here. You can see the masked object"}, {"start": 525.96, "end": 531.24, "text": " identity makes kind of the biggest difference in terms of time, number of deaths, the number of"}, {"start": 531.24, "end": 535.96, "text": " states explored, reverse semantics. I believe these are humans that are, you know, trying it for the"}, {"start": 535.96, "end": 540.2, "text": " first time and they're just like, ooh, an ice cream. So it can also hurt, right? The oral algorithm"}, {"start": 540.2, "end": 547.8, "text": " wouldn't be super impressed by it looking like an ice cream. But the human is very much. And"}, {"start": 549.08, "end": 554.2, "text": " the crazy thing here, you can see exploration, the original game, and then exploration in the no"}, {"start": 554.2, "end": 560.04, "text": " object prior game, especially if you play this for the first time. This is just mad, like no freaking"}, {"start": 560.04, "end": 565.8, "text": " way. I would actually, like, love to see video games like this coming out. This will be the"}, {"start": 565.8, "end": 571.56, "text": " worst selling video game of all times, where dynamically it just removes these kind of priors."}, {"start": 571.56, "end": 576.12, "text": " But it's a, I think it's a really fun way to investigate what humans learn and what they"}, {"start": 576.12, "end": 581.16, "text": " already bring into the game. So here they have another game and they do this same thing on an"}, {"start": 581.16, "end": 585.56, "text": " oral agent. And you see here, the oral agent just don't care about any of these things,"}, {"start": 585.56, "end": 592.1199999999999, "text": " except visual similarity. So visual similarity helps the oral agent to generalize across the game."}, {"start": 592.1199999999999, "end": 597.88, "text": " So if you see a bad blob, the next bad blob will look similar. And that's sort of kind of an"}, {"start": 597.88, "end": 602.04, "text": " invariance that we know they can exploit since they're using convolution on their networks and so on."}, {"start": 603.0799999999999, "end": 607.4, "text": " But I think it is really drawing attention to the importance of priors, prior knowledge"}, {"start": 607.4, "end": 612.28, "text": " in reinforcement learning and human knowledge. So in this game right here, where you have these"}, {"start": 612.28, "end": 616.6, "text": " hidden rewards that the human doesn't see, right? But if they kind of touch it, they're kind of"}, {"start": 616.6, "end": 622.76, "text": " coins. And the human performs way worse than the oral agent because the oral agent will actually"}, {"start": 622.76, "end": 627.72, "text": " try those things out. And the human having the prior that the black thing is, they don't see the"}, {"start": 627.72, "end": 636.1999999999999, "text": " yellow boxes, that the black thing is just empty space. They won't even explore that. So maybe,"}, {"start": 636.1999999999999, "end": 640.8399999999999, "text": " you know, that is something to think about with respect to building oral agents. All right, I don't"}, {"start": 640.84, "end": 645.48, "text": " want to go into the paper too much. It's a very cool paper, but we're here to play games. And I"}, {"start": 645.48, "end": 650.36, "text": " invite you to read the paper. Check out the website. Try these games for yourself. There are a lot of"}, {"start": 650.36, "end": 678.52, "text": " fun, especially if you try them first time. And bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=u5BkO8XMS2I | iMAML: Meta-Learning with Implicit Gradients (Paper Explained) | Gradient-based Meta-Learning requires full backpropagation through the inner optimization procedure, which is a computational nightmare. This paper is able to circumvent this and implicitly compute meta-gradients by the clever introduction of a quadratic regularizer.
OUTLINE:
0:00 - Intro
0:15 - What is Meta-Learning?
9:05 - MAML vs iMAML
16:35 - Problem Formulation
19:15 - Proximal Regularization
26:10 - Derivation of the Implicit Gradient
40:55 - Intuition why this works
43:20 - Full Algorithm
47:40 - Experiments
Paper: https://arxiv.org/abs/1909.04630
Blog Post: https://www.inference.vc/notes-on-imaml-meta-learning-without-differentiating-through/
Abstract:
A core capability of intelligent systems is the ability to quickly learn new tasks by drawing on prior experience. Gradient (or optimization) based meta-learning has recently emerged as an effective approach for few-shot learning. In this formulation, meta-parameters are learned in the outer loop, while task-specific models are learned in the inner-loop, by using only a small amount of data from the current task. A key challenge in scaling these approaches is the need to differentiate through the inner loop learning process, which can impose considerable computational and memory burdens. By drawing upon implicit differentiation, we develop the implicit MAML algorithm, which depends only on the solution to the inner level optimization and not the path taken by the inner loop optimizer. This effectively decouples the meta-gradient computation from the choice of inner loop optimizer. As a result, our approach is agnostic to the choice of inner loop optimizer and can gracefully handle many gradient steps without vanishing gradients or memory constraints. Theoretically, we prove that implicit MAML can compute accurate meta-gradients with a memory footprint that is, up to small constant factors, no more than that which is required to compute a single inner loop gradient and at no overall increase in the total computational cost. Experimentally, we show that these benefits of implicit MAML translate into empirical gains on few-shot image recognition benchmarks.
Authors: Aravind Rajeswaran, Chelsea Finn, Sham Kakade, Sergey Levine
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 meta learning with implicit gradients by R-Wind Rajeshwaran, Chelsea Finn, Shomkakad and Sergei Levine. So this paper deals with the task of meta learning. Now if you don't know what meta learning is, let me quickly introduce the term. So in meta learning you assume you have some sort of a distribution of tasks ahead. So let's make some examples. For example, task one could be you get an image, you have a data set of images and you want to classify them into cats or dogs. And you know you have a little data set with labeled images and you can train test split that and that's one task. Now task two is going to be again you have a small data set of different images but let's just all make image examples here. But you want to locate the pedestrian. So you want to locate the human in the image. So where is the human? And the task three could be again a small database of tasks, sorry, of images. And in each of the image you want to visually question answer. Or let's say you want to point out there is a ground, there is a tree and there is a question about it. Yeah, let's say visual question answering, right? Which which give you yes or no questions. Something like this. Now let's just say you have to segment, you have to segment that image. So down here would be ground, you have to segment the ground. Okay, so these are all image tasks, right? These are all perfectly fine independent tasks each each each one you have a small data set. Now sometimes these data sets are very very small such that you cannot really train a state of the art model on them. For example, if you have medical images, oftentimes the labels of these are very hard to get. I mean, there's privacy concerns and then you know, doctors have to look at it to produce images costs money and so on. So it's not like you have a lot of images and you could profit from more images. So one method that people come up with is called transfer learning. So in transfer learning, you say, I have this giant database of images. Let's say this is image net, right? I have this giant database image net with labeled images. What I can do is I can use this to train a neural network. Let's this are the bunch of layers of neural network and I can train the neural network on this big database and get parameters theta, right? These are the parameters of the neural network and then I will basically adapt these parameters to each task individually. So in task one, sorry about that, I would then take these parameters as an input to the neural network. I would initialize the neural network with these parameters and then I would use this training set in order to fine tune. This is what's called fine tuning to the task specific parameters here. 5. This is so 5.1 because it's task one. For task two, I would also take these as a starting point in order to train its neural network to fine tune it on this bounding box task in order to obtain the parameters for task two. So you can see that there's the pre-training stage here to obtain good initial parameters and then we adapt these initial parameters for each task separately in a fine tuning stage. So this is one way we can do it. Another way we can do it is called multi task learning. What we do in multi task learning is we say, well, see, probably an neural network that can segment the grounds is also pretty good at doing bounding boxes. Like it'll use some of the same features. So can't we just kind of pool together these data sets into one bigger data set and then train on like if it's if it's an image from task one will train on the loss of task one and if it's an image from task two will train on the loss of task two and so on. But we'll sort of use the same neural network basis. We just have kind of different heads on top of them and we'll basically so this is called multi task learning. Have one shared neural network with different outputs for the different tasks and basically counting on the fact that you can sort of learn from one task what's useful and the other. Now this is a good method to combine the tasks and to basically share data information but it will also limit you because you now have to trade off between the tasks like this neural network right here this joint encoder will never be able to will never be able to fully gear to one task because it also has to you know it has to perform for the other tasks as well. So you kind of limit yourself in your top out accuracy. Now maybe the regularization effect is good. So these are two methods the first is called transfer learning here on the left and the other is called multi task learning. Now meta learning goes a different direction. Metal learning is like transfer learning but it says well what if we don't have this giant data set right here. What what if what if we find a way to learn these initial parameters right. So what we'll do is we'll start out with a guess a guess of good initial parameters. Let's call that theta zero and now we have all of these three tasks take theta zero and run their run their fine tuning right to come up with with their own parameters starting at theta zero. So this is phi one started from theta zero and we'll also give it to task two and to task three right and each of these tasks is going to train on its own training data set and then evaluate on its own validation data set and then report back a number. So we do this for every task and every task basically trains this runs through the validation data set reports back a generalization error and then we know once we get all the information from all the tasks we know how good were these initial parameters right. We get a measure of how easy is it for the tasks to adapt these initial parameters to their own data set and then we somehow need to figure out a way okay these parameters were on average 81% good. Can we come up with a better set of initial parameters theta one in some way. Can we somehow find a better set of initial parameters such that it is easier for the tasks to adapt these initial parameters right and even more so there could be task four which we are not seeing during this training phase right this is kind of our so these up here could be our train training tasks and this down here could be our validation task so basically we're trying to come up with a set of initial parameters that if a new task comes along and it takes this thing as its initial parameters it will be able to adapt very quickly these initial parameters to its own data set and most importantly it can do that it will result in a much better model than had the task just trained on its own small data set from scratch so our task is in metal learning is basically to come up with a learning procedure to generate to iteratively generate better and better and better initial parameters right and what better way to do this than using gradient descent so this is this is metal learning using gradient descent is is a is the core of this paper basically now what do you need for gradient descent so if you want to try to go from one task to the next using SGD or even GD gradient descent you need to come up with a gradient now why is this a problem in this case so this is in this figure so this metal learning using gradients was done in this technique called mammal and essentially what you can see here is that if you have you have this set of initial parameters this is your current best guess of these good initial parameters and you want to come up with a gradient of how to get an even better set now this gradient here is indicated by this arrow so you don't let's imagine you don't know the gradient yet you want to come up with a gradient so what you'll need to do is you'll basically have to compute the loss function and you have to differentiate that loss function with respect to your parameters that's down here what the description of the orange arrow so the your loss function of your meta parameters is going to be the average or the sum of the loss functions across all of the different tasks individually so the gradient is going to be the sum of the gradients of these loss functions with respect to your original parameter now this is the difference right usually we differentiate with respect to the parameters that we input into the loss function but not here what we input into the loss function is what is at the end of of the task adapting to its own parameters so this thing we input here is a function of our initial parameters but it's not our initial parameters so what we have is initial parameters we give them to a task we wrote this task runs SGD for K steps it runs it for a number of steps comes up with the adapted version to its own problem that goes into a loss function right so the this this this thing here are the is the neural network that finally determines the loss function so if we want to back propagate we can back propagate this loss function right through the neural network the neural network is right here is parameterized by these things we can back propagate through that but then we'll have to back propagate through the optimization procedure that was used to derive these things so that's the the problem right here you can see this here you start out with the initial parameters and let's say you give them to task one task one is going to take these as initialization and then run SGD so maybe it will perturb these parameters to come up with here phi one these parameters these parameters are the adapted version for task one and then at the end of task one you use these characterizing neural network and you can calculate a gradient so how would you need to update these parameters in order to make the loss go down and the neural network or sorry the computation will maybe result well you need to go up a bit well this is too strong it will maybe say you need to go into this direction right here with respect to these parameters but now the question is how do you have to adjust your initial parameters such that your your final parameters will go into that direction and that's not really clear you could make a guess right you could make a guess and say well if my initial parameters just go up a bit maybe the optimization procedure will just you know sort of look the same but shifted up here so something like this and then I will end up here but that's not guaranteed like this is a super non-linear procedure that you're running it through this SGD thing and it will basically it's an iterative recursive procedure so it will sort of accumulate its own non-linear errors and that's why what you have to do is basically you forward propagate through SGD and then you have to back propagate this gradient right here you have to back propagate this through the entire SGD optimization procedure and that is computationally very expensive because if you have to compute the loss once here for a neural network you have to forward pass once and the back propagation will cost as much as the forward propagation or maybe twice as much constant number but if you run k steps of SGD you basically have to trace back those k steps via back propagating it through each step so basically this is k times a back propagation step and then computationally that's just not feasible for more than very few steps and so you can only ever do very few steps you basically accumulate your non-linear error because gradient descent is a linear procedure and then you get some estimation of the gradient at the end now if you do that for all of your tasks then finally you can decide so maybe for a task one here the result will be in order to make this go up a bit you need to shift this a bit to up and the right right because then the gradient descent will kind of sort of end up here and you do this for all tasks you average the gradient like here then you can come up with a final gradient for your inner sorry for your outer model for your initial parameters so this is a big load of computation that mammal does here now there is a naive approximation and this is exactly what we said at the beginning right this first order mammal is the guess that yeah if we want to go up a bit at the end here why don't we shift the beginning up a bit right and so the first order mammal would just result in basically looking at the gradients at the end and sort of aggregating them right here and then coming up with a gradient but this is very inaccurate and generally doesn't work well because you have to understand how your end gradient is connected to your initial gradient because this is very non-linear you can't just basically transfer it over now implicit mammal this paper right here circumvents that it circumvents the step to have to explicitly back propagate this gradient along the forward pass but it's still able to come up with an expression for how the final gradient relates to the initial gradient so this is quite cool and we're in this video I would basically like to explore how this comes about and why this comes about we won't go through all the theory and the proofs but I would like you to understand that this comes about by basically them imposing a quadratic regularizer and therefore this quadratic regularizer makes a very it kind of gives rise to a very strong connection between this final gradient and this initial gradient so they can basically transform one into the other and therefore they can compute the initial gradient in a closed form setting or at least in theory all right this was this now let's go into the problem formulation as they see it the entire problem formulation is you want to find these best metal learning parameters and they call this the outer level so on an outer level you want to run gradient descent to find the best metal learning parameters to minimize this function f right here now what is f f is the average of the validation loss function so here this is the loss function on the test sets of the individual tasks and the neural network that we evaluate on the test set is the neural network that is trained the algorithm is that is a training algorithm is trained on the training set of that particular task while starting from these parameters theta now you see there is no no no dependence on the task here there is no eye down here for these meta parameters because these are always the same right that's the crucial point all the tasks start from the same initial parameters then they optimize on their own training data set and then they evaluate on their own test data set and that will give you the loss for that particular task and your goal is to find the meta parameters such that this function here the average loss that results from this procedure is minimal okay so where they say right here the inner level is this algorithm component so the algorithm starts from these from these meta parameters and runs gradient steps on the training data set loss now this is just the first step right here of this procedure of course in the next step these are going to be replaced by the by the phi that by the phi i that results from the previous step so the first step is run on the met parameters and then subsequently the task specific parameters are updated the important thing here is that this doesn't need to be gradient descent actually with their method because their method doesn't need to back propagate through the optimization you can think of any inner optimization procedure that you want it can be like a black box solver whatever you want I'm going to be this interesting to see how this is going to affect something like reinforcement learning and so on this might have already happened and I have not looked up this so the crucial part of the paper I think is right here and it's sort of like you know section 2.2 but I would I would want to point out that I think this is the crucial part this is why the method works ultimately why it's in why it's able to build this implicit gradient so the section is called proximal regularization in the inner level and we'll go through this with a bit of detail to have sufficient learning in the inner level while also avoiding overfitting algue that's the inner optimization procedure needs to incorporate some form of regularization right so they're their their sort their goal here or their point here is that if especially if these individual tasks have small training data set you need to have some kind of protection against overfitting and that and that and they say since mammal uses a small number of gradient steps this corresponds to early stopping and can be interpreted as a form of regularization and base in prior so mammal is this this previous method this basic method that back propagates through the optimization procedure and since it does this since it back propagates through the optimization procedure it's computationally limited to only run very few forward optimization steps because it then has to back propagate through each one right it needs to store each one so it's computationally limited so by necessity it uses only a small number of gradient steps and therefore this is kind of early stopping and we know to prevent overfitting one thing you can do is to stop before your training accuracy reaches full zero and you can stop earlier than that ideally at a point when your validation accuracy reaches the low point but they say basically this this limited number of steps is a form of regularization now of course in in this new method we we don't have this constraint anymore we can run our inner optimization to super convergence and therefore we we don't have this implicit regularizer anymore and we'll have to make up for that they say in cases like ill conditioned optimization landscapes and medium shot learning we may want to take many gradient steps which poses two challenges for mammal first we need to store and differentiate through the long optimization path of ALG which imposes a considerable computation and memory burden right that's what we said second the dependence of the model parameters fi i on the meta parameters shrinks and vanishes as the number of gradient steps in ALG grows making meta learning difficult so what they're saying is if you optimize your inner optimization algorithm to the very end then it is not very it's it's dependence and especially for gradient design it's linear dependence on the initial parameters so on the meta parameters shrinks the more optimization steps you do because the more and more you're going to basically forget about your initialization move away from that and move to a local optimum from which you could reach you know from many many different initializations so that's still a question whether that's happening but this that's the idea here right if you're at the local optimum you could have reached that from any sort of point and there's going to be very little information about the end of the procedure from the beginning and therefore if you want to calculate the gradient that's going to be like super inaccurate and they say to overcome these limitations so they solve these two things in one right here we consider a more explicitly regularized algorithm so what they'll say is they'll say we don't just want to optimize this inner objective so this would be here so we don't just want to find the minimum of this inner loss function that's one goal we have but the other goal we have is to stay close to the initial parameters and that's where this regularizer in comes in here so this basically says we we want with our parameters here that we are optimizing we want to find them such that they minimize this loss function right you know really minimize it find the best point but also with a trade-off of lambda we want to stay close to the to the initial parameters that we started from right this is this is the initial parameters and the closeness is measured in the L to norm so it's a quadratic regularizer on how closer you might know from you know initial supervised learning or something that sometimes you do something like plus lambda times the L to norm of the weights so this would be called weight regularization weight decay L to normalization something like this where you regularize your weights such that you stay close to the zero point right implicitly in this there is a minus zero given but here you want to stay close to your initial parameters so the inner optimization is no longer just minimizing the loss on the training data set the inner optimization is that and with Alc star we denote if so if Alc has a star we say that the this is this is referring not to the procedure of the algorithm but to the minimum that the algorithm has found right so Alc star means the algorithm has optimized this inner procedure to its minimum which is a balance of the training loss of that task and staying close to the original parameters and this I think this they say that here the proximal regularization term in equation three encourages say fi i to remain close to theta thereby retaining a strong dependence throughout this is why their method works and we're going to see in the math right soon how exactly this how exactly they're able through this to establish this implicit gradient correspondence so they formulate their entire algorithm as follows we want to find the best metal learning parameters by minimizing the function f where f is the average losses and L here now that's the test set loss the average validation loss for each task of the parameters that the inner optimization procedure finds when it runs to its optimum that is you can see here this is already different from the original mammal the original mammal was simply running it for a number of steps and now we're really running it to the optimum at least in the ideal case what does the inner optimization algorithm do the Alc star here minimizes this function g right now g has two arguments g has g has these parameters which are the local parameters and these are the meta parameters and we only optimize the local parameters we take these as initial and then fine tune them where the function g is defined as the training loss of the local parameters plus this closeness regularizer okay cool now the question of course is how does that lead to gradient descent so ultimately we want to minimize this function f right here so we we're going to have to do something like df by d theta right to in order to run gradient descent we need to calculate this gradient because we need to do gradient descent so what's that going to be that's going to be of course since f is a is this one over m up here right the the gradient simply distributes over that sum now it's the gradient or sorry the derivative of each of these inner loss functions let's go with this Alc star i theta that's basically what you have right here okay so in order to take the gradient of f we need to be able to take the we need to be able to derive these loss functions and you can see right here theta is not the argument to the loss function theta is the argument to this inner procedure so by the chain rule right now this gives us this so the chain rule says we derive the outer thing with respect to its input that's this part right here the gradient of the loss with respect to the neural network and that thing here that's the Alc star so we need to gradient of the loss function with respect to the end parameters of the optimization procedure now that's easy that's we know how to do that that is the or that is the so if you remember the drawing at the beginning this gradient is the end arrow right here this is easy this is one backward propagation this is regular supervised learning back prop right you have parameters of a neural network a gradient for the loss function cool the hard part is to have the derivative of the algorithm itself with respect to the to the meta parameters so this is going to be this here is going to be a vector it's the gradient with respect to these parameters and this is going to be a matrix and the matrix will relate basically one dimension each dimension of this vector sorry this is going to be a product between this thing and this thing and it will result in this thing so the left thing is the gradient we want this is the derivative of the entire thing that's this now the right thing is the gradient at the end of the optimization procedure and this matrix here relates the individual dimension of this end gradient to the gradient that we want right this is a matrix that relates the two in a linear fashion this is what we're looking how if how do we need to change the initial parameters in order to change the end parameters by a certain way because we only need we only know this but we want to know this so how do we calculate this thing here this Jacobian that's a question right how do we derive the the algorithmic procedure this thing here and the paper goes on to say well okay yeah so we need to do this this is the entire gradient descent optimization procedure so we must compute this thing right here and they just throw it in your face it's this boom sugar the bomb this thing here done let's go on no so you can you can see it's it's basically putting this just right here but we kind of want to explore where that comes from so the fact you can see here you can derive this gradient as a close form expression of the inverse of a matrix that contains this is the identity matrix contains somehow this lambda factor that we saw before and it contains this Hessian matrix of the training loss right so this is this end gradient that we can calculate easily and the second derivative of that is the Hessian which is basically the curvature in the landscape of that loss but nowhere in this thing is the is the SGD procedure showing up even though this thing here is the SGD procedure and that's pretty impressive and we're going to look at how that comes about so so where where do we start first let's take this let's take this G right here this G function right and let's calculate the derivative with respect to the in these parameters right here so let's go for this end gradient what's this end gradient going to be so we'll derive the G with respect to the these parameters all right so this is a sum this first thing is pretty easy it's going to be the gradient of this loss function loss function is a scalar right so we can this we can count this is the something one backward prop through the network the second thing we can also do pretty easily this is an L2 norm where we know how to derive a square so the two comes down and the this will simply result in the this vector right here so it's going to be lambda times phi minus theta okay now this was relatively easy now imagine what happens when in this particular thing we have one additional information namely that f the inside of f we will always optimize to the end we will always optimize this to its minimum right this star the notes that the inner optimization procedure will always go to the minimum of that function so what do we know about the minimum of a function we know that it's gradient at that particular point is zero all right this is the this is an important part so now we can restructure so if we take one to the right I might actually use black here because it's kind of burning my eyes we can isolate this part right here so we say the phi is equal to first of all let's let's take this to the right side so we'll have this gradient right here and I'm just gonna write L of phi let's keep the hat alive we'd have to divide this by lambda right and then bring over the theta so we have a close we have an expression that says at the optimum the parameters phi the inner parameters are going to be given by this expression now that's pretty pretty cool but we know also that this parameters aren't just you know parameters per say they depend on these parameters right the end parameters depend on the initial parameters because the we use the initial parameters to initialize these end parameters so these are actually a function of the initial parameters so what we can do is we can derive this using red again let's use blue we can derive this thing by the initial parameters right how do the end parameters relate to the initial parameters now this is our basic question all along but we now have an exact expression for the end parameters which we didn't have before before we just knew they came about by SGD so important to say this only works at the optimum right this is at the optimum that this relation counts not anywhere and the paper is abusing this quite a bit right here so what does this do if we derive this thing here with respect to theta it's simply giving us the identity matrix right this is now our our Jacobian that appears here it's simply giving us this then this one divided by lambda is going to stay and now it gets a bit tricky because these things right here of course are also a function of theta so essentially this means we this thing right here is a gradient of a function of another function of theta so we can apply the chain rule again since this is already the first derivative it will give us the second derivative with respect to the loss function right here of with whatever goes into the loss function so that times the inner derivative now the inner derivative is simply how to derive again the phi by the theta okay now this okay yes so you can see first of all interesting that the expression here or the expression that we are looking to find appears in the expression itself right since since these parameters appear over here as a function argument as well we'll get basically this expression here twice but we can reformulate that and find that the the this term this Jacobian is basically this here inverted so the matrix we're looking for is sorry the inverse Jacobian the matrix we're looking for is given by this quantity right here the identity matrix minus this Hessian term right here okay and this is exactly what you see appearing here this is exactly that so the derivative we're looking for sorry this is actually the Jacobian not the inverse that's my bad what you're looking for is given by this expression now my eraser got stuck hello cool so that's how that appears you see it's the same thing if I had done everything correctly and so this this you do by simply shipping this to the other side which will make it the the inverse right so you divide you basically divide both sides by this and then you get this as an inverse now why does this work again I want to stress why did we get this identity here why were we able to express get a close form solution to the for the inner thing or sorry for the end parameters in terms of the beginning parameters that doesn't have sgd first reason because we optimized to the end to the optimum that's why we got the equal zero right here second reason because we have this regularizer you see this directly comes from from this expression right here if we wouldn't have this regularizer then we could not make this expression we could not get phi as a standalone quantity here and therefore this derivation wouldn't work now why is this important because if you look back into your drawing what you're basically doing is you are imposing a quadratic regularizer around this initial point right here and that creates this very strong connection between the end gradient and the initial gradient so now when you're optimizing when you have a training loss of the inner task and maybe the training loss looks something like it looks something like like this right here so sgd will it would go right to the very inner point right here if you just let sgd run it would go there but now since you have this regularizer sgd needs to find a tradeoff point between the two so what it will do is it will probably go somewhere and stop somewhere here so it will now have two forces pulling on it the first force will be this quantity right here and the second force will be pulling it back towards this and you can pretty much count so now sgd cannot just go to any point right here it cannot so not go to any iseline these are not equal anymore maybe mainly it will go to the one point that points into the direction of this quadratic right here so since it's a quadratic we have closed form formulas for relating one gradient on the quadratic namely the one out here with the gradient back here so we can express this Jacobian in closed form because this is a quadratic because we have this regularizer because you have these basically two forces pulling on this point in opposite direction one pointing towards the training loss and one pointing towards the inside of the quadratic so that's why this method works okay I can recommend Farron who zars block post and he has some very nice animations of why this basically restricts where gradient descent can go I can I can link to it in the description it's pretty cool to see I don't have it open right now so what does that give us the implicit model agnostic meta learning i mammal this is what this paper suggests while not converged do sample about bunch of bunch of tasks right for each task compute the meta gradient g average these gradients to get a gradient for the outer parameters and then do gradient descent on the outer parameters very easy how do you do this how do you do this implicit meta gradient this is this procedure right here so what you are going to do is meta parameters theta you initialize your parameters with the theta by the way they don't need to be initializations they can be actually any sort of hyper parameters that this algorithm takes any parameterization of this algorithm will do fine I just always said initial parameters such that it it gets easier but it can be any sort of hyper parameters of the inner task obtain task parameters using iterative optimizations solver such that the inner parameters are close to the optimum of that algorithm so they actually extend this also in theory not so that you do not don't have to optimize the inner objective really to the optimum but you can be like delta close to it that's pretty useful and that's in the part of the paper that we won't go over because this video would be like super long but I invite you to read it if you're interested then you compute the partial outer level gradient so this this would be your partial gradient your v would be this gradient at the end right the gradient at the end of the optimization procedure with respect to your validation data sets this is one back problem now we need to relate that end gradient to the beginning and that's and we do that by multiplying it with this matrix inverted right here now because obtaining the entire matrix this is the Hessian matrix and inverted is very memory and computation intensive because if you have d parameters in your neural network this is going to be a d by d matrix so if you have five million parameters this is going to be 25 million million size matrix is just not possible and that's why this paper extends this method to a second degree of approximation namely you don't have to compute the exact inverse you just have to compute something that is very close to the inverse times this inner this final gradient and a good method to do this is this conjugate gradient method and that method is able to to basically use the fact that you can compute Hessian vector products without having to compute the Hessian as a matrix this you can also do with a sort of modified back propagation algorithm also won't go in here but see you use iterative solver for example conjugate gradient along with reverse mode differentiation to compute Hessian vector products to compute GI so GI is going to be the final gradient pulled back through this matrix right here to give you the beginning gradient this metagradient okay so two approximations here first approximation you don't actually have to solve to the variant you can solve it delta close and second approximation you don't actually have to compute the inverse of that final graded sorry compute the multiplication of the final gradient with the inverse of this matrix right here you can also find something that's a delta prime close to that and they have a bunch of theory of that this still works they compare this of course to the other algorithms they observe that their algorithm uses substantially less memory and what substantially less memory and substantially less compute time once you go up to a number of inner gradient steps and it works better than this first order mammal so this first order mammal was our kind of initial guess of how we could do this this tends to perform very poorly as you can see there there um oh you can you can't actually see that here their method is better but their method is better and uses less time because you have this con inner conjugate gradient optimizer sorry this is the this is the outer optimizer okay so this is the error plot of how well are these methods are able to approximate the true gradient so if you could compute this true outer gradient you know that we did with mammal but we optimize to the end how close are you getting of course the problem with this method right here is that um you do these approximations um to you do these approximations and those could hurt you but the problem with mammal is that you're back propagating through the optimization procedure and that means the non-linear errors could sort of accumulate and as you can see here even though both might eventually you know get to the to the zero error if you give them enough inner gradient steps um especially at the low inner gradient step regime the implicit mammal is much better than mammal now i've just said the errors accumulate but the effect probably here is that the fact that with mammal you don't actually do good inner enough inner steps to reach a good enough optimum of the inner tasks so these inner gradient of the tasks their gradients when they're still very not optimized and therefore they are a very bad estimate for your outer gradient then when you do more gradient steps so that actually hurts you more which is um so also it's surprising to me and then at the end you see this conjugate gradient steps this is when you approximate this matrix inverse if you just do two steps then at some point that error dominates but if you do more steps you can uh reach a much lower error and 10 steps isn't that much for an algorithm like this as you can see here the 10 steps um your computation time will still in in the uh regime of many gradient steps will still be lower than the original mammal and then they actually test this thing and of course they're the best at pretty much everything um i don't want to go into the exact details here i invite you to check out the paper for that check out if you're interested in the proofs and the approximation guarantees and with that uh bye bye | [{"start": 0.0, "end": 5.04, "text": " Hi there. Today we're looking at meta learning with implicit gradients by"}, {"start": 5.04, "end": 12.84, "text": " R-Wind Rajeshwaran, Chelsea Finn, Shomkakad and Sergei Levine. So this paper"}, {"start": 12.84, "end": 17.12, "text": " deals with the task of meta learning. Now if you don't know what meta learning is,"}, {"start": 17.12, "end": 22.12, "text": " let me quickly introduce the term. So in meta learning you assume you have some"}, {"start": 22.12, "end": 27.88, "text": " sort of a distribution of tasks ahead. So let's make some examples. For example,"}, {"start": 27.88, "end": 35.48, "text": " task one could be you get an image, you have a data set of images and you want to"}, {"start": 35.48, "end": 41.2, "text": " classify them into cats or dogs. And you know you have a little data set with"}, {"start": 41.2, "end": 48.2, "text": " labeled images and you can train test split that and that's one task. Now task two is"}, {"start": 48.2, "end": 53.599999999999994, "text": " going to be again you have a small data set of different images but let's just"}, {"start": 53.6, "end": 58.800000000000004, "text": " all make image examples here. But you want to locate the pedestrian. So you want"}, {"start": 58.800000000000004, "end": 67.36, "text": " to locate the human in the image. So where is the human? And the task three could"}, {"start": 67.36, "end": 77.0, "text": " be again a small database of tasks, sorry, of images. And in each of the image you"}, {"start": 77.0, "end": 86.48, "text": " want to visually question answer. Or let's say you want to point out there is a"}, {"start": 86.48, "end": 90.96000000000001, "text": " ground, there is a tree and there is a question about it. Yeah, let's say visual"}, {"start": 90.96000000000001, "end": 95.8, "text": " question answering, right? Which which give you yes or no questions. Something like"}, {"start": 95.8, "end": 103.2, "text": " this. Now let's just say you have to segment, you have to segment that image. So"}, {"start": 103.2, "end": 107.16, "text": " down here would be ground, you have to segment the ground. Okay, so these are all"}, {"start": 107.16, "end": 113.4, "text": " image tasks, right? These are all perfectly fine independent tasks each each"}, {"start": 113.4, "end": 118.8, "text": " each one you have a small data set. Now sometimes these data sets are very"}, {"start": 118.8, "end": 123.56, "text": " very small such that you cannot really train a state of the art model on them."}, {"start": 123.56, "end": 129.28, "text": " For example, if you have medical images, oftentimes the labels of these are"}, {"start": 129.28, "end": 133.88, "text": " very hard to get. I mean, there's privacy concerns and then you know, doctors"}, {"start": 133.88, "end": 139.2, "text": " have to look at it to produce images costs money and so on. So it's not like"}, {"start": 139.2, "end": 145.28, "text": " you have a lot of images and you could profit from more images. So one method"}, {"start": 145.28, "end": 149.92000000000002, "text": " that people come up with is called transfer learning. So in transfer learning,"}, {"start": 149.92000000000002, "end": 155.2, "text": " you say, I have this giant database of images. Let's say this is image net,"}, {"start": 155.2, "end": 160.95999999999998, "text": " right? I have this giant database image net with labeled images. What I can do is"}, {"start": 160.95999999999998, "end": 167.67999999999998, "text": " I can use this to train a neural network. Let's this are the bunch of layers of"}, {"start": 167.67999999999998, "end": 172.76, "text": " neural network and I can train the neural network on this big database and get"}, {"start": 172.76, "end": 178.72, "text": " parameters theta, right? These are the parameters of the neural network and then"}, {"start": 178.72, "end": 183.76, "text": " I will basically adapt these parameters to each task individually. So in task"}, {"start": 183.76, "end": 189.6, "text": " one, sorry about that, I would then take these parameters as an input to the"}, {"start": 189.6, "end": 193.6, "text": " neural network. I would initialize the neural network with these parameters and"}, {"start": 193.6, "end": 200.76, "text": " then I would use this training set in order to fine tune. This is what's called"}, {"start": 200.76, "end": 208.23999999999998, "text": " fine tuning to the task specific parameters here. 5. This is so 5.1 because it's"}, {"start": 208.24, "end": 214.8, "text": " task one. For task two, I would also take these as a starting point in order to"}, {"start": 214.8, "end": 221.52, "text": " train its neural network to fine tune it on this bounding box task in order to"}, {"start": 221.52, "end": 227.28, "text": " obtain the parameters for task two. So you can see that there's the pre-training"}, {"start": 227.28, "end": 233.60000000000002, "text": " stage here to obtain good initial parameters and then we adapt these initial"}, {"start": 233.6, "end": 239.35999999999999, "text": " parameters for each task separately in a fine tuning stage. So this is one way"}, {"start": 239.35999999999999, "end": 245.48, "text": " we can do it. Another way we can do it is called multi task learning. What we do in"}, {"start": 245.48, "end": 252.56, "text": " multi task learning is we say, well, see, probably an neural network that can"}, {"start": 252.56, "end": 257.15999999999997, "text": " segment the grounds is also pretty good at doing bounding boxes. Like it'll use"}, {"start": 257.15999999999997, "end": 262.36, "text": " some of the same features. So can't we just kind of pool together these data sets"}, {"start": 262.36, "end": 269.56, "text": " into one bigger data set and then train on like if it's if it's an image from"}, {"start": 269.56, "end": 273.92, "text": " task one will train on the loss of task one and if it's an image from task two"}, {"start": 273.92, "end": 278.08000000000004, "text": " will train on the loss of task two and so on. But we'll sort of use the same"}, {"start": 278.08000000000004, "end": 283.12, "text": " neural network basis. We just have kind of different heads on top of them and"}, {"start": 283.12, "end": 287.8, "text": " we'll basically so this is called multi task learning. Have one shared neural"}, {"start": 287.8, "end": 294.24, "text": " network with different outputs for the different tasks and basically counting on"}, {"start": 294.24, "end": 299.44, "text": " the fact that you can sort of learn from one task what's useful and the other."}, {"start": 299.44, "end": 305.2, "text": " Now this is a good method to combine the tasks and to basically share data"}, {"start": 305.2, "end": 310.72, "text": " information but it will also limit you because you now have to trade off"}, {"start": 310.72, "end": 316.56, "text": " between the tasks like this neural network right here this joint encoder will"}, {"start": 316.56, "end": 323.16, "text": " never be able to will never be able to fully gear to one task because it also"}, {"start": 323.16, "end": 329.2, "text": " has to you know it has to perform for the other tasks as well. So you kind of"}, {"start": 329.2, "end": 334.48, "text": " limit yourself in your top out accuracy. Now maybe the regularization effect is"}, {"start": 334.48, "end": 339.52, "text": " good. So these are two methods the first is called transfer learning here on"}, {"start": 339.52, "end": 346.79999999999995, "text": " the left and the other is called multi task learning. Now meta learning goes a"}, {"start": 346.79999999999995, "end": 351.96, "text": " different direction. Metal learning is like transfer learning but it says well"}, {"start": 351.96, "end": 359.24, "text": " what if we don't have this giant data set right here. What what if what if we"}, {"start": 359.24, "end": 366.0, "text": " find a way to learn these initial parameters right. So what we'll do is we'll"}, {"start": 366.0, "end": 371.04, "text": " start out with a guess a guess of good initial parameters. Let's call that"}, {"start": 371.04, "end": 378.32, "text": " theta zero and now we have all of these three tasks take theta zero and run"}, {"start": 378.32, "end": 385.04, "text": " their run their fine tuning right to come up with with their own parameters"}, {"start": 385.04, "end": 391.36, "text": " starting at theta zero. So this is phi one started from theta zero and we'll"}, {"start": 391.36, "end": 398.44, "text": " also give it to task two and to task three right and each of these tasks is going"}, {"start": 398.44, "end": 404.8, "text": " to train on its own training data set and then evaluate on its own validation"}, {"start": 404.8, "end": 410.48, "text": " data set and then report back a number. So we do this for every task and every"}, {"start": 410.48, "end": 415.48, "text": " task basically trains this runs through the validation data set reports back"}, {"start": 415.48, "end": 420.48, "text": " a generalization error and then we know once we get all the information from"}, {"start": 420.48, "end": 425.36, "text": " all the tasks we know how good were these initial parameters right. We get a"}, {"start": 425.36, "end": 431.72, "text": " measure of how easy is it for the tasks to adapt these initial parameters to"}, {"start": 431.72, "end": 438.96000000000004, "text": " their own data set and then we somehow need to figure out a way okay these"}, {"start": 438.96000000000004, "end": 446.68, "text": " parameters were on average 81% good. Can we come up with a better set of initial"}, {"start": 446.68, "end": 452.72, "text": " parameters theta one in some way. Can we somehow find a better set of initial"}, {"start": 452.72, "end": 456.84000000000003, "text": " parameters such that it is easier for the tasks to adapt these initial"}, {"start": 456.84000000000003, "end": 464.4, "text": " parameters right and even more so there could be task four which we are not"}, {"start": 464.4, "end": 468.84000000000003, "text": " seeing during this training phase right this is kind of our so these up here"}, {"start": 468.84000000000003, "end": 474.32, "text": " could be our train training tasks and this down here could be our validation task"}, {"start": 474.32, "end": 479.48, "text": " so basically we're trying to come up with a set of initial parameters that if a"}, {"start": 479.48, "end": 486.0, "text": " new task comes along and it takes this thing as its initial parameters it will"}, {"start": 486.0, "end": 492.03999999999996, "text": " be able to adapt very quickly these initial parameters to its own data set and"}, {"start": 492.03999999999996, "end": 497.68, "text": " most importantly it can do that it will result in a much better model than"}, {"start": 497.68, "end": 505.2, "text": " had the task just trained on its own small data set from scratch so our task is"}, {"start": 505.2, "end": 508.92, "text": " in metal learning is basically to come up with a learning procedure to"}, {"start": 508.92, "end": 513.08, "text": " generate to iteratively generate better and better and better initial"}, {"start": 513.08, "end": 520.16, "text": " parameters right and what better way to do this than using gradient descent so"}, {"start": 520.16, "end": 528.0799999999999, "text": " this is this is metal learning using gradient descent is is a is the core of this"}, {"start": 528.0799999999999, "end": 533.36, "text": " paper basically now what do you need for gradient descent so if you want to"}, {"start": 533.36, "end": 539.48, "text": " try to go from one task to the next using SGD or even GD gradient descent you"}, {"start": 539.48, "end": 545.24, "text": " need to come up with a gradient now why is this a problem in this case so this"}, {"start": 545.24, "end": 550.4, "text": " is in this figure so this metal learning using gradients was done in this"}, {"start": 550.4, "end": 556.84, "text": " technique called mammal and essentially what you can see here is that if you"}, {"start": 556.84, "end": 561.0, "text": " have you have this set of initial parameters this is your current best guess of"}, {"start": 561.0, "end": 565.12, "text": " these good initial parameters and you want to come up with a gradient of how to"}, {"start": 565.12, "end": 570.16, "text": " get an even better set now this gradient here is indicated by this arrow so"}, {"start": 570.16, "end": 574.48, "text": " you don't let's imagine you don't know the gradient yet you want to come up with"}, {"start": 574.48, "end": 579.6800000000001, "text": " a gradient so what you'll need to do is you'll basically have to compute the"}, {"start": 579.6800000000001, "end": 584.6800000000001, "text": " loss function and you have to differentiate that loss function with respect to"}, {"start": 584.6800000000001, "end": 589.44, "text": " your parameters that's down here what the description of the orange arrow so"}, {"start": 589.44, "end": 593.84, "text": " the your loss function of your meta parameters is going to be the average or the"}, {"start": 593.84, "end": 601.24, "text": " sum of the loss functions across all of the different tasks individually so the"}, {"start": 601.24, "end": 606.32, "text": " gradient is going to be the sum of the gradients of these loss functions with"}, {"start": 606.32, "end": 612.72, "text": " respect to your original parameter now this is the difference right usually we"}, {"start": 612.72, "end": 618.08, "text": " differentiate with respect to the parameters that we input into the loss"}, {"start": 618.08, "end": 623.32, "text": " function but not here what we input into the loss function is what is at the end"}, {"start": 623.32, "end": 629.36, "text": " of of the task adapting to its own parameters so this thing we input here is a"}, {"start": 629.36, "end": 635.08, "text": " function of our initial parameters but it's not our initial parameters so what"}, {"start": 635.08, "end": 640.64, "text": " we have is initial parameters we give them to a task we wrote this task runs"}, {"start": 640.64, "end": 649.0, "text": " SGD for K steps it runs it for a number of steps comes up with the adapted"}, {"start": 649.0, "end": 658.04, "text": " version to its own problem that goes into a loss function right so the this"}, {"start": 658.04, "end": 663.04, "text": " this this thing here are the is the neural network that finally determines the"}, {"start": 663.04, "end": 667.4399999999999, "text": " loss function so if we want to back propagate we can back propagate this loss"}, {"start": 667.4399999999999, "end": 671.9599999999999, "text": " function right through the neural network the neural network is right here is"}, {"start": 671.9599999999999, "end": 676.4399999999999, "text": " parameterized by these things we can back propagate through that but then we'll"}, {"start": 676.4399999999999, "end": 680.76, "text": " have to back propagate through the optimization procedure that was used to"}, {"start": 680.76, "end": 687.1999999999999, "text": " derive these things so that's the the problem right here you can see this here"}, {"start": 687.2, "end": 691.9200000000001, "text": " you start out with the initial parameters and let's say you give them to task"}, {"start": 691.9200000000001, "end": 698.44, "text": " one task one is going to take these as initialization and then run SGD so maybe"}, {"start": 698.44, "end": 705.96, "text": " it will perturb these parameters to come up with here phi one these parameters"}, {"start": 705.96, "end": 712.0, "text": " these parameters are the adapted version for task one and then at the end of"}, {"start": 712.0, "end": 716.96, "text": " task one you use these characterizing neural network and you can calculate a"}, {"start": 716.96, "end": 723.0, "text": " gradient so how would you need to update these parameters in order to make the"}, {"start": 723.0, "end": 727.9200000000001, "text": " loss go down and the neural network or sorry the computation will maybe result"}, {"start": 727.9200000000001, "end": 734.2, "text": " well you need to go up a bit well this is too strong it will maybe say you need"}, {"start": 734.2, "end": 740.12, "text": " to go into this direction right here with respect to these parameters but now"}, {"start": 740.12, "end": 745.84, "text": " the question is how do you have to adjust your initial parameters such that"}, {"start": 745.84, "end": 750.48, "text": " your your final parameters will go into that direction and that's not really"}, {"start": 750.48, "end": 754.0400000000001, "text": " clear you could make a guess right you could make a guess and say well if my"}, {"start": 754.0400000000001, "end": 759.32, "text": " initial parameters just go up a bit maybe the optimization procedure will just"}, {"start": 759.32, "end": 764.5600000000001, "text": " you know sort of look the same but shifted up here so something like this and"}, {"start": 764.5600000000001, "end": 768.9200000000001, "text": " then I will end up here but that's not guaranteed like this is a super"}, {"start": 768.9200000000001, "end": 773.6800000000001, "text": " non-linear procedure that you're running it through this SGD thing and it will"}, {"start": 773.68, "end": 779.4399999999999, "text": " basically it's an iterative recursive procedure so it will sort of accumulate"}, {"start": 779.4399999999999, "end": 786.04, "text": " its own non-linear errors and that's why what you have to do is basically you"}, {"start": 786.04, "end": 791.76, "text": " forward propagate through SGD and then you have to back propagate this gradient"}, {"start": 791.76, "end": 796.1999999999999, "text": " right here you have to back propagate this through the entire SGD optimization"}, {"start": 796.1999999999999, "end": 801.3599999999999, "text": " procedure and that is computationally very expensive because if you have to"}, {"start": 801.36, "end": 805.2, "text": " compute the loss once here for a neural network you have to forward pass once"}, {"start": 805.2, "end": 810.64, "text": " and the back propagation will cost as much as the forward propagation or maybe"}, {"start": 810.64, "end": 816.5600000000001, "text": " twice as much constant number but if you run k steps of SGD you basically have to"}, {"start": 816.5600000000001, "end": 822.6, "text": " trace back those k steps via back propagating it through each step so basically"}, {"start": 822.6, "end": 827.88, "text": " this is k times a back propagation step and then computationally that's just"}, {"start": 827.88, "end": 833.56, "text": " not feasible for more than very few steps and so you can only ever do very few"}, {"start": 833.56, "end": 837.8, "text": " steps you basically accumulate your non-linear error because gradient descent"}, {"start": 837.8, "end": 842.48, "text": " is a linear procedure and then you get some estimation of the gradient at the"}, {"start": 842.48, "end": 847.64, "text": " end now if you do that for all of your tasks then finally you can decide so"}, {"start": 847.64, "end": 852.88, "text": " maybe for a task one here the result will be in order to make this go up a bit"}, {"start": 852.88, "end": 858.0, "text": " you need to shift this a bit to up and the right right because then the gradient"}, {"start": 858.0, "end": 863.4399999999999, "text": " descent will kind of sort of end up here and you do this for all tasks you"}, {"start": 863.4399999999999, "end": 870.0, "text": " average the gradient like here then you can come up with a final gradient for"}, {"start": 870.0, "end": 877.28, "text": " your inner sorry for your outer model for your initial parameters so this is a"}, {"start": 877.28, "end": 883.1999999999999, "text": " big load of computation that mammal does here now there is a naive approximation"}, {"start": 883.1999999999999, "end": 887.24, "text": " and this is exactly what we said at the beginning right this first order"}, {"start": 887.24, "end": 891.92, "text": " mammal is the guess that yeah if we want to go up a bit at the end here why"}, {"start": 891.92, "end": 897.92, "text": " don't we shift the beginning up a bit right and so the first order mammal would"}, {"start": 897.92, "end": 903.48, "text": " just result in basically looking at the gradients at the end and sort of"}, {"start": 903.48, "end": 908.36, "text": " aggregating them right here and then coming up with a gradient but this is very"}, {"start": 908.36, "end": 914.6800000000001, "text": " inaccurate and generally doesn't work well because you have to understand how"}, {"start": 914.6800000000001, "end": 921.4, "text": " your end gradient is connected to your initial gradient because this is very"}, {"start": 921.4, "end": 928.44, "text": " non-linear you can't just basically transfer it over now implicit mammal this"}, {"start": 928.44, "end": 934.0400000000001, "text": " paper right here circumvents that it circumvents the step to have to explicitly"}, {"start": 934.0400000000001, "end": 940.7600000000001, "text": " back propagate this gradient along the forward pass but it's still able to"}, {"start": 940.7600000000001, "end": 947.1600000000001, "text": " come up with an expression for how the final gradient relates to the initial"}, {"start": 947.1600000000001, "end": 954.2, "text": " gradient so this is quite cool and we're in this video I would basically like to"}, {"start": 954.2, "end": 959.12, "text": " explore how this comes about and why this comes about we won't go through all"}, {"start": 959.12, "end": 963.1600000000001, "text": " the theory and the proofs but I would like you to understand that this comes"}, {"start": 963.1600000000001, "end": 968.96, "text": " about by basically them imposing a quadratic regularizer and therefore this"}, {"start": 968.96, "end": 974.12, "text": " quadratic regularizer makes a very it kind of gives rise to a very strong"}, {"start": 974.12, "end": 979.0, "text": " connection between this final gradient and this initial gradient so they can"}, {"start": 979.0, "end": 984.4, "text": " basically transform one into the other and therefore they can compute the"}, {"start": 984.4, "end": 991.76, "text": " initial gradient in a closed form setting or at least in theory all right this"}, {"start": 991.76, "end": 1000.52, "text": " was this now let's go into the problem formulation as they see it the entire"}, {"start": 1000.52, "end": 1005.84, "text": " problem formulation is you want to find these best metal learning parameters"}, {"start": 1005.84, "end": 1011.08, "text": " and they call this the outer level so on an outer level you want to run gradient"}, {"start": 1011.08, "end": 1016.12, "text": " descent to find the best metal learning parameters to minimize this function f"}, {"start": 1016.12, "end": 1023.5600000000001, "text": " right here now what is f f is the average of the validation loss function so"}, {"start": 1023.5600000000001, "end": 1030.24, "text": " here this is the loss function on the test sets of the individual tasks and the"}, {"start": 1030.24, "end": 1036.0, "text": " neural network that we evaluate on the test set is the neural network that is"}, {"start": 1036.0, "end": 1041.88, "text": " trained the algorithm is that is a training algorithm is trained on the"}, {"start": 1041.88, "end": 1047.0, "text": " training set of that particular task while starting from these parameters"}, {"start": 1047.0, "end": 1052.0, "text": " theta now you see there is no no no dependence on the task here there is no"}, {"start": 1052.0, "end": 1057.36, "text": " eye down here for these meta parameters because these are always the same"}, {"start": 1057.36, "end": 1062.4399999999998, "text": " right that's the crucial point all the tasks start from the same initial"}, {"start": 1062.4399999999998, "end": 1068.1999999999998, "text": " parameters then they optimize on their own training data set and then they"}, {"start": 1068.1999999999998, "end": 1073.4799999999998, "text": " evaluate on their own test data set and that will give you the loss for that"}, {"start": 1073.4799999999998, "end": 1077.6399999999999, "text": " particular task and your goal is to find the meta parameters such that this"}, {"start": 1077.6399999999999, "end": 1084.1999999999998, "text": " function here the average loss that results from this procedure is minimal"}, {"start": 1084.2, "end": 1096.68, "text": " okay so where they say right here the inner level is this algorithm component so"}, {"start": 1096.68, "end": 1101.6000000000001, "text": " the algorithm starts from these from these meta parameters and runs gradient"}, {"start": 1101.6000000000001, "end": 1107.64, "text": " steps on the training data set loss now this is just the first step right here"}, {"start": 1107.64, "end": 1112.8400000000001, "text": " of this procedure of course in the next step these are going to be replaced by"}, {"start": 1112.84, "end": 1118.72, "text": " the by the phi that by the phi i that results from the previous step so the"}, {"start": 1118.72, "end": 1123.84, "text": " first step is run on the met parameters and then subsequently the task"}, {"start": 1123.84, "end": 1128.28, "text": " specific parameters are updated the important thing here is that this doesn't"}, {"start": 1128.28, "end": 1132.8799999999999, "text": " need to be gradient descent actually with their method because their method"}, {"start": 1132.8799999999999, "end": 1137.28, "text": " doesn't need to back propagate through the optimization you can think of any"}, {"start": 1137.28, "end": 1141.84, "text": " inner optimization procedure that you want it can be like a black box solver"}, {"start": 1141.84, "end": 1149.12, "text": " whatever you want I'm going to be this interesting to see how this is going to"}, {"start": 1149.12, "end": 1152.9199999999998, "text": " affect something like reinforcement learning and so on this might have already"}, {"start": 1152.9199999999998, "end": 1160.3999999999999, "text": " happened and I have not looked up this so the crucial part of the paper I think"}, {"start": 1160.3999999999999, "end": 1166.8, "text": " is right here and it's sort of like you know section 2.2 but I would I would"}, {"start": 1166.8, "end": 1170.8, "text": " want to point out that I think this is the crucial part this is why the method"}, {"start": 1170.8, "end": 1176.84, "text": " works ultimately why it's in why it's able to build this implicit gradient so"}, {"start": 1176.84, "end": 1181.6, "text": " the section is called proximal regularization in the inner level and we'll go"}, {"start": 1181.6, "end": 1186.48, "text": " through this with a bit of detail to have sufficient learning in the inner"}, {"start": 1186.48, "end": 1191.12, "text": " level while also avoiding overfitting algue that's the inner optimization"}, {"start": 1191.12, "end": 1196.48, "text": " procedure needs to incorporate some form of regularization right so they're"}, {"start": 1196.48, "end": 1203.88, "text": " their their sort their goal here or their point here is that if especially if"}, {"start": 1203.88, "end": 1210.28, "text": " these individual tasks have small training data set you need to have some"}, {"start": 1210.28, "end": 1218.52, "text": " kind of protection against overfitting and that and that and they say since"}, {"start": 1218.52, "end": 1224.04, "text": " mammal uses a small number of gradient steps this corresponds to early stopping"}, {"start": 1224.04, "end": 1229.24, "text": " and can be interpreted as a form of regularization and base in prior so mammal"}, {"start": 1229.24, "end": 1235.48, "text": " is this this previous method this basic method that back propagates through"}, {"start": 1235.48, "end": 1240.3999999999999, "text": " the optimization procedure and since it does this since it back propagates"}, {"start": 1240.3999999999999, "end": 1246.6, "text": " through the optimization procedure it's computationally limited to only run"}, {"start": 1246.6, "end": 1251.68, "text": " very few forward optimization steps because it then has to back propagate"}, {"start": 1251.68, "end": 1256.8, "text": " through each one right it needs to store each one so it's computationally"}, {"start": 1256.8, "end": 1262.6000000000001, "text": " limited so by necessity it uses only a small number of gradient steps and"}, {"start": 1262.6000000000001, "end": 1268.04, "text": " therefore this is kind of early stopping and we know to prevent overfitting one"}, {"start": 1268.04, "end": 1273.4, "text": " thing you can do is to stop before your training accuracy reaches full zero"}, {"start": 1273.4, "end": 1278.16, "text": " and you can stop earlier than that ideally at a point when your validation"}, {"start": 1278.16, "end": 1285.0400000000002, "text": " accuracy reaches the low point but they say basically this this limited"}, {"start": 1285.0400000000002, "end": 1290.5600000000002, "text": " number of steps is a form of regularization now of course in in this new"}, {"start": 1290.5600000000002, "end": 1295.72, "text": " method we we don't have this constraint anymore we can run our inner"}, {"start": 1295.72, "end": 1302.0, "text": " optimization to super convergence and therefore we we don't have this implicit"}, {"start": 1302.0, "end": 1308.16, "text": " regularizer anymore and we'll have to make up for that they say in cases like"}, {"start": 1308.16, "end": 1312.2, "text": " ill conditioned optimization landscapes and medium shot learning we may want"}, {"start": 1312.2, "end": 1318.32, "text": " to take many gradient steps which poses two challenges for mammal first we need"}, {"start": 1318.32, "end": 1323.0, "text": " to store and differentiate through the long optimization path of ALG which"}, {"start": 1323.0, "end": 1326.56, "text": " imposes a considerable computation and memory burden right that's what we"}, {"start": 1326.56, "end": 1333.9199999999998, "text": " said second the dependence of the model parameters fi i on the meta parameters"}, {"start": 1333.9199999999998, "end": 1339.04, "text": " shrinks and vanishes as the number of gradient steps in ALG grows making"}, {"start": 1339.04, "end": 1344.72, "text": " meta learning difficult so what they're saying is if you optimize your inner"}, {"start": 1344.72, "end": 1351.1599999999999, "text": " optimization algorithm to the very end then it is not very it's it's"}, {"start": 1351.1599999999999, "end": 1355.9199999999998, "text": " dependence and especially for gradient design it's linear dependence on the"}, {"start": 1355.92, "end": 1362.44, "text": " initial parameters so on the meta parameters shrinks the more optimization steps"}, {"start": 1362.44, "end": 1366.88, "text": " you do because the more and more you're going to basically forget about your"}, {"start": 1366.88, "end": 1372.3200000000002, "text": " initialization move away from that and move to a local optimum from which you"}, {"start": 1372.3200000000002, "end": 1377.0, "text": " could reach you know from many many different initializations so that's still a"}, {"start": 1377.0, "end": 1381.76, "text": " question whether that's happening but this that's the idea here right if you're"}, {"start": 1381.76, "end": 1385.6000000000001, "text": " at the local optimum you could have reached that from any sort of point and"}, {"start": 1385.6, "end": 1391.32, "text": " there's going to be very little information about the end of the procedure from"}, {"start": 1391.32, "end": 1394.6, "text": " the beginning and therefore if you want to calculate the gradient that's going"}, {"start": 1394.6, "end": 1401.8799999999999, "text": " to be like super inaccurate and they say to overcome these limitations so they"}, {"start": 1401.8799999999999, "end": 1408.04, "text": " solve these two things in one right here we consider a more explicitly"}, {"start": 1408.04, "end": 1415.6, "text": " regularized algorithm so what they'll say is they'll say we don't just want to"}, {"start": 1415.6, "end": 1421.24, "text": " optimize this inner objective so this would be here so we don't just want to"}, {"start": 1421.24, "end": 1426.44, "text": " find the minimum of this inner loss function that's one goal we have but the"}, {"start": 1426.44, "end": 1431.68, "text": " other goal we have is to stay close to the initial parameters and that's where"}, {"start": 1431.68, "end": 1437.48, "text": " this regularizer in comes in here so this basically says we we want with our"}, {"start": 1437.48, "end": 1442.1200000000001, "text": " parameters here that we are optimizing we want to find them such that they"}, {"start": 1442.1200000000001, "end": 1447.2, "text": " minimize this loss function right you know really minimize it find the best"}, {"start": 1447.2, "end": 1455.52, "text": " point but also with a trade-off of lambda we want to stay close to the to the"}, {"start": 1455.52, "end": 1460.24, "text": " initial parameters that we started from right this is this is the initial"}, {"start": 1460.24, "end": 1464.56, "text": " parameters and the closeness is measured in the L to norm so it's a quadratic"}, {"start": 1464.56, "end": 1470.48, "text": " regularizer on how closer you might know from you know initial supervised"}, {"start": 1470.48, "end": 1474.72, "text": " learning or something that sometimes you do something like plus lambda times the"}, {"start": 1474.72, "end": 1480.62, "text": " L to norm of the weights so this would be called weight regularization weight"}, {"start": 1480.62, "end": 1485.76, "text": " decay L to normalization something like this where you regularize your weights"}, {"start": 1485.76, "end": 1491.6, "text": " such that you stay close to the zero point right implicitly in this there is a"}, {"start": 1491.6, "end": 1500.12, "text": " minus zero given but here you want to stay close to your initial parameters so"}, {"start": 1500.12, "end": 1505.24, "text": " the inner optimization is no longer just minimizing the loss on the training"}, {"start": 1505.24, "end": 1511.4199999999998, "text": " data set the inner optimization is that and with Alc star we denote if so if"}, {"start": 1511.4199999999998, "end": 1518.04, "text": " Alc has a star we say that the this is this is referring not to the procedure of"}, {"start": 1518.04, "end": 1524.84, "text": " the algorithm but to the minimum that the algorithm has found right so Alc star"}, {"start": 1524.84, "end": 1530.6, "text": " means the algorithm has optimized this inner procedure to its minimum which is"}, {"start": 1530.6, "end": 1535.68, "text": " a balance of the training loss of that task and staying close to the original"}, {"start": 1535.68, "end": 1544.52, "text": " parameters and this I think this they say that here the proximal regularization"}, {"start": 1544.52, "end": 1551.8799999999999, "text": " term in equation three encourages say fi i to remain close to theta thereby"}, {"start": 1551.8799999999999, "end": 1558.96, "text": " retaining a strong dependence throughout this is why their method works and we're"}, {"start": 1558.96, "end": 1568.56, "text": " going to see in the math right soon how exactly this how exactly they're able"}, {"start": 1568.56, "end": 1574.16, "text": " through this to establish this implicit gradient correspondence so they"}, {"start": 1574.16, "end": 1580.8400000000001, "text": " formulate their entire algorithm as follows we want to find the best metal"}, {"start": 1580.8400000000001, "end": 1589.64, "text": " learning parameters by minimizing the function f where f is the average losses"}, {"start": 1589.64, "end": 1597.8400000000001, "text": " and L here now that's the test set loss the average validation loss for each"}, {"start": 1597.84, "end": 1606.36, "text": " task of the parameters that the inner optimization procedure finds when it"}, {"start": 1606.36, "end": 1610.9199999999998, "text": " runs to its optimum that is you can see here this is already different from the"}, {"start": 1610.9199999999998, "end": 1614.76, "text": " original mammal the original mammal was simply running it for a number of"}, {"start": 1614.76, "end": 1620.1999999999998, "text": " steps and now we're really running it to the optimum at least in the ideal case"}, {"start": 1620.1999999999998, "end": 1626.76, "text": " what does the inner optimization algorithm do the Alc star here minimizes this"}, {"start": 1626.76, "end": 1634.92, "text": " function g right now g has two arguments g has g has these parameters which are"}, {"start": 1634.92, "end": 1639.12, "text": " the local parameters and these are the meta parameters and we only optimize the"}, {"start": 1639.12, "end": 1647.56, "text": " local parameters we take these as initial and then fine tune them where the"}, {"start": 1647.56, "end": 1652.52, "text": " function g is defined as the training loss of the local parameters plus this"}, {"start": 1652.52, "end": 1661.76, "text": " closeness regularizer okay cool now the question of course is how does that"}, {"start": 1661.76, "end": 1667.16, "text": " lead to gradient descent so ultimately we want to minimize this function f"}, {"start": 1667.16, "end": 1676.48, "text": " right here so we we're going to have to do something like df by d theta right to"}, {"start": 1676.48, "end": 1681.2, "text": " in order to run gradient descent we need to calculate this gradient because we"}, {"start": 1681.2, "end": 1686.72, "text": " need to do gradient descent so what's that going to be that's going to be of"}, {"start": 1686.72, "end": 1693.72, "text": " course since f is a is this one over m up here right the the gradient simply"}, {"start": 1693.72, "end": 1701.52, "text": " distributes over that sum now it's the gradient or sorry the derivative of each"}, {"start": 1701.52, "end": 1713.8799999999999, "text": " of these inner loss functions let's go with this Alc star i theta that's basically"}, {"start": 1713.8799999999999, "end": 1719.6, "text": " what you have right here okay so in order to take the gradient of f we need to"}, {"start": 1719.6, "end": 1725.36, "text": " be able to take the we need to be able to derive these loss functions and you"}, {"start": 1725.36, "end": 1729.92, "text": " can see right here theta is not the argument to the loss function theta is the"}, {"start": 1729.92, "end": 1735.72, "text": " argument to this inner procedure so by the chain rule right now this gives us"}, {"start": 1735.72, "end": 1742.1200000000001, "text": " this so the chain rule says we derive the outer thing with respect to its input"}, {"start": 1742.1200000000001, "end": 1748.88, "text": " that's this part right here the gradient of the loss with respect to the neural"}, {"start": 1748.88, "end": 1757.24, "text": " network and that thing here that's the Alc star so we need to gradient of the"}, {"start": 1757.24, "end": 1761.8, "text": " loss function with respect to the end parameters of the optimization procedure"}, {"start": 1761.8, "end": 1767.64, "text": " now that's easy that's we know how to do that that is the or that is the so if"}, {"start": 1767.64, "end": 1775.28, "text": " you remember the drawing at the beginning this gradient is the end arrow"}, {"start": 1775.28, "end": 1780.96, "text": " right here this is easy this is one backward propagation this is regular"}, {"start": 1780.96, "end": 1784.8, "text": " supervised learning back prop right you have parameters of a neural network"}, {"start": 1784.8, "end": 1792.24, "text": " a gradient for the loss function cool the hard part is to have the derivative of"}, {"start": 1792.24, "end": 1799.24, "text": " the algorithm itself with respect to the to the meta parameters so this is"}, {"start": 1799.24, "end": 1806.28, "text": " going to be this here is going to be a vector it's the gradient with respect to"}, {"start": 1806.28, "end": 1811.6399999999999, "text": " these parameters and this is going to be a matrix and the matrix will relate"}, {"start": 1811.64, "end": 1819.8000000000002, "text": " basically one dimension each dimension of this vector sorry this is going to be"}, {"start": 1819.8000000000002, "end": 1826.2800000000002, "text": " a product between this thing and this thing and it will result in this thing so"}, {"start": 1826.2800000000002, "end": 1832.0, "text": " the left thing is the gradient we want this is the derivative of the entire"}, {"start": 1832.0, "end": 1838.1200000000001, "text": " thing that's this now the right thing is the gradient at the end of the"}, {"start": 1838.12, "end": 1844.6, "text": " optimization procedure and this matrix here relates the individual dimension of"}, {"start": 1844.6, "end": 1852.1599999999999, "text": " this end gradient to the gradient that we want right this is a matrix that"}, {"start": 1852.1599999999999, "end": 1858.32, "text": " relates the two in a linear fashion this is what we're looking how if how do we"}, {"start": 1858.32, "end": 1865.36, "text": " need to change the initial parameters in order to change the end parameters by"}, {"start": 1865.36, "end": 1870.08, "text": " a certain way because we only need we only know this but we want to know this"}, {"start": 1870.08, "end": 1875.8, "text": " so how do we calculate this thing here this Jacobian that's a question right"}, {"start": 1875.8, "end": 1884.4799999999998, "text": " how do we derive the the algorithmic procedure this thing here and the paper"}, {"start": 1884.4799999999998, "end": 1891.28, "text": " goes on to say well okay yeah so we need to do this this is the entire gradient"}, {"start": 1891.28, "end": 1899.24, "text": " descent optimization procedure so we must compute this thing right here and they"}, {"start": 1899.24, "end": 1905.76, "text": " just throw it in your face it's this boom sugar the bomb this thing here done"}, {"start": 1905.76, "end": 1915.2, "text": " let's go on no so you can you can see it's it's basically putting this just"}, {"start": 1915.2, "end": 1919.52, "text": " right here but we kind of want to explore where that comes from so the fact"}, {"start": 1919.52, "end": 1926.08, "text": " you can see here you can derive this gradient as a close form expression of the"}, {"start": 1926.08, "end": 1931.8799999999999, "text": " inverse of a matrix that contains this is the identity matrix contains somehow"}, {"start": 1931.8799999999999, "end": 1938.0, "text": " this lambda factor that we saw before and it contains this Hessian matrix of"}, {"start": 1938.0, "end": 1944.04, "text": " the training loss right so this is this end gradient that we can calculate"}, {"start": 1944.04, "end": 1949.56, "text": " easily and the second derivative of that is the Hessian which is basically the"}, {"start": 1949.56, "end": 1956.12, "text": " curvature in the landscape of that loss but nowhere in this thing is the is the"}, {"start": 1956.12, "end": 1962.52, "text": " SGD procedure showing up even though this thing here is the SGD procedure and"}, {"start": 1962.52, "end": 1971.12, "text": " that's pretty impressive and we're going to look at how that comes about so so"}, {"start": 1971.12, "end": 1982.52, "text": " where where do we start first let's take this let's take this G right here"}, {"start": 1982.52, "end": 1990.9199999999998, "text": " this G function right and let's calculate the derivative with respect to the"}, {"start": 1990.9199999999998, "end": 1995.76, "text": " in these parameters right here so let's go for this end gradient what's this"}, {"start": 1995.76, "end": 2004.0, "text": " end gradient going to be so we'll derive the G with respect to the these"}, {"start": 2004.0, "end": 2014.48, "text": " parameters all right so this is a sum this first thing is pretty easy it's"}, {"start": 2014.48, "end": 2019.28, "text": " going to be the gradient of this loss function loss function is a scalar"}, {"start": 2019.28, "end": 2028.56, "text": " right so we can this we can count this is the something one backward prop through"}, {"start": 2028.56, "end": 2033.8, "text": " the network the second thing we can also do pretty easily this is an L2 norm"}, {"start": 2033.8, "end": 2042.92, "text": " where we know how to derive a square so the two comes down and the this will"}, {"start": 2042.92, "end": 2048.6, "text": " simply result in the this vector right here so it's going to be lambda times"}, {"start": 2048.6, "end": 2060.08, "text": " phi minus theta okay now this was relatively easy now imagine what happens"}, {"start": 2060.08, "end": 2066.6, "text": " when in this particular thing we have one additional information namely that"}, {"start": 2066.6, "end": 2076.8399999999997, "text": " f the inside of f we will always optimize to the end we will always optimize"}, {"start": 2076.84, "end": 2082.8, "text": " this to its minimum right this star the notes that the inner optimization"}, {"start": 2082.8, "end": 2088.08, "text": " procedure will always go to the minimum of that function so what do we know"}, {"start": 2088.08, "end": 2092.2400000000002, "text": " about the minimum of a function we know that it's gradient at that"}, {"start": 2092.2400000000002, "end": 2098.48, "text": " particular point is zero all right this is the this is an important part so now"}, {"start": 2098.48, "end": 2103.6000000000004, "text": " we can restructure so if we take one to the right I might actually use black"}, {"start": 2103.6, "end": 2111.04, "text": " here because it's kind of burning my eyes we can isolate this part right here so"}, {"start": 2111.04, "end": 2119.48, "text": " we say the phi is equal to first of all let's let's take this to the right"}, {"start": 2119.48, "end": 2125.92, "text": " side so we'll have this gradient right here and I'm just gonna write L of phi"}, {"start": 2125.92, "end": 2133.6800000000003, "text": " let's keep the hat alive we'd have to divide this by lambda right and then bring"}, {"start": 2133.6800000000003, "end": 2140.28, "text": " over the theta so we have a close we have an expression that says at the"}, {"start": 2140.28, "end": 2145.64, "text": " optimum the parameters phi the inner parameters are going to be given by"}, {"start": 2145.64, "end": 2155.56, "text": " this expression now that's pretty pretty cool but we know also that this"}, {"start": 2155.56, "end": 2161.92, "text": " parameters aren't just you know parameters per say they depend on these"}, {"start": 2161.92, "end": 2166.52, "text": " parameters right the end parameters depend on the initial parameters because"}, {"start": 2166.52, "end": 2171.32, "text": " the we use the initial parameters to initialize these end parameters so these"}, {"start": 2171.32, "end": 2175.72, "text": " are actually a function of the initial parameters so what we can do is we can"}, {"start": 2175.72, "end": 2184.84, "text": " derive this using red again let's use blue we can derive this thing by the"}, {"start": 2184.84, "end": 2189.6400000000003, "text": " initial parameters right how do the end parameters relate to the initial"}, {"start": 2189.6400000000003, "end": 2193.8, "text": " parameters now this is our basic question all along but we now have an exact"}, {"start": 2193.8, "end": 2198.44, "text": " expression for the end parameters which we didn't have before before we just"}, {"start": 2198.44, "end": 2204.1200000000003, "text": " knew they came about by SGD so important to say this only works at the"}, {"start": 2204.1200000000003, "end": 2210.52, "text": " optimum right this is at the optimum that this relation counts not anywhere and"}, {"start": 2210.52, "end": 2217.0, "text": " the paper is abusing this quite a bit right here so what does this do if we"}, {"start": 2217.0, "end": 2221.48, "text": " derive this thing here with respect to theta it's simply giving us the identity"}, {"start": 2221.48, "end": 2227.08, "text": " matrix right this is now our our Jacobian that appears here it's simply giving"}, {"start": 2227.08, "end": 2237.68, "text": " us this then this one divided by lambda is going to stay and now it gets a bit"}, {"start": 2237.68, "end": 2245.2799999999997, "text": " tricky because these things right here of course are also a function of theta"}, {"start": 2245.2799999999997, "end": 2253.12, "text": " so essentially this means we this thing right here is a gradient of a function"}, {"start": 2253.7599999999998, "end": 2260.08, "text": " of another function of theta so we can apply the chain rule again since this is"}, {"start": 2260.08, "end": 2266.48, "text": " already the first derivative it will give us the second derivative with respect to"}, {"start": 2266.48, "end": 2276.96, "text": " the loss function right here of with whatever goes into the loss function so"}, {"start": 2276.96, "end": 2286.96, "text": " that times the inner derivative now the inner derivative is simply how to"}, {"start": 2286.96, "end": 2303.76, "text": " derive again the phi by the theta okay now this okay yes so you can see first of"}, {"start": 2303.76, "end": 2309.52, "text": " all interesting that the expression here or the expression that we are looking to"}, {"start": 2309.52, "end": 2314.88, "text": " find appears in the expression itself right since since these parameters"}, {"start": 2314.88, "end": 2320.08, "text": " appear over here as a function argument as well we'll get basically this"}, {"start": 2320.08, "end": 2328.7200000000003, "text": " expression here twice but we can reformulate that and find that the"}, {"start": 2331.76, "end": 2338.56, "text": " the this term this Jacobian is basically this here inverted so the matrix we're"}, {"start": 2338.56, "end": 2344.08, "text": " looking for is sorry the inverse Jacobian the matrix we're looking for is given"}, {"start": 2344.08, "end": 2350.08, "text": " by this quantity right here the identity matrix minus this Hessian term right"}, {"start": 2350.08, "end": 2357.7599999999998, "text": " here okay and this is exactly what you see appearing here this is exactly that"}, {"start": 2358.64, "end": 2365.52, "text": " so the derivative we're looking for sorry this is actually the Jacobian not the"}, {"start": 2365.52, "end": 2373.12, "text": " inverse that's my bad what you're looking for is given by this expression now my eraser"}, {"start": 2373.12, "end": 2386.7999999999997, "text": " got stuck hello cool so that's how that appears you see it's the same thing if I had done"}, {"start": 2386.7999999999997, "end": 2396.3199999999997, "text": " everything correctly and so this this you do by simply shipping this to the other side"}, {"start": 2396.32, "end": 2403.1200000000003, "text": " which will make it the the inverse right so you divide you basically divide both sides by this"}, {"start": 2403.1200000000003, "end": 2411.6000000000004, "text": " and then you get this as an inverse now why does this work again I want to stress why did we get"}, {"start": 2412.32, "end": 2419.2000000000003, "text": " this identity here why were we able to express get a close form solution to the"}, {"start": 2419.2, "end": 2425.7599999999998, "text": " for the inner thing or sorry for the end parameters in terms of the beginning parameters"}, {"start": 2426.3199999999997, "end": 2433.9199999999996, "text": " that doesn't have sgd first reason because we optimized to the end to the optimum that's why"}, {"start": 2433.9199999999996, "end": 2440.72, "text": " we got the equal zero right here second reason because we have this regularizer you see this"}, {"start": 2440.72, "end": 2447.8399999999997, "text": " directly comes from from this expression right here if we wouldn't have this regularizer then"}, {"start": 2447.84, "end": 2455.36, "text": " we could not make this expression we could not get phi as a standalone quantity here and therefore"}, {"start": 2455.36, "end": 2464.0, "text": " this derivation wouldn't work now why is this important because if you look back into your drawing"}, {"start": 2465.1200000000003, "end": 2472.2400000000002, "text": " what you're basically doing is you are imposing a quadratic regularizer around this initial"}, {"start": 2472.24, "end": 2481.4399999999996, "text": " point right here and that creates this very strong connection between the end gradient and the"}, {"start": 2481.4399999999996, "end": 2488.3999999999996, "text": " initial gradient so now when you're optimizing when you have a training loss of the inner task and"}, {"start": 2488.3999999999996, "end": 2498.0, "text": " maybe the training loss looks something like it looks something like like this right here so sgd"}, {"start": 2498.0, "end": 2507.04, "text": " will it would go right to the very inner point right here if you just let sgd run it would go there"}, {"start": 2507.04, "end": 2513.36, "text": " but now since you have this regularizer sgd needs to find a tradeoff point between the two so what"}, {"start": 2513.36, "end": 2519.28, "text": " it will do is it will probably go somewhere and stop somewhere here so it will now have two forces"}, {"start": 2519.28, "end": 2525.28, "text": " pulling on it the first force will be this quantity right here and the second force will be"}, {"start": 2525.28, "end": 2537.92, "text": " pulling it back towards this and you can pretty much count so now sgd cannot just go to any point"}, {"start": 2537.92, "end": 2541.76, "text": " right here it cannot so not go to any iseline these are not equal anymore"}, {"start": 2542.6400000000003, "end": 2548.32, "text": " maybe mainly it will go to the one point that points into the direction of this quadratic right here"}, {"start": 2548.32, "end": 2554.4, "text": " so since it's a quadratic we have closed form formulas for relating one gradient on the quadratic"}, {"start": 2554.4, "end": 2562.2400000000002, "text": " namely the one out here with the gradient back here so we can express this Jacobian in closed form"}, {"start": 2562.2400000000002, "end": 2568.48, "text": " because this is a quadratic because we have this regularizer because you have these basically two"}, {"start": 2568.48, "end": 2575.12, "text": " forces pulling on this point in opposite direction one pointing towards the training loss and one"}, {"start": 2575.12, "end": 2585.8399999999997, "text": " pointing towards the inside of the quadratic so that's why this method works okay I can recommend"}, {"start": 2585.8399999999997, "end": 2593.2, "text": " Farron who zars block post and he has some very nice animations of why this basically restricts"}, {"start": 2593.2, "end": 2600.48, "text": " where gradient descent can go I can I can link to it in the description it's pretty cool to see"}, {"start": 2600.48, "end": 2608.64, "text": " I don't have it open right now so what does that give us the implicit model agnostic meta learning"}, {"start": 2609.28, "end": 2616.4, "text": " i mammal this is what this paper suggests while not converged do sample about bunch of"}, {"start": 2616.4, "end": 2625.12, "text": " bunch of tasks right for each task compute the meta gradient g average these gradients to get a"}, {"start": 2625.12, "end": 2631.3599999999997, "text": " gradient for the outer parameters and then do gradient descent on the outer parameters very"}, {"start": 2631.3599999999997, "end": 2637.6, "text": " easy how do you do this how do you do this implicit meta gradient this is this procedure right here"}, {"start": 2639.2799999999997, "end": 2642.0, "text": " so what you are going to do is"}, {"start": 2644.96, "end": 2650.72, "text": " meta parameters theta you initialize your parameters with the theta by the way they don't need to"}, {"start": 2650.72, "end": 2655.8399999999997, "text": " be initializations they can be actually any sort of hyper parameters that this algorithm takes"}, {"start": 2656.48, "end": 2662.3999999999996, "text": " any parameterization of this algorithm will do fine I just always said initial parameters such"}, {"start": 2662.3999999999996, "end": 2669.68, "text": " that it it gets easier but it can be any sort of hyper parameters of the inner task"}, {"start": 2669.68, "end": 2681.12, "text": " obtain task parameters using iterative optimizations solver such that the inner parameters are close"}, {"start": 2681.12, "end": 2686.7999999999997, "text": " to the optimum of that algorithm so they actually extend this also in theory not so that you do not"}, {"start": 2686.7999999999997, "end": 2693.7599999999998, "text": " don't have to optimize the inner objective really to the optimum but you can be like delta close to"}, {"start": 2693.76, "end": 2700.7200000000003, "text": " it that's pretty useful and that's in the part of the paper that we won't go over because this"}, {"start": 2700.7200000000003, "end": 2708.1600000000003, "text": " video would be like super long but I invite you to read it if you're interested then you compute"}, {"start": 2708.1600000000003, "end": 2716.8, "text": " the partial outer level gradient so this this would be your partial gradient your v would be"}, {"start": 2716.8, "end": 2724.6400000000003, "text": " this gradient at the end right the gradient at the end of the optimization procedure with respect to"}, {"start": 2724.6400000000003, "end": 2732.0, "text": " your validation data sets this is one back problem now we need to relate that end gradient to the"}, {"start": 2732.0, "end": 2739.44, "text": " beginning and that's and we do that by multiplying it with this matrix inverted right here now because"}, {"start": 2739.44, "end": 2748.48, "text": " obtaining the entire matrix this is the Hessian matrix and inverted is very memory and computation"}, {"start": 2748.48, "end": 2754.64, "text": " intensive because if you have d parameters in your neural network this is going to be a d by d"}, {"start": 2754.64, "end": 2762.64, "text": " matrix so if you have five million parameters this is going to be 25 million million size matrix"}, {"start": 2762.64, "end": 2770.3199999999997, "text": " is just not possible and that's why this paper extends this method to a second degree of approximation"}, {"start": 2770.3199999999997, "end": 2776.08, "text": " namely you don't have to compute the exact inverse you just have to compute something that is"}, {"start": 2776.08, "end": 2785.8399999999997, "text": " very close to the inverse times this inner this final gradient and a good method to do this is"}, {"start": 2785.84, "end": 2794.4, "text": " this conjugate gradient method and that method is able to to basically use the fact that you can"}, {"start": 2794.4, "end": 2802.1600000000003, "text": " compute Hessian vector products without having to compute the Hessian as a matrix this you can also"}, {"start": 2802.1600000000003, "end": 2811.76, "text": " do with a sort of modified back propagation algorithm also won't go in here but see you use"}, {"start": 2811.76, "end": 2817.6000000000004, "text": " iterative solver for example conjugate gradient along with reverse mode differentiation to compute"}, {"start": 2817.6000000000004, "end": 2826.1600000000003, "text": " Hessian vector products to compute GI so GI is going to be the final gradient pulled back"}, {"start": 2826.7200000000003, "end": 2833.76, "text": " through this matrix right here to give you the beginning gradient this metagradient"}, {"start": 2834.8, "end": 2840.6400000000003, "text": " okay so two approximations here first approximation you don't actually have to solve to the"}, {"start": 2840.64, "end": 2847.04, "text": " variant you can solve it delta close and second approximation you don't actually have to compute the"}, {"start": 2847.04, "end": 2852.56, "text": " inverse of that final graded sorry compute the multiplication of the final gradient with the inverse"}, {"start": 2852.56, "end": 2858.08, "text": " of this matrix right here you can also find something that's a delta prime close to that"}, {"start": 2858.96, "end": 2866.8799999999997, "text": " and they have a bunch of theory of that this still works they compare this of course to the"}, {"start": 2866.88, "end": 2877.36, "text": " other algorithms they observe that their algorithm uses substantially less memory and what substantially"}, {"start": 2877.36, "end": 2886.8, "text": " less memory and substantially less compute time once you go up to a number of inner gradient steps"}, {"start": 2887.84, "end": 2893.52, "text": " and it works better than this first order mammal so this first order mammal was our kind of initial"}, {"start": 2893.52, "end": 2898.8, "text": " guess of how we could do this this tends to perform very poorly as you can see there"}, {"start": 2900.4, "end": 2908.08, "text": " there um oh you can you can't actually see that here their method is better but their method is"}, {"start": 2908.08, "end": 2915.7599999999998, "text": " better and uses less time because you have this con inner conjugate gradient optimizer sorry this"}, {"start": 2915.76, "end": 2927.0400000000004, "text": " is the this is the outer optimizer okay so this is the error plot of how well are these methods"}, {"start": 2927.0400000000004, "end": 2935.1200000000003, "text": " are able to approximate the true gradient so if you could compute this true outer gradient you know"}, {"start": 2935.1200000000003, "end": 2943.6800000000003, "text": " that we did with mammal but we optimize to the end how close are you getting of course the problem"}, {"start": 2943.68, "end": 2952.0, "text": " with this method right here is that um you do these approximations um to you do these approximations"}, {"start": 2953.7599999999998, "end": 2959.6, "text": " and those could hurt you but the problem with mammal is that you're back propagating through the"}, {"start": 2959.6, "end": 2965.3599999999997, "text": " optimization procedure and that means the non-linear errors could sort of accumulate"}, {"start": 2965.36, "end": 2974.2400000000002, "text": " and as you can see here even though both might eventually you know get to the to the zero error"}, {"start": 2974.2400000000002, "end": 2981.2000000000003, "text": " if you give them enough inner gradient steps um especially at the low inner gradient step regime"}, {"start": 2981.2000000000003, "end": 2988.6400000000003, "text": " the implicit mammal is much better than mammal now i've just said the errors accumulate but the"}, {"start": 2988.64, "end": 2997.3599999999997, "text": " effect probably here is that the fact that with mammal you don't actually do good inner enough"}, {"start": 2997.3599999999997, "end": 3003.3599999999997, "text": " inner steps to reach a good enough optimum of the inner tasks so these inner gradient of the tasks"}, {"start": 3003.3599999999997, "end": 3010.4, "text": " their gradients when they're still very not optimized and therefore they are a very bad estimate"}, {"start": 3010.4, "end": 3016.08, "text": " for your outer gradient then when you do more gradient steps so that actually hurts you more which is"}, {"start": 3016.08, "end": 3024.7999999999997, "text": " um so also it's surprising to me and then at the end you see this conjugate gradient steps this is"}, {"start": 3024.7999999999997, "end": 3030.64, "text": " when you approximate this matrix inverse if you just do two steps then at some point that error"}, {"start": 3030.64, "end": 3037.68, "text": " dominates but if you do more steps you can uh reach a much lower error and 10 steps isn't that much"}, {"start": 3037.68, "end": 3047.2, "text": " for an algorithm like this as you can see here the 10 steps um your computation time will still in"}, {"start": 3047.2, "end": 3054.3199999999997, "text": " in the uh regime of many gradient steps will still be lower than the original mammal"}, {"start": 3056.48, "end": 3061.9199999999996, "text": " and then they actually test this thing and of course they're the best at pretty much everything"}, {"start": 3061.92, "end": 3068.64, "text": " um i don't want to go into the exact details here i invite you to check out the paper for that"}, {"start": 3068.64, "end": 3075.2000000000003, "text": " check out if you're interested in the proofs and the approximation guarantees and with that"}, {"start": 3075.2, "end": 3092.48, "text": " uh bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=G3pOvrKkFuk | [Code] PyTorch sentiment classifier from scratch with Huggingface NLP Library (Full Tutorial) | Huggingface released its newest library called NLP, which gives you easy access to almost any NLP dataset and metric in one convenient interface. We will combine this with a BERT model from Huggingface's Transformers library to build a sentiment classifier for IMDB.
OUTLINE:
0:00 - Intro
1:30 - Boilerplate
3:20 - PyTorch Lightning Module
9:50 - Load Dataset
12:15 - Tokenization
20:50 - Torch Tensors
25:50 - Data Loader
28:00 - Create BERT Model
32:00 - Implement Validation and Train Step
47:00 - Run & Recap
50:20 - Epilogue
My Code: https://github.com/yk/huggingface-nlp-demo
NLP Library: https://github.com/huggingface/nlp
Tutorial Colab: https://colab.research.google.com/github/huggingface/nlp/blob/master/notebooks/Overview.ipynb
Transformers Library: https://github.com/huggingface/transformers
Pytorch Lightning: https://github.com/PyTorchLightning/pytorch-lightning
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 | How did it really do? So, HuggingFace just released this NLP library right here. And this is pretty cool because it allows you access to about 100 NLP data sets and 10 evaluation metrics pre-packaged. So knowing HuggingFace, this is going to be a breeze to work with. So what I thought we would do is we would try to use this. I have not used this yet. And it's been a while since I've used any HuggingFace stuff. So what we're trying to do is use this to load up the IMDB dataset and then use a BERT model maybe to build a sentiment classifier on top of that using PyTorch, specifically PyTorch Lightning. So all of that combined from scratch. And basically, if I can do it, then so can you. And we're going to make some mistakes and have to look at the documentation a bit and so on. But that's the process. Okay. So first of all, if you like content like this, let me know if you're not subscribed, subscribe. Let me know in the comments if you have any sort of criticism or tips. I'm always happy for VIM tips, honestly. So I have a pretty empty repo, Git repo here. I have a Git ignore, but that's about it. So we'll just dive right in, start up VIM and let's make a file. So first, some boilerplate code. I'm terrible at talking and coding at the same time, but you know, so I like to use this app cell library and I'm using, as you can see, I'm using the tab nine completion engine with COC with NeoVim. This is absolutely great. We maybe need apps, app flags logging. That sounds good. So we'll need torch probably, right? And we'll need PyTorch Lightning. Torch Lightning as PL. We'll need the NLP library, of course, since we're going to use that. And we need the Transformers library. Now, I know HuggingFace has this tokenizer's library too, but there are some tokenizers in the Transformer library already. And we'll just keep it light like this. So maybe NumPy, maybe not. Let's see. So we'll export, we'll have these flags object here. Maybe we'll do some flags later. And the main function, let's just call hello. Actually, let's log that info. And all right, run main. So this is our boilerplate and let's just quickly try it out just to see whether it works. So here we are. Hello, that's fine. All right. So where do we go from here? So in PyTorch Lightning, what you'll have to do is you have to build this kind of model class, right? So we'll build an IMDB sentiment classifier. And that's going to extend this Lightning module of PyTorch Lightning. So you need different things in the PyTorch Lightning module. First of all, you need the init. And we'll just do like a very basic init. We'll call super on it. And that's about it. And you need a forward method, since this is a module. So in the forward method, you're going to get a batch and you have to do something with it. And what we also need is a training step method. Training step, which gets a batch and a batch index. And we'll have to output some kind of loss or some kind of training procedure. Then we'll need a train data loader. So all of this, you can look up in the documentation of PyTorch Lightning. Basically, you implement these methods and it will do the rest for you. So it will do all the training loop and it will do the handling of GPUs and whatnot. The whole looping over epochs, all of that is basically taken care for you when you use PyTorch Lightning. So last thing we need is maybe a prepare data. Let's put that up here. Prepare data. That method is optional, but it gets called at the beginning and that's going to be pretty good for us. We have downloaded the weights of a birth model and the data set. So we don't need to do that anymore. So that's about it. And I am going to, so maybe I've forgotten something, Lightning examples. Here's what we're going to do. We're going to look at like an example of PyTorch Lightning and just to see whether we'll have it. And here domain examples, ImageNet sounds good. So we'll have these methods. This is way more than we need. But down here, so basically what you do is you instantiate your model and we won't save, have these hyper parameters here. These will be our flags. But then you'll implement this trainer and then you call fit on the model. Okay, so let's maybe copy this down here. So we'll in model. This is our IMDB sentiment classifier and the trainer. The root tier, let's call that logs. GPUs, we'll give it a GPU if tqda is available. And then we'll make a flag for the epochs. We don't need the rest of this. And then at the end we'll call fit model. Okay, so if we had a classifier, this would already run. Cool. Now, what I like to do is to have this module called SH, which is the model. SH gives you some sort of easy shell commands and at the beginning of each run, whenever the file loads, I just do, I remove the logs folder. So I have basically a clean logs folder and then I make it again like this. So it just deletes the logs and then runs them again. So if we run this right now, this is going to give us an error probably. So we don't have an epochs flag, right? So we need to define a flag. That's called define integer. And we'll go for 10 epochs right now. Cool. Okay. Very cool. We haven't configured our optimizers. So in PyTorch Lite name, you need some sort of optimizer configuration and we'll just copy that from an example, going full serage here, people. Okay. So we need to configure optimizers and I kind of like the SGD for this. SGD tends to work well in neural networks. We don't need the scheduler. We don't need any of that. So let's just return the SGD optimizer with the parameters and we'll make a flags for the learning rate and we'll make a flag for the momentum. Okay. We don't need any weight decay right here. Cool. Let's put these. We'll make floats for the learning rate. We start off with something like this. So I never put help strings if the description is rather clear. Only losers need help. Like, don't begin yourself. If you put the help string, you need help. That's how it works. All right. So I just don't like that this library forces you to put the help string because it somehow makes me feel bad because it's very opinionated, right? It says basically, well, you should put something there. Okay, okay, okay. So we have this and now when we run this, we don't have anything to optimize yet. So first of all, we need the model, right? Do we need to prepare data first? Let's check. So I have this short thing snippet here that embeds an ipython shell and I just plug this into anywhere so I can see if I reach it, right? So I reach the prepare data. So let's care about the data set first. This is why we're here, right? So it is nlp library as you can see right here, maybe. So there's the usage right here. So you can load the data set here with the, I think, even with the appropriate split and it will basically just give it back. So if you don't have it, it will download it. It's pretty cool. So we'll just load the data set and I've already sort of, I've already sort of checked out what they have and they have the IMDB data set. Okay, and in split, in this split argument, we can say give me the train split and as a string, you can say give me whatever the first 5% of the train split. Since we won't be, like this is just my laptop here. So we won't be able to train like a super high grade model. But we'll, we'll go for a 5% of the train split. So this is the train data set, right? And now if, if we see if we run until here, so if you had not downloaded this, it would download this. So given the train data set, I hope you can see this. So it says it's a data set. It has 1,250 rows and it has, each entry has a text and a label. And if you look, you can just index this like a data set and that's the first sample, right? So the label is one here, means that we should predict the label that this is a good sentiment, right? It's either one or zero, maybe. Yeah, I think so. So either good sentiment or bad sentiment. Okay, so our first task is going to be basically to get this into a form where a bird can consume it. So how do we do this with this NLP library? And that's the pretty cool part. So right now you see this is text. So in NLP, we need to map this text into token IDs. So we need to tokenize and we need to map this to IDs. And hugging face, of course, has very nice libraries for that. They're called tokenizers. So we'll have one of these tokenizers and we'll use this from the Transformers library. And I think this is called bird tokenizer that then the bird models can use. Let's check it out. Okay, we're at the documentation. So bird tokenizer, there we go. There's a bird tokenizer fast. Yes. Okay, we'll take the fast one. Maybe not. Yeah, we'll take the fast one. Come on. Be risky. Bird tokenizer fast. I think we can do this from pre, they have these methods from pre trained. Yes, right. So we'll take this from pre trained. And we'll put the model name here. Now I want to make this a flag such that I'm not bound to a particular model. Oops. Cool. So this is called model. So this is our model, the bird based on case. And we have a tokenizer right now. So what we can do is we can now tokenize these things, these every entry in the data set. Now in a classic setting, we'd have to, you know, write a loop for that. But with this data set library, with this NLP library, it's pretty cool that we can tokenize basically each of the samples. We can map this tokenizer function across the training data set. So how do we do that? We have this tokenizer. And the tokenizer has, I'm pretty sure it has like a tokenizer, an encode or something method. So there's forward. Now this is the birth model. Where's the birth tokenizer? Right here, right here. Okay. It has, it has, pretty sure it has this encode or something. Here. Oh yeah, encode, right? Encode. Where is the definition of that? Can we click on this? Okay. Cool. And encode takes text and it takes a bunch of other arguments, such as, I hope you can see this. Oh, there we go. Such as whether or not you should add the special tokens or the max length. This is going to be pretty important and pad to max length. We want everything to be of the same length. So if you apply this token, it's encode function to a text of these samples. So let's just take the first sample here and let's take the text entry. Then what you're going to get is like a list of these IDs. This is exactly what we want. So the 101 here is this CLS token that birth takes in and then it's just the word pieces. Right? Also say, instead of this say tokenize, I think. And that will just give you the word pieces, not the encodes yet. Right? So these are the word pieces right here. This is the tokenize text and with the encode function, it does this and then maps these two IDs such that birth can consume that. So for this NLP, this library has this convenient function called map in their dataset. So what we'll have to do first is we'll define a tokenize function that takes in a single sample and then it will run the tokenizer encode function across the text entry and we have already seen we need like, so add special tokens is true. This is cool with max length, yes. And we'll make a flag sequence length or something and we are going to pad to max length is true. So every single sample will be of the same size. Now in this function, there's a number of ways what you can return here. So one way is to return the original sample and actually just set a new attribute. I think set a new attribute on this original sample right here. Let's format this a bit nicer. So see we have this tokenize function takes a sample, it takes the text, it tokenizes it and codes it and puts this as the new attribute input IDs and returns it again. And now what we can do is we can map this function across the training dataset like so. So this will go over the training dataset and basically each for each entry do this thing. So hopefully after this operation we'll have a dataset with where each sample not only has a text and a label but also a input IDs attribute. And we don't have this sequence length thing right here. So let's put that here. Let's just go with 32 since this is just my laptop. So 32 samples should be fine. So here it says can't pickle tokenizer objects. So what it tries to do right here is it tries to parallelize basically this thing right here. If we look at this NLP thing is there documentation to this we can just look at the datasets maybe naming splits builder arrow data set map right here. So this function I think it will try to multi process and therefore it needs to basically pickle all of the things that go into the into the into the. I can't speak today it pickles all of the things that go into the function which means this tokenizer right here it needs to be pickled now maybe we can keep in memory load blah blah blah. Maybe there's a way to get around this so one thing we can try is we can try another tokenizer. Maybe this one can be pickled. This did library is pretty good but it can't pickle everything. Yes so this tokenizer can actually be pickled. In the other tokenizer so I'm not entirely sure what you'd have to do honestly because I don't know the library but what you could do is like make a thread or process local variable of this and basically make it a singleton in each process and then basically in here you call the function to get it and it returns the already instantiated object and so on. If you really want to multi process all of this anyway we have this train data set right now and you see the schema if you can see this the schema has been extended so there is now text there is label and there is input IDs which is a list of in 64 things that's pretty cool. So now what we can do since this is still a Python list right this is still a Python list. I know the tokenizer can already output a pie torch tensors but that's kind of cheating so we want to use this library right here so we want the train data set there is a method called set format right here and you say type equals torch and what that does and I think you need to say which columns you want so we want columns maybe we should get all columns can we output the text so you can select from the sample which of the columns you want and let's check it out again for now as long as we're just debunking here I like to do a debug flag so this is usually one of the first flags I do it's define Boolean debug and what this does is whenever this is active I try to be as fast as possible so there in this pie torch lightning trainer there's actually this fast death run argument which does the same thing but I can push it a bit harder with this debug here so let me say this is like this is sorry this is like one yeah we just load like batch size samples if we if we are in debug mode batch size we don't we don't actually have a batch size argument yet do we if flags dot debug else 5% okay so we don't have batch size yet we're surely going to need that at some point so let's go with the batch size of eight just because we can so now if we run this in debug if we run this in debug we should okay yes this needs to be a string sugar boom cool so it says it's the fast death run and if we run it in debug it just loads very few data points so this map function here doesn't take this whole while maybe there's a way you can stream that I don't know for now this is pretty good so if we look at the train data set again you can see that it has the same entry so this is still a list of 64 but if you index it right now if you go to the zero of data point okay then it crashes because it tries to convert these two pie torch tensors and they can't convert the string so we'll have to say we just want the columns input IDs and we want the label label can't spell okay let's try it again so right here you see that what we get out is actually a pie torch tensors for this and not kind of Python lists anymore so this is now pretty this is one to one so with duck typing maybe it's even subclass this is a pie torch data set right which we can load into a data order so this is a perfectly fine data set so we can now say self train data set is this train data set now we want to do this for the test as well but in order to do that we would have to write all of this code again which I'm not really in the mood so we'll just loop it we'll create a function prepare data set and we'll take in the split name all right like this and we'll just go with the split name here um that should do it and we just call it data set data set sugar boom sugar bang sugar boom and return that so now we can say train data set self test data set is prepare data set for train and test okay excellent so now we have a training data set and a testing data set so here in the train data loader we need to take the training data set and construct a data loader from it this is super super easy so what we'll do is we'll do it in one line data loader so what does the data loader the data loader needs a data set so the prepare data is called at the beginning so we have the state set right here and I think we can go with a batch size right here and we already have a flag for that and uh I think there is like a drop last yes so the drop last will go for true we only want full batches during training and we'll also shuffle okay and the same goes for we need a validation data loader for our validation set so in pie-torch light you have trained validation and test and test test is really only for like the final final test um if the the test date set we have here is the would be called the validation data set in pie-torch lightning so we false here false we don't want to shuffle particularly okay so we have a training data loader and a validation data loader now what do we need we have optimizer very good now what do we need all we need to do is to actually pass our data through the birth model so this forward thing here we're just going to leave not implemented um maybe we can implement it okay so we do need a model as you can see right here uh this batch let's say this batch is going to let's go right here right so if you know if you don't sometimes don't know what to do you just go to where you should be okay at optimality parameter we don't have parameters yet all right so what do we do we go up here and we make a model we need to actually make the birth model right here so from transformers we can use the birth model now they have a lot of birth models and we'll go back right here to the birth models because they as you know birth is just an encoder so we need to build a classifier on top of birth but they already have done this so they have a bunch of uh birth different configurations and the one we're looking for here would be this this birth for sequence classification right this is birth birth model transformer with a sequence classification or regression head on top right so this is exactly what we need a classifier on top of birth and we can um I think we can also load this with this from pre-trained and just put in the same name so we can this birth for sequence classification um and we'll load up the same model that we had okay so um this is our model easy as that so what do we what do we do with this birth if we put in data what what happens um for that we quickly go back again so in the forward method we can we can input the input IDs right which um is batch size sequence length tensor we can input the attention mask that basically tells you where there's padding and where there isn't mask to avoid performing attention on padding token mask value selected in 0.1 one for tokens that are not masks 0 for tokens that are masks then we can input the token type IDs which we don't have here we just have one sentence but usually in verb you have the capability of inputting two different types like a question and a paragraph or a first sentence and the second sentence um position IDs are optional um blah blah blah blah blah blah blah none of that okay we could also input the labels these are optional and it would already compute a loss for us uh which we we don't this that's almost cheating so let's just focus on putting in the input IDs and I think that's gonna be enough since we basically trunkate our long text to 32 tokens we don't need to worry about masking right here otherwise you would input a mask for um actually we we can do it we can do it okay so what you could input a mask for basically where um your tokens are not pad tokens and the pad tokens in birth are 0 so basically your mask should should just be whatever's non-zero uh but maybe also your model learns um to ignore the pad tokens I might be wrong here and it does it automatically right so in your forward pass what do you do actually let's go to the training step we'll put something here you can see it so if you if you didn't have a birth um it would actually uh birth you it birthed you up it would download birth right here but since I have it you can see here this is the smaller birth model um um pad torch lightning I don't have enough space in my console right here but it would give you a nice overview over your model how many parameters it has how what kind of layers it has and so on so uh we also need a validation step if we have a validation data loader validation step and we need the um validation epoch and function so usually in training you don't really care about epochs too much because you just have many batch after many batch but in validation uh what you want is kind of one single metric across your entire test dataset or validation dataset and therefore you sort of in the validation step you'll just kind of output things you output local things per batch and then in the epoch and function you aggregate them into one big number so um we'll we'll we'll we'll just put we'll put things into each thing thing thing so I'm pretty sure we're going to end up in the validation step first because if especially if we do this debug run it basically it tries to run a validation first uh at the very start of training so we can look at a batch right here so what's a batch um the batch seems to be a dictionary if you look at its keys we have label and input IDs okay so that's pretty cool so if we go for the input IDs that gives us a tensor and the tensors of shape eight which is our batch size and 32 which is our sequence length and we should be able to pretty much input that into the birth model that we created boom okay and what do we get out we get out a tuple and the first entry is going to be this looks like logits right okay let's check the shape and this is eight so this is our batch size and two is the logit so one for the negative class and one for the positive class and this is this we can basically input into a cross entropy loss given our labels so we also have our label here and their label is all ones nice um is this maybe sorted is the dataset sorted into good and bad things because that would be how would be bad in any case um so what do we have to do so in the forward method we get the input IDs let's let's just say we get the input IDs and we run this through our model and we can actually construct a mask here and the mask is going to be wherever the input IDs are not zero and um that as a what does it need to be so these mask this attention mask is going to be a float tensor okay so put it as a float tensor cool um write like this so our logits are going to be that and yeah tuple with one entry of the comma here is important we're going to return the logits so this is our forward function so in the validation and the training step the first thing we got to do is we got to call this forward function with the input IDs and these of course are in our batch like this so these are going to be our logits and then in the validation what we want to do is we first of all want to compute our loss right so we have to construct this up here in the init we can actually just fold this prepare data um loss is going to be a cross entropy loss yes that exists with red reduction I like to put reduction on I don't think there is like a deprecated reduce and there is like reduction where you can put mean or something I like to not reduce the loss at first because then I can I can use the same thing for validation and training so in the validation step I just want to compute my loss right here with self so loss loss um and we'll have to cheat a bit so look up the cross entropy loss and wow okay where is the cross entropy loss cross entropy loss it takes yes it's reduction ha tada and uh so the input to the function that we can struct is going to be first um um n by c first the input and then the targets so first the logits and then the targets right criterion that combines logs of max and nl loss over a single class nice nice nice okay okay cool so first logits and then labels label okay that's our loss so if we check out what our loss is going to be it's probably going to be an vector of size 8 because we have reduction none loss yes see vector of size 8 very nice so we can just um basically return oh say we can return this loss just as is and then in the validation epoch ends the outputs here is going to be a list of and every entry in the list is going to be one of these validation steps for for one batch so we can aggregate those um so losses is we'll concatenate them since they're going to be chunks of 8 um outputs at the dimension 0 and then we can calculate the mean right so um we can do that and then we can oh no we need to do more we also want to know the accuracy right so um the accuracy is going to be whether or not the logits dot arg max is go is equal to the label label so the accuracy for each sample is going to be that is either going to be one or zero and we want that as a float so here let's output a dictionary with loss um and accuracy all right excellent so here then we can aggregate so the loss is going to be and I like to have um like a construction here that aggregates this still so we go out loss for oh in outputs so these are now going to be entries each one is going to be a dictionary right so our loss losses we have concatenation to the mean okay our accuracy is going to be the same thing for the accuracy nice so our output here is going to be a dictionary and I think in Pythagoras lightning there if you put validation accuracy it's like Val-AC it selects the model according to this but I'm not sure so also in Pythagoras lightning I can now output this here but also if you have a log entry it will forward this to the logger which we can uh actually do and make a tensor board logger out of this so what have we done we have first of all set up the validation step so the the Pythagoras lightning is going to run through the data loader for each batch do this so we forward it through the birth model to get our logits and then we compute our loss by the cross entropy loss of the logits and the labels and we also compute our accuracy by seeing how much the logits agree with the labels or the maximum logit and then we aggregate all of this over the entire epoch and output that now let's set up a logger so for the logger we can put this I think in the trainer here Pythagoras lightning logger dot and I think there is a tensor board logger uh pretty sure Pythagoras lightning is there tensor board no Pythagoras lightning logger I'm pretty sure that exists that's not the newest version I hate these these old docs so latest oh come on this was called logging logger uh logger loggers tensor board logger right here nice so our save dir is going to be called logs and then what we what do we want we want the name IMDB and there's also this version thing um where if if if you don't put version zero I will just make a new kind of folder each time but I guess we delete the logs anyway we delete the logs folder at the beginning so we don't have this problem but I generally like to overwrite my logs and not make new runs but if you like something different that's you know fine all right so let's run this again and we're cool this is the bird configuration that we loaded and then we have no attribute logger Pythagoras lightning logger logger logger uh okay again loading the weights very cool blah blah blah blah blah blah blah blah and we're in an iphone shell and do we have an iphone shell remaining only in the training step okay so we're at the training step right here and we can actually can we can check whether or not um ah now we have lightning logs and logs my okay so this appeared to be our tensorboard logs so we are maybe able to run a tensorboard here later um let's run it logs we don't have tensorboard okay oh we have uninstalled it because I was angry at it oh come on what's going on um tensorboard I should have tensorboards somewhere uh it's it's like in um in local bin or something local bin no it's not in local bin pull pull we'll find it we'll figure it out uh how to get a tensorboard maybe we need to install tensorflow while that's gonna take a while okay so back to the training step in the training step we basically need to do the same as in the validation step so we'll need to forward our batch through the model but here we don't need to compute an accuracy but we do need to compute a actually batch loss that we can back propagate on now in the training step you can either specify how you back propagate per se or what you can do is you can just output this log loss attribute and then PyTorch lightning will basically do the back propagation for you we have the tensorboard now please all right there we go and we can we can put this into a different thing right here um get a p demo yes um um okay so this is running and if everything goes correctly six shabu we have a tensorboard okay so we need to forward our training step and we need to calculate a loss for the batch so these loss here we do the same thing but here we call mean on it so this is the mean loss from this batch and we can now return um the loss right here and we can also in the training step you can also output a log dictionary and we'll output the loss again here in order so this is our going to be our training loss that we output right here um let's call it train loss and this also will go into the tensorboard so if we run this right now we don't have an ipython shell simply by outputting this loss attribute we already instruct PyTorch lightning to now run back prop on this loss using the optimizer that we have defined okay and by outputting the log we instructed to put this into the tensorboard so now we have a scalar entry and um you can see this it only contains the valid node contains everything very cool very very cool so let's remove the debug flag and we'll just see what happens so to recap right to recap we have um on i go see ipok 1 ipok 2 go go go go go go oh very cool um what we've done is we've set up this PyTorch lightning module it needs a bunch of functions but in the init we've basically just set up our birth model from the hugging face transformers library we've loaded in a pre-trained birth model that we're going to fine tune the main thing that the PyTorch lightning module needs is a training step function where you define what did you do with the data and this data loader function so in the data loader function um we've loaded up a data set um and we basically specify the batch size this is very easy where does the data set come from we do it here in prepare data this is a special function in PyTorch lightning that's basically called after the init but before anything else runs and here we are loading this data set from the nlp library and this is kind of the magic part uh we specify the split and the size that we want inside of the string and you can do this in percent or in a number of samples that you want i'm sort of sure you can do more things but i haven't explored that then we run map on the data set in order to tokenize it and that's right here and we use a tokenizer again from the PyTorch lightning and um just run this encode function this is very simple like if how complicated was this just like a year ago a crazy then we need to to to put set format and set format tells the data set how it needs to output its samples and we tell it please output Torch tensors and um we want these columns right here and we make a train and the test data set with uh from the train and test split accordingly so we have this this goes into a data loader PyTorch lightning will take the data loader and run training on it using this train step function in this train step function we get a batch um in the batch there are these two columns that we specified previously in podidies and label the input ids will put through the forward function of the model itself this is the forward function we construct a mask and run it through the model um we we wouldn't actually need to construct a mask but okay and we get back the logits of the classification and then we run this through a cross entropy loss uh get the mean of the batch and there we go in the validation step we do the same thing but also calculate the accuracy but don't calculate the mean we want to keep it per sample and only at the end we want to concatenate everything and calculate the mean if we've done everything correctly you see right here our train loss goes down down down until it is almost zero because we've just and the validation accuracy is super high is this is this because all the labels are equal like for real um okay so we'll do something else we'll make an integer um with percent and this was five right so that we loaded five percent of the data set um but let's load some more and this might take longer but let's load 50 percent of the data set and just see what happens no present I called it present very good so we'll load up 50 percent of the data set and um we'll do the same thing and we can track in real time what happens in tensor port and unrecognized instruction format um okay whoo can we make a format string in a format string this is nasty does it work please work we can make a format string in a format string absolutely bonkers okay so it takes a little bit longer and you could actually I think you can speed this up this mapping of the data set maybe you can stream it um i'm pretty sure you can batch it you can do a batch um processing of this but for our case right here uh we think it's enough so it was like what 1,200 if we had five percent so now it should be something like 12,000 um so let's continue with the recap of what we did here we have the trained it set the validation date set and on yes so we have everything like this the configure optimizers you can put an optimizer you can also put a learning rate scheduler if you want to and then in the main function we load this PyTorch Lightning module and we specify a trainer and the trainer we tell it you know the max epochs and so on and we set up the logger and we just run fit on this model and this runs epochs of the model and after each epoch it does a validation epoch and minimizes our loss very cool very effective so now if if please if you would all right here we go this is my laptop training bird all right okay we don't seem to make too much progress let's check the tensor board training loss goes down training loss goes to zero I have the sneaking suspicion that this is not entirely shuffled so um is there like a shuffle like a shuffle thing because this seems a bit this seems a bit bit fishy um this IMDB data set right here just seems like you know we could use a bit of of shuffling because all the labels yeah the training loss instantly goes to zero so maybe maybe it's not we can we shuffle here let's look at the load data set function hum brum brum brum brum load data set batch no keep in memory no none of that okay this does not seem to go to continue right here data sets NLP data sets I hope here we know we should find this load data set somewhere builder features load load data set that split can we not shuffle anywhere we'll search shuffle builder okay so generate examples this function pre-processed examples where the key will be hashed okay we are not able to shuffle this um just like that but I hope this at least gives you an impression I guess if you were to take the full data set and um map it then it would actually work we'll just try again with 10% of the data just uh to see it go down tensorboard see this is now good because we always delete the logs folder we don't have any uh remnant uh old tensor flow logs all right come on come on so 10% should be yeah about this about this okay train loss looking good looking good so far look at these models how large is that how large is the birth base case hugging face pre-trained models pre-trained models birth base on case that's the one we have 12 layers 110 million parameters easy easy uh no it's too large training loss goes to zero again okay so we've determined that this data set very probably isn't entirely shuffled it might just have all the good labels first and all the bad labels last and um yeah just to confirm let's confirm this uh right here let's go with 100% but let's put an ipython shell down um just before we map the data set so we don't have to go through the whole mapping um procedure actually that would be here right yes can we not map this async crinnisly map I might be doing something really wrong with this library but I think that's that's how it should go so map death map right here we can do batched we could do batched and then I think hugging face has a function to encode batched encode batch encode encode batch no um let's go to the tokenizer shnavada bam build inputs create token type id sketspecial token masks save where is encode right here can we have batch encode build inputs no this might be it batch encode yes there is a batch encode where you have batches of these things so okay what if we do the negative one see here's the label zero um i'm pretty sure i'm pretty sure uh batch true let's do that and in our function here we'll say batching code so let's see how fast this is with 100 percent we're tokenizer has no we just had batching code oh but this might be we have batching code plus batching code plus or text pairs okay we need this batching code plus but then that gives us a dictionary right this gives us a dictionary with the fields inputs id's right here so like this how about that and then we still might want to limit the actual data set um once we have once we have mapped it because we need to train on it as well but i just want to see how fast this batch encoding is yes okay reasonably fast but it takes like three minutes um yeah so we won't go on here i will put i will put this as is on um i'll put this as is on github and i hope you can profit from that in any way you want the hugging phase site has a tutorial on squad where they also use the metrics so they have basically these predefined metrics like blue uh or rouge i think um and you can just use them as you use these data sets so it's very very very convenient uh to work with these things in nlp so nlp has come a long way absolutely invite you to check out the um the transformers and tokenizers and nlp repos and with that that's it for me i think i hope you enjoyed this again leave a comment if you see improvements or if i maybe should edit this a bit more i thought the entire process of just going through and making mistakes um would be entertaining to some um all right bye bye | [{"start": 0.0, "end": 2.56, "text": " How did it really do?"}, {"start": 2.56, "end": 7.48, "text": " So, HuggingFace just released this NLP library right here."}, {"start": 7.48, "end": 14.92, "text": " And this is pretty cool because it allows you access to about 100 NLP data sets and 10"}, {"start": 14.92, "end": 17.64, "text": " evaluation metrics pre-packaged."}, {"start": 17.64, "end": 22.2, "text": " So knowing HuggingFace, this is going to be a breeze to work with."}, {"start": 22.2, "end": 25.64, "text": " So what I thought we would do is we would try to use this."}, {"start": 25.64, "end": 27.96, "text": " I have not used this yet."}, {"start": 27.96, "end": 30.84, "text": " And it's been a while since I've used any HuggingFace stuff."}, {"start": 30.84, "end": 39.160000000000004, "text": " So what we're trying to do is use this to load up the IMDB dataset and then use a BERT model"}, {"start": 39.160000000000004, "end": 46.36, "text": " maybe to build a sentiment classifier on top of that using PyTorch, specifically PyTorch"}, {"start": 46.36, "end": 47.68, "text": " Lightning."}, {"start": 47.68, "end": 50.64, "text": " So all of that combined from scratch."}, {"start": 50.64, "end": 54.72, "text": " And basically, if I can do it, then so can you."}, {"start": 54.72, "end": 59.8, "text": " And we're going to make some mistakes and have to look at the documentation a bit and"}, {"start": 59.8, "end": 61.2, "text": " so on."}, {"start": 61.2, "end": 62.2, "text": " But that's the process."}, {"start": 62.2, "end": 63.2, "text": " Okay."}, {"start": 63.2, "end": 70.56, "text": " So first of all, if you like content like this, let me know if you're not subscribed, subscribe."}, {"start": 70.56, "end": 74.36, "text": " Let me know in the comments if you have any sort of criticism or tips."}, {"start": 74.36, "end": 78.12, "text": " I'm always happy for VIM tips, honestly."}, {"start": 78.12, "end": 81.24, "text": " So I have a pretty empty repo, Git repo here."}, {"start": 81.24, "end": 83.88, "text": " I have a Git ignore, but that's about it."}, {"start": 83.88, "end": 93.11999999999999, "text": " So we'll just dive right in, start up VIM and let's make a file."}, {"start": 93.11999999999999, "end": 99.88, "text": " So first, some boilerplate code."}, {"start": 99.88, "end": 105.8, "text": " I'm terrible at talking and coding at the same time, but you know, so I like to use this"}, {"start": 105.8, "end": 111.52, "text": " app cell library and I'm using, as you can see, I'm using the tab nine completion engine"}, {"start": 111.52, "end": 114.0, "text": " with COC with NeoVim."}, {"start": 114.0, "end": 117.84, "text": " This is absolutely great."}, {"start": 117.84, "end": 121.0, "text": " We maybe need apps, app flags logging."}, {"start": 121.0, "end": 122.24, "text": " That sounds good."}, {"start": 122.24, "end": 128.56, "text": " So we'll need torch probably, right?"}, {"start": 128.56, "end": 131.2, "text": " And we'll need PyTorch Lightning."}, {"start": 131.2, "end": 135.51999999999998, "text": " Torch Lightning as PL."}, {"start": 135.51999999999998, "end": 139.6, "text": " We'll need the NLP library, of course, since we're going to use that."}, {"start": 139.6, "end": 142.12, "text": " And we need the Transformers library."}, {"start": 142.12, "end": 146.56, "text": " Now, I know HuggingFace has this tokenizer's library too, but there are some tokenizers"}, {"start": 146.56, "end": 149.92, "text": " in the Transformer library already."}, {"start": 149.92, "end": 153.12, "text": " And we'll just keep it light like this."}, {"start": 153.12, "end": 157.2, "text": " So maybe NumPy, maybe not."}, {"start": 157.2, "end": 158.51999999999998, "text": " Let's see."}, {"start": 158.51999999999998, "end": 162.56, "text": " So we'll export, we'll have these flags object here."}, {"start": 162.56, "end": 165.4, "text": " Maybe we'll do some flags later."}, {"start": 165.4, "end": 172.64000000000001, "text": " And the main function, let's just call hello."}, {"start": 172.64000000000001, "end": 177.96, "text": " Actually, let's log that info."}, {"start": 177.96, "end": 185.96, "text": " And all right, run main."}, {"start": 185.96, "end": 195.04000000000002, "text": " So this is our boilerplate and let's just quickly try it out just to see whether it works."}, {"start": 195.04, "end": 196.04, "text": " So here we are."}, {"start": 196.04, "end": 197.95999999999998, "text": " Hello, that's fine."}, {"start": 197.95999999999998, "end": 199.35999999999999, "text": " All right."}, {"start": 199.35999999999999, "end": 201.28, "text": " So where do we go from here?"}, {"start": 201.28, "end": 206.23999999999998, "text": " So in PyTorch Lightning, what you'll have to do is you have to build this kind of model"}, {"start": 206.23999999999998, "end": 208.0, "text": " class, right?"}, {"start": 208.0, "end": 214.92, "text": " So we'll build an IMDB sentiment classifier."}, {"start": 214.92, "end": 219.48, "text": " And that's going to extend this Lightning module of PyTorch Lightning."}, {"start": 219.48, "end": 222.23999999999998, "text": " So you need different things in the PyTorch Lightning module."}, {"start": 222.24, "end": 226.04000000000002, "text": " First of all, you need the init."}, {"start": 226.04000000000002, "end": 229.08, "text": " And we'll just do like a very basic init."}, {"start": 229.08, "end": 231.12, "text": " We'll call super on it."}, {"start": 231.12, "end": 232.8, "text": " And that's about it."}, {"start": 232.8, "end": 236.76000000000002, "text": " And you need a forward method, since this is a module."}, {"start": 236.76000000000002, "end": 241.32000000000002, "text": " So in the forward method, you're going to get a batch and you have to do something with"}, {"start": 241.32000000000002, "end": 243.16000000000003, "text": " it."}, {"start": 243.16000000000003, "end": 248.08, "text": " And what we also need is a training step method."}, {"start": 248.08, "end": 254.4, "text": " Training step, which gets a batch and a batch index."}, {"start": 254.4, "end": 260.6, "text": " And we'll have to output some kind of loss or some kind of training procedure."}, {"start": 260.6, "end": 266.12, "text": " Then we'll need a train data loader."}, {"start": 266.12, "end": 270.76, "text": " So all of this, you can look up in the documentation of PyTorch Lightning."}, {"start": 270.76, "end": 274.96000000000004, "text": " Basically, you implement these methods and it will do the rest for you."}, {"start": 274.96, "end": 282.79999999999995, "text": " So it will do all the training loop and it will do the handling of GPUs and whatnot."}, {"start": 282.79999999999995, "end": 288.24, "text": " The whole looping over epochs, all of that is basically taken care for you when you use"}, {"start": 288.24, "end": 289.71999999999997, "text": " PyTorch Lightning."}, {"start": 289.71999999999997, "end": 293.15999999999997, "text": " So last thing we need is maybe a prepare data."}, {"start": 293.15999999999997, "end": 296.12, "text": " Let's put that up here."}, {"start": 296.12, "end": 298.67999999999995, "text": " Prepare data."}, {"start": 298.67999999999995, "end": 302.84, "text": " That method is optional, but it gets called at the beginning and that's going to be pretty"}, {"start": 302.84, "end": 303.84, "text": " good for us."}, {"start": 303.84, "end": 308.79999999999995, "text": " We have downloaded the weights of a birth model and the data set."}, {"start": 308.79999999999995, "end": 312.64, "text": " So we don't need to do that anymore."}, {"start": 312.64, "end": 314.71999999999997, "text": " So that's about it."}, {"start": 314.71999999999997, "end": 323.52, "text": " And I am going to, so maybe I've forgotten something, Lightning examples."}, {"start": 323.52, "end": 324.52, "text": " Here's what we're going to do."}, {"start": 324.52, "end": 330.4, "text": " We're going to look at like an example of PyTorch Lightning and just to see whether we'll"}, {"start": 330.4, "end": 331.4, "text": " have it."}, {"start": 331.4, "end": 335.88, "text": " And here domain examples, ImageNet sounds good."}, {"start": 335.88, "end": 338.0, "text": " So we'll have these methods."}, {"start": 338.0, "end": 339.96, "text": " This is way more than we need."}, {"start": 339.96, "end": 344.91999999999996, "text": " But down here, so basically what you do is you instantiate your model and we won't"}, {"start": 344.91999999999996, "end": 347.59999999999997, "text": " save, have these hyper parameters here."}, {"start": 347.59999999999997, "end": 349.32, "text": " These will be our flags."}, {"start": 349.32, "end": 355.76, "text": " But then you'll implement this trainer and then you call fit on the model."}, {"start": 355.76, "end": 362.71999999999997, "text": " Okay, so let's maybe copy this down here."}, {"start": 362.71999999999997, "end": 366.96, "text": " So we'll in model."}, {"start": 366.96, "end": 372.76, "text": " This is our IMDB sentiment classifier and the trainer."}, {"start": 372.76, "end": 377.15999999999997, "text": " The root tier, let's call that logs."}, {"start": 377.15999999999997, "end": 385.32, "text": " GPUs, we'll give it a GPU if tqda is available."}, {"start": 385.32, "end": 390.96, "text": " And then we'll make a flag for the epochs."}, {"start": 390.96, "end": 394.12, "text": " We don't need the rest of this."}, {"start": 394.12, "end": 397.52, "text": " And then at the end we'll call fit model."}, {"start": 397.52, "end": 403.08, "text": " Okay, so if we had a classifier, this would already run."}, {"start": 403.08, "end": 404.28, "text": " Cool."}, {"start": 404.28, "end": 414.88, "text": " Now, what I like to do is to have this module called SH, which is the model."}, {"start": 414.88, "end": 420.2, "text": " SH gives you some sort of easy shell commands and at the beginning of each run, whenever"}, {"start": 420.2, "end": 427.24, "text": " the file loads, I just do, I remove the logs folder."}, {"start": 427.24, "end": 435.12, "text": " So I have basically a clean logs folder and then I make it again like this."}, {"start": 435.12, "end": 438.12, "text": " So it just deletes the logs and then runs them again."}, {"start": 438.12, "end": 445.4, "text": " So if we run this right now, this is going to give us an error probably."}, {"start": 445.4, "end": 447.24, "text": " So we don't have an epochs flag, right?"}, {"start": 447.24, "end": 450.04, "text": " So we need to define a flag."}, {"start": 450.04, "end": 457.48, "text": " That's called define integer."}, {"start": 457.48, "end": 460.84000000000003, "text": " And we'll go for 10 epochs right now."}, {"start": 460.84000000000003, "end": 462.84000000000003, "text": " Cool."}, {"start": 462.84000000000003, "end": 465.92, "text": " Okay."}, {"start": 465.92, "end": 466.92, "text": " Very cool."}, {"start": 466.92, "end": 469.08000000000004, "text": " We haven't configured our optimizers."}, {"start": 469.08000000000004, "end": 476.44, "text": " So in PyTorch Lite name, you need some sort of optimizer configuration and we'll just"}, {"start": 476.44, "end": 482.64000000000004, "text": " copy that from an example, going full serage here, people."}, {"start": 482.64000000000004, "end": 484.92, "text": " Okay."}, {"start": 484.92, "end": 489.56, "text": " So we need to configure optimizers and I kind of like the SGD for this."}, {"start": 489.56, "end": 492.72, "text": " SGD tends to work well in neural networks."}, {"start": 492.72, "end": 495.04, "text": " We don't need the scheduler."}, {"start": 495.04, "end": 496.36, "text": " We don't need any of that."}, {"start": 496.36, "end": 505.76, "text": " So let's just return the SGD optimizer with the parameters and we'll make a flags for"}, {"start": 505.76, "end": 510.68, "text": " the learning rate and we'll make a flag for the momentum."}, {"start": 510.68, "end": 512.2, "text": " Okay."}, {"start": 512.2, "end": 515.12, "text": " We don't need any weight decay right here."}, {"start": 515.12, "end": 516.12, "text": " Cool."}, {"start": 516.12, "end": 519.0, "text": " Let's put these."}, {"start": 519.0, "end": 525.36, "text": " We'll make floats for the learning rate."}, {"start": 525.36, "end": 529.4, "text": " We start off with something like this."}, {"start": 529.4, "end": 537.32, "text": " So I never put help strings if the description is rather clear."}, {"start": 537.32, "end": 540.04, "text": " Only losers need help."}, {"start": 540.04, "end": 542.4, "text": " Like, don't begin yourself."}, {"start": 542.4, "end": 546.32, "text": " If you put the help string, you need help."}, {"start": 546.32, "end": 548.4, "text": " That's how it works."}, {"start": 548.4, "end": 549.4, "text": " All right."}, {"start": 549.4, "end": 557.0, "text": " So I just don't like that this library forces you to put the help string because it somehow"}, {"start": 557.0, "end": 563.36, "text": " makes me feel bad because it's very opinionated, right?"}, {"start": 563.36, "end": 566.6, "text": " It says basically, well, you should put something there."}, {"start": 566.6, "end": 568.72, "text": " Okay, okay, okay."}, {"start": 568.72, "end": 574.4, "text": " So we have this and now when we run this, we don't have anything to optimize yet."}, {"start": 574.4, "end": 579.84, "text": " So first of all, we need the model, right?"}, {"start": 579.84, "end": 583.68, "text": " Do we need to prepare data first?"}, {"start": 583.68, "end": 584.68, "text": " Let's check."}, {"start": 584.68, "end": 590.8, "text": " So I have this short thing snippet here that embeds an ipython shell and I just plug this"}, {"start": 590.8, "end": 593.56, "text": " into anywhere so I can see if I reach it, right?"}, {"start": 593.56, "end": 595.48, "text": " So I reach the prepare data."}, {"start": 595.48, "end": 597.16, "text": " So let's care about the data set first."}, {"start": 597.16, "end": 598.64, "text": " This is why we're here, right?"}, {"start": 598.64, "end": 604.4, "text": " So it is nlp library as you can see right here, maybe."}, {"start": 604.4, "end": 606.56, "text": " So there's the usage right here."}, {"start": 606.56, "end": 615.6, "text": " So you can load the data set here with the, I think, even with the appropriate split and"}, {"start": 615.6, "end": 617.52, "text": " it will basically just give it back."}, {"start": 617.52, "end": 619.28, "text": " So if you don't have it, it will download it."}, {"start": 619.28, "end": 620.3199999999999, "text": " It's pretty cool."}, {"start": 620.32, "end": 630.88, "text": " So we'll just load the data set and I've already sort of, I've already sort of checked out"}, {"start": 630.88, "end": 634.08, "text": " what they have and they have the IMDB data set."}, {"start": 634.08, "end": 644.0400000000001, "text": " Okay, and in split, in this split argument, we can say give me the train split and as a"}, {"start": 644.0400000000001, "end": 649.24, "text": " string, you can say give me whatever the first 5% of the train split."}, {"start": 649.24, "end": 653.08, "text": " Since we won't be, like this is just my laptop here."}, {"start": 653.08, "end": 657.04, "text": " So we won't be able to train like a super high grade model."}, {"start": 657.04, "end": 660.48, "text": " But we'll, we'll go for a 5% of the train split."}, {"start": 660.48, "end": 664.8, "text": " So this is the train data set, right?"}, {"start": 664.8, "end": 671.28, "text": " And now if, if we see if we run until here, so if you had not downloaded this, it would"}, {"start": 671.28, "end": 672.76, "text": " download this."}, {"start": 672.76, "end": 678.6800000000001, "text": " So given the train data set, I hope you can see this."}, {"start": 678.68, "end": 680.8, "text": " So it says it's a data set."}, {"start": 680.8, "end": 687.9599999999999, "text": " It has 1,250 rows and it has, each entry has a text and a label."}, {"start": 687.9599999999999, "end": 694.16, "text": " And if you look, you can just index this like a data set and that's the first sample,"}, {"start": 694.16, "end": 695.16, "text": " right?"}, {"start": 695.16, "end": 704.16, "text": " So the label is one here, means that we should predict the label that this is a good sentiment,"}, {"start": 704.16, "end": 705.16, "text": " right?"}, {"start": 705.16, "end": 707.68, "text": " It's either one or zero, maybe."}, {"start": 707.68, "end": 709.3599999999999, "text": " Yeah, I think so."}, {"start": 709.3599999999999, "end": 712.16, "text": " So either good sentiment or bad sentiment."}, {"start": 712.16, "end": 719.3599999999999, "text": " Okay, so our first task is going to be basically to get this into a form where a bird can consume"}, {"start": 719.3599999999999, "end": 720.3599999999999, "text": " it."}, {"start": 720.3599999999999, "end": 722.3599999999999, "text": " So how do we do this with this NLP library?"}, {"start": 722.3599999999999, "end": 724.04, "text": " And that's the pretty cool part."}, {"start": 724.04, "end": 726.0799999999999, "text": " So right now you see this is text."}, {"start": 726.0799999999999, "end": 731.2399999999999, "text": " So in NLP, we need to map this text into token IDs."}, {"start": 731.2399999999999, "end": 735.0799999999999, "text": " So we need to tokenize and we need to map this to IDs."}, {"start": 735.08, "end": 738.88, "text": " And hugging face, of course, has very nice libraries for that."}, {"start": 738.88, "end": 740.84, "text": " They're called tokenizers."}, {"start": 740.84, "end": 752.12, "text": " So we'll have one of these tokenizers and we'll use this from the Transformers library."}, {"start": 752.12, "end": 760.5600000000001, "text": " And I think this is called bird tokenizer that then the bird models can use."}, {"start": 760.5600000000001, "end": 761.5600000000001, "text": " Let's check it out."}, {"start": 761.5600000000001, "end": 763.5600000000001, "text": " Okay, we're at the documentation."}, {"start": 763.56, "end": 768.52, "text": " So bird tokenizer, there we go."}, {"start": 768.52, "end": 771.3199999999999, "text": " There's a bird tokenizer fast."}, {"start": 771.3199999999999, "end": 772.3199999999999, "text": " Yes."}, {"start": 772.3199999999999, "end": 778.52, "text": " Okay, we'll take the fast one."}, {"start": 778.52, "end": 780.52, "text": " Maybe not."}, {"start": 780.52, "end": 783.8, "text": " Yeah, we'll take the fast one."}, {"start": 783.8, "end": 785.0, "text": " Come on."}, {"start": 785.0, "end": 787.64, "text": " Be risky."}, {"start": 787.64, "end": 791.0799999999999, "text": " Bird tokenizer fast."}, {"start": 791.08, "end": 795.88, "text": " I think we can do this from pre, they have these methods from pre trained."}, {"start": 795.88, "end": 797.0400000000001, "text": " Yes, right."}, {"start": 797.0400000000001, "end": 804.72, "text": " So we'll take this from pre trained."}, {"start": 804.72, "end": 806.32, "text": " And we'll put the model name here."}, {"start": 806.32, "end": 814.96, "text": " Now I want to make this a flag such that I'm not bound to a particular model."}, {"start": 814.96, "end": 818.8000000000001, "text": " Oops."}, {"start": 818.8, "end": 822.64, "text": " Cool."}, {"start": 822.64, "end": 828.4399999999999, "text": " So this is called model."}, {"start": 828.4399999999999, "end": 832.68, "text": " So this is our model, the bird based on case."}, {"start": 832.68, "end": 834.24, "text": " And we have a tokenizer right now."}, {"start": 834.24, "end": 841.52, "text": " So what we can do is we can now tokenize these things, these every entry in the data set."}, {"start": 841.52, "end": 846.24, "text": " Now in a classic setting, we'd have to, you know, write a loop for that."}, {"start": 846.24, "end": 852.0, "text": " But with this data set library, with this NLP library, it's pretty cool that we can tokenize"}, {"start": 852.0, "end": 854.5600000000001, "text": " basically each of the samples."}, {"start": 854.5600000000001, "end": 861.28, "text": " We can map this tokenizer function across the training data set."}, {"start": 861.28, "end": 865.32, "text": " So how do we do that?"}, {"start": 865.32, "end": 866.88, "text": " We have this tokenizer."}, {"start": 866.88, "end": 872.88, "text": " And the tokenizer has, I'm pretty sure it has like a tokenizer, an encode or something"}, {"start": 872.88, "end": 873.88, "text": " method."}, {"start": 873.88, "end": 874.88, "text": " So there's forward."}, {"start": 874.88, "end": 877.08, "text": " Now this is the birth model."}, {"start": 877.08, "end": 879.2, "text": " Where's the birth tokenizer?"}, {"start": 879.2, "end": 883.72, "text": " Right here, right here."}, {"start": 883.72, "end": 885.2, "text": " Okay."}, {"start": 885.2, "end": 893.0, "text": " It has, it has, pretty sure it has this encode or something."}, {"start": 893.0, "end": 894.0, "text": " Here."}, {"start": 894.0, "end": 896.88, "text": " Oh yeah, encode, right?"}, {"start": 896.88, "end": 898.12, "text": " Encode."}, {"start": 898.12, "end": 899.92, "text": " Where is the definition of that?"}, {"start": 899.92, "end": 901.76, "text": " Can we click on this?"}, {"start": 901.76, "end": 902.76, "text": " Okay."}, {"start": 902.76, "end": 903.76, "text": " Cool."}, {"start": 903.76, "end": 909.12, "text": " And encode takes text and it takes a bunch of other arguments, such as, I hope you can"}, {"start": 909.12, "end": 910.12, "text": " see this."}, {"start": 910.12, "end": 914.0, "text": " Oh, there we go."}, {"start": 914.0, "end": 920.52, "text": " Such as whether or not you should add the special tokens or the max length."}, {"start": 920.52, "end": 924.0, "text": " This is going to be pretty important and pad to max length."}, {"start": 924.0, "end": 926.72, "text": " We want everything to be of the same length."}, {"start": 926.72, "end": 934.44, "text": " So if you apply this token, it's encode function to a text of these samples."}, {"start": 934.44, "end": 940.0, "text": " So let's just take the first sample here and let's take the text entry."}, {"start": 940.0, "end": 943.48, "text": " Then what you're going to get is like a list of these IDs."}, {"start": 943.48, "end": 944.88, "text": " This is exactly what we want."}, {"start": 944.88, "end": 951.6, "text": " So the 101 here is this CLS token that birth takes in and then it's just the word pieces."}, {"start": 951.6, "end": 952.6, "text": " Right?"}, {"start": 952.6, "end": 959.52, "text": " Also say, instead of this say tokenize, I think."}, {"start": 959.52, "end": 964.08, "text": " And that will just give you the word pieces, not the encodes yet."}, {"start": 964.08, "end": 965.08, "text": " Right?"}, {"start": 965.08, "end": 968.0400000000001, "text": " So these are the word pieces right here."}, {"start": 968.0400000000001, "end": 973.72, "text": " This is the tokenize text and with the encode function, it does this and then maps these"}, {"start": 973.72, "end": 978.36, "text": " two IDs such that birth can consume that."}, {"start": 978.36, "end": 984.88, "text": " So for this NLP, this library has this convenient function called map in their dataset."}, {"start": 984.88, "end": 990.4, "text": " So what we'll have to do first is we'll define a tokenize function that takes in a single"}, {"start": 990.4, "end": 1001.8000000000001, "text": " sample and then it will run the tokenizer encode function across the text entry and we"}, {"start": 1001.8000000000001, "end": 1005.8000000000001, "text": " have already seen we need like, so add special tokens is true."}, {"start": 1005.8, "end": 1010.5999999999999, "text": " This is cool with max length, yes."}, {"start": 1010.5999999999999, "end": 1023.56, "text": " And we'll make a flag sequence length or something and we are going to pad to max length is true."}, {"start": 1023.56, "end": 1027.72, "text": " So every single sample will be of the same size."}, {"start": 1027.72, "end": 1030.76, "text": " Now in this function, there's a number of ways what you can return here."}, {"start": 1030.76, "end": 1036.28, "text": " So one way is to return the original sample and actually just set a new attribute."}, {"start": 1036.28, "end": 1043.08, "text": " I think set a new attribute on this original sample right here."}, {"start": 1043.08, "end": 1047.84, "text": " Let's format this a bit nicer."}, {"start": 1047.84, "end": 1051.84, "text": " So see we have this tokenize function takes a sample, it takes the text, it tokenizes"}, {"start": 1051.84, "end": 1057.48, "text": " it and codes it and puts this as the new attribute input IDs and returns it again."}, {"start": 1057.48, "end": 1066.84, "text": " And now what we can do is we can map this function across the training dataset like so."}, {"start": 1066.84, "end": 1074.16, "text": " So this will go over the training dataset and basically each for each entry do this thing."}, {"start": 1074.16, "end": 1082.16, "text": " So hopefully after this operation we'll have a dataset with where each sample not only"}, {"start": 1082.16, "end": 1090.44, "text": " has a text and a label but also a input IDs attribute."}, {"start": 1090.44, "end": 1094.3200000000002, "text": " And we don't have this sequence length thing right here."}, {"start": 1094.3200000000002, "end": 1099.24, "text": " So let's put that here."}, {"start": 1099.24, "end": 1103.6000000000001, "text": " Let's just go with 32 since this is just my laptop."}, {"start": 1103.6000000000001, "end": 1107.92, "text": " So 32 samples should be fine."}, {"start": 1107.92, "end": 1113.72, "text": " So here it says can't pickle tokenizer objects."}, {"start": 1113.72, "end": 1128.04, "text": " So what it tries to do right here is it tries to parallelize basically this thing right"}, {"start": 1128.04, "end": 1129.04, "text": " here."}, {"start": 1129.04, "end": 1140.44, "text": " If we look at this NLP thing is there documentation to this we can just look at the datasets maybe"}, {"start": 1140.44, "end": 1149.92, "text": " naming splits builder arrow data set map right here."}, {"start": 1149.92, "end": 1157.48, "text": " So this function I think it will try to multi process and therefore it needs to basically"}, {"start": 1157.48, "end": 1165.48, "text": " pickle all of the things that go into the into the into the."}, {"start": 1165.48, "end": 1171.04, "text": " I can't speak today it pickles all of the things that go into the function which means this"}, {"start": 1171.04, "end": 1180.96, "text": " tokenizer right here it needs to be pickled now maybe we can keep in memory load blah blah"}, {"start": 1180.96, "end": 1182.44, "text": " blah."}, {"start": 1182.44, "end": 1192.68, "text": " Maybe there's a way to get around this so one thing we can try is we can try another tokenizer."}, {"start": 1192.68, "end": 1195.28, "text": " Maybe this one can be pickled."}, {"start": 1195.28, "end": 1198.96, "text": " This did library is pretty good but it can't pickle everything."}, {"start": 1198.96, "end": 1203.88, "text": " Yes so this tokenizer can actually be pickled."}, {"start": 1203.88, "end": 1211.04, "text": " In the other tokenizer so I'm not entirely sure what you'd have to do honestly because"}, {"start": 1211.04, "end": 1216.48, "text": " I don't know the library but what you could do is like make a thread or process local"}, {"start": 1216.48, "end": 1221.04, "text": " variable of this and basically make it a singleton in each process and then basically"}, {"start": 1221.04, "end": 1226.28, "text": " in here you call the function to get it and it returns the already instantiated object"}, {"start": 1226.28, "end": 1228.24, "text": " and so on."}, {"start": 1228.24, "end": 1233.12, "text": " If you really want to multi process all of this anyway we have this train data set right"}, {"start": 1233.12, "end": 1238.04, "text": " now and you see the schema if you can see this the schema has been extended so there is"}, {"start": 1238.04, "end": 1245.56, "text": " now text there is label and there is input IDs which is a list of in 64 things that's"}, {"start": 1245.56, "end": 1247.3999999999999, "text": " pretty cool."}, {"start": 1247.3999999999999, "end": 1254.48, "text": " So now what we can do since this is still a Python list right this is still a Python list."}, {"start": 1254.48, "end": 1259.8799999999999, "text": " I know the tokenizer can already output a pie torch tensors but that's kind of cheating"}, {"start": 1259.8799999999999, "end": 1266.3999999999999, "text": " so we want to use this library right here so we want the train data set there is a method"}, {"start": 1266.4, "end": 1274.48, "text": " called set format right here and you say type equals torch and what that does and I think"}, {"start": 1274.48, "end": 1285.72, "text": " you need to say which columns you want so we want columns maybe we should get all columns"}, {"start": 1285.72, "end": 1292.44, "text": " can we output the text so you can select from the sample which of the columns you want"}, {"start": 1292.44, "end": 1298.8400000000001, "text": " and let's check it out again for now as long as we're just debunking here I like to do"}, {"start": 1298.8400000000001, "end": 1309.76, "text": " a debug flag so this is usually one of the first flags I do it's define Boolean debug"}, {"start": 1309.76, "end": 1317.52, "text": " and what this does is whenever this is active I try to be as fast as possible so there"}, {"start": 1317.52, "end": 1325.76, "text": " in this pie torch lightning trainer there's actually this fast death run argument which"}, {"start": 1325.76, "end": 1335.16, "text": " does the same thing but I can push it a bit harder with this debug here so let me say"}, {"start": 1335.16, "end": 1345.36, "text": " this is like this is sorry this is like one yeah we just load like batch size samples if"}, {"start": 1345.36, "end": 1354.02, "text": " we if we are in debug mode batch size we don't we don't actually have a batch size argument"}, {"start": 1354.02, "end": 1364.28, "text": " yet do we if flags dot debug else 5% okay so we don't have batch size yet we're surely"}, {"start": 1364.28, "end": 1372.6, "text": " going to need that at some point so let's go with the batch size of eight just because"}, {"start": 1372.6, "end": 1387.3999999999999, "text": " we can so now if we run this in debug if we run this in debug we should okay yes this"}, {"start": 1387.3999999999999, "end": 1395.52, "text": " needs to be a string sugar boom cool so it says it's the fast death run and if we run"}, {"start": 1395.52, "end": 1400.8799999999999, "text": " it in debug it just loads very few data points so this map function here doesn't take"}, {"start": 1400.88, "end": 1405.6000000000001, "text": " this whole while maybe there's a way you can stream that I don't know for now this is"}, {"start": 1405.6000000000001, "end": 1413.68, "text": " pretty good so if we look at the train data set again you can see that it has the same"}, {"start": 1413.68, "end": 1419.92, "text": " entry so this is still a list of 64 but if you index it right now if you go to the zero"}, {"start": 1419.92, "end": 1426.48, "text": " of data point okay then it crashes because it tries to convert these two pie torch"}, {"start": 1426.48, "end": 1434.2, "text": " tensors and they can't convert the string so we'll have to say we just want the columns"}, {"start": 1434.2, "end": 1450.44, "text": " input IDs and we want the label label can't spell okay let's try it again so right here you"}, {"start": 1450.44, "end": 1457.72, "text": " see that what we get out is actually a pie torch tensors for this and not kind of Python"}, {"start": 1457.72, "end": 1463.8, "text": " lists anymore so this is now pretty this is one to one so with duck typing maybe it's"}, {"start": 1463.8, "end": 1470.52, "text": " even subclass this is a pie torch data set right which we can load into a data order so"}, {"start": 1470.52, "end": 1479.64, "text": " this is a perfectly fine data set so we can now say self train data set is this train"}, {"start": 1479.64, "end": 1489.3200000000002, "text": " data set now we want to do this for the test as well but in order to do that we would have"}, {"start": 1489.3200000000002, "end": 1496.1200000000001, "text": " to write all of this code again which I'm not really in the mood so we'll just loop it"}, {"start": 1497.24, "end": 1505.3200000000002, "text": " we'll create a function prepare data set and we'll take in the split name"}, {"start": 1505.32, "end": 1518.84, "text": " all right like this and we'll just go with the split name here um that should do it and we"}, {"start": 1518.84, "end": 1530.4399999999998, "text": " just call it data set data set sugar boom sugar bang sugar boom and return that so now we can say"}, {"start": 1530.44, "end": 1539.4, "text": " train data set self test data set is prepare data set"}, {"start": 1544.44, "end": 1554.04, "text": " for train and test okay excellent so now we have a training data set and a testing data set"}, {"start": 1554.04, "end": 1560.76, "text": " so here in the train data loader we need to take the training data set and construct a data"}, {"start": 1560.76, "end": 1571.8799999999999, "text": " loader from it this is super super easy so what we'll do is we'll do it in one line data loader"}, {"start": 1571.8799999999999, "end": 1577.96, "text": " so what does the data loader the data loader needs a data set so the prepare data is called at"}, {"start": 1577.96, "end": 1584.44, "text": " the beginning so we have the state set right here and I think we can go with a batch size right here"}, {"start": 1585.24, "end": 1593.08, "text": " and we already have a flag for that and uh I think there is like a drop last yes so the drop last"}, {"start": 1593.08, "end": 1598.28, "text": " will go for true we only want full batches during training and we'll also shuffle"}, {"start": 1598.28, "end": 1609.08, "text": " okay and the same goes for we need a validation data loader for our validation set so in"}, {"start": 1609.08, "end": 1613.8799999999999, "text": " pie-torch light you have trained validation and test and test test is really only for like the"}, {"start": 1613.8799999999999, "end": 1621.08, "text": " final final test um if the the test date set we have here is the would be called the validation"}, {"start": 1621.08, "end": 1628.6799999999998, "text": " data set in pie-torch lightning so we false here false we don't want to shuffle particularly"}, {"start": 1629.32, "end": 1638.28, "text": " okay so we have a training data loader and a validation data loader now what do we need we have"}, {"start": 1638.28, "end": 1647.56, "text": " optimizer very good now what do we need all we need to do is to actually pass our data through"}, {"start": 1647.56, "end": 1654.44, "text": " the birth model so this forward thing here we're just going to leave not implemented um maybe"}, {"start": 1655.6399999999999, "end": 1663.3999999999999, "text": " we can implement it okay so we do need a model as you can see right here uh this batch"}, {"start": 1664.04, "end": 1670.12, "text": " let's say this batch is going to let's go right here right so if you know if you don't sometimes"}, {"start": 1670.12, "end": 1677.9599999999998, "text": " don't know what to do you just go to where you should be okay at optimality parameter we don't"}, {"start": 1677.9599999999998, "end": 1686.76, "text": " have parameters yet all right so what do we do we go up here and we make a model we need to"}, {"start": 1686.76, "end": 1696.12, "text": " actually make the birth model right here so from transformers we can use the birth model now they"}, {"start": 1696.12, "end": 1705.7199999999998, "text": " have a lot of birth models and we'll go back right here to the birth models because they as you"}, {"start": 1705.7199999999998, "end": 1712.36, "text": " know birth is just an encoder so we need to build a classifier on top of birth but they already"}, {"start": 1712.36, "end": 1718.1999999999998, "text": " have done this so they have a bunch of uh birth different configurations and the one we're looking"}, {"start": 1718.1999999999998, "end": 1723.32, "text": " for here would be this this birth for sequence classification right this is birth"}, {"start": 1723.32, "end": 1727.6399999999999, "text": " birth model transformer with a sequence classification or regression head on top"}, {"start": 1728.6, "end": 1735.8, "text": " right so this is exactly what we need a classifier on top of birth and we can um I think we can"}, {"start": 1735.8, "end": 1743.8799999999999, "text": " also load this with this from pre-trained and just put in the same name so we can this"}, {"start": 1743.88, "end": 1755.64, "text": " birth for sequence classification um and we'll load up the same model that we had okay so um"}, {"start": 1757.0800000000002, "end": 1764.44, "text": " this is our model easy as that so what do we what do we do with this birth if we put in data what"}, {"start": 1764.44, "end": 1772.2, "text": " what happens um for that we quickly go back again so in the forward method we can we can input the"}, {"start": 1772.2, "end": 1780.28, "text": " input IDs right which um is batch size sequence length tensor we can input the attention mask"}, {"start": 1781.8, "end": 1784.76, "text": " that basically tells you where there's padding and where there isn't"}, {"start": 1786.52, "end": 1791.0800000000002, "text": " mask to avoid performing attention on padding token mask value selected in 0.1 one for tokens that"}, {"start": 1791.0800000000002, "end": 1797.0, "text": " are not masks 0 for tokens that are masks then we can input the token type IDs which we don't"}, {"start": 1797.0, "end": 1800.52, "text": " have here we just have one sentence but usually in verb you have the capability of"}, {"start": 1800.52, "end": 1806.36, "text": " inputting two different types like a question and a paragraph or a first sentence and the second"}, {"start": 1806.36, "end": 1816.92, "text": " sentence um position IDs are optional um blah blah blah blah blah blah blah none of that okay"}, {"start": 1816.92, "end": 1823.8799999999999, "text": " we could also input the labels these are optional and it would already compute a loss for us"}, {"start": 1823.88, "end": 1832.3600000000001, "text": " uh which we we don't this that's almost cheating so let's just focus on putting in the input IDs and"}, {"start": 1832.3600000000001, "end": 1837.72, "text": " I think that's gonna be enough since we basically trunkate our long text to 32 tokens we don't"}, {"start": 1837.72, "end": 1844.7600000000002, "text": " need to worry about masking right here otherwise you would input a mask for um actually we we"}, {"start": 1844.76, "end": 1855.24, "text": " can do it we can do it okay so what you could input a mask for basically where um your tokens are"}, {"start": 1855.24, "end": 1861.16, "text": " not pad tokens and the pad tokens in birth are 0 so basically your mask should should just be"}, {"start": 1861.16, "end": 1868.44, "text": " whatever's non-zero uh but maybe also your model learns um to ignore the pad tokens"}, {"start": 1868.44, "end": 1875.0, "text": " I might be wrong here and it does it automatically right so in your forward pass what do you do"}, {"start": 1875.0, "end": 1884.92, "text": " actually let's go to the training step we'll put something here you can see it so if you if you"}, {"start": 1884.92, "end": 1891.16, "text": " didn't have a birth um it would actually uh birth you it birthed you up it would download"}, {"start": 1891.16, "end": 1896.3600000000001, "text": " birth right here but since I have it you can see here this is the smaller birth model um"}, {"start": 1896.36, "end": 1902.52, "text": " um pad torch lightning I don't have enough space in my console right here but it would give you"}, {"start": 1902.52, "end": 1908.84, "text": " a nice overview over your model how many parameters it has how what kind of layers it has and so on"}, {"start": 1908.84, "end": 1914.1999999999998, "text": " so uh we also need a validation step if we have a validation data loader"}, {"start": 1915.8799999999999, "end": 1923.6399999999999, "text": " validation step and we need the um validation epoch and function so"}, {"start": 1923.64, "end": 1931.0, "text": " usually in training you don't really care about epochs too much because you just have many batch"}, {"start": 1931.0, "end": 1937.48, "text": " after many batch but in validation uh what you want is kind of one single metric across your entire"}, {"start": 1937.48, "end": 1943.8000000000002, "text": " test dataset or validation dataset and therefore you sort of in the validation step you'll just"}, {"start": 1943.8000000000002, "end": 1949.8000000000002, "text": " kind of output things you output local things per batch and then in the epoch and function you"}, {"start": 1949.8, "end": 1960.84, "text": " aggregate them into one big number so um we'll we'll we'll we'll just put we'll put things into each"}, {"start": 1961.96, "end": 1968.12, "text": " thing thing thing so I'm pretty sure we're going to end up in the validation step first because if"}, {"start": 1968.12, "end": 1974.12, "text": " especially if we do this debug run it basically it tries to run a validation first uh at the very"}, {"start": 1974.12, "end": 1981.6399999999999, "text": " start of training so we can look at a batch right here so what's a batch um the batch seems to be a"}, {"start": 1981.6399999999999, "end": 1989.6399999999999, "text": " dictionary if you look at its keys we have label and input IDs okay so that's pretty cool so if we go"}, {"start": 1989.6399999999999, "end": 1998.04, "text": " for the input IDs that gives us a tensor and the tensors of shape eight which is our batch size"}, {"start": 1998.04, "end": 2004.76, "text": " and 32 which is our sequence length and we should be able to pretty much input that into the"}, {"start": 2004.76, "end": 2013.1599999999999, "text": " birth model that we created boom okay and what do we get out we get out a tuple and the first entry"}, {"start": 2013.1599999999999, "end": 2020.36, "text": " is going to be this looks like logits right okay let's check the shape and this is eight so this"}, {"start": 2020.36, "end": 2025.8, "text": " is our batch size and two is the logit so one for the negative class and one for the positive class"}, {"start": 2025.8, "end": 2033.6399999999999, "text": " and this is this we can basically input into a cross entropy loss given our labels so we also have"}, {"start": 2033.6399999999999, "end": 2044.84, "text": " our label here and their label is all ones nice um is this maybe sorted is the dataset sorted into"}, {"start": 2045.96, "end": 2053.48, "text": " good and bad things because that would be how would be bad in any case um so what do we have to do"}, {"start": 2053.48, "end": 2062.68, "text": " so in the forward method we get the input IDs let's let's just say we get the input IDs and we run"}, {"start": 2062.68, "end": 2070.6, "text": " this through our model and we can actually construct a mask here and the mask is going to be wherever"}, {"start": 2070.6, "end": 2082.92, "text": " the input IDs are not zero and um that as a what does it need to be so these mask this"}, {"start": 2082.92, "end": 2094.36, "text": " attention mask is going to be a float tensor okay so put it as a float tensor cool um"}, {"start": 2097.16, "end": 2104.84, "text": " write like this so our logits are going to be that and yeah tuple with one entry of the comma"}, {"start": 2104.84, "end": 2109.96, "text": " here is important we're going to return the logits so this is our forward function"}, {"start": 2109.96, "end": 2115.48, "text": " so in the validation and the training step the first thing we got to do is we got to"}, {"start": 2117.16, "end": 2122.2, "text": " call this forward function with the input IDs and these of course are in our batch"}, {"start": 2124.52, "end": 2133.0, "text": " like this so these are going to be our logits and then in the validation what we want to do is we"}, {"start": 2133.0, "end": 2138.44, "text": " first of all want to compute our loss right so we have to construct this up here in the init"}, {"start": 2138.44, "end": 2149.0, "text": " we can actually just fold this prepare data um loss is going to be a cross entropy loss"}, {"start": 2149.0, "end": 2158.6, "text": " yes that exists with red reduction I like to put reduction on I don't think there is like"}, {"start": 2158.6, "end": 2164.76, "text": " a deprecated reduce and there is like reduction where you can put mean or something I like to not"}, {"start": 2164.76, "end": 2170.2000000000003, "text": " reduce the loss at first because then I can I can use the same thing for validation and training"}, {"start": 2171.7200000000003, "end": 2178.1200000000003, "text": " so in the validation step I just want to compute my loss right here with self so loss"}, {"start": 2179.7200000000003, "end": 2185.0, "text": " loss um and we'll have to cheat a bit"}, {"start": 2185.0, "end": 2193.48, "text": " so look up the cross entropy loss and"}, {"start": 2196.68, "end": 2203.4, "text": " wow okay where is the cross entropy loss"}, {"start": 2203.4, "end": 2215.96, "text": " cross entropy loss it takes yes it's reduction ha tada and uh"}, {"start": 2219.48, "end": 2224.44, "text": " so the input to the function that we can struct is going to be first um"}, {"start": 2224.44, "end": 2232.52, "text": " um n by c first the input and then the targets so first the logits and then the targets right"}, {"start": 2234.44, "end": 2242.12, "text": " criterion that combines logs of max and nl loss over a single class nice nice nice"}, {"start": 2243.0, "end": 2249.7200000000003, "text": " okay okay cool so first logits and then labels label"}, {"start": 2249.72, "end": 2257.72, "text": " okay that's our loss so if we check out what our loss is going to be it's probably going to be"}, {"start": 2259.3999999999996, "end": 2264.68, "text": " an vector of size 8 because we have reduction none"}, {"start": 2267.3999999999996, "end": 2275.72, "text": " loss yes see vector of size 8 very nice so we can just um basically return"}, {"start": 2275.72, "end": 2285.08, "text": " oh say we can return this loss just as is and then in the validation epoch ends the outputs here"}, {"start": 2285.08, "end": 2291.7999999999997, "text": " is going to be a list of and every entry in the list is going to be one of these validation steps"}, {"start": 2291.7999999999997, "end": 2301.72, "text": " for for one batch so we can aggregate those um so losses is we'll concatenate them since they're"}, {"start": 2301.72, "end": 2314.7599999999998, "text": " going to be chunks of 8 um outputs at the dimension 0 and then we can calculate the mean right so um"}, {"start": 2317.08, "end": 2329.8799999999997, "text": " we can do that and then we can oh no we need to do more we also want to know the accuracy"}, {"start": 2329.88, "end": 2338.44, "text": " right so um the accuracy is going to be whether or not the logits dot arg max"}, {"start": 2340.36, "end": 2350.92, "text": " is go is equal to the label label so the accuracy for each sample is going to be that is either"}, {"start": 2350.92, "end": 2361.0, "text": " going to be one or zero and we want that as a float so here let's output a dictionary with loss um and"}, {"start": 2361.0, "end": 2373.2400000000002, "text": " accuracy all right excellent so here then we can aggregate so the loss is going to be and I like"}, {"start": 2373.24, "end": 2385.0, "text": " to have um like a construction here that aggregates this still so we go out loss for oh in outputs"}, {"start": 2385.64, "end": 2392.7599999999998, "text": " so these are now going to be entries each one is going to be a dictionary right so our loss"}, {"start": 2392.76, "end": 2403.2400000000002, "text": " losses we have concatenation to the mean okay our accuracy is going to be the same thing for the"}, {"start": 2403.2400000000002, "end": 2408.5200000000004, "text": " accuracy nice so our output here is going to be a dictionary"}, {"start": 2413.32, "end": 2419.0, "text": " and I think in Pythagoras lightning there if you put validation accuracy it's like Val-AC"}, {"start": 2419.0, "end": 2426.68, "text": " it selects the model according to this but I'm not sure so also in Pythagoras lightning I can"}, {"start": 2426.68, "end": 2434.12, "text": " now output this here but also if you have a log entry it will forward this to the logger which"}, {"start": 2434.12, "end": 2439.72, "text": " we can uh actually do and make a tensor board logger out of this so what have we done"}, {"start": 2440.68, "end": 2446.52, "text": " we have first of all set up the validation step so the the Pythagoras lightning is going to run"}, {"start": 2446.52, "end": 2452.52, "text": " through the data loader for each batch do this so we forward it through the birth model to get our"}, {"start": 2452.52, "end": 2458.28, "text": " logits and then we compute our loss by the cross entropy loss of the logits and the labels"}, {"start": 2458.92, "end": 2463.48, "text": " and we also compute our accuracy by seeing how much the logits agree with the labels or the"}, {"start": 2463.48, "end": 2470.12, "text": " maximum logit and then we aggregate all of this over the entire epoch and output that now let's set"}, {"start": 2470.12, "end": 2479.0, "text": " up a logger so for the logger we can put this I think in the trainer here Pythagoras lightning"}, {"start": 2479.0, "end": 2489.56, "text": " logger dot and I think there is a tensor board logger uh pretty sure Pythagoras lightning is there"}, {"start": 2489.56, "end": 2501.96, "text": " tensor board no Pythagoras lightning logger I'm pretty sure that exists that's not the newest version"}, {"start": 2502.84, "end": 2511.7999999999997, "text": " I hate these these old docs so latest oh come on this was called logging logger"}, {"start": 2511.8, "end": 2530.36, "text": " uh logger loggers tensor board logger right here nice so our save dir is going to be called logs and then"}, {"start": 2530.36, "end": 2544.92, "text": " what we what do we want we want the name IMDB and there's also this version thing um where if"}, {"start": 2544.92, "end": 2550.52, "text": " if if you don't put version zero I will just make a new kind of folder each time but I guess we"}, {"start": 2550.52, "end": 2555.2400000000002, "text": " delete the logs anyway we delete the logs folder at the beginning so we don't have this problem"}, {"start": 2555.2400000000002, "end": 2560.1200000000003, "text": " but I generally like to overwrite my logs and not make new runs but if you like something"}, {"start": 2560.12, "end": 2568.04, "text": " different that's you know fine all right so let's run this again and we're cool this is the"}, {"start": 2568.04, "end": 2576.92, "text": " bird configuration that we loaded and then we have no attribute logger Pythagoras lightning logger"}, {"start": 2576.92, "end": 2592.2000000000003, "text": " logger logger uh okay again loading the weights very cool blah blah blah blah blah blah blah blah"}, {"start": 2592.2000000000003, "end": 2598.52, "text": " and we're in an iphone shell and do we have an iphone shell remaining only in the training step"}, {"start": 2598.52, "end": 2604.28, "text": " okay so we're at the training step right here and we can actually can we can check whether or not"}, {"start": 2604.28, "end": 2616.0400000000004, "text": " um ah now we have lightning logs and logs my okay so this appeared to be our tensorboard logs so"}, {"start": 2616.0400000000004, "end": 2626.1200000000003, "text": " we are maybe able to run a tensorboard here later um let's run it logs we don't have tensorboard"}, {"start": 2626.12, "end": 2639.72, "text": " okay oh we have uninstalled it because I was angry at it oh come on what's going on um"}, {"start": 2642.12, "end": 2651.08, "text": " tensorboard I should have tensorboards somewhere uh it's it's like in um in local bin or something"}, {"start": 2651.08, "end": 2662.6, "text": " local bin no it's not in local bin pull pull we'll find it we'll figure it out"}, {"start": 2665.0, "end": 2670.2, "text": " uh how to get a tensorboard maybe we need to install tensorflow"}, {"start": 2673.0, "end": 2677.56, "text": " while that's gonna take a while okay so back to the training step in the training step we basically"}, {"start": 2677.56, "end": 2683.64, "text": " need to do the same as in the validation step so we'll need to forward our batch through the model"}, {"start": 2683.64, "end": 2688.36, "text": " but here we don't need to compute an accuracy but we do need to compute a actually batch loss"}, {"start": 2688.36, "end": 2694.68, "text": " that we can back propagate on now in the training step you can either specify how you back propagate"}, {"start": 2695.48, "end": 2703.16, "text": " per se or what you can do is you can just output this log loss attribute and then PyTorch lightning"}, {"start": 2703.16, "end": 2713.24, "text": " will basically do the back propagation for you we have the tensorboard now please all right there we go"}, {"start": 2713.24, "end": 2729.3999999999996, "text": " and we can we can put this into a different thing right here um get a p demo yes um"}, {"start": 2729.4, "end": 2747.64, "text": " um okay so this is running and if everything goes correctly six shabu we have a tensorboard okay"}, {"start": 2749.88, "end": 2754.84, "text": " so we need to forward our training step and we need to calculate a loss for the batch so these"}, {"start": 2754.84, "end": 2760.76, "text": " loss here we do the same thing but here we call mean on it so this is the mean loss from this batch"}, {"start": 2760.76, "end": 2768.44, "text": " and we can now return um the loss right here and we can also in the training step you can also"}, {"start": 2768.44, "end": 2776.28, "text": " output a log dictionary and we'll output the loss again here in order so this is our going to be our"}, {"start": 2776.28, "end": 2784.1200000000003, "text": " training loss that we output right here um let's call it train loss and this also will go into the"}, {"start": 2784.12, "end": 2789.96, "text": " tensorboard so if we run this right now we don't have an ipython shell simply by"}, {"start": 2789.96, "end": 2797.16, "text": " outputting this loss attribute we already instruct PyTorch lightning to now run back prop on this"}, {"start": 2797.16, "end": 2804.92, "text": " loss using the optimizer that we have defined okay and by outputting the log we"}, {"start": 2804.92, "end": 2811.16, "text": " instructed to put this into the tensorboard so now we have a scalar entry and um you can see"}, {"start": 2811.16, "end": 2817.64, "text": " this it only contains the valid node contains everything very cool very very cool so let's remove"}, {"start": 2817.64, "end": 2828.2, "text": " the debug flag and we'll just see what happens so to recap right to recap we have um"}, {"start": 2829.0, "end": 2840.8399999999997, "text": " on i go see ipok 1 ipok 2 go go go go go go oh very cool um what we've done is we've set up this"}, {"start": 2840.84, "end": 2847.0, "text": " PyTorch lightning module it needs a bunch of functions but in the init we've basically just set up"}, {"start": 2847.0, "end": 2851.7200000000003, "text": " our birth model from the hugging face transformers library we've loaded in a pre-trained"}, {"start": 2851.7200000000003, "end": 2858.36, "text": " birth model that we're going to fine tune the main thing that the PyTorch lightning module needs"}, {"start": 2858.36, "end": 2865.32, "text": " is a training step function where you define what did you do with the data and this data loader"}, {"start": 2865.32, "end": 2874.92, "text": " function so in the data loader function um we've loaded up a data set um and we basically specify"}, {"start": 2874.92, "end": 2881.1600000000003, "text": " the batch size this is very easy where does the data set come from we do it here in prepare data"}, {"start": 2881.1600000000003, "end": 2886.6800000000003, "text": " this is a special function in PyTorch lightning that's basically called after the init but before"}, {"start": 2886.6800000000003, "end": 2894.92, "text": " anything else runs and here we are loading this data set from the nlp library and this is kind of"}, {"start": 2894.92, "end": 2901.48, "text": " the magic part uh we specify the split and the size that we want inside of the string and you"}, {"start": 2901.48, "end": 2907.4, "text": " can do this in percent or in a number of samples that you want i'm sort of sure you can do more"}, {"start": 2907.4, "end": 2913.16, "text": " things but i haven't explored that then we run map on the data set in order to tokenize it and"}, {"start": 2913.16, "end": 2921.56, "text": " that's right here and we use a tokenizer again from the PyTorch lightning and um just run this"}, {"start": 2921.56, "end": 2930.84, "text": " encode function this is very simple like if how complicated was this just like a year ago"}, {"start": 2931.24, "end": 2938.92, "text": " a crazy then we need to to to put set format and set format tells the data set how it needs to"}, {"start": 2938.92, "end": 2944.92, "text": " output its samples and we tell it please output Torch tensors and um we want these columns right here"}, {"start": 2944.92, "end": 2952.12, "text": " and we make a train and the test data set with uh from the train and test split accordingly so"}, {"start": 2953.08, "end": 2958.52, "text": " we have this this goes into a data loader PyTorch lightning will take the data loader and run"}, {"start": 2958.52, "end": 2963.56, "text": " training on it using this train step function in this train step function we get a batch"}, {"start": 2963.56, "end": 2969.32, "text": " um in the batch there are these two columns that we specified previously in podidies and label"}, {"start": 2969.32, "end": 2974.44, "text": " the input ids will put through the forward function of the model itself this is the forward"}, {"start": 2974.44, "end": 2981.96, "text": " function we construct a mask and run it through the model um we we wouldn't actually need to construct"}, {"start": 2981.96, "end": 2988.28, "text": " a mask but okay and we get back the logits of the classification and then we run this through a"}, {"start": 2988.28, "end": 2996.04, "text": " cross entropy loss uh get the mean of the batch and there we go in the validation step we do the"}, {"start": 2996.04, "end": 3000.84, "text": " same thing but also calculate the accuracy but don't calculate the mean we want to keep it"}, {"start": 3000.84, "end": 3006.1200000000003, "text": " per sample and only at the end we want to concatenate everything and calculate the mean"}, {"start": 3007.4, "end": 3015.2400000000002, "text": " if we've done everything correctly you see right here our train loss goes down down down until it"}, {"start": 3015.2400000000002, "end": 3022.04, "text": " is almost zero because we've just and the validation accuracy is super high is this is this because"}, {"start": 3022.04, "end": 3032.12, "text": " all the labels are equal like for real um okay so we'll do something else we'll make an integer um"}, {"start": 3033.4, "end": 3041.24, "text": " with percent and this was five right so that we loaded five percent of the data set um"}, {"start": 3043.48, "end": 3050.52, "text": " but let's load some more and this might take longer but let's load"}, {"start": 3050.52, "end": 3061.56, "text": " 50 percent of the data set and just see what happens no present I called it present"}, {"start": 3066.36, "end": 3066.92, "text": " very good"}, {"start": 3070.28, "end": 3076.2, "text": " so we'll load up 50 percent of the data set and um we'll do the same thing and we can track in"}, {"start": 3076.2, "end": 3082.68, "text": " real time what happens in tensor port and unrecognized instruction format um"}, {"start": 3087.24, "end": 3087.64, "text": " okay"}, {"start": 3089.64, "end": 3099.0, "text": " whoo can we make a format string in a format string this is nasty does it work please work"}, {"start": 3099.0, "end": 3106.92, "text": " we can make a format string in a format string absolutely bonkers okay so it takes a little bit"}, {"start": 3106.92, "end": 3112.12, "text": " longer and you could actually I think you can speed this up this mapping of the data set maybe"}, {"start": 3112.12, "end": 3119.88, "text": " you can stream it um i'm pretty sure you can batch it you can do a batch um processing of this"}, {"start": 3119.88, "end": 3128.92, "text": " but for our case right here uh we think it's enough so it was like what 1,200 if we had five"}, {"start": 3128.92, "end": 3138.12, "text": " percent so now it should be something like 12,000 um so let's continue with the recap of what we"}, {"start": 3138.12, "end": 3145.48, "text": " did here we have the trained it set the validation date set and on yes so we have everything like"}, {"start": 3145.48, "end": 3150.6800000000003, "text": " this the configure optimizers you can put an optimizer you can also put a learning rate"}, {"start": 3150.6800000000003, "end": 3158.6, "text": " scheduler if you want to and then in the main function we load this PyTorch Lightning module"}, {"start": 3158.6, "end": 3164.2799999999997, "text": " and we specify a trainer and the trainer we tell it you know the max epochs and so on"}, {"start": 3165.16, "end": 3172.04, "text": " and we set up the logger and we just run fit on this model and this runs epochs of the model"}, {"start": 3172.04, "end": 3181.0, "text": " and after each epoch it does a validation epoch and minimizes our loss very cool very effective so"}, {"start": 3181.0, "end": 3192.36, "text": " now if if please if you would all right here we go this is my laptop training bird"}, {"start": 3193.96, "end": 3200.44, "text": " all right okay we don't seem to make too much progress"}, {"start": 3200.44, "end": 3211.8, "text": " let's check the tensor board training loss goes down training loss goes to zero"}, {"start": 3214.36, "end": 3219.64, "text": " I have the sneaking suspicion that this is not entirely shuffled so"}, {"start": 3221.2400000000002, "end": 3225.8, "text": " um is there like a shuffle like a shuffle thing"}, {"start": 3225.8, "end": 3233.0800000000004, "text": " because this seems a bit this seems a bit bit fishy um"}, {"start": 3235.96, "end": 3245.8, "text": " this IMDB data set right here just seems like you know we could use a bit of of shuffling"}, {"start": 3245.8, "end": 3259.48, "text": " because all the labels yeah the training loss instantly goes to zero so maybe maybe it's not we"}, {"start": 3260.92, "end": 3267.5600000000004, "text": " can we shuffle here let's look at the load data set function"}, {"start": 3267.56, "end": 3275.16, "text": " hum brum brum brum brum"}, {"start": 3275.16, "end": 3287.16, "text": " load data set batch no keep in memory no none of that okay this does not seem to go to continue"}, {"start": 3287.16, "end": 3304.7599999999998, "text": " right here data sets NLP data sets I hope here we know we should find this load data set somewhere"}, {"start": 3304.76, "end": 3320.36, "text": " builder features load load data set that split can we not shuffle anywhere we'll search"}, {"start": 3322.36, "end": 3324.2000000000003, "text": " shuffle builder"}, {"start": 3324.2, "end": 3335.7999999999997, "text": " okay so generate examples this function pre-processed examples"}, {"start": 3335.7999999999997, "end": 3338.52, "text": " where the key will be hashed"}, {"start": 3342.8399999999997, "end": 3352.4399999999996, "text": " okay we are not able to shuffle this um just like that but I hope this at least gives you"}, {"start": 3352.44, "end": 3360.6, "text": " an impression I guess if you were to take the full data set and um map it then it would actually"}, {"start": 3360.6, "end": 3368.76, "text": " work we'll just try again with 10% of the data just uh to see it go down"}, {"start": 3371.8, "end": 3377.7200000000003, "text": " tensorboard see this is now good because we always delete the logs folder we don't have any"}, {"start": 3377.72, "end": 3388.3599999999997, "text": " uh remnant uh old tensor flow logs all right come on come on"}, {"start": 3390.9199999999996, "end": 3396.6, "text": " so 10% should be yeah about this about this okay"}, {"start": 3396.6, "end": 3409.3199999999997, "text": " train loss looking good looking good so far"}, {"start": 3414.04, "end": 3425.3199999999997, "text": " look at these models how large is that how large is the birth base case hugging face pre-trained"}, {"start": 3425.32, "end": 3434.1200000000003, "text": " models pre-trained models birth base on case that's the one we have 12 layers"}, {"start": 3434.92, "end": 3438.44, "text": " 110 million parameters easy easy"}, {"start": 3442.52, "end": 3449.8, "text": " uh no it's too large training loss goes to zero again okay so we've determined that this"}, {"start": 3449.8, "end": 3458.52, "text": " data set very probably isn't entirely shuffled it might just have all the good labels first and"}, {"start": 3458.52, "end": 3467.8, "text": " all the bad labels last and um yeah just to confirm let's confirm this uh right here"}, {"start": 3468.92, "end": 3477.96, "text": " let's go with 100% but let's put an ipython shell down um just before we map the data set"}, {"start": 3477.96, "end": 3482.04, "text": " so we don't have to go through the whole mapping um procedure"}, {"start": 3485.0, "end": 3489.96, "text": " actually that would be here right yes"}, {"start": 3493.7200000000003, "end": 3496.44, "text": " can we not map this async crinnisly map"}, {"start": 3500.28, "end": 3504.76, "text": " I might be doing something really wrong with this library but I think that's that's how it"}, {"start": 3504.76, "end": 3520.2000000000003, "text": " should go so map death map right here we can do batched we could do batched"}, {"start": 3521.2400000000002, "end": 3531.0800000000004, "text": " and then I think hugging face has a function to encode batched encode batch encode"}, {"start": 3531.08, "end": 3541.4, "text": " encode batch no um let's go to the tokenizer"}, {"start": 3543.88, "end": 3551.16, "text": " shnavada bam build inputs create token type id sketspecial token masks save"}, {"start": 3552.44, "end": 3553.4, "text": " where is encode"}, {"start": 3553.4, "end": 3570.84, "text": " right here can we have batch encode build inputs no this might be it batch encode yes there is a"}, {"start": 3570.84, "end": 3579.08, "text": " batch encode where you have batches of these things so okay what if we do the negative one see"}, {"start": 3579.08, "end": 3594.7599999999998, "text": " here's the label zero um i'm pretty sure i'm pretty sure uh batch true let's do that and in our"}, {"start": 3594.76, "end": 3610.44, "text": " function here we'll say batching code so let's see how fast this is with 100 percent"}, {"start": 3613.0800000000004, "end": 3618.5200000000004, "text": " we're tokenizer has no we just had batching code"}, {"start": 3618.52, "end": 3629.8, "text": " oh but this might be we have batching code plus batching code plus or text pairs"}, {"start": 3631.8, "end": 3635.0, "text": " okay we need this batching code plus"}, {"start": 3638.92, "end": 3645.88, "text": " but then that gives us a dictionary right this gives us a dictionary with the fields"}, {"start": 3645.88, "end": 3659.32, "text": " inputs id's right here so like this how about that and then we still might want to limit the"}, {"start": 3659.32, "end": 3669.32, "text": " actual data set um once we have once we have mapped it because we need to train on it as well"}, {"start": 3669.32, "end": 3680.84, "text": " but i just want to see how fast this batch encoding is yes"}, {"start": 3685.0, "end": 3693.32, "text": " okay reasonably fast but it takes like three minutes um yeah so we won't go on here i will put"}, {"start": 3693.32, "end": 3704.52, "text": " i will put this as is on um i'll put this as is on github and i hope you can profit from that"}, {"start": 3705.56, "end": 3713.4, "text": " in any way you want the hugging phase site has a tutorial on squad where they also use the metrics"}, {"start": 3713.4, "end": 3719.8, "text": " so they have basically these predefined metrics like blue uh or rouge i think"}, {"start": 3719.8, "end": 3728.92, "text": " um and you can just use them as you use these data sets so it's very very very convenient"}, {"start": 3728.92, "end": 3735.0800000000004, "text": " uh to work with these things in nlp so nlp has come a long way absolutely invite you to check out the"}, {"start": 3735.0800000000004, "end": 3744.76, "text": " um the transformers and tokenizers and nlp repos and with that that's it for me i think i hope"}, {"start": 3744.76, "end": 3751.5600000000004, "text": " you enjoyed this again leave a comment if you see improvements or if i maybe should edit this a bit more"}, {"start": 3751.5600000000004, "end": 3758.28, "text": " i thought the entire process of just going through and making mistakes um would be entertaining to some"}, {"start": 3758.28, "end": 3775.5600000000004, "text": " um all right bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=IiBFqnNu7A8 | Planning to Explore via Self-Supervised World Models (Paper Explained) | What can an agent do without any reward? Explore the world! While many formulations of intrinsic rewards exist (Curiosity, Novelty, etc.), they all look back in time to learn. Plan2Explore is the first model that uses planning in a learned imaginary latent world model to seek out states where it is uncertain about what will happen.
OUTLINE:
0:00 - Intro & Problem Statement
3:30 - Model
5:10 - Intrinsic Motivation
9:05 - Planning in Latent Space
11:15 - Latent Disagreement
16:30 - Maximizing Information Gain
21:00 - More problems with the model
26:45 - Experiments
32:10 - Final Comments
Paper: https://arxiv.org/abs/2005.05960
Website: https://ramanans1.github.io/plan2explore/
Code: https://github.com/ramanans1/plan2explore
Abstract:
Reinforcement learning allows solving complex tasks, however, the learning tends to be task-specific and the sample efficiency remains a challenge. We present Plan2Explore, a self-supervised reinforcement learning agent that tackles both these challenges through a new approach to self-supervised exploration and fast adaptation to new tasks, which need not be known during exploration. During exploration, unlike prior methods which retrospectively compute the novelty of observations after the agent has already reached them, our agent acts efficiently by leveraging planning to seek out expected future novelty. After exploration, the agent quickly adapts to multiple downstream tasks in a zero or a few-shot manner. We evaluate on challenging control tasks from high-dimensional image inputs. Without any training supervision or task-specific interaction, Plan2Explore outperforms prior self-supervised exploration methods, and in fact, almost matches the performances oracle which has access to rewards. Videos and code at this https URL
Authors: Ramanan Sekar, Oleh Rybkin, Kostas Daniilidis, Pieter Abbeel, Danijar Hafner, Deepak Pathak
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 planning to explore via self-supervised world models by Ramanan Sekar, Ole Ribkin, Kostas Danieli, Dis Pieter Abil, Dani Gerhoffner, and Depak Patak. So this is a paper that concerns reinforcement learning and specifically, sort of self-supervised reinforcement learning. So what do they mean? There's a graphic right here. In reinforcement learning usually you have an environment and an agent, right? So you have this environment and let's ignore the without rewards for now. And you have the agent and the agent needs to interact with the environment in order to achieve a maximum reward. So the reward is given by a certain task, right? You have to do something in this environment. In this case they consider these types of tasks where I think the top task might be called run forward. So your reward is more the further you go with this walker. And how you can influence the walker is you can sort of give a bit of force onto its joints right here. And you have a bunch of sensors. So the main task is actually to keep it to balance it on its feet and then sort of walk forward such that it never falls over. Otherwise you get negative reward. You lose. So in this case what they want to do is they want to say, wait, if we just train a reinforcement learning agent for each of these tasks individually that will use a lot of data. And basically we can't reuse the learned reinforcement learning agent for each of these individual tasks. It's sort of like if you have many you know image tasks or NLP tasks you don't want to learn one model for each one individually, but you might do something like a common joint pre-training. And this is exactly this for reinforcement learning. And it's even called self supervised, right? Like we are used to in the in the classification setting self supervised learning. What does it mean? So it means that at first you're in an environment without rewards. So basically the agent is just dropped in an environment. And there's no rewards. It can just do actions and observes up the states from this environment. And after that after a while of that, then the tasks come in. So task A, task B and task C are three different tasks all in the same environment, but all requiring the agent to do different things like running forward or running backwards or do a front flip or things like this. So the how fast the agent can adapt to these individual tasks very much depends on what it has learned during this phase where there were no rewards, right? So the agent is tasked to just explore the world via what they call here task agnostic exploration to explore the world to learn something about the world in order then to generalize to these tasks. And in their case, they learn this global world model. So the agent is supposed to learn somehow how the world works, right? And this is this is the the way that this agent is then able to adapt really quickly. So in essence, what does this agent do? The agent works as follows. It gets an input observation and it runs that through an encoder, which is usually something like a convolutional neural network. And that will give you a set of features, right? So this is sort of an embedding of the state that you're in. And that you can incorporate into a latent state at time t. Now usually in these RL algorithms or what can happen is that you incorporate the last agent latent state. So the latent state from the step here also goes into the latent state of the next step, right? So here was the sorry, the last observation observation comes in features latent state and so on. Ultimately, and then and so on and comes in from here. And there's usually like an RNN going over the time steps. But ultimately here, the agent has to decide on an action using this policy network. Now, how is this trained to this policy network? It has to come up with an action, but there are no rewards. So usually we would train this policy network with like an actor critic method. So we would also train some sort of a value function. And then the policy would try to maximize the value function. And but if we don't have rewards, how are we going to do that? So people have thought about this for a bit. And people have come up with things like intrinsic motivation, intrinsic motivation is a term where you're trying to say something like if you're in a room right here like this, your agent is right here, then you just you know, you do something and maybe your agent goes down here, right? If your agent were to go down there again, it would sort of not really learn anything because it has now already gone there. There's already learned from those states. So you might want to explore some different space, right? Like here. And in the next episode, you might one explore this room right here. So this this notion of intrinsic motivation to explore, it has a bunch of different formulations of how exactly you can formulate it. But just imagine basically the entire state is filled with a bunch of coins. And I'm going to draw this as green dots sort of like Pac-Man and everything is filled with these green dots, right? And what the agent wants to do if it has no rewards, it will simply collect those green dots. And once one is collected. So if I go here, I'll collect all these green dots. These are now no longer there, right? So that area doesn't give me any reward anymore. So you can imagine sort of like this. So as an intrinsic reward, you simply reward the agent every time it finds itself in a new state that it hasn't seen before. So you train it to seek out novel states. Now usually when you just have like an actor critic method and that's what this paper here criticizes, if you have it, it's called retrospective novelty. That means if you train a model free algorithm, which is an actor critic, right? If we just plug in into here something like a3c, that will simply have a policy and a value function. And in this case, if we train it on intrinsic reward, the policy will simply tell you where to go to find more green stuff. But you can only train it. So you use this to run an episode. And then you observe how many green things you found in that episode, right? If your episode goes here and then you put that back into your buffer to learn from. But at that point, you've already collected the green things, right? So the reward signal is actually a bit off because you want to train your agent that there that it should seek out novel things. But as soon as you've explored them, they're not really novel anymore because you have now explored them. But still you're going to train your agent telling your agent that this area right here has lots of has given me lots of rewards. So the agent is going to be encouraged to repeat that. They say this right here, the retrospective novelty, model free exploration methods, not only require large amounts of experience to adapt to downstream tests, they can also be inefficient during exploration. These agents usually first act in the environment, collect trajectories, and then calculate an intrinsic reward as the agent's current estimate of novelty. This approach misses out on efficiency by operating retrospectively. That is, the novelty of inputs is computed after the agent has already reached them. Hence it seeks out previously novel inputs that have already been visited and would not be novel anymore. Instead one should directly seek out future inputs that are expected to be novel. Now, so what this paper is doing, it's basically saying, can we build a model that estimates the future novelty of a state that we maybe haven't seen so far? And here is where that goes. So what do they do in this policy? So the policy isn't just trained to maximize the novelty in the world. Instead, sorry, it uses planning. It uses planning in latent space. So what this model does is it learns a world model in latent space. The world model takes as input these features that you saw right here that encoder gives you and it predicts the future hidden latent states. These are the things you saw here. So these things that are always made by incorporating the new features with the old state, it tries to predict it. So technically these things here should have like some sort of, no, this is actually exact here, but these here should have some sort of a tick or something to indicate. These are estimated, these are estimated future states. And this model right here, this is an estimate, this is a world model. They use Dreamer for this. And I have made a video about Dreamer. Dreamer tries exactly that. It tries to estimate what is the future, but not in actual world space, but in latent space. And yeah, so it tries to estimate its own future. And the cool thing here is that this is probabilistic or you can make it probabilistic. So you can technically from this one age that you have here, you can run out many futures in your imagination. And since you don't need the observations, you only need the latent space, you can simply forward roll your RNN example from it and you have many trajectories in the future. Now the fact that you have many trajectories leads to even a different thing. So what you can do for each of these hidden states, they have a head here that predicts the so-called latent disagreement. What does this do? This consists of a whole bunch of models. These are ensemble models. They're the same for each time step. But what they take in, they take in the latent state of the model and the action that you're about to do, the action that you imagine you would do. So this is the imagined state and this is the imagined action in that state. And then it will compute the next features. So the next, whatever in the next step would be the age. So right, right, where do we put it? Whatever in the next. So if I have this age and I have this state, it tells me if I do action a1 and if I were to execute this in the real world, what would be my next age that I would get? So basically by performing an action, I will get the next observation and I will encode that to get the next features and this small model would try to predict what are the features of the next state. If I were to execute this action in this state, okay? So it's kind of a future predictor. But also not in observation space, but in latent space. So it tries to predict the latent features of the next observation. And the, this split here, you might think that there is bit of a, it's like almost the same, this latent state here and the features. But as we discussed before, the latent state can incorporate the last or the history of latent states. Well, the features simply are only a function of the current observation. And that's why they predict the features. They really want to predict the observation. But history has sort of shown that if you try to predict, for example, the pixels of the observation that won't serve you really well. And therefore what you need to do is you need to predict the latent features of the observation that works much better. So they have a bunch of these models right here. They have a bunch of models with different parameterizations. They instantiate K different models of that. And they all run the same. So these are all the same inputs through these different models. Now these different models have been initialized at different points. So they will make slightly different predictions. And the crucial part is, so if, if it's really deterministic, what the next state is going to be, right? So say you're in this state, you perform this action. And so if you have a ball in your hand and you drop the ball, then the ball is going to fall down. Really deterministic. That means these next, these estimated next features, if the models are any good, they all agree. And this variance here between the estimates is very, very small. And now if the uncertainty over the next state is very high, and this can be due to two facts either, it is actually uncertain what's going to happen. So maybe you have a really a piece of paper and you drop that and due to the wind, you can't know what's happening. Or because your model has simply not learned yet what's going to happen. In either of those cases, you don't know what's going to happen. Therefore these, these predictions here, sorry, are going to be very different from each other. And because of that, this variance will be high. And this variance you take as the intrinsic reward. So in each step, you basically try to predict over the next actions you can do, which ones leads me to a situation where I don't know what's going to happen, where I cannot really predict. The variance in my prediction is high. So I really don't know what's going to happen. And that is going to be the states you seek out. Okay. So this is the core of the paper. Basically, you do this planning in latent space in order to find the states or action that leads you to a state where you don't know what's going to happen. And you measure that by trying to predict it using slightly different models. And if they disagree a whole bunch, then you can use you sort of you, you say, I don't know what's going to happen. And therefore, I want to go there because I want to learn about that state. Now this, this is the, this is the entire thing. It has a bunch of problems. As you can imagine. So this is the reasoning behind it, right? Now, they try to make a, a deal out of basically, their latent disagreement here agrees with minimize, sorry, maximizing the expected information game. They go into the theory right here and say, okay, if I have a state and an action, and I had, and this W are the dynamics parameters of the world. So the W characterizes how the world works. And the H here is the next state, sorry, the features of the next observation. And the I is the mutual information between H and W. So this right here measures how much information of the next state is contained in the dynamics of the world. If this is really low and I have a good world model, then I should be able to predict the next state really well. And this, this, they say, okay, selecting the most promising data during exploration. We want to select the action that maximizes this information game. So the, the, the more the mutual information here, we want to select the action that maximizes that. They decompose this mutual information into two things. They decompose it into this thing right here, which is simply the entropy of the next state given the current state and action. This is simply the total uncertainty, including the fact that it could actually be stochastic, like dropping a paper, and the fact that you haven't learned yet what happens, like if you drop a ball, but you haven't learned that yet, that is also uncertain. So this is that part. This is the total uncertainty minus this right here. And this is the uncertainty if you know the dynamics, right? So this is the the wind basically in the paper example. So you want something where the total uncertainty is high, but the, the kind of uncertainty of the of the stochasticity of the world is low. If you maximize this quantity here, this total quantity, sorry, if you maximize this entire quantity, because I called one of them total, that means you are going to seek out actions where what's left is only the uncertainty that you yourself don't know, right? You say, well, this state has a pretty high total uncertainty, but it's not due to the fact that the world itself is uncertain. It must be due to the fact that I don't know yet. And they make the claim that their model is actually going after these things. And they say, okay, because we have these these gousins here as our estimators, they somehow reduce to this total to this uncertainty. But only basically by taking gousins, they assume they just assume that this quantity here is constant. At least that's how I understand it. They basically assume that every transition in the world has about the same amount of uncertainty. And therefore we can just focus on the total amount of uncertainty, right? So if we can't predict, if we can't predict the next state A, if we can predict the next state A better than the next state B, and both have about the same amount of intrinsic uncertainty, stochasticity in the world, that must mean we should go to B because that's where our model hasn't learned yet. Now, of course, in the real world, that is absolutely not the case. And I think this model works mainly because they test it in these transitions or in these environments where that might be very close to accurate that actually, most of the transitions have the same stochasticity as any other transition. The second part why this is a bit difficult is because you have to somehow keep this latent, sorry, this couple of models right here that make this disagreement prediction. So you rely on the fact that you can capture disagreement by looking how those models disagree with each other. And again, they employ gousins here, but it is not said that these things will actually give you the true disagreement among themselves. If you initialize them wrongly, they might miss, like if your distribution has three modes, they might just for all of them focus on one of them, and then your disagreement will be completely out of whack or you can initialize them not far enough or too close together. That's the same thing. So it all depends on kind of how you manage to handle this uncertainty right here. So all of this seems a bit problematic, but the whole setup is pretty cool because imagine like all of this is shifting constantly right. The policy here tries to maximize these rewards and that's just something I don't understand. In the paper, they make it sort of explicitly clear that the policy tries to maximize this quantity right here. The next uncertainty, right, the planning objective is to maximize expected novelty RIT, which is this thing right here. However, I don't actually see why in that case you need planning because with planning, your goal is sort of to look ahead more than one step. So what I would expect is that they somehow have the aggregated somehow that they don't maximize this, but somehow they maximize the future right of T prime of RT prime i. They somehow maximize the, yes, they somehow maximize the future, the total future maybe with a disagreement. Like if it was a reward and you actually want to maximize the total reward across your episode, I would imagine they use planning to maximize the total future uncertainty that they encounter because right here you have your trajectories and as they say it, they only maximize the uncertainty after the first step. So this here might be, you know, even intrinsically uncertain or a bit uncertain, but if you go down the path here, there might be a state where that's super uncertain and you would like to find that right through your different rollouts. So I'm not sure that the paper is correct or consistent here actually. I might be wrong though, they do have the code, which is a really good thing. So I'll link to the code and you can go and explore that. They do have this algorithm down here, which is pretty much, I mean, this is saying just nothing. While exploring, do train the world model, train the latent disagreement ensemble, train the policy in imagination of, like, it helps a bit, okay. But one other thing right here, the policy that tries to maximize the reward, right? So you use planning to look ahead where the uncertainty is, but how do you do the planning? You need a policy in imagination space, right? This latent disagreement policy here is used to train how you act in latent space, right? How this action that you imagine comes to be, you can't plan in imagination space and in imagination space, use planning again. It's just an infinite recursion. At some point, you need a model that tells you what to do. And in imagination, they just use an actor critic model, you see they have a value function here. They just use an actor critic model to basically one shot predict the next best, the next best action to get you to the next step. So as they themselves rag on these model free methods because they only look ahead, how is that not exactly the same as me ragging on the fact that they use model free and imagination space? Because your world model certainly is retrospective. Your world model learns from the past, right? So the model free method that learns on your imagined world model learns from retrospective imagination. And therefore, it itself has sort of the same problem, just one layer deeper that it learns from retrospective data and not from data ahead. Because your uncertainty about the future might just be because of your retrospect, it's actually is because of your retrospective data. And I see the value in having this uncertainty. But I think there are other methods that also do model free and don't just maximize an intrinsic reward, but actually maximize a sort of uncertainty. Okay, enough ragging, let's go to the experiment. So the cool thing you can do with this is what's called zero shot performance. So what they do is in a first step, they do this, they just learn task agnostic, just explorer without task. Then second, they go and into their buffer. So when they explore, they all save, they save what they do. There is no reward, but they just save, they store their episodes. Right? And then someone comes with a task and the task is simply they specify like you have to run forward and they go to this buffer and they now label every episode with its reward. So this is different. This is like offline reinforcement learning, right? So basically it is, it is how well they call it zero shot, but it is how well can an algorithm that has explored with self with this kind of self supervision perform in offline reinforcement learning on the trajectories that it has already experienced, which is different from performing the same trajectories in a with the reward, because you would you would learn from the reward and you would learn to seek out different like your experience would be different if you're going after a reward. So this is harder. So they compare this to dreamer and dreamer, sorry, is a fully supervised method. The dreamer is actually cheating. Dreamer actually goes after the reward. And all the other methods here, they don't have a reward and just they're just zero shot offline reinforcement learning generalize to these methods. And you see the green is the plan to explore and that that outperforms almost all the other methods right here down here. And even comes close to this to the dreamer that goes up here. It seemed pretty much every graphic that dreamer is the one that's able to cheat right. So it is performing pretty well. But then the zero shot generalized plan to explore is sometimes on par and certainly outperforms the other intrinsic reward methods. Now how does that go about when you try actually when you allow the model to fine tune on the task. So here is performance on few shot adaptation from raw pixels without state space input. So basically you learn without reward for this many steps right here until these shaded area back here. This is how when you do no reward. And then all of a sudden now you say okay now I'll give you reward. Now please learn now you have this many steps. You have this many steps where you can learn from the reward. So now we're no longer in this offline or else setting. This is now online or hell. But we've been pre-trained with all of this experience that we had without the reward. But again the orange here is the cheater. So the orange is cheating. And now we don't so before the graphs were higher because we've we've actually at each step for example how this works is you train until here without reward and then you do this offline or else offline or else training. And that's how this point comes about. Now I think in the graph down here they they don't do that. So they just measure how well you're doing in the task. And of course if after this many steps you've never looked at the reward. You haven't been able to look at the reward. Your reward will be fairly low right at the task because you don't know what to do to get the higher reward. The dreamer again this orange line is able to cheat. That's why it just is basically straight line or goes up at the beginning. It's able to look at the reward from the beginning and it's here as a baseline comparison. So you see as soon as you give the reward to the models they generally shoot up and this plan to explore generally shoots up much harder than these others as you can see pretty much everywhere. And again it gets competitive and here even outperforms the dreamer. Why could it outperform the supervised method? Maybe because this this method here is sort of confused or is stuck in a local optimum which can happen very easily in reinforcement learning. Whereas the plan to explore has never seen the reward. Therefore hasn't tried to just single-mindedly maximize the reward and has explored a bunch of different things to do in the world and now we can use that knowledge to outperform the plan the dreamer the baseline. So the other thing I would like to draw your attention to here is that sometimes you see that the plan to explore or the other curiosity methods actually get a reward before the reward kicks in as we saw here right. It's for example right here and this tells me that this is probably a property of the environment itself. Namely these reinforcement learning environments they don't really have much noise going on right they pretty much just have it's a simulator with one figure that can walk or not and therefore it might be that the only interesting thing to do in these models is to actually perform one of these tasks and that's why it might be that the sometimes you they already get a reward. So it's true that they don't see the reward for this entire duration but also implicitly via the developers building the simulator they have made it such that the only interesting thing to do is the same thing as getting a reward right. So I'm sort of skeptical that this is like a general exploration policy because also in the real world there are just combinatorically hugely many many actions to do many paths to follow and if you just go by what do I not know yet I think you can't you can't put that all into one model it's just too much and the states where you really where really something interesting happens are so few and far in between and it doesn't compare to the amount of states where you simply don't know most states you don't know what's going to happen but probably nothing nothing interesting is going to happen just different things which will screw over this method completely. In any case they um yeah sorry this is just this is another experiment they have a bunch of other experiments and yeah that that was my this was my review of the paper tell me if you agree or disagree or if I've misunderstood something that's entirely possible I'm just always a bit skeptical of these things a bit um so the experiments they're very compute intensive of course so you never know there and then these specific environments right here you never know there and then the fact that the real world actually has very different stochasticity which they simply assume away right here uh yeah but other than that big props to the fact that the code is out and as I said leave a comment if you agree or disagree uh please subscribe and share this video if you liked it and I'll see you next time bye bye | [{"start": 0.0, "end": 6.8, "text": " Hi there. Today we're looking at planning to explore via self-supervised world models"}, {"start": 6.8, "end": 14.8, "text": " by Ramanan Sekar, Ole Ribkin, Kostas Danieli, Dis Pieter Abil, Dani Gerhoffner, and"}, {"start": 14.8, "end": 23.76, "text": " Depak Patak. So this is a paper that concerns reinforcement learning and specifically,"}, {"start": 23.76, "end": 28.96, "text": " sort of self-supervised reinforcement learning. So what do they mean? There's a graphic"}, {"start": 28.96, "end": 35.6, "text": " right here. In reinforcement learning usually you have an environment and an agent, right?"}, {"start": 35.6, "end": 45.040000000000006, "text": " So you have this environment and let's ignore the without rewards for now. And you have the agent"}, {"start": 45.760000000000005, "end": 51.44, "text": " and the agent needs to interact with the environment in order to achieve a maximum reward."}, {"start": 51.44, "end": 56.72, "text": " So the reward is given by a certain task, right? You have to do something in this environment."}, {"start": 56.72, "end": 63.12, "text": " In this case they consider these types of tasks where I think the top task might be called"}, {"start": 63.12, "end": 71.84, "text": " run forward. So your reward is more the further you go with this walker. And how you can influence"}, {"start": 71.84, "end": 77.92, "text": " the walker is you can sort of give a bit of force onto its joints right here. And you have a"}, {"start": 77.92, "end": 82.88, "text": " bunch of sensors. So the main task is actually to keep it to balance it on its feet and then sort of"}, {"start": 82.88, "end": 88.96, "text": " walk forward such that it never falls over. Otherwise you get negative reward. You lose."}, {"start": 90.72, "end": 97.28, "text": " So in this case what they want to do is they want to say, wait, if we just train a reinforcement"}, {"start": 97.28, "end": 103.91999999999999, "text": " learning agent for each of these tasks individually that will use a lot of data. And basically we can't"}, {"start": 103.91999999999999, "end": 110.64, "text": " reuse the learned reinforcement learning agent for each of these individual tasks. It's sort of like"}, {"start": 110.64, "end": 118.32, "text": " if you have many you know image tasks or NLP tasks you don't want to learn one model for each one"}, {"start": 118.32, "end": 124.48, "text": " individually, but you might do something like a common joint pre-training. And this is exactly"}, {"start": 124.48, "end": 130.96, "text": " this for reinforcement learning. And it's even called self supervised, right? Like we are used to"}, {"start": 130.96, "end": 138.8, "text": " in the in the classification setting self supervised learning. What does it mean? So it means that at"}, {"start": 138.8, "end": 144.24, "text": " first you're in an environment without rewards. So basically the agent is just dropped in an"}, {"start": 144.24, "end": 150.96, "text": " environment. And there's no rewards. It can just do actions and observes up the states from this"}, {"start": 150.96, "end": 159.76000000000002, "text": " environment. And after that after a while of that, then the tasks come in. So task A, task B and"}, {"start": 159.76000000000002, "end": 165.44, "text": " task C are three different tasks all in the same environment, but all requiring the agent to do"}, {"start": 165.44, "end": 171.44, "text": " different things like running forward or running backwards or do a front flip or things like this."}, {"start": 172.48, "end": 180.07999999999998, "text": " So the how fast the agent can adapt to these individual tasks very much depends on what it has"}, {"start": 180.07999999999998, "end": 187.2, "text": " learned during this phase where there were no rewards, right? So the agent is tasked to just"}, {"start": 187.2, "end": 193.28, "text": " explore the world via what they call here task agnostic exploration to explore the world to learn"}, {"start": 193.28, "end": 201.2, "text": " something about the world in order then to generalize to these tasks. And in their case, they"}, {"start": 201.2, "end": 208.08, "text": " learn this global world model. So the agent is supposed to learn somehow how the world works,"}, {"start": 208.08, "end": 216.48, "text": " right? And this is this is the the way that this agent is then able to adapt really quickly."}, {"start": 216.48, "end": 225.28, "text": " So in essence, what does this agent do? The agent works as follows. It gets an input observation"}, {"start": 225.28, "end": 231.51999999999998, "text": " and it runs that through an encoder, which is usually something like a convolutional neural"}, {"start": 231.51999999999998, "end": 238.56, "text": " network. And that will give you a set of features, right? So this is sort of an embedding of the state"}, {"start": 238.56, "end": 247.04, "text": " that you're in. And that you can incorporate into a latent state at time t. Now usually in these"}, {"start": 247.04, "end": 254.16, "text": " RL algorithms or what can happen is that you incorporate the last agent latent state. So the latent"}, {"start": 254.16, "end": 260.32, "text": " state from the step here also goes into the latent state of the next step, right? So here was the"}, {"start": 260.32, "end": 267.52, "text": " sorry, the last observation observation comes in features latent state and so on. Ultimately,"}, {"start": 267.52, "end": 273.28, "text": " and then and so on and comes in from here. And there's usually like an RNN going over the time"}, {"start": 273.28, "end": 281.91999999999996, "text": " steps. But ultimately here, the agent has to decide on an action using this policy network."}, {"start": 282.64, "end": 287.12, "text": " Now, how is this trained to this policy network? It has to come up with an action, but there are"}, {"start": 287.12, "end": 293.76, "text": " no rewards. So usually we would train this policy network with like an actor critic method. So we"}, {"start": 293.76, "end": 299.84, "text": " would also train some sort of a value function. And then the policy would try to maximize the value"}, {"start": 299.84, "end": 307.36, "text": " function. And but if we don't have rewards, how are we going to do that? So people have thought about"}, {"start": 307.36, "end": 315.03999999999996, "text": " this for a bit. And people have come up with things like intrinsic motivation, intrinsic motivation"}, {"start": 315.04, "end": 324.8, "text": " is a term where you're trying to say something like if you're in a room right here like this,"}, {"start": 324.8, "end": 333.36, "text": " your agent is right here, then you just you know, you do something and maybe your agent goes down"}, {"start": 333.36, "end": 341.04, "text": " here, right? If your agent were to go down there again, it would sort of not really learn anything"}, {"start": 341.04, "end": 348.08000000000004, "text": " because it has now already gone there. There's already learned from those states. So you might want to"}, {"start": 348.96000000000004, "end": 355.28000000000003, "text": " explore some different space, right? Like here. And in the next episode, you might one explore"}, {"start": 355.28000000000003, "end": 362.32000000000005, "text": " this room right here. So this this notion of intrinsic motivation to explore, it has a bunch of"}, {"start": 362.32000000000005, "end": 368.56, "text": " different formulations of how exactly you can formulate it. But just imagine basically the entire"}, {"start": 368.56, "end": 374.24, "text": " state is filled with a bunch of coins. And I'm going to draw this as green dots sort of like"}, {"start": 374.24, "end": 383.2, "text": " Pac-Man and everything is filled with these green dots, right? And what the agent wants to do if"}, {"start": 383.2, "end": 390.16, "text": " it has no rewards, it will simply collect those green dots. And once one is collected. So if I go"}, {"start": 390.16, "end": 395.36, "text": " here, I'll collect all these green dots. These are now no longer there, right? So that area doesn't"}, {"start": 395.36, "end": 403.6, "text": " give me any reward anymore. So you can imagine sort of like this. So as an intrinsic reward,"}, {"start": 403.6, "end": 409.44, "text": " you simply reward the agent every time it finds itself in a new state that it hasn't seen before."}, {"start": 409.44, "end": 417.2, "text": " So you train it to seek out novel states. Now usually when you just have like an actor critic method"}, {"start": 417.2, "end": 423.76, "text": " and that's what this paper here criticizes, if you have it, it's called retrospective novelty."}, {"start": 423.76, "end": 430.88, "text": " That means if you train a model free algorithm, which is an actor critic, right? If we just plug"}, {"start": 430.88, "end": 441.44, "text": " in into here something like a3c, that will simply have a policy and a value function. And in this case,"}, {"start": 441.44, "end": 446.8, "text": " if we train it on intrinsic reward, the policy will simply tell you where to go to find more green"}, {"start": 446.8, "end": 456.0, "text": " stuff. But you can only train it. So you use this to run an episode. And then you observe how"}, {"start": 456.0, "end": 460.96000000000004, "text": " many green things you found in that episode, right? If your episode goes here and then you put"}, {"start": 460.96000000000004, "end": 466.16, "text": " that back into your buffer to learn from. But at that point, you've already collected the green"}, {"start": 466.16, "end": 473.52, "text": " things, right? So the reward signal is actually a bit off because you want to train your agent that"}, {"start": 473.52, "end": 478.88, "text": " there that it should seek out novel things. But as soon as you've explored them, they're not really"}, {"start": 478.88, "end": 484.32, "text": " novel anymore because you have now explored them. But still you're going to train your agent"}, {"start": 485.03999999999996, "end": 491.91999999999996, "text": " telling your agent that this area right here has lots of has given me lots of rewards. So the agent"}, {"start": 491.91999999999996, "end": 500.08, "text": " is going to be encouraged to repeat that. They say this right here, the retrospective novelty,"}, {"start": 500.08, "end": 505.91999999999996, "text": " model free exploration methods, not only require large amounts of experience to adapt to downstream"}, {"start": 505.91999999999996, "end": 512.88, "text": " tests, they can also be inefficient during exploration. These agents usually first act in the environment,"}, {"start": 513.92, "end": 520.72, "text": " collect trajectories, and then calculate an intrinsic reward as the agent's current estimate of"}, {"start": 520.72, "end": 528.48, "text": " novelty. This approach misses out on efficiency by operating retrospectively. That is, the novelty"}, {"start": 528.48, "end": 536.64, "text": " of inputs is computed after the agent has already reached them. Hence it seeks out previously novel"}, {"start": 536.64, "end": 543.36, "text": " inputs that have already been visited and would not be novel anymore. Instead one should directly seek"}, {"start": 543.36, "end": 550.5600000000001, "text": " out future inputs that are expected to be novel. Now, so what this paper is doing, it's basically saying,"}, {"start": 550.56, "end": 558.9599999999999, "text": " can we build a model that estimates the future novelty of a state that we maybe haven't seen so far?"}, {"start": 560.0799999999999, "end": 566.8, "text": " And here is where that goes. So what do they do in this policy? So the policy isn't just trained"}, {"start": 566.8, "end": 575.1199999999999, "text": " to maximize the novelty in the world. Instead, sorry, it uses planning. It uses planning in"}, {"start": 575.12, "end": 583.68, "text": " latent space. So what this model does is it learns a world model in latent space. The world model takes"}, {"start": 583.68, "end": 591.2, "text": " as input these features that you saw right here that encoder gives you and it predicts the future"}, {"start": 591.2, "end": 599.76, "text": " hidden latent states. These are the things you saw here. So these things that are always made by"}, {"start": 599.76, "end": 605.92, "text": " incorporating the new features with the old state, it tries to predict it. So technically these"}, {"start": 605.92, "end": 612.88, "text": " things here should have like some sort of, no, this is actually exact here, but these here should"}, {"start": 612.88, "end": 620.16, "text": " have some sort of a tick or something to indicate. These are estimated, these are estimated future"}, {"start": 620.16, "end": 626.8, "text": " states. And this model right here, this is an estimate, this is a world model. They use Dreamer"}, {"start": 626.8, "end": 632.7199999999999, "text": " for this. And I have made a video about Dreamer. Dreamer tries exactly that. It tries to estimate"}, {"start": 632.7199999999999, "end": 643.92, "text": " what is the future, but not in actual world space, but in latent space. And yeah, so it tries to"}, {"start": 643.92, "end": 649.5999999999999, "text": " estimate its own future. And the cool thing here is that this is probabilistic or you can make"}, {"start": 649.5999999999999, "end": 655.52, "text": " it probabilistic. So you can technically from this one age that you have here, you can run out"}, {"start": 655.52, "end": 661.52, "text": " many futures in your imagination. And since you don't need the observations, you only need the"}, {"start": 661.52, "end": 667.52, "text": " latent space, you can simply forward roll your RNN example from it and you have many trajectories"}, {"start": 667.52, "end": 675.84, "text": " in the future. Now the fact that you have many trajectories leads to even a different thing."}, {"start": 675.84, "end": 683.52, "text": " So what you can do for each of these hidden states, they have a head here that predicts the"}, {"start": 683.52, "end": 689.52, "text": " so-called latent disagreement. What does this do? This consists of a whole bunch of models."}, {"start": 689.52, "end": 696.56, "text": " These are ensemble models. They're the same for each time step. But what they take in,"}, {"start": 697.92, "end": 706.48, "text": " they take in the latent state of the model and the action that you're about to do, the action"}, {"start": 706.48, "end": 712.0, "text": " that you imagine you would do. So this is the imagined state and this is the imagined action"}, {"start": 712.0, "end": 721.76, "text": " in that state. And then it will compute the next features. So the next, whatever in the next step"}, {"start": 721.76, "end": 731.04, "text": " would be the age. So right, right, where do we put it? Whatever in the next. So if I have this age"}, {"start": 731.04, "end": 745.92, "text": " and I have this state, it tells me if I do action a1 and if I were to execute this in the real world,"}, {"start": 745.92, "end": 752.64, "text": " what would be my next age that I would get? So basically by performing an action, I will get the"}, {"start": 752.64, "end": 760.4, "text": " next observation and I will encode that to get the next features and this small model would try to"}, {"start": 760.4, "end": 770.24, "text": " predict what are the features of the next state. If I were to execute this action in this state,"}, {"start": 770.24, "end": 779.4399999999999, "text": " okay? So it's kind of a future predictor. But also not in observation space, but in latent space."}, {"start": 779.4399999999999, "end": 783.52, "text": " So it tries to predict the latent features of the next observation."}, {"start": 783.52, "end": 791.6, "text": " And the, this split here, you might think that there is bit of a, it's like almost the same,"}, {"start": 791.6, "end": 799.12, "text": " this latent state here and the features. But as we discussed before, the latent state can incorporate"}, {"start": 799.12, "end": 805.12, "text": " the last or the history of latent states. Well, the features simply are only a function of the"}, {"start": 805.12, "end": 810.88, "text": " current observation. And that's why they predict the features. They really want to predict the"}, {"start": 810.88, "end": 817.04, "text": " observation. But history has sort of shown that if you try to predict, for example, the pixels of"}, {"start": 817.04, "end": 823.68, "text": " the observation that won't serve you really well. And therefore what you need to do is you need to"}, {"start": 824.48, "end": 828.64, "text": " predict the latent features of the observation that works much better."}, {"start": 830.16, "end": 834.64, "text": " So they have a bunch of these models right here. They have a bunch of models with different"}, {"start": 834.64, "end": 841.68, "text": " parameterizations. They instantiate K different models of that. And they all run the same. So these"}, {"start": 841.68, "end": 846.3199999999999, "text": " are all the same inputs through these different models. Now these different models have been"}, {"start": 846.3199999999999, "end": 852.72, "text": " initialized at different points. So they will make slightly different predictions. And the crucial"}, {"start": 852.72, "end": 859.36, "text": " part is, so if, if it's really deterministic, what the next state is going to be, right? So say"}, {"start": 859.36, "end": 866.5600000000001, "text": " you're in this state, you perform this action. And so if you have a ball in your hand and you drop"}, {"start": 866.5600000000001, "end": 871.36, "text": " the ball, then the ball is going to fall down. Really deterministic. That means these"}, {"start": 872.4, "end": 880.24, "text": " next, these estimated next features, if the models are any good, they all agree. And this variance"}, {"start": 880.24, "end": 889.76, "text": " here between the estimates is very, very small. And now if the uncertainty over the next state"}, {"start": 889.76, "end": 895.52, "text": " is very high, and this can be due to two facts either, it is actually uncertain what's going to"}, {"start": 895.52, "end": 901.36, "text": " happen. So maybe you have a really a piece of paper and you drop that and due to the wind,"}, {"start": 901.36, "end": 907.04, "text": " you can't know what's happening. Or because your model has simply not learned yet what's going to"}, {"start": 907.04, "end": 913.76, "text": " happen. In either of those cases, you don't know what's going to happen. Therefore these,"}, {"start": 913.76, "end": 922.0, "text": " these predictions here, sorry, are going to be very different from each other. And because of that,"}, {"start": 922.0, "end": 929.04, "text": " this variance will be high. And this variance you take as the intrinsic reward. So in each step,"}, {"start": 929.04, "end": 940.0799999999999, "text": " you basically try to predict over the next actions you can do, which ones leads me to a situation"}, {"start": 940.0799999999999, "end": 947.4399999999999, "text": " where I don't know what's going to happen, where I cannot really predict. The variance in my"}, {"start": 947.4399999999999, "end": 953.52, "text": " prediction is high. So I really don't know what's going to happen. And that is going to be the states"}, {"start": 953.52, "end": 959.4399999999999, "text": " you seek out. Okay. So this is the core of the paper. Basically, you do this planning in"}, {"start": 959.4399999999999, "end": 967.12, "text": " latent space in order to find the states or action that leads you to a state where you don't know"}, {"start": 967.12, "end": 973.28, "text": " what's going to happen. And you measure that by trying to predict it using slightly different"}, {"start": 973.28, "end": 981.76, "text": " models. And if they disagree a whole bunch, then you can use you sort of you, you say, I don't"}, {"start": 981.76, "end": 985.28, "text": " know what's going to happen. And therefore, I want to go there because I want to learn about that"}, {"start": 985.28, "end": 994.48, "text": " state. Now this, this is the, this is the entire thing. It has a bunch of problems. As you can imagine."}, {"start": 994.48, "end": 1005.68, "text": " So this is the reasoning behind it, right? Now, they try to make a, a deal out of basically,"}, {"start": 1005.68, "end": 1013.04, "text": " their latent disagreement here agrees with minimize, sorry, maximizing the expected information"}, {"start": 1013.04, "end": 1019.68, "text": " game. They go into the theory right here and say, okay, if I have a state and an action,"}, {"start": 1020.88, "end": 1028.8, "text": " and I had, and this W are the dynamics parameters of the world. So the W characterizes how the"}, {"start": 1028.8, "end": 1036.72, "text": " world works. And the H here is the next state, sorry, the features of the next observation. And the"}, {"start": 1036.72, "end": 1045.2, "text": " I is the mutual information between H and W. So this right here measures how much information"}, {"start": 1046.8799999999999, "end": 1053.2, "text": " of the next state is contained in the dynamics of the world. If this is really low and I have a"}, {"start": 1053.2, "end": 1061.6000000000001, "text": " good world model, then I should be able to predict the next state really well. And this, this,"}, {"start": 1062.16, "end": 1068.32, "text": " they say, okay, selecting the most promising data during exploration. We want to select the action"}, {"start": 1068.32, "end": 1078.24, "text": " that maximizes this information game. So the, the, the more the mutual information here, we want"}, {"start": 1078.24, "end": 1084.56, "text": " to select the action that maximizes that. They decompose this mutual information into two things."}, {"start": 1085.52, "end": 1093.68, "text": " They decompose it into this thing right here, which is simply the entropy of the next state"}, {"start": 1093.68, "end": 1101.28, "text": " given the current state and action. This is simply the total uncertainty, including the fact that"}, {"start": 1101.28, "end": 1106.48, "text": " it could actually be stochastic, like dropping a paper, and the fact that you haven't learned yet"}, {"start": 1106.48, "end": 1110.96, "text": " what happens, like if you drop a ball, but you haven't learned that yet, that is also uncertain."}, {"start": 1112.56, "end": 1121.3600000000001, "text": " So this is that part. This is the total uncertainty minus this right here. And this is the uncertainty"}, {"start": 1121.3600000000001, "end": 1128.88, "text": " if you know the dynamics, right? So this is the the wind basically in the paper example."}, {"start": 1128.88, "end": 1138.72, "text": " So you want something where the total uncertainty is high, but the, the kind of uncertainty of the"}, {"start": 1138.72, "end": 1146.4, "text": " of the stochasticity of the world is low. If you maximize this quantity here, this total quantity,"}, {"start": 1146.4, "end": 1154.4, "text": " sorry, if you maximize this entire quantity, because I called one of them total, that means you"}, {"start": 1154.4, "end": 1161.92, "text": " are going to seek out actions where what's left is only the uncertainty that you yourself don't"}, {"start": 1161.92, "end": 1167.2800000000002, "text": " know, right? You say, well, this state has a pretty high total uncertainty, but it's not due to"}, {"start": 1167.2800000000002, "end": 1172.96, "text": " the fact that the world itself is uncertain. It must be due to the fact that I don't know yet."}, {"start": 1174.0, "end": 1181.2800000000002, "text": " And they make the claim that their model is actually going after these things. And they say,"}, {"start": 1181.28, "end": 1190.8799999999999, "text": " okay, because we have these these gousins here as our estimators, they somehow reduce to this"}, {"start": 1190.8799999999999, "end": 1198.16, "text": " total to this uncertainty. But only basically by taking gousins, they assume they just assume"}, {"start": 1199.04, "end": 1207.44, "text": " that this quantity here is constant. At least that's how I understand it. They basically assume that"}, {"start": 1207.44, "end": 1213.1200000000001, "text": " every transition in the world has about the same amount of uncertainty. And therefore we can"}, {"start": 1213.1200000000001, "end": 1218.96, "text": " just focus on the total amount of uncertainty, right? So if we can't predict, if we can't predict the"}, {"start": 1219.92, "end": 1227.1200000000001, "text": " next state A, if we can predict the next state A better than the next state B, and both have about"}, {"start": 1227.1200000000001, "end": 1235.2, "text": " the same amount of intrinsic uncertainty, stochasticity in the world, that must mean we should go"}, {"start": 1235.2, "end": 1240.0, "text": " to B because that's where our model hasn't learned yet. Now, of course, in the real world, that is"}, {"start": 1240.0, "end": 1246.96, "text": " absolutely not the case. And I think this model works mainly because they test it in these"}, {"start": 1246.96, "end": 1253.1200000000001, "text": " transitions or in these environments where that might be very close to accurate that actually,"}, {"start": 1253.1200000000001, "end": 1262.88, "text": " most of the transitions have the same stochasticity as any other transition. The second part"}, {"start": 1262.88, "end": 1270.64, "text": " why this is a bit difficult is because you have to somehow keep this latent, sorry, this"}, {"start": 1271.6000000000001, "end": 1280.4, "text": " couple of models right here that make this disagreement prediction. So you rely on the fact that you"}, {"start": 1280.4, "end": 1287.5200000000002, "text": " can capture disagreement by looking how those models disagree with each other. And again, they employ"}, {"start": 1287.52, "end": 1296.08, "text": " gousins here, but it is not said that these things will actually give you the true disagreement"}, {"start": 1296.08, "end": 1302.8799999999999, "text": " among themselves. If you initialize them wrongly, they might miss, like if your distribution has"}, {"start": 1302.8799999999999, "end": 1309.68, "text": " three modes, they might just for all of them focus on one of them, and then your disagreement will"}, {"start": 1309.68, "end": 1319.28, "text": " be completely out of whack or you can initialize them not far enough or too close together. That's"}, {"start": 1319.28, "end": 1326.3200000000002, "text": " the same thing. So it all depends on kind of how you manage to handle this uncertainty right here."}, {"start": 1327.1200000000001, "end": 1333.68, "text": " So all of this seems a bit problematic, but the whole setup is pretty cool because"}, {"start": 1333.68, "end": 1341.1200000000001, "text": " imagine like all of this is shifting constantly right. The policy here tries to maximize these"}, {"start": 1341.1200000000001, "end": 1346.5600000000002, "text": " rewards and that's just something I don't understand. In the paper, they make it sort of explicitly"}, {"start": 1346.5600000000002, "end": 1353.28, "text": " clear that the policy tries to maximize this quantity right here. The next uncertainty,"}, {"start": 1353.28, "end": 1365.28, "text": " right, the planning objective is to maximize expected novelty RIT, which is this thing right here."}, {"start": 1366.0, "end": 1375.6, "text": " However, I don't actually see why in that case you need planning because with planning,"}, {"start": 1375.6, "end": 1384.24, "text": " your goal is sort of to look ahead more than one step. So what I would expect is that they somehow"}, {"start": 1384.24, "end": 1391.04, "text": " have the aggregated somehow that they don't maximize this, but somehow they maximize the future"}, {"start": 1391.04, "end": 1401.04, "text": " right of T prime of RT prime i. They somehow maximize the, yes, they somehow maximize the"}, {"start": 1401.04, "end": 1407.2, "text": " future, the total future maybe with a disagreement. Like if it was a reward and you actually want to"}, {"start": 1407.2, "end": 1413.84, "text": " maximize the total reward across your episode, I would imagine they use planning to maximize the total"}, {"start": 1414.3999999999999, "end": 1421.44, "text": " future uncertainty that they encounter because right here you have your trajectories and"}, {"start": 1422.3999999999999, "end": 1428.48, "text": " as they say it, they only maximize the uncertainty after the first step. So this here might be,"}, {"start": 1428.48, "end": 1434.16, "text": " you know, even intrinsically uncertain or a bit uncertain, but if you go down the path here,"}, {"start": 1434.16, "end": 1439.84, "text": " there might be a state where that's super uncertain and you would like to find that right through"}, {"start": 1439.84, "end": 1446.56, "text": " your different rollouts. So I'm not sure that the paper is correct or consistent here actually."}, {"start": 1448.16, "end": 1452.96, "text": " I might be wrong though, they do have the code, which is a really good thing. So I'll link to the"}, {"start": 1452.96, "end": 1460.56, "text": " code and you can go and explore that. They do have this algorithm down here, which is pretty much,"}, {"start": 1460.56, "end": 1467.68, "text": " I mean, this is saying just nothing. While exploring, do train the world model, train the latent"}, {"start": 1467.68, "end": 1475.92, "text": " disagreement ensemble, train the policy in imagination of, like, it helps a bit, okay."}, {"start": 1475.92, "end": 1486.0800000000002, "text": " But one other thing right here, the policy that tries to maximize the reward, right? So you use"}, {"start": 1486.0800000000002, "end": 1493.92, "text": " planning to look ahead where the uncertainty is, but how do you do the planning? You need a policy"}, {"start": 1493.92, "end": 1503.28, "text": " in imagination space, right? This latent disagreement policy here is used to train how you act in"}, {"start": 1503.28, "end": 1511.68, "text": " latent space, right? How this action that you imagine comes to be, you can't plan in imagination space"}, {"start": 1511.68, "end": 1516.56, "text": " and in imagination space, use planning again. It's just an infinite recursion. At some point,"}, {"start": 1516.56, "end": 1522.32, "text": " you need a model that tells you what to do. And in imagination, they just use an actor critic model,"}, {"start": 1522.32, "end": 1527.6, "text": " you see they have a value function here. They just use an actor critic model to basically one shot"}, {"start": 1527.6, "end": 1539.04, "text": " predict the next best, the next best action to get you to the next step. So as they themselves"}, {"start": 1539.76, "end": 1548.7199999999998, "text": " rag on these model free methods because they only look ahead, how is that not exactly the same"}, {"start": 1549.36, "end": 1556.1599999999999, "text": " as me ragging on the fact that they use model free and imagination space? Because your world model"}, {"start": 1556.16, "end": 1563.8400000000001, "text": " certainly is retrospective. Your world model learns from the past, right? So the model free method"}, {"start": 1563.8400000000001, "end": 1571.3600000000001, "text": " that learns on your imagined world model learns from retrospective imagination. And therefore,"}, {"start": 1573.2, "end": 1579.68, "text": " it itself has sort of the same problem, just one layer deeper that it learns from retrospective"}, {"start": 1579.68, "end": 1587.44, "text": " data and not from data ahead. Because your uncertainty about the future might just be because of your"}, {"start": 1587.44, "end": 1592.5600000000002, "text": " retrospect, it's actually is because of your retrospective data. And I see the value in having"}, {"start": 1592.5600000000002, "end": 1600.8, "text": " this uncertainty. But I think there are other methods that also do model free and don't just"}, {"start": 1600.8, "end": 1607.92, "text": " maximize an intrinsic reward, but actually maximize a sort of uncertainty. Okay, enough ragging,"}, {"start": 1607.92, "end": 1615.52, "text": " let's go to the experiment. So the cool thing you can do with this is what's called zero shot"}, {"start": 1615.52, "end": 1625.04, "text": " performance. So what they do is in a first step, they do this, they just learn task agnostic,"}, {"start": 1625.04, "end": 1635.1200000000001, "text": " just explorer without task. Then second, they go and into their buffer. So when they explore,"}, {"start": 1635.12, "end": 1640.0, "text": " they all save, they save what they do. There is no reward, but they just save, they store their"}, {"start": 1640.0, "end": 1648.4799999999998, "text": " episodes. Right? And then someone comes with a task and the task is simply they specify like you"}, {"start": 1648.4799999999998, "end": 1655.6799999999998, "text": " have to run forward and they go to this buffer and they now label every episode with its reward."}, {"start": 1655.6799999999998, "end": 1662.32, "text": " So this is different. This is like offline reinforcement learning, right? So basically it is,"}, {"start": 1662.32, "end": 1669.6, "text": " it is how well they call it zero shot, but it is how well can an algorithm that has explored"}, {"start": 1670.32, "end": 1680.48, "text": " with self with this kind of self supervision perform in offline reinforcement learning"}, {"start": 1680.48, "end": 1688.1599999999999, "text": " on the trajectories that it has already experienced, which is different from performing the same"}, {"start": 1688.16, "end": 1693.8400000000001, "text": " trajectories in a with the reward, because you would you would learn from the reward and you"}, {"start": 1693.8400000000001, "end": 1699.28, "text": " would learn to seek out different like your experience would be different if you're going after a"}, {"start": 1699.28, "end": 1709.0400000000002, "text": " reward. So this is harder. So they compare this to dreamer and dreamer, sorry, is a fully supervised"}, {"start": 1709.0400000000002, "end": 1715.6000000000001, "text": " method. The dreamer is actually cheating. Dreamer actually goes after the reward. And all the other"}, {"start": 1715.6, "end": 1722.32, "text": " methods here, they don't have a reward and just they're just zero shot offline reinforcement learning"}, {"start": 1722.32, "end": 1729.4399999999998, "text": " generalize to these methods. And you see the green is the plan to explore and that that outperforms"}, {"start": 1730.0, "end": 1737.52, "text": " almost all the other methods right here down here. And even comes close to this to the dreamer"}, {"start": 1737.52, "end": 1743.84, "text": " that goes up here. It seemed pretty much every graphic that dreamer is the one that's able to cheat"}, {"start": 1743.84, "end": 1752.8, "text": " right. So it is performing pretty well. But then the zero shot generalized plan to explore"}, {"start": 1753.4399999999998, "end": 1759.52, "text": " is sometimes on par and certainly outperforms the other intrinsic reward methods."}, {"start": 1761.76, "end": 1771.04, "text": " Now how does that go about when you try actually when you allow the model to fine tune on the task."}, {"start": 1771.04, "end": 1776.8, "text": " So here is performance on few shot adaptation from raw pixels without state space input."}, {"start": 1777.6, "end": 1786.24, "text": " So basically you learn without reward for this many steps right here until these shaded area back"}, {"start": 1786.24, "end": 1794.08, "text": " here. This is how when you do no reward. And then all of a sudden now you say okay now I'll give"}, {"start": 1794.08, "end": 1802.08, "text": " you reward. Now please learn now you have this many steps. You have this many steps where you can"}, {"start": 1802.08, "end": 1807.84, "text": " learn from the reward. So now we're no longer in this offline or else setting. This is now online"}, {"start": 1807.84, "end": 1812.96, "text": " or hell. But we've been pre-trained with all of this experience that we had without the reward."}, {"start": 1812.96, "end": 1824.8, "text": " But again the orange here is the cheater. So the orange is cheating. And now we don't so before the"}, {"start": 1824.8, "end": 1833.52, "text": " graphs were higher because we've we've actually at each step for example how this works is you train"}, {"start": 1833.52, "end": 1840.8, "text": " until here without reward and then you do this offline or else offline or else training. And that's"}, {"start": 1840.8, "end": 1848.72, "text": " how this point comes about. Now I think in the graph down here they they don't do that. So they just"}, {"start": 1848.72, "end": 1856.0, "text": " measure how well you're doing in the task. And of course if after this many steps you've never"}, {"start": 1856.0, "end": 1862.3999999999999, "text": " looked at the reward. You haven't been able to look at the reward. Your reward will be fairly low"}, {"start": 1862.3999999999999, "end": 1868.48, "text": " right at the task because you don't know what to do to get the higher reward. The dreamer again this"}, {"start": 1868.48, "end": 1873.52, "text": " orange line is able to cheat. That's why it just is basically straight line or goes up at the"}, {"start": 1873.52, "end": 1878.56, "text": " beginning. It's able to look at the reward from the beginning and it's here as a baseline comparison."}, {"start": 1878.56, "end": 1886.56, "text": " So you see as soon as you give the reward to the models they generally shoot up and this plan to"}, {"start": 1886.56, "end": 1892.72, "text": " explore generally shoots up much harder than these others as you can see pretty much everywhere. And"}, {"start": 1892.72, "end": 1901.1200000000001, "text": " again it gets competitive and here even outperforms the dreamer. Why could it outperform the supervised"}, {"start": 1901.1200000000001, "end": 1908.72, "text": " method? Maybe because this this method here is sort of confused or is stuck in a local optimum"}, {"start": 1908.72, "end": 1914.56, "text": " which can happen very easily in reinforcement learning. Whereas the plan to explore has never"}, {"start": 1914.56, "end": 1920.64, "text": " seen the reward. Therefore hasn't tried to just single-mindedly maximize the reward and has"}, {"start": 1920.64, "end": 1926.0, "text": " explored a bunch of different things to do in the world and now we can use that knowledge to outperform"}, {"start": 1926.0, "end": 1933.76, "text": " the plan the dreamer the baseline. So the other thing I would like to draw your attention to here"}, {"start": 1933.76, "end": 1941.44, "text": " is that sometimes you see that the plan to explore or the other curiosity methods actually"}, {"start": 1942.5600000000002, "end": 1947.3600000000001, "text": " get a reward before the reward kicks in as we saw here right."}, {"start": 1947.36, "end": 1958.3999999999999, "text": " It's for example right here and this tells me that this is probably a property of the environment"}, {"start": 1958.3999999999999, "end": 1963.76, "text": " itself. Namely these reinforcement learning environments they don't really have much noise going"}, {"start": 1963.76, "end": 1969.36, "text": " on right they pretty much just have it's a simulator with one figure that can walk or not"}, {"start": 1969.36, "end": 1978.56, "text": " and therefore it might be that the only interesting thing to do in these models is to actually perform"}, {"start": 1978.56, "end": 1985.84, "text": " one of these tasks and that's why it might be that the sometimes you they already get a reward."}, {"start": 1985.84, "end": 1995.6, "text": " So it's true that they don't see the reward for this entire duration but also implicitly via the"}, {"start": 1995.6, "end": 2001.6799999999998, "text": " developers building the simulator they have made it such that the only interesting thing to do"}, {"start": 2001.6799999999998, "end": 2010.8799999999999, "text": " is the same thing as getting a reward right. So I'm sort of skeptical that this is like a general"}, {"start": 2010.8799999999999, "end": 2019.12, "text": " exploration policy because also in the real world there are just combinatorically hugely many many"}, {"start": 2019.12, "end": 2028.8, "text": " actions to do many paths to follow and if you just go by what do I not know yet I think you can't"}, {"start": 2028.8, "end": 2035.76, "text": " you can't put that all into one model it's just too much and the states where you really"}, {"start": 2035.76, "end": 2043.52, "text": " where really something interesting happens are so few and far in between and it doesn't"}, {"start": 2043.52, "end": 2047.76, "text": " compare to the amount of states where you simply don't know most states you don't know what's"}, {"start": 2047.76, "end": 2054.0, "text": " going to happen but probably nothing nothing interesting is going to happen just different things"}, {"start": 2054.8, "end": 2064.96, "text": " which will screw over this method completely. In any case they um yeah sorry this is just this"}, {"start": 2064.96, "end": 2071.84, "text": " is another experiment they have a bunch of other experiments and yeah that that was my this was my"}, {"start": 2071.84, "end": 2078.1600000000003, "text": " review of the paper tell me if you agree or disagree or if I've misunderstood something that's"}, {"start": 2078.1600000000003, "end": 2089.2000000000003, "text": " entirely possible I'm just always a bit skeptical of these things a bit um so the experiments they're"}, {"start": 2089.2000000000003, "end": 2094.96, "text": " very compute intensive of course so you never know there and then these specific environments"}, {"start": 2094.96, "end": 2101.2000000000003, "text": " right here you never know there and then the fact that the real world actually has very different"}, {"start": 2101.2, "end": 2109.52, "text": " stochasticity which they simply assume away right here uh yeah but other than that big props to"}, {"start": 2109.52, "end": 2116.8799999999997, "text": " the fact that the code is out and as I said leave a comment if you agree or disagree uh please"}, {"start": 2116.88, "end": 2134.1600000000003, "text": " subscribe and share this video if you liked it and I'll see you next time bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=XvDzZwoQFcU | [News] Facebook's Real-Time TTS system runs on CPUs only! | Facebook AI's new Text-To-Speech system is able to create 1 second of speech in as little as 500ms, making it real-time. What's even more impressive is the fact that this does not require a rack of GPUs, but runs on merely 4 CPUs.
OUTLINE:
0:00 - Intro
1:00 - Problem Formulation
3:20 - System Explanation
15:00 - Speeding up the computation
https://ai.facebook.com/blog/a-highly-efficient-real-time-text-to-speech-system-deployed-on-cpus/
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 this out. Modern text-to-speech systems have come a long way in using neural networks to mimic the nuances of human voice. To generate human-like audio, one second of speech can require a TTS system to output as many as 24,000 samples, sometimes even more. The size and complexity of state-of-the-art models require massive computation, which often needs to run on GPUs or other specialized hardware. So this is generated by a system that Facebook AI has built, and we're going to look at it. It's called a highly efficient real-time text-to-speech system deployed on CPUs. There's a lot to unpack here, but this is not a paper. This is basically a technical blog post because I think they built this into their products and it's mainly explaining on a high level what they did. So they have a real-time text-to-speech system, which means that you have a text like the Sentence here, share on Facebook. You give it to the system and the system comes up with a sound wave, a sound wave that says this sentence. So if you listen to it, you'll hear Share on Facebook. It has to do that in a, let's say, credible way such that it is a human-like voice because people like hearing that, not these kind of robot-old-school telephone robot voices where they just chunk together words. It has to flow naturally. So what you want to do for this is you want to have some sort of recurrent neural network or any sort of auto-regressive network that outputs basically, these samples here one at a time. So these points, you're going to output one at a time. And this, for one, they say for one second of audio, it can require you to output two or 24,000 of these data points. So 24,000 forward propagations of your auto-regressive model. That's massive. And if you want to do it in real time, and that's why real time is so impressive, is you have to do this in less than one second. So you have to do this 24,000 forward passes in less than a second. And even more so, this was already possible, I think. But it required, you basically required a big data center with many, many, many, many GPUs in it. So you basically would send your text to this and it would stream back the audio. And they can do this just on CPUs. And in fact, they can do this on a quad core CPU in real time. In they can generate this many samples in half a second. Pretty impressive. So let's dive into how they do it. And they say it's deployed in portal, our video calling service and available for use across a range of other Facebook applications from reading support for the visual impaired to visual reality experiences. Okay. So first, they show this graph right here. What are they doing? So this is their entire system. It is chunked in multiple parts. If you're a deep learning practitioner, you're very, very keen on taking this text and just like giant neural network and just run it through and generate audio end to end, right? This doesn't really work in this case, first of all, because it would be too much of a two, too many parameters to evaluate this many times. But also, especially text and audio are such different modalities that you'll have to basically chunk this into individual parts. And that's what they do. So they have this linguistic front end. And the linguistic front end generates two different things. It generates what needs to be said and how does it need to be said? So what needs to be said? They call this linguistic features. The linguistic features, they're things like phonemes and so on. Sorry, they don't even have a title for this one. So the linguistic front end converts the input text. So this is probably a sentence by sentence thing. So this is one sentence of text into a sequence of linguistic features such as phonemes and sentence type. So these linguistic features are, if it's like share on Facebook, it would be like, okay, shh, is one. And then a, and then r, these are the phonemes of share, right? It would kind of chunk it into that. So that is much closer to what we think of an audio signal. This will make one sound, this will make a sound, and this will make a sound. So we sort of chunk it into that and then here the how is it said? This would be, for example, the fact that share on Facebook is sort of an instruction. And this is different from if this would be a question. Like if it said, do you want to share this on Facebook? Then the what would output much the same phonemes right here except it's different word now, but the how would output a, this is a question. So as you can see, the information flow right here informs the later stages. This would then cause at the end of the sentence the voice to go up because it's a question, right? So it, this, this linguistic frontend, it, as you can see, it still deals with text. It deals with text and it outputs these, these how features and these linguistic, these what features. So the what features now go into an acoustic model. And what does the acoustic model do? The acoustic model is meant to generate a spectrum, a spectrogram of the sound. Now we'll skip this for the moment and go to the neural vocoder. The neural vocoder is a kind of a standard thing in a text in any speech producing. It takes a spectrogram of the sound and turns it into actual audio. So this here, I think they achieve it with, they say something similar like a wave RNN based on plus like a CNN. So we'll look into that quickly. So the spectrum, the spectrogram of the sound is going to be a bit of an image. And the image has time on the this axis and frequency on this axis. And then there is a, it's usually somewhat like color coded, but it's just intensity. Right? So whenever there is, whenever a frequency at a given time is expressed strongly, it will light up so it could be something like this. So over time, the mid-frequency is always there, but this frequency right here is not there and this is here at the beginning. So there's a sort of a way to read the spectrum. But this represents maybe something like this represents the, not even sure how much sound this represents, but this can represent maybe something like 200 milliseconds of audio. And you have to basically perform a Fourier transform to transform that into 200 milliseconds of actual wave audio. But since the audio has to be output at what is 24,000 samples per second, what's coming in here is not that much. The acoustic model outputs not 24,000 spectrums per second. So first of all, this has to be up sampled. So this time dimension here has just two few samples. So we use the CNN because this is basically an image in order to up sample this, in order to make a long image out of this. And basically the CNN will have to impute, it will have to, this is learned, right? This is learned how this spectrum would look if it were sampled much more densely. And now it has basically the correct number of samples here. And now this wave RNN can step through it and look at these slices and look at the last slices or actually also can look at the last spectrograms. Maybe I don't know, they don't really say what the RNN exactly goes over, but this is how I imagine it. And the wave RNN is based on a wave net architecture. And that means wave net is sort of like if you look to produce this thing right here, you can look back all the way to the beginning. But this would be too many connections, right? It would be too much memory. So what you do is you can look back at the directions, at the things right before you in very great detail. But then as you go back further and further, you basically lose details. See, there's only two connections here with in this long stretch where there's many, many connections here at the very beginning. So right before you. That means you look in more detail what you've produced recently, but you also sort of look back in a more blurry way at what you've produced a long time ago. So this is a wave net architecture and they say they use something like this in order to then actually produce the final audio from the spectrograms. So actually in neural vocoder, you can train this thing. You can train it by itself, right? You simply feed spectrums and you make it go audio. And you know, there's a lot of audio on the internet. You can simply produce spectrograms from that and then train the vocoder to produce the audio. So the good thing about this pipeline here is you can train a lot of these things independently from each other. I don't actually know whether they do that or not, but you can. You see this box up here, this prosody model. And that will take in these how features. So how does something need to be set? Come on. Well, this is an H. How does something need to be set? And it will transform it into features that the sort of neural network can understand. These neural networks, they need features like they need embeddings. And as you can see here, it also takes into account the speaker embedding, which is not only how what the sentence is, the fact that the sentence is a question, you would also get the information that the speaker should be, you know, kind of calm, sorry, that would be the style. The speaker should be maybe a woman voice. And then the language should be, it should have like an English sound, the regerman sound and so on. So this model here will take in all of that and emit features that these neural networks here can understand. So as you see here, the neural vocoder, not only does it transform spectrograms to audio, but it takes into account how you want the audio to sound. And so does this acoustic model. So the acoustic model is sort of along with the prosody model is a bit of the heart of the thing here. It takes in these linguistic features, so what needs to be said, right? The acoustic model, it takes into account the, again, the speaker embedding, language embedding and so on. It takes into account the output from the prosody model of the how you would like it to be said. This includes what type of sentence this is. And this, it synthesizes it all in order to come up with the spectrum right here, in order to come up with these spectrograms. So this is sort of the heart of the thing. So about the prosody model, they say we use style embeddings that allow us to create new voice styles, including assistance of fast project and formal using only a small amount of additional data with the existing data sets that we don't have to create a separate model for each style. We need only 30 to 60 minutes of training data for each voice style. So that happens because you take into, you take in actually an embedding of the feet of the speakers and you train these things independently. So that means you can sort of generalize to a new style really quickly. So here, they describe in essence how their acoustic model works. The fact that they output 13 dimensional MFCC features concatenated with the fundamental frequency and the five dimensional periodicity feature, which is much easier for the acoustic model to generate. So that's what the acoustic model generates. And then here, our conditional neural vocoders is the final part of the pipeline consists of two components, a convolutional neural network that upsamples or expands the input feature vectors from the frame rate 200 predictions per second. So that's not 200 milliseconds. It would be 200 spectrograms a second to the sample rate, 24,000 predictions per second and this similar to wave RNN, which synthesizes audio samples autoregressively. That means one sample at a time, at 24,000 samples per second. Crazy, right? So this all seems like it's a lot of computation. And now they describe how they get this to run faster than real time. And they list their individual contributions here. So if they just run this on one CPU core, you see it takes 80 seconds to produce one second of audio. Then they do optimized inference operators, which means they basically use a PyTorch jit along with some, so these PyTorch jit, which is kind of where you can sort of compile your deep learning model to an optimized, to an optimized form that runs faster. And they also customize this. So they get to 20 seconds per one second. Then they do parameter reduction by sparsification and they are able to abuse the sparse matrix compute operator. I think they implemented a custom one to do that. So this here is very much like if you have a neural network and that's somehow connected, connected, connected. You want to train it in such a way that it's sparse, meaning that only very few of these connections have non-zero weights. And because of that, you don't have to store the non-zero weights and you don't also have to compute because something multiplied by zero is going to be zero, so you don't have to compute that. So they achieve sparsity at 96%. And this basically you do by some sort of teacher, teacher, student model, or there are many ways to do this. But you can sparsity regularize a neural network and basically force most of the connections to be sparse while still maintaining a good training error or a good generalization error. So they supercharge this and with the sparsity, they bring this down to five seconds per second. Then they go further and do blockwise sparsification and distillation. So they distill it to an entirely smaller model that then is also blockwise sparse. So they also enforce this blockwise sparsification. And that not only can you then have a better operator, they implement this block sparse matrix compute operator that is specifically designed to multiply block sparse matrices. They also in the text they describe that it also optimizes cache access. So if you know about CPUs, they have these level one, level two, level three caches and you can optimize your computations, that's what libraries like LaPac and Blas do. You can optimize your computations such that your cache access is optimized and therefore you can speed up a lot your computations because the amount of times that you actually have to go to your RAM and retrieve something is minimized. And that tends to be the slow part of the process when your cache misses. So again, they achieve 94% block sparsity and that almost gets them to real time and it's still one CPU. So now they parallelize the operators that are doing the heavy lifting to four CPU course. And that doesn't divide it by four of course because there's an overhead in parallelization and synchronization. But that gets you to this one half a second needed to produce one second of audio. So there you're at real time and that is pretty impressive. And they go on to describe so in detail how they did it, but they also give some examples of what they can do and would like to achieve even better in the future. So here is an example where they can adapt their model to a given style and here they have a British accent. Recently, we successfully applied our new approach to create a British accent voice. This is the first of more accents and languages to come. And also you can adapt it, their idea is that you have sort of an assistant and this assistant will be able to adapt to let's say your mood. We're also exploring features to make our voice respond intelligently with different styles of speaking based on the context. For example, when you're rushing at the door in the morning and need to know the time, your assistant would match your hurried pace. When you're in a quiet place and you are speaking softly, your AI assistant would reply to you in a quiet voice. And later, when it gets noisy in the kitchen, your assistant would switch to a projected voice so you can hear the call from your mom. Right. So this ties in very much with sort of conversational AI, so assistants and so on, but it also ties into wearables, I think. So the fact that you are now smaller than real time means you can run this potentially directly on your smartphone, you could run this on your fridge or something on your stove in your car without having to stream basically. So you'll get much more real time on device assistants maybe even in your watch. And I'm excited by this technology. So far, it seems you can get it in Facebook products, but I'm sure this will come to places. All right. If you enjoyed this, please consider subscribing. Thank you for listening and watching. Leave a like if you liked it and leave a comment if you have something to comment with that. Bye bye. | [{"start": 0.0, "end": 4.0, "text": " Hi there, check this out."}, {"start": 4.0, "end": 8.44, "text": " Modern text-to-speech systems have come a long way in using neural networks to mimic the"}, {"start": 8.44, "end": 10.56, "text": " nuances of human voice."}, {"start": 10.56, "end": 15.6, "text": " To generate human-like audio, one second of speech can require a TTS system to output as"}, {"start": 15.6, "end": 19.76, "text": " many as 24,000 samples, sometimes even more."}, {"start": 19.76, "end": 24.6, "text": " The size and complexity of state-of-the-art models require massive computation, which often"}, {"start": 24.6, "end": 30.080000000000002, "text": " needs to run on GPUs or other specialized hardware."}, {"start": 30.080000000000002, "end": 36.760000000000005, "text": " So this is generated by a system that Facebook AI has built, and we're going to look at it."}, {"start": 36.760000000000005, "end": 43.36, "text": " It's called a highly efficient real-time text-to-speech system deployed on CPUs."}, {"start": 43.36, "end": 46.56, "text": " There's a lot to unpack here, but this is not a paper."}, {"start": 46.56, "end": 53.56, "text": " This is basically a technical blog post because I think they built this into their products"}, {"start": 53.56, "end": 58.2, "text": " and it's mainly explaining on a high level what they did."}, {"start": 58.2, "end": 65.76, "text": " So they have a real-time text-to-speech system, which means that you have a text like"}, {"start": 65.76, "end": 68.16, "text": " the Sentence here, share on Facebook."}, {"start": 68.16, "end": 75.24000000000001, "text": " You give it to the system and the system comes up with a sound wave, a sound wave that"}, {"start": 75.24000000000001, "end": 77.32000000000001, "text": " says this sentence."}, {"start": 77.32000000000001, "end": 80.48, "text": " So if you listen to it, you'll hear Share on Facebook."}, {"start": 80.48, "end": 88.16, "text": " It has to do that in a, let's say, credible way such that it is a human-like voice because"}, {"start": 88.16, "end": 95.56, "text": " people like hearing that, not these kind of robot-old-school telephone robot voices where they"}, {"start": 95.56, "end": 97.0, "text": " just chunk together words."}, {"start": 97.0, "end": 98.88000000000001, "text": " It has to flow naturally."}, {"start": 98.88000000000001, "end": 104.68, "text": " So what you want to do for this is you want to have some sort of recurrent neural network"}, {"start": 104.68, "end": 111.24000000000001, "text": " or any sort of auto-regressive network that outputs basically, these samples here one"}, {"start": 111.24000000000001, "end": 112.24000000000001, "text": " at a time."}, {"start": 112.24000000000001, "end": 116.44000000000001, "text": " So these points, you're going to output one at a time."}, {"start": 116.44000000000001, "end": 122.84, "text": " And this, for one, they say for one second of audio, it can require you to output two"}, {"start": 122.84, "end": 127.4, "text": " or 24,000 of these data points."}, {"start": 127.4, "end": 133.20000000000002, "text": " So 24,000 forward propagations of your auto-regressive model."}, {"start": 133.2, "end": 135.2, "text": " That's massive."}, {"start": 135.2, "end": 139.07999999999998, "text": " And if you want to do it in real time, and that's why real time is so impressive, is you have"}, {"start": 139.07999999999998, "end": 141.92, "text": " to do this in less than one second."}, {"start": 141.92, "end": 151.48, "text": " So you have to do this 24,000 forward passes in less than a second."}, {"start": 151.48, "end": 155.35999999999999, "text": " And even more so, this was already possible, I think."}, {"start": 155.35999999999999, "end": 161.64, "text": " But it required, you basically required a big data center with many, many, many, many"}, {"start": 161.64, "end": 163.95999999999998, "text": " GPUs in it."}, {"start": 163.95999999999998, "end": 169.76, "text": " So you basically would send your text to this and it would stream back the audio."}, {"start": 169.76, "end": 172.6, "text": " And they can do this just on CPUs."}, {"start": 172.6, "end": 179.16, "text": " And in fact, they can do this on a quad core CPU in real time."}, {"start": 179.16, "end": 185.07999999999998, "text": " In they can generate this many samples in half a second."}, {"start": 185.07999999999998, "end": 186.07999999999998, "text": " Pretty impressive."}, {"start": 186.07999999999998, "end": 188.79999999999998, "text": " So let's dive into how they do it."}, {"start": 188.8, "end": 193.48000000000002, "text": " And they say it's deployed in portal, our video calling service and available for use"}, {"start": 193.48000000000002, "end": 199.08, "text": " across a range of other Facebook applications from reading support for the visual impaired"}, {"start": 199.08, "end": 202.04000000000002, "text": " to visual reality experiences."}, {"start": 202.04000000000002, "end": 204.8, "text": " Okay."}, {"start": 204.8, "end": 207.96, "text": " So first, they show this graph right here."}, {"start": 207.96, "end": 209.68, "text": " What are they doing?"}, {"start": 209.68, "end": 211.28, "text": " So this is their entire system."}, {"start": 211.28, "end": 213.56, "text": " It is chunked in multiple parts."}, {"start": 213.56, "end": 218.12, "text": " If you're a deep learning practitioner, you're very, very keen on taking this text and"}, {"start": 218.12, "end": 226.56, "text": " just like giant neural network and just run it through and generate audio end to end, right?"}, {"start": 226.56, "end": 232.32, "text": " This doesn't really work in this case, first of all, because it would be too much of a"}, {"start": 232.32, "end": 236.96, "text": " two, too many parameters to evaluate this many times."}, {"start": 236.96, "end": 245.04000000000002, "text": " But also, especially text and audio are such different modalities that you'll have to"}, {"start": 245.04000000000002, "end": 247.92000000000002, "text": " basically chunk this into individual parts."}, {"start": 247.92, "end": 249.32, "text": " And that's what they do."}, {"start": 249.32, "end": 251.92, "text": " So they have this linguistic front end."}, {"start": 251.92, "end": 256.32, "text": " And the linguistic front end generates two different things."}, {"start": 256.32, "end": 263.91999999999996, "text": " It generates what needs to be said and how does it need to be said?"}, {"start": 263.91999999999996, "end": 265.15999999999997, "text": " So what needs to be said?"}, {"start": 265.15999999999997, "end": 268.08, "text": " They call this linguistic features."}, {"start": 268.08, "end": 275.76, "text": " The linguistic features, they're things like phonemes and so on."}, {"start": 275.76, "end": 282.28, "text": " Sorry, they don't even have a title for this one."}, {"start": 282.28, "end": 286.28, "text": " So the linguistic front end converts the input text."}, {"start": 286.28, "end": 289.03999999999996, "text": " So this is probably a sentence by sentence thing."}, {"start": 289.03999999999996, "end": 294.88, "text": " So this is one sentence of text into a sequence of linguistic features such as phonemes"}, {"start": 294.88, "end": 297.68, "text": " and sentence type."}, {"start": 297.68, "end": 306.12, "text": " So these linguistic features are, if it's like share on Facebook, it would be like,"}, {"start": 306.12, "end": 308.0, "text": " okay, shh, is one."}, {"start": 308.0, "end": 312.08, "text": " And then a, and then r, these are the phonemes of share, right?"}, {"start": 312.08, "end": 314.88, "text": " It would kind of chunk it into that."}, {"start": 314.88, "end": 318.8, "text": " So that is much closer to what we think of an audio signal."}, {"start": 318.8, "end": 323.04, "text": " This will make one sound, this will make a sound, and this will make a sound."}, {"start": 323.04, "end": 329.24, "text": " So we sort of chunk it into that and then here the how is it said?"}, {"start": 329.24, "end": 337.8, "text": " This would be, for example, the fact that share on Facebook is sort of an instruction."}, {"start": 337.8, "end": 341.48, "text": " And this is different from if this would be a question."}, {"start": 341.48, "end": 345.52000000000004, "text": " Like if it said, do you want to share this on Facebook?"}, {"start": 345.52000000000004, "end": 350.96000000000004, "text": " Then the what would output much the same phonemes right here except it's different word"}, {"start": 350.96, "end": 355.96, "text": " now, but the how would output a, this is a question."}, {"start": 355.96, "end": 362.12, "text": " So as you can see, the information flow right here informs the later stages."}, {"start": 362.12, "end": 368.15999999999997, "text": " This would then cause at the end of the sentence the voice to go up because it's a question,"}, {"start": 368.15999999999997, "end": 369.91999999999996, "text": " right?"}, {"start": 369.91999999999996, "end": 375.12, "text": " So it, this, this linguistic frontend, it, as you can see, it still deals with text."}, {"start": 375.12, "end": 379.91999999999996, "text": " It deals with text and it outputs these, these how features and these linguistic, these"}, {"start": 379.92, "end": 381.76, "text": " what features."}, {"start": 381.76, "end": 386.04, "text": " So the what features now go into an acoustic model."}, {"start": 386.04, "end": 387.6, "text": " And what does the acoustic model do?"}, {"start": 387.6, "end": 394.56, "text": " The acoustic model is meant to generate a spectrum, a spectrogram of the sound."}, {"start": 394.56, "end": 399.40000000000003, "text": " Now we'll skip this for the moment and go to the neural vocoder."}, {"start": 399.40000000000003, "end": 405.84000000000003, "text": " The neural vocoder is a kind of a standard thing in a text in any speech producing."}, {"start": 405.84, "end": 410.0, "text": " It takes a spectrogram of the sound and turns it into actual audio."}, {"start": 410.0, "end": 418.08, "text": " So this here, I think they achieve it with, they say something similar like a wave RNN"}, {"start": 418.08, "end": 422.96, "text": " based on plus like a CNN."}, {"start": 422.96, "end": 425.12, "text": " So we'll look into that quickly."}, {"start": 425.12, "end": 431.15999999999997, "text": " So the spectrum, the spectrogram of the sound is going to be a bit of an image."}, {"start": 431.16, "end": 439.12, "text": " And the image has time on the this axis and frequency on this axis."}, {"start": 439.12, "end": 447.6, "text": " And then there is a, it's usually somewhat like color coded, but it's just intensity."}, {"start": 447.6, "end": 448.6, "text": " Right?"}, {"start": 448.6, "end": 453.96000000000004, "text": " So whenever there is, whenever a frequency at a given time is expressed strongly, it will"}, {"start": 453.96000000000004, "end": 460.12, "text": " light up so it could be something like this."}, {"start": 460.12, "end": 465.56, "text": " So over time, the mid-frequency is always there, but this frequency right here is not there"}, {"start": 465.56, "end": 467.72, "text": " and this is here at the beginning."}, {"start": 467.72, "end": 470.04, "text": " So there's a sort of a way to read the spectrum."}, {"start": 470.04, "end": 479.04, "text": " But this represents maybe something like this represents the, not even sure how much sound"}, {"start": 479.04, "end": 488.32, "text": " this represents, but this can represent maybe something like 200 milliseconds of audio."}, {"start": 488.32, "end": 494.8, "text": " And you have to basically perform a Fourier transform to transform that into 200 milliseconds"}, {"start": 494.8, "end": 497.8, "text": " of actual wave audio."}, {"start": 497.8, "end": 506.71999999999997, "text": " But since the audio has to be output at what is 24,000 samples per second, what's coming"}, {"start": 506.71999999999997, "end": 509.03999999999996, "text": " in here is not that much."}, {"start": 509.03999999999996, "end": 515.84, "text": " The acoustic model outputs not 24,000 spectrums per second."}, {"start": 515.84, "end": 519.36, "text": " So first of all, this has to be up sampled."}, {"start": 519.36, "end": 523.24, "text": " So this time dimension here has just two few samples."}, {"start": 523.24, "end": 530.36, "text": " So we use the CNN because this is basically an image in order to up sample this, in order"}, {"start": 530.36, "end": 534.2, "text": " to make a long image out of this."}, {"start": 534.2, "end": 541.2800000000001, "text": " And basically the CNN will have to impute, it will have to, this is learned, right?"}, {"start": 541.28, "end": 548.12, "text": " This is learned how this spectrum would look if it were sampled much more densely."}, {"start": 548.12, "end": 552.68, "text": " And now it has basically the correct number of samples here."}, {"start": 552.68, "end": 559.28, "text": " And now this wave RNN can step through it and look at these slices and look at the last"}, {"start": 559.28, "end": 564.4399999999999, "text": " slices or actually also can look at the last spectrograms."}, {"start": 564.4399999999999, "end": 569.72, "text": " Maybe I don't know, they don't really say what the RNN exactly goes over, but this is"}, {"start": 569.72, "end": 571.1600000000001, "text": " how I imagine it."}, {"start": 571.1600000000001, "end": 574.52, "text": " And the wave RNN is based on a wave net architecture."}, {"start": 574.52, "end": 579.72, "text": " And that means wave net is sort of like if you look to produce this thing right here,"}, {"start": 579.72, "end": 583.1600000000001, "text": " you can look back all the way to the beginning."}, {"start": 583.1600000000001, "end": 586.2, "text": " But this would be too many connections, right?"}, {"start": 586.2, "end": 587.84, "text": " It would be too much memory."}, {"start": 587.84, "end": 593.96, "text": " So what you do is you can look back at the directions, at the things right before you"}, {"start": 593.96, "end": 595.84, "text": " in very great detail."}, {"start": 595.84, "end": 600.36, "text": " But then as you go back further and further, you basically lose details."}, {"start": 600.36, "end": 604.84, "text": " See, there's only two connections here with in this long stretch where there's many,"}, {"start": 604.84, "end": 609.24, "text": " many connections here at the very beginning."}, {"start": 609.24, "end": 611.08, "text": " So right before you."}, {"start": 611.08, "end": 616.88, "text": " That means you look in more detail what you've produced recently, but you also sort of"}, {"start": 616.88, "end": 621.08, "text": " look back in a more blurry way at what you've produced a long time ago."}, {"start": 621.08, "end": 627.2800000000001, "text": " So this is a wave net architecture and they say they use something like this in order"}, {"start": 627.2800000000001, "end": 632.76, "text": " to then actually produce the final audio from the spectrograms."}, {"start": 632.76, "end": 636.72, "text": " So actually in neural vocoder, you can train this thing."}, {"start": 636.72, "end": 641.0400000000001, "text": " You can train it by itself, right?"}, {"start": 641.0400000000001, "end": 645.48, "text": " You simply feed spectrums and you make it go audio."}, {"start": 645.48, "end": 648.6400000000001, "text": " And you know, there's a lot of audio on the internet."}, {"start": 648.64, "end": 653.48, "text": " You can simply produce spectrograms from that and then train the vocoder to produce the"}, {"start": 653.48, "end": 654.88, "text": " audio."}, {"start": 654.88, "end": 659.16, "text": " So the good thing about this pipeline here is you can train a lot of these things independently"}, {"start": 659.16, "end": 660.16, "text": " from each other."}, {"start": 660.16, "end": 665.3199999999999, "text": " I don't actually know whether they do that or not, but you can."}, {"start": 665.3199999999999, "end": 668.48, "text": " You see this box up here, this prosody model."}, {"start": 668.48, "end": 674.3199999999999, "text": " And that will take in these how features."}, {"start": 674.32, "end": 679.2, "text": " So how does something need to be set?"}, {"start": 679.2, "end": 681.32, "text": " Come on."}, {"start": 681.32, "end": 687.2800000000001, "text": " Well, this is an H. How does something need to be set?"}, {"start": 687.2800000000001, "end": 694.0, "text": " And it will transform it into features that the sort of neural network can understand."}, {"start": 694.0, "end": 698.12, "text": " These neural networks, they need features like they need embeddings."}, {"start": 698.12, "end": 702.96, "text": " And as you can see here, it also takes into account the speaker embedding, which is not"}, {"start": 702.96, "end": 708.2, "text": " only how what the sentence is, the fact that the sentence is a question, you would also"}, {"start": 708.2, "end": 715.2800000000001, "text": " get the information that the speaker should be, you know, kind of calm, sorry, that would"}, {"start": 715.2800000000001, "end": 716.48, "text": " be the style."}, {"start": 716.48, "end": 720.64, "text": " The speaker should be maybe a woman voice."}, {"start": 720.64, "end": 726.1600000000001, "text": " And then the language should be, it should have like an English sound, the regerman"}, {"start": 726.1600000000001, "end": 727.44, "text": " sound and so on."}, {"start": 727.44, "end": 734.32, "text": " So this model here will take in all of that and emit features that these neural networks"}, {"start": 734.32, "end": 735.8000000000001, "text": " here can understand."}, {"start": 735.8000000000001, "end": 741.6, "text": " So as you see here, the neural vocoder, not only does it transform spectrograms to audio,"}, {"start": 741.6, "end": 747.4000000000001, "text": " but it takes into account how you want the audio to sound."}, {"start": 747.4000000000001, "end": 749.44, "text": " And so does this acoustic model."}, {"start": 749.44, "end": 754.48, "text": " So the acoustic model is sort of along with the prosody model is a bit of the heart of"}, {"start": 754.48, "end": 755.6, "text": " the thing here."}, {"start": 755.6, "end": 760.16, "text": " It takes in these linguistic features, so what needs to be said, right?"}, {"start": 760.16, "end": 766.36, "text": " The acoustic model, it takes into account the, again, the speaker embedding, language embedding"}, {"start": 766.36, "end": 767.36, "text": " and so on."}, {"start": 767.36, "end": 775.64, "text": " It takes into account the output from the prosody model of the how you would like it to"}, {"start": 775.64, "end": 776.64, "text": " be said."}, {"start": 776.64, "end": 779.36, "text": " This includes what type of sentence this is."}, {"start": 779.36, "end": 786.04, "text": " And this, it synthesizes it all in order to come up with the spectrum right here, in order"}, {"start": 786.04, "end": 788.16, "text": " to come up with these spectrograms."}, {"start": 788.16, "end": 799.24, "text": " So this is sort of the heart of the thing."}, {"start": 799.24, "end": 806.08, "text": " So about the prosody model, they say we use style embeddings that allow us to create"}, {"start": 806.08, "end": 810.88, "text": " new voice styles, including assistance of fast project and formal using only a small amount"}, {"start": 810.88, "end": 814.48, "text": " of additional data with the existing data sets that we don't have to create a separate"}, {"start": 814.48, "end": 816.24, "text": " model for each style."}, {"start": 816.24, "end": 819.6, "text": " We need only 30 to 60 minutes of training data for each voice style."}, {"start": 819.6, "end": 825.12, "text": " So that happens because you take into, you take in actually an embedding of the feet"}, {"start": 825.12, "end": 828.2800000000001, "text": " of the speakers and you train these things independently."}, {"start": 828.2800000000001, "end": 834.2, "text": " So that means you can sort of generalize to a new style really quickly."}, {"start": 834.2, "end": 841.6, "text": " So here, they describe in essence how their acoustic model works."}, {"start": 841.6, "end": 848.32, "text": " The fact that they output 13 dimensional MFCC features concatenated with the fundamental"}, {"start": 848.32, "end": 853.44, "text": " frequency and the five dimensional periodicity feature, which is much easier for the acoustic"}, {"start": 853.44, "end": 854.44, "text": " model to generate."}, {"start": 854.44, "end": 861.36, "text": " So that's what the acoustic model generates."}, {"start": 861.36, "end": 867.84, "text": " And then here, our conditional neural vocoders is the final part of the pipeline consists"}, {"start": 867.84, "end": 872.3000000000001, "text": " of two components, a convolutional neural network that upsamples or expands the input"}, {"start": 872.3000000000001, "end": 876.36, "text": " feature vectors from the frame rate 200 predictions per second."}, {"start": 876.36, "end": 878.32, "text": " So that's not 200 milliseconds."}, {"start": 878.32, "end": 885.5600000000001, "text": " It would be 200 spectrograms a second to the sample rate, 24,000 predictions per second"}, {"start": 885.56, "end": 892.88, "text": " and this similar to wave RNN, which synthesizes audio samples autoregressively."}, {"start": 892.88, "end": 897.28, "text": " That means one sample at a time, at 24,000 samples per second."}, {"start": 897.28, "end": 899.64, "text": " Crazy, right?"}, {"start": 899.64, "end": 904.4399999999999, "text": " So this all seems like it's a lot of computation."}, {"start": 904.4399999999999, "end": 913.1199999999999, "text": " And now they describe how they get this to run faster than real time."}, {"start": 913.12, "end": 918.32, "text": " And they list their individual contributions here."}, {"start": 918.32, "end": 923.48, "text": " So if they just run this on one CPU core, you see it takes 80 seconds to produce one second"}, {"start": 923.48, "end": 925.2, "text": " of audio."}, {"start": 925.2, "end": 931.08, "text": " Then they do optimized inference operators, which means they basically use a PyTorch jit"}, {"start": 931.08, "end": 939.48, "text": " along with some, so these PyTorch jit, which is kind of where you can sort of compile"}, {"start": 939.48, "end": 946.84, "text": " your deep learning model to an optimized, to an optimized form that runs faster."}, {"start": 946.84, "end": 948.88, "text": " And they also customize this."}, {"start": 948.88, "end": 952.76, "text": " So they get to 20 seconds per one second."}, {"start": 952.76, "end": 959.72, "text": " Then they do parameter reduction by sparsification and they are able to abuse the sparse matrix"}, {"start": 959.72, "end": 960.72, "text": " compute operator."}, {"start": 960.72, "end": 964.28, "text": " I think they implemented a custom one to do that."}, {"start": 964.28, "end": 975.76, "text": " So this here is very much like if you have a neural network and that's somehow connected,"}, {"start": 975.76, "end": 976.8399999999999, "text": " connected, connected."}, {"start": 976.8399999999999, "end": 982.24, "text": " You want to train it in such a way that it's sparse, meaning that only very few of these"}, {"start": 982.24, "end": 985.4399999999999, "text": " connections have non-zero weights."}, {"start": 985.4399999999999, "end": 989.56, "text": " And because of that, you don't have to store the non-zero weights and you don't also"}, {"start": 989.56, "end": 994.2399999999999, "text": " have to compute because something multiplied by zero is going to be zero, so you don't"}, {"start": 994.2399999999999, "end": 995.7199999999999, "text": " have to compute that."}, {"start": 995.7199999999999, "end": 1003.52, "text": " So they achieve sparsity at 96%."}, {"start": 1003.52, "end": 1009.04, "text": " And this basically you do by some sort of teacher, teacher, student model, or there are many"}, {"start": 1009.04, "end": 1010.04, "text": " ways to do this."}, {"start": 1010.04, "end": 1016.3199999999999, "text": " But you can sparsity regularize a neural network and basically force most of the connections"}, {"start": 1016.32, "end": 1023.8000000000001, "text": " to be sparse while still maintaining a good training error or a good generalization error."}, {"start": 1023.8000000000001, "end": 1029.8, "text": " So they supercharge this and with the sparsity, they bring this down to five seconds per"}, {"start": 1029.8, "end": 1031.4, "text": " second."}, {"start": 1031.4, "end": 1036.48, "text": " Then they go further and do blockwise sparsification and distillation."}, {"start": 1036.48, "end": 1042.28, "text": " So they distill it to an entirely smaller model that then is also blockwise sparse."}, {"start": 1042.28, "end": 1044.88, "text": " So they also enforce this blockwise sparsification."}, {"start": 1044.88, "end": 1051.24, "text": " And that not only can you then have a better operator, they implement this block sparse"}, {"start": 1051.24, "end": 1058.24, "text": " matrix compute operator that is specifically designed to multiply block sparse matrices."}, {"start": 1058.24, "end": 1065.48, "text": " They also in the text they describe that it also optimizes cache access."}, {"start": 1065.48, "end": 1070.44, "text": " So if you know about CPUs, they have these level one, level two, level three caches and"}, {"start": 1070.44, "end": 1076.88, "text": " you can optimize your computations, that's what libraries like LaPac and Blas do."}, {"start": 1076.88, "end": 1083.64, "text": " You can optimize your computations such that your cache access is optimized and therefore"}, {"start": 1083.64, "end": 1091.1200000000001, "text": " you can speed up a lot your computations because the amount of times that you actually have"}, {"start": 1091.1200000000001, "end": 1094.92, "text": " to go to your RAM and retrieve something is minimized."}, {"start": 1094.92, "end": 1100.0800000000002, "text": " And that tends to be the slow part of the process when your cache misses."}, {"start": 1100.08, "end": 1108.84, "text": " So again, they achieve 94% block sparsity and that almost gets them to real time and it's"}, {"start": 1108.84, "end": 1110.28, "text": " still one CPU."}, {"start": 1110.28, "end": 1118.36, "text": " So now they parallelize the operators that are doing the heavy lifting to four CPU course."}, {"start": 1118.36, "end": 1123.3999999999999, "text": " And that doesn't divide it by four of course because there's an overhead in parallelization"}, {"start": 1123.3999999999999, "end": 1125.1599999999999, "text": " and synchronization."}, {"start": 1125.16, "end": 1132.48, "text": " But that gets you to this one half a second needed to produce one second of audio."}, {"start": 1132.48, "end": 1138.1200000000001, "text": " So there you're at real time and that is pretty impressive."}, {"start": 1138.1200000000001, "end": 1145.1200000000001, "text": " And they go on to describe so in detail how they did it, but they also give some examples"}, {"start": 1145.1200000000001, "end": 1151.8000000000002, "text": " of what they can do and would like to achieve even better in the future."}, {"start": 1151.8, "end": 1161.3999999999999, "text": " So here is an example where they can adapt their model to a given style and here they have"}, {"start": 1161.3999999999999, "end": 1163.36, "text": " a British accent."}, {"start": 1163.36, "end": 1169.12, "text": " Recently, we successfully applied our new approach to create a British accent voice."}, {"start": 1169.12, "end": 1176.28, "text": " This is the first of more accents and languages to come."}, {"start": 1176.28, "end": 1182.3999999999999, "text": " And also you can adapt it, their idea is that you have sort of an assistant and this"}, {"start": 1182.3999999999999, "end": 1188.36, "text": " assistant will be able to adapt to let's say your mood."}, {"start": 1188.36, "end": 1192.56, "text": " We're also exploring features to make our voice respond intelligently with different"}, {"start": 1192.56, "end": 1195.04, "text": " styles of speaking based on the context."}, {"start": 1195.04, "end": 1198.08, "text": " For example, when you're rushing at the door in the morning and need to know the time,"}, {"start": 1198.08, "end": 1200.08, "text": " your assistant would match your hurried pace."}, {"start": 1200.08, "end": 1205.04, "text": " When you're in a quiet place and you are speaking softly, your AI assistant would reply"}, {"start": 1205.04, "end": 1206.8, "text": " to you in a quiet voice."}, {"start": 1206.8, "end": 1211.44, "text": " And later, when it gets noisy in the kitchen, your assistant would switch to a projected voice"}, {"start": 1211.44, "end": 1214.84, "text": " so you can hear the call from your mom."}, {"start": 1214.84, "end": 1217.12, "text": " Right."}, {"start": 1217.12, "end": 1225.32, "text": " So this ties in very much with sort of conversational AI, so assistants and so on, but it also ties"}, {"start": 1225.32, "end": 1227.44, "text": " into wearables, I think."}, {"start": 1227.44, "end": 1235.44, "text": " So the fact that you are now smaller than real time means you can run this potentially directly"}, {"start": 1235.44, "end": 1240.96, "text": " on your smartphone, you could run this on your fridge or something on your stove in your"}, {"start": 1240.96, "end": 1244.92, "text": " car without having to stream basically."}, {"start": 1244.92, "end": 1251.72, "text": " So you'll get much more real time on device assistants maybe even in your watch."}, {"start": 1251.72, "end": 1256.92, "text": " And I'm excited by this technology."}, {"start": 1256.92, "end": 1262.96, "text": " So far, it seems you can get it in Facebook products, but I'm sure this will come to places."}, {"start": 1262.96, "end": 1263.96, "text": " All right."}, {"start": 1263.96, "end": 1267.16, "text": " If you enjoyed this, please consider subscribing."}, {"start": 1267.16, "end": 1269.8400000000001, "text": " Thank you for listening and watching."}, {"start": 1269.8400000000001, "end": 1275.4, "text": " Leave a like if you liked it and leave a comment if you have something to comment with that."}, {"start": 1275.4, "end": 1305.3200000000002, "text": " Bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=p-zOeQCoG9c | Weight Standardization (Paper Explained) | It's common for neural networks to include data normalization such as BatchNorm or GroupNorm. This paper extends the normalization to also include the weights of the network. This surprisingly simple change leads to a boost in performance and - combined with GroupNorm - new state-of-the-art results.
https://arxiv.org/abs/1903.10520
Abstract:
In this paper, we propose Weight Standardization (WS) to accelerate deep network training. WS is targeted at the micro-batch training setting where each GPU typically has only 1-2 images for training. The micro-batch training setting is hard because small batch sizes are not enough for training networks with Batch Normalization (BN), while other normalization methods that do not rely on batch knowledge still have difficulty matching the performances of BN in large-batch training. Our WS ends this problem because when used with Group Normalization and trained with 1 image/GPU, WS is able to match or outperform the performances of BN trained with large batch sizes with only 2 more lines of code. In micro-batch training, WS significantly outperforms other normalization methods. WS achieves these superior results by standardizing the weights in the convolutional layers, which we show is able to smooth the loss landscape by reducing the Lipschitz constants of the loss and the gradients. The effectiveness of WS is verified on many tasks, including image classification, object detection, instance segmentation, video recognition, semantic segmentation, and point cloud recognition. The code is available here: this https URL.
Authors: Siyuan Qiao, Huiyu Wang, Chenxi Liu, Wei Shen, Alan Yuille
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 Weight Standardization by Siwon Jao, who you Wang Shen Qi Yu Wei Shen, Alan Yule of John Hopkins University. So Weight Standardization is a normalization technique for training neural networks and it goes basically in conjunction with another technique called Group Normalization. So if you haven't Group Normalization, that is ugly. If you haven't seen my video on Group Normalization and don't know what it is, I suggest you go watch that first or read the Group Normal Paper or some blog post because Weight Standardization is usually used together with Group Normal in order to work well and that's what this paper also says. Even though it's pretty much independent but here you can see their main results. So if they compare batch norm, group norm and weight standardization used with Group Normal, then they can as you can see here they can outperform in the ImageNet top 1 accuracy the other two models and the important part here as you can see is batch norm is trained with large batch sizes while Group Normal and Group Normal plus weight standardization are trained with one image per GPU. So they have a multi GPU setup and this is just one image per GPU and these results over here are on a mask R-CNN which I believe is a recurrent model where the model is large because the kind of the model is large and therefore you can only have very small batches per worker and that means batch norm will work less. Now again we've discussed why batch norm is not a good thing when you have to go to small batch sizes because basically what people have discovered is that it is very beneficial in machine learning to normalize your data before working with it. What do we mean by it? So if you have a bunch of data points right here and let's say like this it is it is usually beneficial to first center the data like this so basically calculate its mean and shift it and then to standardize the axis. So basically divided by the standard deviation in each direction and your data will look something like this. Of many classical methods that will improve the conditioning numbers of the requirements to solve it and so on and even of deep learning methods we just know that if you standardize your data like this it works better. So people are basically have come up with these methods that where they say well if it helps for the data at the beginning of a neural network then if after if after a layer the data is kind of out of whack that can happen after a layer of neural network we should maybe first before we send it to the next layer do the same thing center it again and then send it through and if after the next layer again it's out of whack we should maybe center it and standardize it again before sending it through the next layer. So at each layer you have these transformations that center and standardize the data and usually for the longest time this was batch norm. Batch norm does this across the mini batches of the data since you can't pass the entire data set. Now group norm has come and replaced batch norm because in batch norm it's very dependent on the batch size while group norm isn't. Now the group norm paper has sort of made it clear that in competitive batch sizes in the large batch size regime group norm is sorry batch norm is still the king batch norm still works better it's only when you go to very small batch sizes that group norm takes over and that's what you can see here. So here okay it's a bit unfair because batch norm is trained with a larger batch size but even if group norm were to be trained with the large batch size it would still be in the same place because no it wouldn't it would not. Sorry that is that is not the case because the batch is still influenced the gradient stock hasty city and so on but still batch norm is better than group norm as you can see here but here over here where you kind of have to go to the small batch sizes then batch norm is all of a sudden worse than group norm and the weight standardization is a technique to actually make group norm better than batch norm in any of these so even in these in the large batch regime okay so we'll now explore weight standardization. So in the group norm paper we've looked at the diagram on the left so basically in batch norm here is the number of data points this is your batch this is the channels of the batch of the individual images channels and this is the height and width of the image so this is the image itself a single channel so a single channel in the image would be a column in this thing right here. Batch norm normalizes across the data points in a single channel layer norm which is a precursor to group norm normalizes only in a single data point instance but across all of the channels as you can see here now that frees its dependence on the batch size each data point is treated individually but of course it it sort of convolves all the channels with each other it doesn't distinguish them instance norm tries to fix this instance norm down here tries to fix this by saying it was a good idea to own to normalize each feature individually and takes it to the extreme basically normalizes a single image for by each of these single features but that loses too much information group norm comes along and says maybe some of the features naturally depend on each other naturally exhibit the same responses therefore we should normalize them in groups so we take still a single image but we take groups in this case groups of three channels together and normalize across that now this here is all in data space this all normalizes the data like we said up here when we drew this this is all normalizing the data before passing it through the next layer now what actually happens in these layers so what happens here what happens here in a convolutional neural network is that the images get convolved with kernels that's how that's what a neural network layer is so if you have an image right here of our trust the cat I've drawn whiskers in a while that knows is very high the eyes must be like up here sorry cat and the layer inherently has these things called kernels now I'm just gonna draw one of these kernels right here it's a three by three kernel and what you'll do is you'll slide the kernel across this right across like this you slide it across across across across and for each point you convolve the kernel so you can evolve the values here with the pixels here and sum them up and that for each position in the image means that you'll basically get a new value at each point and that will be your next layers data point now in these normalization techniques we usually normalize the data points so here you have multiple channels maybe a red, a green and a blue and so on and the intermediate layers you have even more and but you also have multiple kernels you can see here you have multiple of these kernels which will then result in multiple output channels the old normalization methods batch norm layer norm group norm they all work in they all work in this or in this space in the space of data whereas weight standardization works on the kernel space so weight standardization means you want to normalize the weights of the neural network not the data and that's why it can be used in conjunction with something like group norm or actually batch norm or layer norm could be used with any of these but these authors use it in conjunction with group norm so what does it do if you have these kernels the kernels are of our characterized actually a kernel is characterized by four numbers so first of all it's the height and width of the kernel which in our case was three by three and it is characterized by two more numbers which is the C in in channels and the out channels so the in channels is the number of channels that come into the layer and the out channels are the number of channels that you want to transform that into so here you can see the in channels are listed here and the out channels are listed here and in the up-down direction which is not labeled here is the height and width so this here would be actually a two by two kernels so each of these slivers here is a two by two kernel in the convolutional network and then that would be the orange sliver here and then the sliver behind that would be the next two by two kernel weight standardization says hi hey it might be as we normalize the data it might be a good idea sorry I was that was wrong one column here one of these columns is a two by two filter and then the column behind and the column next to it they're all two by two filters right so you have two by two filters in the output or and you also have two by two filters for each of the for each of the input output channel combination you have a two by two filters so you have an entire matrix of two by two filters if you can imagine that so across the out and across the in direction weights standardization says hi it might be a good idea to see that the weights for a given output channel right this is we take one output channel and we see all the filters that transform the input into that one output channel which is going to be this many times this many times this many numbers or this many filters maybe we should normalize all of these to be sort of to not get out of whack because one could imagine that during training right if we start we initialize our filters somewhere here you know maybe one number this this one number here we initialize it randomly right we draw it from random and then maybe as we train it actually gets very large because it's actually plausible because after that we we you know this is our neural network layer after that we have this procedure to recenter the data right so I could make a very large weight here multiply the data by very large weight because it gets re-centered anyway but of course if my weights get large I'll basically increase the variance and the instability and the gradients might be high and and so on so these all through think it might be good idea to normalize these weights so just as you normalize the data you'd normalize the weights and this actually turns out to be fairly easy in the sense of how you would do it so instead of transforming x which is the input to a layer into y using w so this is w this is your actual parameter using w you would you won't do this right now so this this was usually you just do you just do x times w and that gives you y this is a convolutional operation right here now you don't do this you do you have to take w and first you subtract the mean of w this is now for a single output channel and then you divide by the standard deviation I mean this is the under deviation of w and that entire thing you know multiply by x now since these things here are sorry about that since these things here are just you know deterministic operation you can actually back propagate through it so the forward path of data now looks as follows you come you start you say okay my data comes in I will take my weights that my layer weights and I will first center them then scale them with its standard deviation and then I will use that thing and x in order to obtain my layer output and then I'll send that to the next layer now the back prop signal here is interesting because the back prop signal comes in from here and splits up in two way it splits up into the back prop signal basically you have to back prop through the x times w hat operation we know how to do that that's just a convolutional back prop that you back prop through the convolution operation back to the last layer now usually when you back prop through the convolution operation you get two things you get the derivative with respect to x and you get the derivative with respect to the weights w and you can send both on and you would update your weights with that gradient but now what you'll have to do because this is not your actual parameter of the network you have to take that particular signal and you have to basically reverse the standardization and the centering before you can apply the gradient but that's all doable the actually modern frameworks will do it by themselves but it's just that the the back prop path here it introduces two new operation to the forward and to the back prop path that you didn't have before but I can imagine this will actually not take you won't even notice that this is happening this is so fast so they the idea is basically pretty basic especially since the entire discussion around normalization has already happened I enjoy that this paper does go into the theory a bit more so they analyze what this weight standardization what affected has on the lip sheets constant of the loss for example and they also research what what what contributes more the centering of the weights or the standardization so they kind of run all these ablations where they figure out okay if we just do group norm we have one we you know we have this trajectory here and if we run group norm plus equation five which is subtracting the mean you can see the blue and the orange that is quite a bit and if we only do the dividing by the standard deviation you can see it's pretty close together but there is a difference if you do both then again there is a difference to only doing the centering so they they say even though you know probably subtracting the mean gives you most of the benefit since it is so easy you should just do both and I honestly think and here in the in the in the validation error that makes basically no difference at all and they do quite a number of these ablations which I'm not gonna go into too much and they do also the so the lip sheets constant of the loss and the lip sheets constant of the gradients they basically show that the loss and the gradients are behaved more more well behaved when you use this weight standardization technique together with group norm they also do quite a bit of experiments where they show that their method out performs batch home and especially in the small batch size regime and that is something that I absolutely believe what happened here okay I we actually don't even need to go down there because if you want to read the paper I invite you to read the paper it's a very good paper I enjoyed reading it but ultimately they suggest this new method and also I have seen this one replicated across the community a number of times so it seems to be a thing that I would expect either it fizzes out and the community decides that it's about the same as batch norm and therefore not worth it or and that's what I believe since we also go into the direction of larger models which means smaller batches per worker and generally batch norm is a pain I believe this is just going to be rather standard in the future so I'll actually incorporate this if I can into my next projects so that was it for me if you like this consider subscribing consider leaving a like on the video thank you for listening if you have any comments I will very probably read them bye bye | [{"start": 0.0, "end": 7.34, "text": " Hi there! Today we're looking at Weight Standardization by Siwon Jao, who you"}, {"start": 7.34, "end": 15.44, "text": " Wang Shen Qi Yu Wei Shen, Alan Yule of John Hopkins University. So Weight"}, {"start": 15.44, "end": 22.04, "text": " Standardization is a normalization technique for training neural networks and it"}, {"start": 22.04, "end": 26.96, "text": " goes basically in conjunction with another technique called Group Normalization."}, {"start": 26.96, "end": 36.480000000000004, "text": " So if you haven't Group Normalization, that is ugly. If you haven't seen my video on"}, {"start": 36.480000000000004, "end": 41.64, "text": " Group Normalization and don't know what it is, I suggest you go watch that first or"}, {"start": 41.64, "end": 47.0, "text": " read the Group Normal Paper or some blog post because Weight Standardization is"}, {"start": 47.0, "end": 54.24, "text": " usually used together with Group Normal in order to work well and that's what"}, {"start": 54.24, "end": 61.72, "text": " this paper also says. Even though it's pretty much independent but here you can"}, {"start": 61.72, "end": 69.24000000000001, "text": " see their main results. So if they compare batch norm, group norm and"}, {"start": 69.24000000000001, "end": 75.04, "text": " weight standardization used with Group Normal, then they can as you can see here"}, {"start": 75.04, "end": 81.12, "text": " they can outperform in the ImageNet top 1 accuracy the other two models and"}, {"start": 81.12, "end": 87.36, "text": " the important part here as you can see is batch norm is trained with large batch"}, {"start": 87.36, "end": 93.04, "text": " sizes while Group Normal and Group Normal plus weight standardization are trained"}, {"start": 93.04, "end": 99.60000000000001, "text": " with one image per GPU. So they have a multi GPU setup and this is just one image"}, {"start": 99.60000000000001, "end": 108.96000000000001, "text": " per GPU and these results over here are on a mask R-CNN which I believe is a"}, {"start": 108.96, "end": 119.03999999999999, "text": " recurrent model where the model is large because the kind of the model is large"}, {"start": 119.03999999999999, "end": 125.0, "text": " and therefore you can only have very small batches per worker and that means"}, {"start": 125.0, "end": 130.4, "text": " batch norm will work less. Now again we've discussed why batch norm is not a"}, {"start": 130.4, "end": 136.79999999999998, "text": " good thing when you have to go to small batch sizes because basically what"}, {"start": 136.8, "end": 141.72, "text": " people have discovered is that it is very beneficial in machine learning to"}, {"start": 141.72, "end": 145.84, "text": " normalize your data before working with it. What do we mean by it? So if you have"}, {"start": 145.84, "end": 152.84, "text": " a bunch of data points right here and let's say like this it is it is usually"}, {"start": 152.84, "end": 158.68, "text": " beneficial to first center the data like this so basically calculate its mean"}, {"start": 158.68, "end": 165.24, "text": " and shift it and then to standardize the axis. So basically divided by the standard"}, {"start": 165.24, "end": 170.32000000000002, "text": " deviation in each direction and your data will look something like this. Of many"}, {"start": 170.32000000000002, "end": 175.28, "text": " classical methods that will improve the conditioning numbers of the"}, {"start": 175.28, "end": 179.44, "text": " requirements to solve it and so on and even of deep learning methods we just"}, {"start": 179.44, "end": 185.36, "text": " know that if you standardize your data like this it works better. So people are"}, {"start": 185.36, "end": 190.48000000000002, "text": " basically have come up with these methods that where they say well if it helps"}, {"start": 190.48, "end": 196.67999999999998, "text": " for the data at the beginning of a neural network then if after if after a"}, {"start": 196.67999999999998, "end": 201.48, "text": " layer the data is kind of out of whack that can happen after a layer of neural"}, {"start": 201.48, "end": 206.04, "text": " network we should maybe first before we send it to the next layer do the same"}, {"start": 206.04, "end": 211.67999999999998, "text": " thing center it again and then send it through and if after the next layer again"}, {"start": 211.67999999999998, "end": 216.67999999999998, "text": " it's out of whack we should maybe center it and standardize it again before"}, {"start": 216.68, "end": 222.0, "text": " sending it through the next layer. So at each layer you have these transformations"}, {"start": 222.0, "end": 227.8, "text": " that center and standardize the data and usually for the longest time this was"}, {"start": 227.8, "end": 232.76000000000002, "text": " batch norm. Batch norm does this across the mini batches of the data since you"}, {"start": 232.76000000000002, "end": 238.28, "text": " can't pass the entire data set. Now group norm has come and replaced batch norm"}, {"start": 238.28, "end": 243.8, "text": " because in batch norm it's very dependent on the batch size while group norm"}, {"start": 243.8, "end": 250.84, "text": " isn't. Now the group norm paper has sort of made it clear that in competitive"}, {"start": 250.84, "end": 255.16000000000003, "text": " batch sizes in the large batch size regime group norm is sorry batch norm is"}, {"start": 255.16000000000003, "end": 258.64, "text": " still the king batch norm still works better it's only when you go to very"}, {"start": 258.64, "end": 262.2, "text": " small batch sizes that group norm takes over and that's what you can see here."}, {"start": 262.2, "end": 267.32, "text": " So here okay it's a bit unfair because batch norm is trained with a larger"}, {"start": 267.32, "end": 272.44, "text": " batch size but even if group norm were to be trained with the large batch size it"}, {"start": 272.44, "end": 282.56, "text": " would still be in the same place because no it wouldn't it would not. Sorry that"}, {"start": 282.56, "end": 288.16, "text": " is that is not the case because the batch is still influenced the gradient"}, {"start": 288.16, "end": 292.28, "text": " stock hasty city and so on but still batch norm is better than group norm as you"}, {"start": 292.28, "end": 297.4, "text": " can see here but here over here where you kind of have to go to the small batch"}, {"start": 297.4, "end": 304.2, "text": " sizes then batch norm is all of a sudden worse than group norm and the"}, {"start": 304.2, "end": 310.0, "text": " weight standardization is a technique to actually make group norm better than"}, {"start": 310.0, "end": 318.79999999999995, "text": " batch norm in any of these so even in these in the large batch regime okay so"}, {"start": 318.79999999999995, "end": 325.44, "text": " we'll now explore weight standardization. So in the group norm paper we've looked"}, {"start": 325.44, "end": 330.84, "text": " at the diagram on the left so basically in batch norm here is the number of"}, {"start": 330.84, "end": 337.36, "text": " data points this is your batch this is the channels of the batch of the"}, {"start": 337.36, "end": 342.56, "text": " individual images channels and this is the height and width of the image so"}, {"start": 342.56, "end": 345.96, "text": " this is the image itself a single channel so a single channel in the image"}, {"start": 345.96, "end": 352.24, "text": " would be a column in this thing right here. Batch norm normalizes across the"}, {"start": 352.24, "end": 358.56, "text": " data points in a single channel layer norm which is a precursor to group norm"}, {"start": 358.56, "end": 364.12, "text": " normalizes only in a single data point instance but across all of the channels"}, {"start": 364.12, "end": 369.04, "text": " as you can see here now that frees its dependence on the batch size each"}, {"start": 369.04, "end": 374.24, "text": " data point is treated individually but of course it it sort of convolves all"}, {"start": 374.24, "end": 380.08, "text": " the channels with each other it doesn't distinguish them instance norm tries"}, {"start": 380.08, "end": 385.32, "text": " to fix this instance norm down here tries to fix this by saying it was a good"}, {"start": 385.32, "end": 389.59999999999997, "text": " idea to own to normalize each feature individually and takes it to the"}, {"start": 389.59999999999997, "end": 396.03999999999996, "text": " extreme basically normalizes a single image for by each of these single"}, {"start": 396.03999999999996, "end": 402.36, "text": " features but that loses too much information group norm comes along and says"}, {"start": 402.36, "end": 407.28, "text": " maybe some of the features naturally depend on each other naturally exhibit"}, {"start": 407.28, "end": 413.44, "text": " the same responses therefore we should normalize them in groups so we take"}, {"start": 413.44, "end": 418.64, "text": " still a single image but we take groups in this case groups of three channels"}, {"start": 418.64, "end": 426.88, "text": " together and normalize across that now this here is all in data space this all"}, {"start": 426.88, "end": 431.59999999999997, "text": " normalizes the data like we said up here when we drew this this is all"}, {"start": 431.59999999999997, "end": 436.59999999999997, "text": " normalizing the data before passing it through the next layer now what actually"}, {"start": 436.6, "end": 442.8, "text": " happens in these layers so what happens here what happens here in a convolutional"}, {"start": 442.8, "end": 447.56, "text": " neural network is that the images get convolved with kernels that's how that's"}, {"start": 447.56, "end": 454.12, "text": " what a neural network layer is so if you have an image right here of our trust"}, {"start": 454.12, "end": 459.16, "text": " the cat I've drawn whiskers in a while that knows is very high the eyes must be"}, {"start": 459.16, "end": 465.44, "text": " like up here sorry cat and the layer inherently has these things called"}, {"start": 465.44, "end": 470.32, "text": " kernels now I'm just gonna draw one of these kernels right here it's a three by"}, {"start": 470.32, "end": 475.44, "text": " three kernel and what you'll do is you'll slide the kernel across this right"}, {"start": 475.44, "end": 481.76, "text": " across like this you slide it across across across across and for each point"}, {"start": 481.76, "end": 486.84, "text": " you convolve the kernel so you can evolve the values here with the pixels here"}, {"start": 486.84, "end": 493.64, "text": " and sum them up and that for each position in the image means that you'll"}, {"start": 493.64, "end": 498.96, "text": " basically get a new value at each point and that will be your next layers"}, {"start": 498.96, "end": 507.2, "text": " data point now in these normalization techniques we usually normalize the"}, {"start": 507.2, "end": 511.12, "text": " data points so here you have multiple channels maybe a red, a green and a blue"}, {"start": 511.12, "end": 517.68, "text": " and so on and the intermediate layers you have even more and but you also have"}, {"start": 517.68, "end": 524.16, "text": " multiple kernels you can see here you have multiple of these kernels which"}, {"start": 524.16, "end": 532.76, "text": " will then result in multiple output channels the old normalization methods"}, {"start": 532.76, "end": 542.68, "text": " batch norm layer norm group norm they all work in they all work in this or in"}, {"start": 542.68, "end": 548.68, "text": " this space in the space of data whereas weight standardization works on the"}, {"start": 548.68, "end": 554.2399999999999, "text": " kernel space so weight standardization means you want to normalize the weights"}, {"start": 554.2399999999999, "end": 559.4, "text": " of the neural network not the data and that's why it can be used in conjunction"}, {"start": 559.4, "end": 564.04, "text": " with something like group norm or actually batch norm or layer norm could be"}, {"start": 564.04, "end": 568.56, "text": " used with any of these but these authors use it in conjunction with group norm"}, {"start": 568.56, "end": 574.56, "text": " so what does it do if you have these kernels the kernels are of our"}, {"start": 574.56, "end": 578.92, "text": " characterized actually a kernel is characterized by four numbers so first of"}, {"start": 578.92, "end": 583.64, "text": " all it's the height and width of the kernel which in our case was three by"}, {"start": 583.64, "end": 589.76, "text": " three and it is characterized by two more numbers which is the C in in"}, {"start": 589.76, "end": 597.1199999999999, "text": " channels and the out channels so the in channels is the number of channels that"}, {"start": 597.12, "end": 601.6, "text": " come into the layer and the out channels are the number of channels that you"}, {"start": 601.6, "end": 607.72, "text": " want to transform that into so here you can see the in channels are listed here"}, {"start": 607.72, "end": 611.76, "text": " and the out channels are listed here and in the up-down direction which is not"}, {"start": 611.76, "end": 617.28, "text": " labeled here is the height and width so this here would be actually a two by two"}, {"start": 617.28, "end": 624.04, "text": " kernels so each of these slivers here is a two by two kernel in the"}, {"start": 624.04, "end": 627.88, "text": " convolutional network and then that would be the orange sliver here and then the"}, {"start": 627.88, "end": 634.56, "text": " sliver behind that would be the next two by two kernel weight standardization"}, {"start": 634.56, "end": 642.9599999999999, "text": " says hi hey it might be as we normalize the data it might be a good idea"}, {"start": 642.9599999999999, "end": 650.36, "text": " sorry I was that was wrong one column here one of these columns is a two by"}, {"start": 650.36, "end": 656.2, "text": " two filter and then the column behind and the column next to it they're all"}, {"start": 656.2, "end": 665.92, "text": " two by two filters right so you have two by two filters in the output or"}, {"start": 665.92, "end": 669.64, "text": " and you also have two by two filters for each of the for each of the input"}, {"start": 669.64, "end": 672.84, "text": " output channel combination you have a two by two filters so you have an entire"}, {"start": 672.84, "end": 678.76, "text": " matrix of two by two filters if you can imagine that so across the out and"}, {"start": 678.76, "end": 684.16, "text": " across the in direction weights standardization says hi it might be a good idea"}, {"start": 684.16, "end": 693.8, "text": " to see that the weights for a given output channel right this is we take one"}, {"start": 693.8, "end": 700.4399999999999, "text": " output channel and we see all the filters that transform the input into that one"}, {"start": 700.4399999999999, "end": 706.24, "text": " output channel which is going to be this many times this many times this many"}, {"start": 706.24, "end": 713.32, "text": " numbers or this many filters maybe we should normalize all of these to be"}, {"start": 713.32, "end": 717.64, "text": " sort of to not get out of whack because one could imagine that during training"}, {"start": 717.64, "end": 724.08, "text": " right if we start we initialize our filters somewhere here you know maybe one"}, {"start": 724.08, "end": 727.92, "text": " number this this one number here we initialize it randomly right we draw it from"}, {"start": 727.92, "end": 733.8, "text": " random and then maybe as we train it actually gets very large because it's"}, {"start": 733.8, "end": 738.4399999999999, "text": " actually plausible because after that we we you know this is our neural network"}, {"start": 738.4399999999999, "end": 744.04, "text": " layer after that we have this procedure to recenter the data right so I could"}, {"start": 744.04, "end": 750.28, "text": " make a very large weight here multiply the data by very large weight because it"}, {"start": 750.28, "end": 756.5999999999999, "text": " gets re-centered anyway but of course if my weights get large I'll basically"}, {"start": 756.5999999999999, "end": 763.04, "text": " increase the variance and the instability and the gradients might be high and"}, {"start": 763.04, "end": 768.5999999999999, "text": " and so on so these all through think it might be good idea to normalize these"}, {"start": 768.5999999999999, "end": 773.8399999999999, "text": " weights so just as you normalize the data you'd normalize the weights and this"}, {"start": 773.8399999999999, "end": 779.28, "text": " actually turns out to be fairly easy in the sense of how you would do it so"}, {"start": 779.28, "end": 787.64, "text": " instead of transforming x which is the input to a layer into y using w so this"}, {"start": 787.64, "end": 792.12, "text": " is w this is your actual parameter using w you would you won't do this right"}, {"start": 792.12, "end": 799.16, "text": " now so this this was usually you just do you just do x times w and that gives you"}, {"start": 799.16, "end": 806.16, "text": " y this is a convolutional operation right here now you don't do this you do you"}, {"start": 806.16, "end": 813.16, "text": " have to take w and first you subtract the mean of w this is now for a single"}, {"start": 813.16, "end": 817.96, "text": " output channel and then you divide by the standard deviation I mean this is"}, {"start": 817.96, "end": 825.12, "text": " the under deviation of w and that entire thing you know multiply by x now since"}, {"start": 825.12, "end": 831.8000000000001, "text": " these things here are sorry about that since these things here are just you know"}, {"start": 831.8000000000001, "end": 835.84, "text": " deterministic operation you can actually back propagate through it so the"}, {"start": 835.84, "end": 844.2, "text": " forward path of data now looks as follows you come you start you say okay my"}, {"start": 844.2, "end": 852.1600000000001, "text": " data comes in I will take my weights that my layer weights and I will first"}, {"start": 852.1600000000001, "end": 858.5200000000001, "text": " center them then scale them with its standard deviation and then I will use"}, {"start": 858.5200000000001, "end": 864.0, "text": " that thing and x in order to obtain my layer output and then I'll send that"}, {"start": 864.0, "end": 868.2800000000001, "text": " to the next layer now the back prop signal here is interesting because the"}, {"start": 868.2800000000001, "end": 873.4000000000001, "text": " back prop signal comes in from here and splits up in two way it splits up into"}, {"start": 873.4, "end": 882.3199999999999, "text": " the back prop signal basically you have to back prop through the x times w hat"}, {"start": 882.3199999999999, "end": 887.4, "text": " operation we know how to do that that's just a convolutional back prop that you"}, {"start": 887.4, "end": 894.16, "text": " back prop through the convolution operation back to the last layer now"}, {"start": 894.16, "end": 899.28, "text": " usually when you back prop through the convolution operation you get two things"}, {"start": 899.28, "end": 903.24, "text": " you get the derivative with respect to x and you get the derivative with"}, {"start": 903.24, "end": 910.32, "text": " respect to the weights w and you can send both on and you would update your"}, {"start": 910.32, "end": 917.36, "text": " weights with that gradient but now what you'll have to do because this is not"}, {"start": 917.36, "end": 924.0, "text": " your actual parameter of the network you have to take that particular signal and"}, {"start": 924.0, "end": 929.92, "text": " you have to basically reverse the standardization and the centering before you"}, {"start": 929.92, "end": 935.04, "text": " can apply the gradient but that's all doable the actually modern frameworks will"}, {"start": 935.04, "end": 942.0, "text": " do it by themselves but it's just that the the back prop path here it"}, {"start": 942.0, "end": 947.9599999999999, "text": " introduces two new operation to the forward and to the back prop path that you"}, {"start": 947.9599999999999, "end": 952.7199999999999, "text": " didn't have before but I can imagine this will actually not take you won't"}, {"start": 952.72, "end": 960.88, "text": " even notice that this is happening this is so fast so they the idea is"}, {"start": 960.88, "end": 966.28, "text": " basically pretty basic especially since the entire discussion around normalization"}, {"start": 966.28, "end": 972.76, "text": " has already happened I enjoy that this paper does go into the theory a bit more"}, {"start": 972.76, "end": 979.4, "text": " so they analyze what this weight standardization what affected has on the"}, {"start": 979.4, "end": 985.04, "text": " lip sheets constant of the loss for example and they also research what what"}, {"start": 985.04, "end": 992.12, "text": " what contributes more the centering of the weights or the standardization so they"}, {"start": 992.12, "end": 996.68, "text": " kind of run all these ablations where they figure out okay if we just do group"}, {"start": 996.68, "end": 1001.72, "text": " norm we have one we you know we have this trajectory here and if we run"}, {"start": 1001.72, "end": 1006.0799999999999, "text": " group norm plus equation five which is subtracting the mean you can see the"}, {"start": 1006.08, "end": 1013.32, "text": " blue and the orange that is quite a bit and if we only do the dividing by the"}, {"start": 1013.32, "end": 1018.0, "text": " standard deviation you can see it's pretty close together but there is a"}, {"start": 1018.0, "end": 1023.0400000000001, "text": " difference if you do both then again there is a difference to only doing the"}, {"start": 1023.0400000000001, "end": 1027.92, "text": " centering so they they say even though you know probably subtracting the mean"}, {"start": 1027.92, "end": 1035.1200000000001, "text": " gives you most of the benefit since it is so easy you should just do both and I"}, {"start": 1035.12, "end": 1041.4399999999998, "text": " honestly think and here in the in the in the validation error that makes"}, {"start": 1041.4399999999998, "end": 1047.4799999999998, "text": " basically no difference at all and they do quite a number of these ablations"}, {"start": 1047.4799999999998, "end": 1054.76, "text": " which I'm not gonna go into too much and they do also the so the lip sheets"}, {"start": 1054.76, "end": 1058.6, "text": " constant of the loss and the lip sheets constant of the gradients they basically"}, {"start": 1058.6, "end": 1064.76, "text": " show that the loss and the gradients are behaved more more well behaved when"}, {"start": 1064.76, "end": 1069.24, "text": " you use this weight standardization technique together with group norm they"}, {"start": 1069.24, "end": 1074.8, "text": " also do quite a bit of experiments where they show that their method out"}, {"start": 1074.8, "end": 1080.24, "text": " performs batch home and especially in the small batch size regime and that is"}, {"start": 1080.24, "end": 1087.08, "text": " something that I absolutely believe what happened here okay I we actually don't"}, {"start": 1087.08, "end": 1092.92, "text": " even need to go down there because if you want to read the paper I invite you to"}, {"start": 1092.92, "end": 1098.48, "text": " read the paper it's a very good paper I enjoyed reading it but ultimately they"}, {"start": 1098.48, "end": 1103.2, "text": " suggest this new method and also I have seen this one replicated across the"}, {"start": 1103.2, "end": 1109.3200000000002, "text": " community a number of times so it seems to be a thing that I would expect either"}, {"start": 1109.3200000000002, "end": 1114.24, "text": " it fizzes out and the community decides that it's about the same as batch norm"}, {"start": 1114.24, "end": 1120.5600000000002, "text": " and therefore not worth it or and that's what I believe since we also go into"}, {"start": 1120.56, "end": 1125.72, "text": " the direction of larger models which means smaller batches per worker and"}, {"start": 1125.72, "end": 1131.52, "text": " generally batch norm is a pain I believe this is just going to be rather"}, {"start": 1131.52, "end": 1137.52, "text": " standard in the future so I'll actually incorporate this if I can into my next"}, {"start": 1137.52, "end": 1144.0, "text": " projects so that was it for me if you like this consider subscribing consider"}, {"start": 1144.0, "end": 1148.8799999999999, "text": " leaving a like on the video thank you for listening if you have any comments I"}, {"start": 1148.88, "end": 1155.48, "text": " will very probably read them bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=zt_R85Ife_U | [Trash] Automated Inference on Criminality using Face Images | This paper sets out to build a classifier to distinguish criminals from non-criminals using nothing but a face picture. I explore why the research is trash and what lessons we can learn from it.
https://arxiv.org/abs/1611.04135
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 these faces. Try to decide which of these faces are criminals and which ones are law abiding citizens. I'll give you a second. Okay, got it? So if you decided that these four here are the criminals, you would be correct. And that makes these three the law abiding citizens. As for this one, maybe if the crime is being too cool. Of course, none of these faces actually exist in real life. These are compositions of eigenfaces, of datasets, of criminals and non criminals. Today's paper is a absolute controversy. This is going to get me into so much trouble. So if you see something like this in the news, always, always, always go and check. Now we're going to look at automated inference on criminality using face images by jiao Ling Wu and Ji Chang. On a high level, they're trying to separate criminals from non criminals using face images. So basically using classifiers on ID photos. This of course has has generated quite the uproar. I suggest we just dive into the paper and look at what's happening right here. We study for the first time automated inference on criminality based solely on still face images, which is free of any biases and subjective judgements of human observers. So they say we train a bunch of models, including as you can see, a CNN using facial images of 1,856 real persons controlled for race, gender, age and facial expressions, nearly half of whom were convicted criminals for discriminating between criminals and non criminals. So this is the outset. This is the kind of research question here. Now immediately you have people jumping up saying that's not possible. And I would agree, but I think actually there are very, very interesting lessons to be learned from this paper. So they're saying they actually manage to do this with their classifiers, actually with all of these classifiers. Of course deep learning being the best. Also some discriminating structural features for predicting criminality have been found by machine learning. So they even tell you why above all the most important discovery of this research is that criminal and non criminal face images populate to quite distinctive manifolds. The variation among criminal faces is significantly greater than that of non criminal faces. The two manifolds consisting of criminal and non criminal faces appear to be concentric with the non criminal manifold lying in the kernel with the smaller span exhibiting a law of normality for faces of non criminals. I'm going to be canceled. I don't have a case for this. This is not this is not I'm not a fan of this. Just in other words, the faces of general law abiding public have a greater degree of resemblance compared with the faces of criminals or criminals have a higher degree of dissimilarity and facial appearance than non criminals. So basically what they're saying is that the this kind of similarity among the non criminals in their dataset is larger than the similarity among the criminals. Okay, so already the outset right then they go into this introduction and in the introduction we won't go it through fully. But they basically introduced the concept of facial recognition. They try to build up kind of an argument where they say faces are different. Some people have hypothesized that it's possible to infer personality traits from facial features. Some studies exist that show that people agree on the perception of these traits. So not the actual traits but people will kind of agree that a face looks extroverted or more agreeable. People tend to agree that the appearance exists and then they sort of make the next step and say okay can facial features also be used not just for predicting the appearance but to predict the actual person. For validating the hypothesis on the correlations between the innate traits and social behaviors of a person and the physical characteristics of that person's face. It would be hard push to find a more convincing experiment than examining the success rate of discriminating between criminals and non criminals. So actually you could agree with this right since this is sort of a distinction one can make about behavior whether or not someone breaks the law or in this case is caught and convicted and so on. There are like many many hurdles in this in essence the statement sort of makes sense like if you could actually do this from facial features that would be very first of all very surprising and second of all very drastic. People immediately jump to the conclusion that okay if such a thing were found that means you could somehow precognate criminality which I don't think it has to be because what could also be the case is they have a quote from Aristotle right here. It is possible to infer character from features if it is granted that body and soul are changed together by the natural affections. One interpretation of me is that let's say you break the law for whatever it could be completely moral light you steal the medicine for the old lady in your house. But you know you broke the law you know you did something that society doesn't want you to do and that will exert stress on you right you now have to lie to people about this you now have to sort of make sure you're not caught you have to worry maybe there's a security tape or something like this and the stress will we know that stress will physically change you and that could be in turn made out by your features. For example the stress of being in jail could change your physical features and since these are all convicted criminals one might think that it might be possible it might again not saying it is it might. So if you if we throw away all of the kind of prejudgments on this it could be an interesting research question right could now whether we want to pursue it or not that's it a different question but the way they build this up here is that they only have the best of intentions in mind I feel like this might not be the case. So they say something like this right here at the onset of this study our gut feeling is that modern tools of machine learning and computer vision will refute the validity of physiognomy although the outcomes turn out otherwise this and this is the part where I just stop believing them that their intentions were like all good and it's just about disproving this so we can just lay it to rest because they then it's very quickly switched. When they find something else non criminals are the normals and the criminals are like the that just rubs me the wrong way where you'll have to say yeah it's like the cook looks playing going like oh no we you know we have many social gatherings and our gut feeling is that people aren't really different and the roles are actually personal protective equipment it's all actually just a community thing we all you know good intentions on every now and then we let you go going into this with sort of a mixed bag of feelings where you have a hypothetically valid research question but also even the introduction makes it very clear because it's somewhat over the top promising to just be neutral and be good good intended not going to fall for it sorry. They say in order to conduct experiments they have 1,856 ID photos the fallen criteria Chinese male between ages of 18 and 55 no facial hair no facial scars or other markings and the data set is called S then there's two subsets SN for non criminals and SC for criminals. The non criminals contains ID photos of 116 non criminals that were acquired from the internet using the web spider tool there from a wide gamut of professions and social status including waiters construction were above OK. The subset of the criminals contains ID photos of 730 criminals of which 330 as are published as wanted suspects by the ministry of public security of China and by the departments of public security for the provinces of Guangdong, Jiangsu, Yao Ming etc. The others are provided by city police department in China under confidentiality agreement we stress and here here's an important point we stress that the criminal face images in SC are normal ID photos not police mug shots. They say they have violent crimes or non violent crimes and so on so there are these examples here of those images so the top ones are the criminals and the bottom ones are the non criminals. Now people immediately see differences here and if you spotted that all of these have white colors and none of those have white colors then you would be correct. Now you're on the right path you're not actually correct correct but you're on the right path here because actually what they do is they mask away the colors so they only extract the face part and the upper neck part so this white color part will actually not be on the image that they analyze to control for clothing which is good but it gives you sort of an indication that the origins of the two image groups might not actually be the same. So what you'll have is you'll have basically a database actually have two databases of criminals which are so the one database is this wanted let's call them W. These are released by the police for wanted criminals then the others database is the convicted criminals let's call that C and then on the other side you have the database of non criminals and the non criminals come from the internet. So you have three different databases and of course these two make going to make up the criminals and this will make up the non criminals and here in lies the problem right you even though the white colors are masked out you have to make sure that whatever you find isn't just a property of how you collected the data and this doesn't really come through in this paper so they do data preparation as again they mask their resize and so on they stress again all our ideas images with frontal lighting so yeah and they okay so now they test the classifiers so they say we test logistic regression logistic regression K and N SVM and CNN on the image data set so for the CNN you can just input the original image but for the other classifiers you need a set of features and what they do is they concatenate three different image feature vectors so the first one is facial landmark points that you extract by some sort of tool you can extract whatever corners of mouth and so on. Then the second facial facial feature vector generated by a modular PCA and the third is a facial feature vector based on a local binary pattern histograms. So these are sort of face features that people use for recognizing faces they concatenate that gives you feature vector feedback into the machine learning algorithm and they do a we perform a tenfold cross validation for all possible combinations of three feature classifiers and the four types of feature vectors plus the data driven CNN so they do a tenfold cross validation right which basically means you you do you partition your data into ten parts you take nine to train predict the one then you take the next nine to train predict the one that you left out and so on that this kind of you get a train test split across all sorts of splits of your data which is a it's a you know it's a valid thing to do and they discover here that their CNN classifier performs at almost 90% accuracy as you can see here and even their SVM and the other classifiers it performed fairly well in recognizing these criminality faces. So and they analyze you know the ROC curves and the ROC curves this is a really this is a classifier that works right so you can see in the the other models but especially the CNN classifier here works really well. Of course the question is what does it work for so they basically say all right we now have a classifier that distinguishes criminals from non criminals and I would say you have a classifier that discriminates your particular pictures of criminals from your particular pictures of non criminals and if this were submitted to me as a reviewer I would expect that any sane author would then go. And then go and try to invalidate that so here's what you'll have to do if you want to convince me that this is not just due to how you collected your data you need to go and you need to basically say okay I have these different methods of collecting data right here. Now maybe I can go to the police and ask them for a picture from the same database of a non convicted not so a non criminal someone that was arrested but then not convicted and I can you know have someone from from here. That can put in that data set and then you have to show me that your classifier will correctly predict that that's a non criminal and if it predicts it's a criminal it's due to the data set. You can also find one of the criminals but find their picture on the internet like you collected the non criminals and that will give you someone from this database in that data set and then you have to show me that your classifier correctly predicts that's a criminal. You can further convince me that your classifier is neutral to this separation right here of the wanted and convicted criminals because they all should be criminals right so if your classifier is neutral to that then it basically doesn't care where it comes from so this will be a weaker argument but still one that one could investigate. What do they do for validating their method? Here is where it gets funky. So they say given the high social sensitivities and repercussions of our topic and skeptics on physiognomy we try to exercise maximum caution before publishing our results. Yeah you failed. In playing Devils advocate we design and conduct the following experiments to challenge the validity of the tested classifiers for the task of discriminating between criminals and non criminals. All right this is it right here here is where you give us where you tell us it's not because of how we collected the data which is the obvious explanation. We randomly label the faces in the very sample set as as negative and positive instances with equal probability and redo all the above experiments of binary classification. How can I see this? They are basically saying well if our classifier were not a criminality classifier that means we could invalidate it by shuffling the labels and if that comes out to 50-50 then our classifier obviously works because it's not 50-50 in this data set. So basically they're just validating that a classification algorithm can classify something. The critics and here is never that they haven't actually trained a working classifier. The criticism is what have they trained a classifier for but their entire validation procedure is basically we don't have it bogging our code. The outcomes show that the randomly generated negative and positive instances cannot be distinguished at all. Gee who guessed a classifier on random labels doesn't generalize. Man. In fact in fact we go much further along the self-critical path. Alright here it comes. Here it comes. In Korea the same experiments for random labeling on different samples of the same size and with the same variable control. Only this time in the selection criteria are standard edd photos of Chinese female young middle aged or standard edd photos of Caucasian male young middle aged of Caucasian female young middle aged no facial. So basically if you train on a randomly labeled data set on any day on any sort of pictures your classifier will not work. Thanks. Maybe that's I think that's the academically most valid statement in the entire paper. Oh man in none of the three cases any of the four classifiers managed to achieve a true positive rate higher than 53% on randomly labeled positive and negative instances. So the classifier must be valid because... The above experiments rule out that the good accuracies of the four evaluated classifiers in face inference on criminality are due to data overfitting. No. Otherwise given the same sample size they would also be able to distinguish between randomly labeled positive and negative instances with significantly better chances. But they did cross validation. They did. The cross validation prevents the overfitting we know on criticizes that you owe these people have no idea what they're doing they have no clue of machine learning they don't know what the problems with methods are they don't know what overfitting is and and how you control for it. The big jump of the true positive rate from random labeling to truth labeling on the same set of face images can only be explained by intrinsic separability of SC and SN. That is true. That is true. But why are they separable? That's the question. As different source cameras generated the ID photos in the set as now they might be on the right track here. Different source cameras. Maybe they could get the idea that different data sources lead to different things. They might leave their signatures that although below perception threshold in signal strength could mislead machine learning. They are basically saying different cameras could generate different sort of artifacts. They rule this out by basically adding noise to the images such that these artifacts would be washed out and the noise doesn't change their results. They were so close to actually doing something useful. This section is where it gets even more interesting. Now they're trying to guess from their classifier what are the actual features that make criminals criminals. So discriminating features right here. Having obtained the above strong empirical evidence is for the validity of automated face induced inference on criminality. One cannot resist the following in three in questions. What features of a human face betray its owners propensity for crimes. Okay, Shakespeare. And they basically they basically go and explain ability or out where they see what the classifier pays attention to. And it turns out the classifier pays attention to the following features on the left. You can see where the classifier pays attention to. And when we're surprised here it pays attention to face features but they kind of parse out the following three features. First of all, the D the distance between the eyes in criminals tends to be smaller than in non criminals. The angle between the nose and the corners of the mouth tends to be smaller in criminals than in non criminals. And the curvature of the upper lip tends to be higher in criminals than in non criminals. So let's let's try just from this information to draw the ultimate criminal and non criminal faces. So first of all, the non criminal. Let's draw the non criminal as just regular. I'm not very good at this. So here's the nose. And then let's just draw the lips like this. Non criminal. Perfect. Looks like a law-liding citizen to me. Criminal. Right here. So the eyes are closer together. Here's the nose. And then the curvature of the upper lip is higher. So. And then the angle between the nose and the outer corners of the mouth is smaller. How can I make the angle smaller? Could it be that if I'm oh yes. Oh, that's the trick. Criminal, ladies and gentlemen. So are you telling me that all someone has to do to be a criminal is frown. Yeah, totally valid. So they're so close, right? But they say all of these are intrinsic facial features. But come on. All right. So they go. They go on to say that they they have some histogram differences of these features that they basically say these features are what's responsible for this. And then they do face clustering, which is beautiful. So first of all what they do is they sort of take the average faces for criminals and non criminals. And these are the average faces. So the top or the actual average eye in faces and the bottom is when you kind of shift the facial landmarks around the seeming paradox that S C and S N can be classified. But the average faces appear almost the same can sorry the average faces appear almost the same the average faces appear almost the same. What a paradox. These are almost the same. I mean if I just overlay them one over another. They're almost the same. There is no no difference at all. I don't see a difference. How what could possibly be the difference. What what could be the difference. I don't think that these are the most honest of intentions. So they basically do some clustering, which I find interesting. I find interesting. For example that they don't really explain iso map here. So iso map uses the GUDsick distance between two points on the manifold, which is defined between the sum of the way it's. So they kind of washi washi iso map, but they then explain K means in great detail with formulas and again this. I mean the okay non machine learning people can do machine learning that's fine, but they're not really into the matter here. And they try K means clustering and they find in their opinion they find four clusters of criminals and three clusters of non criminals now Y, three and four. And usually can do something like this by clustering and then measuring the residual variance in your data. So how much does one cluster explain two clusters and so on. So here you can see the curves for non criminals and criminals now they claim that the optimal number of clusters here for non criminals is three, which makes no sense to me like Y, three. So what you usually want to find is kind of a kink in your curve, like if it's steep and then it gets flat, that means that up until then your clusters actually buy you something good and from then they basically are useless. So if I were to guess I would divide the criminals into two clusters and the non criminals into a single cluster because that's pretty flat. Certainly not the non criminals into three and the criminals into four. And that makes no sense at all like why and they say, OK, these are the clusters right here and these are the pictures I shown you at the beginning. What surprise the bottom ones, the non criminals are smiling and the top ones aren't. I wonder why the method works and the interesting part here is that where how can we justify maybe how can we say if we decide on one cluster for non criminals and two clusters for criminals, what does that remind us of. Oh, yes, that is exactly how we collected the data. That is exactly the fact that we collected the non criminals with one procedure and the criminals with two different procedures. Gee, they're classifying their data set replicates exactly how they collected the data and that convinces me that it says absolutely nothing about the actual criminality of people. It's just that police, even if it's ID photos, they don't smile and pictures on the internet. Sometimes people smile, the rest of the papers pretty much garbage. They did reply to critics and they kind of take issue with a number of things. So first name calling, I don't mean to name call, but it's going to happen. I don't get why people call them racist because it's all the say doesn't know trouble. And smiley. Ha. In our experiments, we did control facial expression, but not faint micro expression. The critique that our methods can be reduced to a simple discriminator of smiling versus not smiling has given us a new angle of scrutiny. They say, well, Westerners think that this is smiling, but our Chinese students and colleagues, even after being prompted to consider the queue of smile, fail to detect the same. So basically their answer is, yeah, you think so, but we don't. And then they say instead they only find the faces in the bottom row appearing somewhat more relaxed than those in the top row. And then here's the crucial part, all criminal ID photos are government issues, but not mock shots. They are normal government issue ID portraits like those to drive a license in the USA. In contrast, most of the non criminal ID style photos are taken officially by some organizations such as real estate companies, law firms, etc. for their website. You know what I'd always says when you take your picture for a government ID, please don't smile. Imagine if you're a law firm, come to students, say we want a picture for our website, please don't smile. All right, this was it for this paper. If you like this content, please consider subscribing and sharing it out. This is absolute garbage. And there is important lessons to learn here. Namely, Occam's razor is a real problem in research. People often fail to criticize themselves enough and to think, is there maybe a different explanation for why I'm getting the results that I'm getting? And how can I disprove that that is the case? And how can I make sure that the effect that I'm seeing actually comes from the place where I claim it comes from? I think this is a real threat throughout all of research. I've seen many papers that I've reviewed that are exactly of the same fallacy, not as touchy subjects as this one, but it definitely exists. And I remind everyone that learn a lesson from this and have a good day. | [{"start": 0.0, "end": 10.0, "text": " Hi there. Take a look at these faces. Try to decide which of these faces are criminals and which ones are law abiding citizens."}, {"start": 10.0, "end": 12.0, "text": " I'll give you a second."}, {"start": 13.0, "end": 20.0, "text": " Okay, got it? So if you decided that these four here are the criminals, you would be correct."}, {"start": 20.0, "end": 28.0, "text": " And that makes these three the law abiding citizens. As for this one, maybe if the crime is being too cool."}, {"start": 28.0, "end": 38.0, "text": " Of course, none of these faces actually exist in real life. These are compositions of eigenfaces, of datasets, of criminals and non criminals."}, {"start": 38.0, "end": 45.0, "text": " Today's paper is a absolute controversy. This is going to get me into so much trouble."}, {"start": 45.0, "end": 51.0, "text": " So if you see something like this in the news, always, always, always go and check."}, {"start": 51.0, "end": 60.0, "text": " Now we're going to look at automated inference on criminality using face images by jiao Ling Wu and Ji Chang."}, {"start": 60.0, "end": 67.0, "text": " On a high level, they're trying to separate criminals from non criminals using face images."}, {"start": 67.0, "end": 75.0, "text": " So basically using classifiers on ID photos. This of course has has generated quite the uproar."}, {"start": 75.0, "end": 94.0, "text": " I suggest we just dive into the paper and look at what's happening right here. We study for the first time automated inference on criminality based solely on still face images, which is free of any biases and subjective judgements of human observers."}, {"start": 94.0, "end": 117.0, "text": " So they say we train a bunch of models, including as you can see, a CNN using facial images of 1,856 real persons controlled for race, gender, age and facial expressions, nearly half of whom were convicted criminals for discriminating between criminals and non criminals."}, {"start": 117.0, "end": 128.0, "text": " So this is the outset. This is the kind of research question here. Now immediately you have people jumping up saying that's not possible."}, {"start": 128.0, "end": 137.0, "text": " And I would agree, but I think actually there are very, very interesting lessons to be learned from this paper."}, {"start": 137.0, "end": 145.0, "text": " So they're saying they actually manage to do this with their classifiers, actually with all of these classifiers. Of course deep learning being the best."}, {"start": 145.0, "end": 164.0, "text": " Also some discriminating structural features for predicting criminality have been found by machine learning. So they even tell you why above all the most important discovery of this research is that criminal and non criminal face images populate to quite distinctive manifolds."}, {"start": 164.0, "end": 188.0, "text": " The variation among criminal faces is significantly greater than that of non criminal faces. The two manifolds consisting of criminal and non criminal faces appear to be concentric with the non criminal manifold lying in the kernel with the smaller span exhibiting a law of normality for faces of non criminals."}, {"start": 188.0, "end": 217.0, "text": " I'm going to be canceled. I don't have a case for this. This is not this is not I'm not a fan of this. Just in other words, the faces of general law abiding public have a greater degree of resemblance compared with the faces of criminals or criminals have a higher degree of dissimilarity and facial appearance than non criminals."}, {"start": 217.0, "end": 228.0, "text": " So basically what they're saying is that the this kind of similarity among the non criminals in their dataset is larger than the similarity among the criminals."}, {"start": 228.0, "end": 236.0, "text": " Okay, so already the outset right then they go into this introduction and in the introduction we won't go it through fully."}, {"start": 236.0, "end": 255.0, "text": " But they basically introduced the concept of facial recognition. They try to build up kind of an argument where they say faces are different. Some people have hypothesized that it's possible to infer personality traits from facial features."}, {"start": 255.0, "end": 269.0, "text": " Some studies exist that show that people agree on the perception of these traits. So not the actual traits but people will kind of agree that a face looks extroverted or more agreeable."}, {"start": 269.0, "end": 284.0, "text": " People tend to agree that the appearance exists and then they sort of make the next step and say okay can facial features also be used not just for predicting the appearance but to predict the actual person."}, {"start": 284.0, "end": 297.0, "text": " For validating the hypothesis on the correlations between the innate traits and social behaviors of a person and the physical characteristics of that person's face."}, {"start": 297.0, "end": 306.0, "text": " It would be hard push to find a more convincing experiment than examining the success rate of discriminating between criminals and non criminals."}, {"start": 306.0, "end": 320.0, "text": " So actually you could agree with this right since this is sort of a distinction one can make about behavior whether or not someone breaks the law or in this case is caught and convicted and so on."}, {"start": 320.0, "end": 336.0, "text": " There are like many many hurdles in this in essence the statement sort of makes sense like if you could actually do this from facial features that would be very first of all very surprising and second of all very drastic."}, {"start": 336.0, "end": 354.0, "text": " People immediately jump to the conclusion that okay if such a thing were found that means you could somehow precognate criminality which I don't think it has to be because what could also be the case is they have a quote from Aristotle right here."}, {"start": 354.0, "end": 365.0, "text": " It is possible to infer character from features if it is granted that body and soul are changed together by the natural affections."}, {"start": 365.0, "end": 375.0, "text": " One interpretation of me is that let's say you break the law for whatever it could be completely moral light you steal the medicine for the old lady in your house."}, {"start": 375.0, "end": 402.0, "text": " But you know you broke the law you know you did something that society doesn't want you to do and that will exert stress on you right you now have to lie to people about this you now have to sort of make sure you're not caught you have to worry maybe there's a security tape or something like this and the stress will we know that stress will physically change you and that could be in turn made out by your features."}, {"start": 402.0, "end": 418.0, "text": " For example the stress of being in jail could change your physical features and since these are all convicted criminals one might think that it might be possible it might again not saying it is it might."}, {"start": 418.0, "end": 440.0, "text": " So if you if we throw away all of the kind of prejudgments on this it could be an interesting research question right could now whether we want to pursue it or not that's it a different question but the way they build this up here is that they only have the best of intentions in mind I feel like this might not be the case."}, {"start": 440.0, "end": 469.0, "text": " So they say something like this right here at the onset of this study our gut feeling is that modern tools of machine learning and computer vision will refute the validity of physiognomy although the outcomes turn out otherwise this and this is the part where I just stop believing them that their intentions were like all good and it's just about disproving this so we can just lay it to rest because they then it's very quickly switched."}, {"start": 469.0, "end": 489.0, "text": " When they find something else non criminals are the normals and the criminals are like the that just rubs me the wrong way where you'll have to say yeah it's like the cook looks playing going like oh no we you know we have many social gatherings and our gut feeling is that people aren't really different and the"}, {"start": 489.0, "end": 518.0, "text": " roles are actually personal protective equipment it's all actually just a community thing we all you know good intentions on every now and then we let you go going into this with sort of a mixed bag of feelings where you have a hypothetically valid research question but also even the introduction makes it very clear because it's somewhat over the top promising to just be neutral and be good good intended not going to fall for it sorry."}, {"start": 518.0, "end": 539.0, "text": " They say in order to conduct experiments they have 1,856 ID photos the fallen criteria Chinese male between ages of 18 and 55 no facial hair no facial scars or other markings and the data set is called S then there's two subsets SN for non criminals and SC for criminals."}, {"start": 539.0, "end": 558.0, "text": " The non criminals contains ID photos of 116 non criminals that were acquired from the internet using the web spider tool there from a wide gamut of professions and social status including waiters construction were above OK."}, {"start": 558.0, "end": 580.0, "text": " The subset of the criminals contains ID photos of 730 criminals of which 330 as are published as wanted suspects by the ministry of public security of China and by the departments of public security for the provinces of Guangdong, Jiangsu, Yao Ming etc."}, {"start": 580.0, "end": 599.0, "text": " The others are provided by city police department in China under confidentiality agreement we stress and here here's an important point we stress that the criminal face images in SC are normal ID photos not police mug shots."}, {"start": 599.0, "end": 620.0, "text": " They say they have violent crimes or non violent crimes and so on so there are these examples here of those images so the top ones are the criminals and the bottom ones are the non criminals."}, {"start": 620.0, "end": 635.0, "text": " Now people immediately see differences here and if you spotted that all of these have white colors and none of those have white colors then you would be correct."}, {"start": 635.0, "end": 649.0, "text": " Now you're on the right path you're not actually correct correct but you're on the right path here because actually what they do is they mask away the colors so they only extract the face part"}, {"start": 649.0, "end": 672.0, "text": " and the upper neck part so this white color part will actually not be on the image that they analyze to control for clothing which is good but it gives you sort of an indication that the origins of the two image groups might not actually be the same."}, {"start": 672.0, "end": 688.0, "text": " So what you'll have is you'll have basically a database actually have two databases of criminals which are so the one database is this wanted let's call them W."}, {"start": 688.0, "end": 709.0, "text": " These are released by the police for wanted criminals then the others database is the convicted criminals let's call that C and then on the other side you have the database of non criminals and the non criminals come from the internet."}, {"start": 709.0, "end": 734.0, "text": " So you have three different databases and of course these two make going to make up the criminals and this will make up the non criminals and here in lies the problem right you even though the white colors are masked out you have to make sure that whatever you find isn't just a property of how you collected the data"}, {"start": 734.0, "end": 760.0, "text": " and this doesn't really come through in this paper so they do data preparation as again they mask their resize and so on they stress again all our ideas images with frontal lighting so yeah and they okay so now they test the classifiers so they say we test logistic regression"}, {"start": 760.0, "end": 778.0, "text": " logistic regression K and N SVM and CNN on the image data set so for the CNN you can just input the original image but for the other classifiers you need a set of features and what they do is they"}, {"start": 778.0, "end": 792.0, "text": " concatenate three different image feature vectors so the first one is facial landmark points that you extract by some sort of tool you can extract whatever corners of mouth and so on."}, {"start": 792.0, "end": 805.0, "text": " Then the second facial facial feature vector generated by a modular PCA and the third is a facial feature vector based on a local binary pattern histograms."}, {"start": 805.0, "end": 823.0, "text": " So these are sort of face features that people use for recognizing faces they concatenate that gives you feature vector feedback into the machine learning algorithm and they do a we perform a tenfold cross validation for all possible combinations of three feature"}, {"start": 823.0, "end": 852.0, "text": " classifiers and the four types of feature vectors plus the data driven CNN so they do a tenfold cross validation right which basically means you you do you partition your data into ten parts you take nine to train predict the one then you take the next nine to train predict the one that you left out and so on that this kind of you get a train test split across all sorts of splits of your data which is a it's a you know it's a valid thing to do and they discover here"}, {"start": 852.0, "end": 872.0, "text": " that their CNN classifier performs at almost 90% accuracy as you can see here and even their SVM and the other classifiers it performed fairly well in recognizing these criminality faces."}, {"start": 872.0, "end": 892.0, "text": " So and they analyze you know the ROC curves and the ROC curves this is a really this is a classifier that works right so you can see in the the other models but especially the CNN classifier here works really well."}, {"start": 892.0, "end": 921.0, "text": " Of course the question is what does it work for so they basically say all right we now have a classifier that distinguishes criminals from non criminals and I would say you have a classifier that discriminates your particular pictures of criminals from your particular pictures of non criminals and if this were submitted to me as a reviewer I would expect that any sane author would then go."}, {"start": 921.0, "end": 939.0, "text": " And then go and try to invalidate that so here's what you'll have to do if you want to convince me that this is not just due to how you collected your data you need to go and you need to basically say okay I have these different methods of collecting data right here."}, {"start": 939.0, "end": 958.0, "text": " Now maybe I can go to the police and ask them for a picture from the same database of a non convicted not so a non criminal someone that was arrested but then not convicted and I can you know have someone from from here."}, {"start": 958.0, "end": 970.0, "text": " That can put in that data set and then you have to show me that your classifier will correctly predict that that's a non criminal and if it predicts it's a criminal it's due to the data set."}, {"start": 970.0, "end": 988.0, "text": " You can also find one of the criminals but find their picture on the internet like you collected the non criminals and that will give you someone from this database in that data set and then you have to show me that your classifier correctly predicts that's a criminal."}, {"start": 988.0, "end": 1013.0, "text": " You can further convince me that your classifier is neutral to this separation right here of the wanted and convicted criminals because they all should be criminals right so if your classifier is neutral to that then it basically doesn't care where it comes from so this will be a weaker argument but still one that one could investigate."}, {"start": 1013.0, "end": 1020.0, "text": " What do they do for validating their method? Here is where it gets funky."}, {"start": 1020.0, "end": 1034.0, "text": " So they say given the high social sensitivities and repercussions of our topic and skeptics on physiognomy we try to exercise maximum caution before publishing our results."}, {"start": 1034.0, "end": 1050.0, "text": " Yeah you failed. In playing Devils advocate we design and conduct the following experiments to challenge the validity of the tested classifiers for the task of discriminating between criminals and non criminals."}, {"start": 1050.0, "end": 1062.0, "text": " All right this is it right here here is where you give us where you tell us it's not because of how we collected the data which is the obvious explanation."}, {"start": 1062.0, "end": 1080.0, "text": " We randomly label the faces in the very sample set as as negative and positive instances with equal probability and redo all the above experiments of binary classification."}, {"start": 1080.0, "end": 1105.0, "text": " How can I see this? They are basically saying well if our classifier were not a criminality classifier that means we could invalidate it by shuffling the labels and if that comes out to 50-50 then our classifier obviously works because it's not 50-50 in this data set."}, {"start": 1105.0, "end": 1119.0, "text": " So basically they're just validating that a classification algorithm can classify something. The critics and here is never that they haven't actually trained a working classifier."}, {"start": 1119.0, "end": 1132.0, "text": " The criticism is what have they trained a classifier for but their entire validation procedure is basically we don't have it bogging our code."}, {"start": 1132.0, "end": 1141.0, "text": " The outcomes show that the randomly generated negative and positive instances cannot be distinguished at all."}, {"start": 1141.0, "end": 1147.0, "text": " Gee who guessed a classifier on random labels doesn't generalize."}, {"start": 1147.0, "end": 1156.0, "text": " Man. In fact in fact we go much further along the self-critical path."}, {"start": 1156.0, "end": 1173.0, "text": " Alright here it comes. Here it comes. In Korea the same experiments for random labeling on different samples of the same size and with the same variable control."}, {"start": 1173.0, "end": 1186.0, "text": " Only this time in the selection criteria are standard edd photos of Chinese female young middle aged or standard edd photos of Caucasian male young middle aged of Caucasian female young middle aged no facial."}, {"start": 1186.0, "end": 1198.0, "text": " So basically if you train on a randomly labeled data set on any day on any sort of pictures your classifier will not work."}, {"start": 1198.0, "end": 1206.0, "text": " Thanks. Maybe that's I think that's the academically most valid statement in the entire paper."}, {"start": 1206.0, "end": 1217.0, "text": " Oh man in none of the three cases any of the four classifiers managed to achieve a true positive rate higher than 53% on randomly labeled positive and negative instances."}, {"start": 1217.0, "end": 1223.0, "text": " So the classifier must be valid because..."}, {"start": 1223.0, "end": 1233.0, "text": " The above experiments rule out that the good accuracies of the four evaluated classifiers in face inference on criminality are due to data overfitting."}, {"start": 1233.0, "end": 1247.0, "text": " No. Otherwise given the same sample size they would also be able to distinguish between randomly labeled positive and negative instances with significantly better chances."}, {"start": 1247.0, "end": 1273.0, "text": " But they did cross validation. They did. The cross validation prevents the overfitting we know on criticizes that you owe these people have no idea what they're doing they have no clue of machine learning they don't know what the problems with methods are they don't know what overfitting is and and how you control for it."}, {"start": 1273.0, "end": 1287.0, "text": " The big jump of the true positive rate from random labeling to truth labeling on the same set of face images can only be explained by intrinsic separability of SC and SN."}, {"start": 1287.0, "end": 1294.0, "text": " That is true. That is true. But why are they separable? That's the question."}, {"start": 1294.0, "end": 1311.0, "text": " As different source cameras generated the ID photos in the set as now they might be on the right track here. Different source cameras. Maybe they could get the idea that different data sources lead to different things."}, {"start": 1311.0, "end": 1320.0, "text": " They might leave their signatures that although below perception threshold in signal strength could mislead machine learning."}, {"start": 1320.0, "end": 1339.0, "text": " They are basically saying different cameras could generate different sort of artifacts. They rule this out by basically adding noise to the images such that these artifacts would be washed out and the noise doesn't change their results."}, {"start": 1339.0, "end": 1358.0, "text": " They were so close to actually doing something useful. This section is where it gets even more interesting. Now they're trying to guess from their classifier what are the actual features that make criminals criminals."}, {"start": 1358.0, "end": 1373.0, "text": " So discriminating features right here. Having obtained the above strong empirical evidence is for the validity of automated face induced inference on criminality. One cannot resist the following in three in questions."}, {"start": 1373.0, "end": 1384.0, "text": " What features of a human face betray its owners propensity for crimes."}, {"start": 1384.0, "end": 1401.0, "text": " Okay, Shakespeare. And they basically they basically go and explain ability or out where they see what the classifier pays attention to. And it turns out the classifier pays attention to the following features on the left. You can see where the classifier pays attention to."}, {"start": 1401.0, "end": 1422.0, "text": " And when we're surprised here it pays attention to face features but they kind of parse out the following three features. First of all, the D the distance between the eyes in criminals tends to be smaller than in non criminals."}, {"start": 1422.0, "end": 1440.0, "text": " The angle between the nose and the corners of the mouth tends to be smaller in criminals than in non criminals. And the curvature of the upper lip tends to be higher in criminals than in non criminals."}, {"start": 1440.0, "end": 1455.0, "text": " So let's let's try just from this information to draw the ultimate criminal and non criminal faces. So first of all, the non criminal. Let's draw the non criminal as just regular."}, {"start": 1455.0, "end": 1468.0, "text": " I'm not very good at this. So here's the nose. And then let's just draw the lips like this. Non criminal. Perfect. Looks like a law-liding citizen to me."}, {"start": 1468.0, "end": 1486.0, "text": " Criminal. Right here. So the eyes are closer together. Here's the nose. And then the curvature of the upper lip is higher. So."}, {"start": 1486.0, "end": 1505.0, "text": " And then the angle between the nose and the outer corners of the mouth is smaller. How can I make the angle smaller? Could it be that if I'm oh yes."}, {"start": 1505.0, "end": 1523.0, "text": " Oh, that's the trick. Criminal, ladies and gentlemen. So are you telling me that all someone has to do to be a criminal is frown."}, {"start": 1523.0, "end": 1548.0, "text": " Yeah, totally valid. So they're so close, right? But they say all of these are intrinsic facial features. But come on. All right. So they go. They go on to say that they they have some histogram differences of these features that they basically say these features are what's responsible for this."}, {"start": 1548.0, "end": 1573.0, "text": " And then they do face clustering, which is beautiful. So first of all what they do is they sort of take the average faces for criminals and non criminals. And these are the average faces. So the top or the actual average eye in faces and the bottom is when you kind of shift the facial landmarks around the seeming paradox that S C and S N can be classified."}, {"start": 1573.0, "end": 1591.0, "text": " But the average faces appear almost the same can sorry the average faces appear almost the same the average faces appear almost the same. What a paradox. These are almost the same. I mean if I just overlay them one over another."}, {"start": 1591.0, "end": 1609.0, "text": " They're almost the same. There is no no difference at all. I don't see a difference. How what could possibly be the difference. What what could be the difference. I don't think that these are the most honest of intentions."}, {"start": 1609.0, "end": 1626.0, "text": " So they basically do some clustering, which I find interesting. I find interesting. For example that they don't really explain iso map here. So iso map uses the GUDsick distance between two points on the manifold, which is defined between the sum of the way it's."}, {"start": 1626.0, "end": 1647.0, "text": " So they kind of washi washi iso map, but they then explain K means in great detail with formulas and again this. I mean the okay non machine learning people can do machine learning that's fine, but they're not really into the matter here."}, {"start": 1647.0, "end": 1661.0, "text": " And they try K means clustering and they find in their opinion they find four clusters of criminals and three clusters of non criminals now Y, three and four."}, {"start": 1661.0, "end": 1684.0, "text": " And usually can do something like this by clustering and then measuring the residual variance in your data. So how much does one cluster explain two clusters and so on. So here you can see the curves for non criminals and criminals now they claim that the optimal number of clusters here for non criminals is three, which makes no sense to me like Y, three."}, {"start": 1684.0, "end": 1698.0, "text": " So what you usually want to find is kind of a kink in your curve, like if it's steep and then it gets flat, that means that up until then your clusters actually buy you something good and from then they basically are useless."}, {"start": 1698.0, "end": 1715.0, "text": " So if I were to guess I would divide the criminals into two clusters and the non criminals into a single cluster because that's pretty flat. Certainly not the non criminals into three and the criminals into four."}, {"start": 1715.0, "end": 1728.0, "text": " And that makes no sense at all like why and they say, OK, these are the clusters right here and these are the pictures I shown you at the beginning."}, {"start": 1728.0, "end": 1736.0, "text": " What surprise the bottom ones, the non criminals are smiling and the top ones aren't."}, {"start": 1736.0, "end": 1759.0, "text": " I wonder why the method works and the interesting part here is that where how can we justify maybe how can we say if we decide on one cluster for non criminals and two clusters for criminals, what does that remind us of."}, {"start": 1759.0, "end": 1773.0, "text": " Oh, yes, that is exactly how we collected the data. That is exactly the fact that we collected the non criminals with one procedure and the criminals with two different procedures."}, {"start": 1773.0, "end": 1795.0, "text": " Gee, they're classifying their data set replicates exactly how they collected the data and that convinces me that it says absolutely nothing about the actual criminality of people. It's just that police, even if it's ID photos, they don't smile and pictures on the internet."}, {"start": 1795.0, "end": 1805.0, "text": " Sometimes people smile, the rest of the papers pretty much garbage. They did reply to critics and they kind of take issue with a number of things."}, {"start": 1805.0, "end": 1820.0, "text": " So first name calling, I don't mean to name call, but it's going to happen. I don't get why people call them racist because it's all the say doesn't know trouble."}, {"start": 1820.0, "end": 1825.0, "text": " And smiley. Ha."}, {"start": 1825.0, "end": 1832.0, "text": " In our experiments, we did control facial expression, but not faint micro expression."}, {"start": 1832.0, "end": 1842.0, "text": " The critique that our methods can be reduced to a simple discriminator of smiling versus not smiling has given us a new angle of scrutiny."}, {"start": 1842.0, "end": 1855.0, "text": " They say, well, Westerners think that this is smiling, but our Chinese students and colleagues, even after being prompted to consider the queue of smile, fail to detect the same."}, {"start": 1855.0, "end": 1869.0, "text": " So basically their answer is, yeah, you think so, but we don't. And then they say instead they only find the faces in the bottom row appearing somewhat more relaxed than those in the top row."}, {"start": 1869.0, "end": 1875.0, "text": " And then here's the crucial part, all criminal ID photos are government issues, but not mock shots."}, {"start": 1875.0, "end": 1892.0, "text": " They are normal government issue ID portraits like those to drive a license in the USA. In contrast, most of the non criminal ID style photos are taken officially by some organizations such as real estate companies, law firms, etc. for their website."}, {"start": 1892.0, "end": 1903.0, "text": " You know what I'd always says when you take your picture for a government ID, please don't smile. Imagine if you're a law firm, come to students, say we want a picture for our website, please don't smile."}, {"start": 1903.0, "end": 1910.0, "text": " All right, this was it for this paper. If you like this content, please consider subscribing and sharing it out."}, {"start": 1910.0, "end": 1930.0, "text": " This is absolute garbage. And there is important lessons to learn here. Namely, Occam's razor is a real problem in research. People often fail to criticize themselves enough and to think, is there maybe a different explanation for why I'm getting the results that I'm getting?"}, {"start": 1930.0, "end": 1942.0, "text": " And how can I disprove that that is the case? And how can I make sure that the effect that I'm seeing actually comes from the place where I claim it comes from?"}, {"start": 1942.0, "end": 1956.0, "text": " I think this is a real threat throughout all of research. I've seen many papers that I've reviewed that are exactly of the same fallacy, not as touchy subjects as this one, but it definitely exists."}, {"start": 1956.0, "end": 1963.0, "text": " And I remind everyone that learn a lesson from this and have a good day."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=bFn2xcGi1TQ | Faster Neural Network Training with Data Echoing (Paper Explained) | CPUs are often bottlenecks in Machine Learning pipelines. Data fetching, loading, preprocessing and augmentation can be slow to a point where the GPUs are mostly idle. Data Echoing is a technique to re-use data that is already in the pipeline to reclaim this idle time and keep the GPUs busy at all times.
https://arxiv.org/abs/1907.05550
Abstract:
In the twilight of Moore's law, GPUs and other specialized hardware accelerators have dramatically sped up neural network training. However, earlier stages of the training pipeline, such as disk I/O and data preprocessing, do not run on accelerators. As accelerators continue to improve, these earlier stages will increasingly become the bottleneck. In this paper, we introduce "data echoing," which reduces the total computation used by earlier pipeline stages and speeds up training whenever computation upstream from accelerators dominates the training time. Data echoing reuses (or "echoes") intermediate outputs from earlier pipeline stages in order to reclaim idle capacity. We investigate the behavior of different data echoing algorithms on various workloads, for various amounts of echoing, and for various batch sizes. We find that in all settings, at least one data echoing algorithm can match the baseline's predictive performance using less upstream computation. We measured a factor of 3.25 decrease in wall-clock time for ResNet-50 on ImageNet when reading training data over a network.
Authors: Dami Choi, Alexandre Passos, Christopher J. Shallue, George E. Dahl
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 faster neural network training with data echoing by Dami Choi, Alexander Paso, Christopher J, Shallyu and George E. Dahl. So on a high level this paper basically says you should repeat data that's already in memory in order to speed up the entire process of neural network training. And it also says that this can speed up your wall time without hurting your performance too much. And I have mixed feelings about it. So let's jump in. So they basically make a point of saying that machine learning doesn't happen in just one thing. It's not like sklearn.fit anymore. It is more of a pipeline. So what do we mean by this? If you have if you think of something like you want to train an ImageNet model, what you want to do is you have like your data set somewhere. And that could be on in a database, it could be in the network somewhere. So if you have even something larger than ImageNet, you'll probably storage on a central server on Amazon bucket somewhere. So this is in AWS. And the first thing you actually need to do is you need to read that data set. Now usually you're not going to have enough memory on a machine to just load in the entire data set into memory. So that means this process here is streaming. So this is continuously streaming data points. And once you have used the data point, you're going to throw it away because you need space for the next one. Right. And so the streaming is done continuously. The next process is read and decode. That means you have to read it from the network and actually bring it into a format where you can use it. Usually something like an umpire array or a TensorFlow tensor. Um, you need to apply some shuffling because usually the order, you can't really trust the order that it is stored in. Oftentimes there is like a bias in the ordering. So you need some sort of a shuffle buffer here. Um, then often you want to apply some data augmentation to it. That means that you have one image. And we know for these models, if this is your cat, we know for these models that what can help, um, is to basically make many, many different images from one image. So this could be by cropping part of it and saying, well, if it was a cat before the small upper right part here is still a cat. So this is one date, it's called data augmentation. And you're going to apply a whole bunch of these things. So you can crop, you cannot rotate the image a bit. It's still a cat, right? And you can also change its luminance and a bit of its colors. You can jitter the colors. You can horizontally flip it and it'll still be a cat. And that's basically how you make many data points from one data point. And we know that helps. Then what you want to do is you want to batch this data. So you want to put it into mini batches. Um, since you've shuffled here, that means when the next time the same data point comes along, it's going to be batched with a different, um, with a different group of images. And of course, augmented differently with a different group of images. And that basically means it's a different training batch for the model. So this entire pipeline is basically a way that we take data points that we have. And we make a whole bunch of variations and various groupings and batchings of it. And we know that helps enormously with the generalization capability of your final models. And then here you do your apply your SGD update. So that's usually where you forward propagate your data through your network, which here is F. It'll get like some Y hat as an output. And then you have your labels that also come through the pipeline. And you have some sort of loss function L that takes both as an input and gives you an output. And then you do your back propagation. So the back propagation would go through your loss function through your network and update the network parameters. Search that your network learned something. Right. Now this step to the right here is usually what we focus on when we do deep learning. Um, the step on the right here, all of this, this can be done on a GPU or is usually done on something like a GPU or a TPU, right. But in these things are getting faster and faster. The point the paper makes is that the TPUs and GPUs of the world are getting faster. But this entire other thing right here, this is basically CPU land. Now I know there is some data augmentation now happening on the GPU and so on. But in essence, you can think of a pipeline where the thing to the left is happening on CPU and the thing to the right is happening on TPU. And even even worse, let's say the speed is continuously, um, is continuously increasing. So in your pipeline, the kind of speed would be, so here is the network reading. And here over here is the GPU SGD step. And this is speed. Basically, the further to the right in your pipeline, you go the faster your, the faster your hardware gets. And that means that if, if this since this is a continuous pipeline, right. That basically means that if I input something here, it goes through the pipeline. And even if this is all running in parallel, at this thing over here is going to idle. This since this is the fastest part of the pipeline, it is going to just idle a lot. Right. Because because it can only consume things as fast as this thing can produce. Now if you, if you have some sort of a multi GPU machine and just train image net, like you just around the code, usually your, this is not the bottleneck. Usually, um, your GPUs here are at 100, 100% capacity. So this paper is not for you. But if you are, let's say, a big company have this network storage, have a big data set, have very expensive data augmentation. This happens, for example, this can happen in NLP and so on. This can be quite your situation where the, the earlier in the pipeline, the slower it is. And don't you just love these graphics. Um, so here's, here's time. And apparently it goes in both directions. And so does it go like this? I think what they mean is just time goes in this direction. And you're here. And your upstream, so your upstream is your network. This is your network reading or your pre processing and the downstream. This is the GPU. So as you are pre processing things, you, you, um, and this should be, this should be different. It should me. Okay. To correct this right here. This is idle. And this is running. So as your upstream processes images, right at the beginning, your GPU is idle. But then as soon as it ships off the first batch of images, your GPU can run. Now it's running. While you're doing that, your upstream, your network is still reading new images, pre processing them and so on. But it cannot is too slow to insert a batch at the time that the GPU is done. The time the GPU is done, it's still processing this batch. So the GPU is idle until here, where it finally manages to process that batch. And then the GPU is running again. I think that would have been a much better graphic. But you know, so their goal basically is that what you'll have is right here, for example, after the batch, what you'll do is you scrap this connection, you take this and you put it into a smaller buffer. And the buffer is is a repeat buffer. So what it does is it's simply will repeat the whatever you have in the buffer until something new comes in, right? So new data point comes in, you just output that data point again, again, again, again, the for the GPU, it's going to feel like these are all new batches and they continuously come in. But it's always the same until the next data point comes in. And then you output that one again and again and again. Now the actual factor here, you can of course tune by hand or you can just say repeat until something else comes in. In this paper, they have an explicit factor where they say we repeat each data point four times or three times or so on. So this is data echoing. You basically echo the data point multiple times. And this can be done in various places. So they experiment with echoing in any of these places right here. So the experiment with it right here, after reading and decoding, after shuffling, no, I think always before shuffling. Because if you if you have a shuffle buffer anyway, they say it makes sense that if you do the echoing, you do your shuffle buffer after your echoing. So here, then after augmentation and after batching. So the experiment with these three locations in echoing, now what could be the downturn of something like this? The downturn of course is that this SGD procedure right here, basically, it relies on the data incoming being an IID sample from your data distribution, right? That's that's how we formulate SGD is that there's always new data incoming. Now, if you just output the same data point all the time, that could that is like no new information. First of all, and second of all, it could bias the SGD update such that you it because it sees the same date, it doesn't, it sees the same information over and over. It's going to think that's the whole data set, right? So potentially, it can make too many steps into the wrong direction. That just happens to be the bias in this particular data point, right? So the IID assumption is is invalid. Now, why do you experiment with this in different locations? Because what you expect is that it hurts more, it already hurts less the earlier you introduce this. So if you introduce echoing right here, so if you echo your data until new data from the network comes in, it's still going to be shuffled differently, right? It's and it's still going to be augmented differently. So each time the data point comes out of the echo buffer, it is going to be shuffled and it is going to be augmented in a different way than the last time the same data point came out. And it is going to be batched together because you've shuffled differently, it's going to be batched together with a different bunch of data points. And that means SGD gets new information. But if you go onto the very last thing, where you just after the batch right here, where you input the echo, that means SGD just gets to see the same batch of data augmented in the same way all the time, right? So the of course where you exactly have to echo, you have to trade this off. So you have to trade off the how much you basically violate the IID fresh data assumption against where in your data pipeline is the bottleneck. So if your bottleneck is in the data augmentation, it may be make little sense to echo before that because your bottleneck is the data augmentation. And that being said, if the bottleneck is that you don't have enough GPUs, then it probably doesn't make sense to data echo at all. Though their experiments are somehow wonky on this. But so let's dive in. They make the following claims. Let's just go through them really quick. Data echo reduces the amount of upstream that it's a think of network reading or augmentation. Computation needed to reach a competitive out of sample error rate on various data sets and model architectures. Second, data echoing can provide a wall time speed up in practice. Third, data echoing can support a wide range of echoing factors. And that's the echoing factor is how often you repeat the data. Fourth, the effectiveness of data echoing depends on the intersection point in the training pipeline. Sorry, in the insertion point. That's what that's what our hypothesis was, right? Fifth, data echoing can benefit from additional shuffling after echoing, but does not require it. And six, countering expectations, data echoing reaches the same final error rate as well tuned baselines. So I can absolutely accept one through five, especially in like an actual practical in the wild setting, but six, we will see about six. So let's jump into their models. They, sorry about that, they trained the following four models. So they train a transformer on these two data sets, LM1B and common crawl. So back is technically it's five models on language modeling. They train the ResNet 32 on C410. They train the ResNet 50 on ImageNet and they train SD on Coco. Now here is the accuracy they get. And here is, sorry, this is the target. So what they do is they train these models and then they say, okay, what's the accuracy we reach and then they set a target value. So on ResNet 50 on ImageNet, a very common number to reach is something like 76.5. If you look at, for example, Torch Vision models, they reach something like this. And so they say, well, our target accuracy here is just a little bit below that. So and then we just measure how many steps or how many their measurement here is fresh data points. So how many actual fresh training samples do we need to reach this target? And this is, this is where it gets wonky because, for example, take the 91% here on C410. That is quite, quite low. And also the ResNet 50 is, I mean, this is standard, but still ImageNet is much further nowadays. And I think the effectiveness of something like this has a lot to do with how competitive you want to get. Maybe this is all just an effect of how much on under par your this target performance really is. And I would, I would expect that even though they say it doesn't hurt their performance in their experiments, I would at least expect it will hurt your performance in general if you try to get competitive. Because these things aren't as as as of now at least the ones I know like the the ResNet aren't really competitive. But so what do they do? They measure data echoing with an echoing factor of two. So that means data that's incoming is output twice in a row. Any every data point that's coming in is just emitted twice from the buffer and then the next data point is emitted twice and so on. And what they measure again is the fresh examples red. So how many fresh data points do you need to achieve something? This is a good measurement because this is kind of independent of hardware. So if you're if you are really in the situation where your GPU is twice as fast as the as your the rest of your pipeline, then an echoing factor of two will speed up at most your your training procedure by factor of two. All right. So you have the baseline in red and then you have batch echoing which is where you echo what we said at the worst possible time right after batching. So this might hurt your performance the most. But also it has a potential to be the fastest if your if maybe you're augmentation is very expensive. Then sorry or you're batching. You have example echoing after augmentation. So that would mean you use the augmentation is very expensive. So you save the augmented data points and then you emit it multiple times but each time it is batched differently. So it is it is shuffled and then batched with different other data points. So you have a shuffle buffer after it. And then you have example echoing before date augmentation. So that means the same data point emitted multiple times will be augmented in different ways and basically will lead to slightly different data points. So the results here are pretty much what you could expect in that the earlier you do the echoing as you can see here the more this echoing helps. So the number if you for example this is the object segmentation task the baseline needs this many fresh examples to reach this target accuracy with batch echoing not only do you sorry with batch echoing you need less fresh training examples. So that means even though you kind of train on the same data twice you this helps you more or this helps you. It doesn't help you fully because the dash line here is the if it would help you as much as a fresh data point you'd be at the dash line right this is exactly half of this because the echoing factor is two. So if you're if a repeated data point was as useful as a fresh data point you'd be at the dash line as you can see right here you're not at the dash line but at least it doesn't hurt right you might expect that it hurts but it doesn't hurt it actually speeds up so the repeated data points at least have some utility. Again this is only useful if you're if you have this asymmetry in your pipeline if your pipeline is actually symmetric and you do an echoing factor of two the wall time here the wall time plot would look this for the baseline and then almost twice as high for the batch echoing because even though it needs the same amount of fresh or almost the same amount of fresh example it you echo each one twice so it needs to process it twice so you'll it'll take much longer so again this is useful if you have this asymmetry and if the echoing factor is kind of smaller than your asymmetry otherwise you're you're simply wasting time repeating data points then if you do example echoing here after augmentation you use even less fresh data points and if you do it before augmentation this is really surprising you almost get the benefit of fresh data points which is something you you might expect right because an augmented newly shuffled data point is kind of almost a new data point but still it's quite surprising that you almost get to the level of the of of the theoretical possible and also here on the image net task now here is actually an example where you can see that it hurts to do this batch echoing because the reasons why it could hurt is just that you have you violate this iid assumption you basically have correlated data points this is a big big problem for example in reinforcement learning where already by nature of you running episodes and then feeding the episodes back into the training procedure you have correlated data points and that hurts your performance here actually compared to the to the baseline but then if you go to example echoing and the example echoing before augmentation again you get a speed up which is pretty cool okay so they do a bunch of other experiments and I appreciate these experiments here to really show what's going on and until when can you push this so here they have a plot of example echoing before augmentation can reduce training time for resonant 50 on image net so this is before augmentation and the echoing factor describes how often you repeat each data point so this goes from two to five and you can see that basically you you get the speed up you you just sort of get it for free as you can see the dash line again is as if if at repeated data point were as useful as a fresh data point you'd be at the dash line and you can see right here that you are just above this dash line so this can help a lot and so this is the fresh examples red and this is the wall time in their particular situation in that case it doesn't help as much but again it if that very much depends on how the asymmetry in your pipeline is now in these experiments I would actually appreciate something like they do down here where I would always like to see where it breaks so how far can you go with the echoing factor until it doesn't help anymore because this sort of tells me pretty much nothing I want to see where is the low point where is kind of the optimal echoing factor and what can you tell me about this optimal echoing factor how how can we determine it sort of beforehand or how can you reason how does it connect to the different parts of your architecture so if I had to point out a flaw in this paper it would be that right here I would expect them to continue this echoing factor increase until it breaks sort of like they do down here this is for I believe this is for the transformer on LM1B now here they have a batch size of 1024 and you can see and this is the this is their standard setting for the transformer the 100024 batch size you can see that the baseline this many 1.5 to 10 to the 7th fresh examples to train until their target if you increase the echoing factor by 2 you basically need half as many fresh examples as long as you echo each one twice again very surprising the fact how close you can get to the as if each vatch were a a perfect fresh data point but you can see as you increase this echoing factor and here is exactly what I said right you at some point this hurts at some point you get to the point where the non-iidness the correlation of date of successive data points will actually hurt you and they make a point here of saying that this is for example dependent on batch size now in this experiment over here they have a larger batch size and here is again the the baseline number of data points to reach the target and you can see again it goes down but now with the echoing factor where before you had a you had an increase again now it continues to decrease again it will be interesting to see where it goes up here and how the number at the slowest like here the four and here the I don't know what is going to be maybe the 16 how this will kind of depend on your batch size and here is another problem and that's what I alluded to at the beginning this this performance dependence now I have not read anything differently in the paper so I had to assume that they trained this here this number of fresh examples to reach the target is still the target that they determined at the beginning so it's that 3.9 in the table that 3.9 was achieved with this batch size with a 1024 and we know especially in language models that larger batch sizes will lead to a better performance even if you need let's say more samples so here you can see that the samples here it's 1.5 and here it's actually 4 because you increase that batch size so that will tell you something 1.5 and 4 that is that is like a times okay that's like a times 2.5 so you go with the batch sizes of times 4 and you need 2.5 more fresh training samples to reach the same target accuracy first of all we know that the larger batch sizes can reach higher target accuracies so again this this this results the dependence of them on the actual performance to the maximum achievable value to me that's kind of a shady world here to always to always say okay how long does it take to reach that particular target because we know that this model right here can reach a much higher target but we don't know this about these models here what is their kind of performance in the limit and they try to make these experiments but I don't really believe them maybe yeah and yeah so in the second right that will that will be that will that is already interesting so this ratio right here this 2.5 to 4 this ratio must mean something right it's it's I go to a higher batch size 4 times higher batch size and I need 2.5 many more fresh training samples to reach the same target that must somehow tell you something about the usefulness of a single data point versus a succession of data points right so it doesn't seem because I would expect if each data point was valuable I would expect this to be times 4 and if it were if it were times 1 so if it were no no speed up at all sorry not times 4 if it that it would be times 1 it would mean I'd need the same number of fresh training samples right no matter how I batch them but it were times 4 that means basically that it doesn't matter really how many training points I have in a batch as long as I have enough and the 1024 seems to be enough it just it just matters how many you know SGD steps I do so basically what we're saying SGD isn't getting the most out of these data points and this ratio this 2.5 this this tells you something about the information content of a of an additional data point versus the usefulness content of an additional step of SGD and I would expect that to depend to intrinsically be connected to the where the low point of this echoing factor is because that's exactly what the echoing does it trades off freshness of data point versus doing more steps on the on the on the same information and for a paper especially a paper by Google brain I this this is a connection that I would love to see investigated but enough of the ranting they do investigate other things they do investigate for example what happens if we just up the batch size and you can see here yeah this is interesting the baseline needs more fresh samples as you up the batch size but and at the beginning this batch echoing for example doesn't help doesn't hurt but doesn't help but as you go to higher and higher batch sizes this batch echoing starts to help more and more again I believe this is connected to the usefulness of the single data point at some point your batch size is just too large for the problem you'd rather do more steps and that's why this helps but also this model right here might have a higher ceiling accuracy so and it is the question whether this model right here has the same or whether this model right here the batch echoing model would actually fall back to the ceiling accuracy of one of these models over here yeah in any case their point is basically that as you increase the batch size this echoing tends to help more relatively because maybe it's because what I said right they say as batch size increases the performance of batch echoing relative to the baseline stays either stays the same or improves while for example echoing it either stays the same or it gets sorry while for example echoing it either stays the same or gets worse dashed lines indicate the expected values if repeated examples or as useful as fresh examples yeah so I built there is an intrinsic connection here between the usefulness of more data and usefulness of doing additional steps and here the example echoing you can almost see it as more data because especially here you're going to do augmentation on top of it and you see the non augmented versus the augmented ratio changes dramatically from here to here okay final set of experiments as you can tell this is more mostly an experimental paper and it is always easy to criticize experimental papers and rightfully so because I would not trust this very much but given that it comes from a big institution and it is a very well written paper I would trust it more than I would a regular paper and I would say if you're in practice this is certainly worth trying absolutely I'm just I just think that some of the things aren't aren't researched like some of my questions aren't answered of this so they investigate sizes so they now build shuffle buffers so we have batch echoing but they say ah but we can do batch echoing with shuffle buffers so after the batch echoing right we have this state where we have the batching and then we have the echoing this is our echo buffer where we output the each data point multiple times and then we have another buffer which is a shuffle buffer that a shuffle buffer just collects data points and then shuffles them around before outputting them and that means even though we you know output this five times it might not come out five times after each other it might be that it comes out once and then another data point that was already in the shuffle buffer comes out and then it will just say that in total it comes out five times but it is first shuffle together with a bunch of other data points of course this uses more memory but of it returns to that more iid setting and you can see here as the buffer size increases then the performance gets more and more to the performance that you would have with completely fresh data right so again trading of freshness and um freshness and doing multiple steps uh with by by basically repeating repeating data points straight out versus repeating data points shuffled and also here you have the same with example echoing so if you apply the shuffle buffer to example echoing and you increase its size you can get very very very close to the performance that you would get with fresh data which of course if you increase the shuffle buffer to the size of the data set you are at the situation that's the limit you are at the situation of fresh data right if you do example echoing right so here is where it gets into the funky part where they say we actually measure the validation cross entropy and the validation accuracy versus the number of fresh examples red and here i want to concentrate on the resonant 50 on image net and as you can see most of these models um they pretty much end up in the same place here it's just that the echoing models end up there faster right and this this is i mean um this is where it gets a bit confusing honestly because why do you have this super sharp thing here because um usually and here it sort of speeds up in the middle you see you see that and then it kind of sharply declines is this maybe because they drop the learning rate or something now my main thing is that the performance here even though the this target thing is lower than um um then the even though this target thing is the same for everyone it is lower than the best reachable accuracy and uh i'm i'm just this this is just confusing if this is really true whoa if this is really true i think we have a lot to learn about um sgd yet and how we're not actually doing sgd correctly and because it seems like almost the the echo versions are better or reach a better accuracy than the baseline i don't know do they just cap it at the performance uh i don't think so i think they say they let it reach they also have these um things right here these these curves where they say this is the best we reach and this is the resonant 32 on c410 and again 91% on c410 is just very very low and i'm almost thinking that okay this might help if you just throw something that we know is kind of overpowered because we can reach 99% or at least you can reach something like 94% on c410 easily easily with a network smaller than resonant 32 um maybe this effect manifests if you if you have actually something that could reach higher but for some reason you only reach this low i'm not sure but this is confusing and if this is really true yeah i would just if it's true which i believe i believe this paper it might be just an effect of not reaching the actual ceiling and again look at this this is just the curves are just strange right you have the echoing before augmentation or like it seems like it's out performing the uh the fresh data points i don't know there's a little bell in my head that doesn't like this if it's actually true then you know that's cool um but yeah so my main criticism is there a bit with the experimental methodology for example where they increase the batch size but still reach the same target accuracy even though we know that there is a higher ceiling if you increase the batch size for language models my other criticism is the non-investigation of this connection uh this connection right here maybe but all in all it's a pretty cool paper if i had a big company with these pipeline issues i would absolutely implement this this seems like a no-brainer um to do this and can help you tremendously all right that was it thank you for listening if you're still here subscribe like tell a friend bye bye | [{"start": 0.0, "end": 6.32, "text": " Hi there, today we're looking at faster neural network training with data echoing by"}, {"start": 6.32, "end": 12.92, "text": " Dami Choi, Alexander Paso, Christopher J, Shallyu and George E. Dahl. So on a"}, {"start": 12.92, "end": 18.06, "text": " high level this paper basically says you should repeat data that's already in"}, {"start": 18.06, "end": 23.2, "text": " memory in order to speed up the entire process of neural network training. And it"}, {"start": 23.2, "end": 28.12, "text": " also says that this can speed up your wall time without hurting your"}, {"start": 28.12, "end": 34.56, "text": " performance too much. And I have mixed feelings about it. So let's jump in. So they"}, {"start": 34.56, "end": 39.56, "text": " basically make a point of saying that machine learning doesn't happen in just"}, {"start": 39.56, "end": 47.480000000000004, "text": " one thing. It's not like sklearn.fit anymore. It is more of a pipeline. So what do"}, {"start": 47.480000000000004, "end": 51.96, "text": " we mean by this? If you have if you think of something like you want to train"}, {"start": 51.96, "end": 57.72, "text": " an ImageNet model, what you want to do is you have like your data set somewhere."}, {"start": 57.72, "end": 64.88, "text": " And that could be on in a database, it could be in the network somewhere. So if you"}, {"start": 64.88, "end": 69.68, "text": " have even something larger than ImageNet, you'll probably storage on a central"}, {"start": 69.68, "end": 74.96000000000001, "text": " server on Amazon bucket somewhere. So this is in AWS. And the first thing you"}, {"start": 74.96000000000001, "end": 80.32, "text": " actually need to do is you need to read that data set. Now usually you're not"}, {"start": 80.32, "end": 84.24, "text": " going to have enough memory on a machine to just load in the entire data set"}, {"start": 84.24, "end": 90.88, "text": " into memory. So that means this process here is streaming. So this is"}, {"start": 90.88, "end": 94.47999999999999, "text": " continuously streaming data points. And once you have used the data point,"}, {"start": 94.47999999999999, "end": 97.96, "text": " you're going to throw it away because you need space for the next one. Right."}, {"start": 97.96, "end": 104.16, "text": " And so the streaming is done continuously. The next process is read and"}, {"start": 104.16, "end": 108.6, "text": " decode. That means you have to read it from the network and actually bring it"}, {"start": 108.6, "end": 112.6, "text": " into a format where you can use it. Usually something like an umpire array or"}, {"start": 112.6, "end": 119.55999999999999, "text": " a TensorFlow tensor. Um, you need to apply some shuffling because usually the"}, {"start": 119.55999999999999, "end": 124.96, "text": " order, you can't really trust the order that it is stored in. Oftentimes there"}, {"start": 124.96, "end": 128.48, "text": " is like a bias in the ordering. So you need some sort of a shuffle buffer here."}, {"start": 128.48, "end": 134.48, "text": " Um, then often you want to apply some data augmentation to it. That means that"}, {"start": 134.48, "end": 140.56, "text": " you have one image. And we know for these models, if this is your cat, we know"}, {"start": 140.56, "end": 146.52, "text": " for these models that what can help, um, is to basically make many, many"}, {"start": 146.52, "end": 151.64000000000001, "text": " different images from one image. So this could be by cropping part of it and"}, {"start": 151.64000000000001, "end": 156.88, "text": " saying, well, if it was a cat before the small upper right part here is still a"}, {"start": 156.88, "end": 162.48000000000002, "text": " cat. So this is one date, it's called data augmentation. And you're going to"}, {"start": 162.48000000000002, "end": 165.84, "text": " apply a whole bunch of these things. So you can crop, you cannot rotate the"}, {"start": 165.84, "end": 171.4, "text": " image a bit. It's still a cat, right? And you can also change its luminance and a"}, {"start": 171.4, "end": 175.84, "text": " bit of its colors. You can jitter the colors. You can horizontally flip it and"}, {"start": 175.84, "end": 180.6, "text": " it'll still be a cat. And that's basically how you make many data points from"}, {"start": 180.6, "end": 185.64000000000001, "text": " one data point. And we know that helps. Then what you want to do is you want to"}, {"start": 185.64000000000001, "end": 190.8, "text": " batch this data. So you want to put it into mini batches. Um, since you've"}, {"start": 190.8, "end": 195.28, "text": " shuffled here, that means when the next time the same data point comes along, it's"}, {"start": 195.28, "end": 200.32, "text": " going to be batched with a different, um, with a different group of images. And"}, {"start": 200.32, "end": 204.32, "text": " of course, augmented differently with a different group of images. And that"}, {"start": 204.32, "end": 209.96, "text": " basically means it's a different training batch for the model. So this entire"}, {"start": 209.96, "end": 214.92000000000002, "text": " pipeline is basically a way that we take data points that we have. And we make a"}, {"start": 214.92000000000002, "end": 219.88, "text": " whole bunch of variations and various groupings and batchings of it. And we know"}, {"start": 219.88, "end": 224.76, "text": " that helps enormously with the generalization capability of your final models."}, {"start": 224.76, "end": 230.04, "text": " And then here you do your apply your SGD update. So that's usually where you"}, {"start": 230.04, "end": 236.48, "text": " forward propagate your data through your network, which here is F. It'll get"}, {"start": 236.48, "end": 242.2, "text": " like some Y hat as an output. And then you have your labels that also come"}, {"start": 242.2, "end": 247.95999999999998, "text": " through the pipeline. And you have some sort of loss function L that takes both"}, {"start": 247.95999999999998, "end": 253.95999999999998, "text": " as an input and gives you an output. And then you do your back propagation. So the"}, {"start": 253.96, "end": 258.96000000000004, "text": " back propagation would go through your loss function through your network and"}, {"start": 258.96000000000004, "end": 265.36, "text": " update the network parameters. Search that your network learned something. Right."}, {"start": 265.36, "end": 270.64, "text": " Now this step to the right here is usually what we focus on when we do deep"}, {"start": 270.64, "end": 279.44, "text": " learning. Um, the step on the right here, all of this, this can be done on a GPU"}, {"start": 279.44, "end": 289.96, "text": " or is usually done on something like a GPU or a TPU, right. But in these things"}, {"start": 289.96, "end": 294.04, "text": " are getting faster and faster. The point the paper makes is that the TPUs and"}, {"start": 294.04, "end": 299.36, "text": " GPUs of the world are getting faster. But this entire other thing right here,"}, {"start": 299.36, "end": 305.0, "text": " this is basically CPU land. Now I know there is some data augmentation now"}, {"start": 305.0, "end": 310.32, "text": " happening on the GPU and so on. But in essence, you can think of a pipeline"}, {"start": 310.32, "end": 314.44, "text": " where the thing to the left is happening on CPU and the thing to the right is"}, {"start": 314.44, "end": 322.0, "text": " happening on TPU. And even even worse, let's say the speed is continuously, um,"}, {"start": 322.0, "end": 330.44, "text": " is continuously increasing. So in your pipeline, the kind of speed would be, so"}, {"start": 330.44, "end": 339.64, "text": " here is the network reading. And here over here is the GPU SGD step. And this is"}, {"start": 339.64, "end": 346.68, "text": " speed. Basically, the further to the right in your pipeline, you go the faster"}, {"start": 346.68, "end": 354.44, "text": " your, the faster your hardware gets. And that means that if, if this since this"}, {"start": 354.44, "end": 359.24, "text": " is a continuous pipeline, right. That basically means that if I input something"}, {"start": 359.24, "end": 365.36, "text": " here, it goes through the pipeline. And even if this is all running in parallel,"}, {"start": 365.36, "end": 371.24, "text": " at this thing over here is going to idle. This since this is the fastest part of"}, {"start": 371.24, "end": 377.36, "text": " the pipeline, it is going to just idle a lot. Right. Because because it can only"}, {"start": 377.36, "end": 382.92, "text": " consume things as fast as this thing can produce. Now if you, if you have some"}, {"start": 382.92, "end": 387.08, "text": " sort of a multi GPU machine and just train image net, like you just around the"}, {"start": 387.08, "end": 392.8, "text": " code, usually your, this is not the bottleneck. Usually, um, your GPUs here are at"}, {"start": 392.8, "end": 399.08, "text": " 100, 100% capacity. So this paper is not for you. But if you are, let's say, a"}, {"start": 399.08, "end": 403.59999999999997, "text": " big company have this network storage, have a big data set, have very expensive"}, {"start": 403.59999999999997, "end": 409.0, "text": " data augmentation. This happens, for example, this can happen in NLP and so on."}, {"start": 409.76, "end": 416.44, "text": " This can be quite your situation where the, the earlier in the pipeline, the"}, {"start": 416.44, "end": 424.48, "text": " slower it is. And don't you just love these graphics. Um, so here's, here's time."}, {"start": 425.24, "end": 432.12, "text": " And apparently it goes in both directions. And so does it go like this?"}, {"start": 432.52, "end": 438.04, "text": " I think what they mean is just time goes in this direction. And you're here."}, {"start": 438.48, "end": 444.96, "text": " And your upstream, so your upstream is your network. This is your network"}, {"start": 444.96, "end": 448.91999999999996, "text": " reading or your pre processing and the downstream. This is the GPU."}, {"start": 449.88, "end": 456.79999999999995, "text": " So as you are pre processing things, you, you, um, and this should be, this"}, {"start": 456.79999999999995, "end": 463.15999999999997, "text": " should be different. It should me. Okay. To correct this right here."}, {"start": 463.15999999999997, "end": 466.67999999999995, "text": " This is idle. And this is running."}, {"start": 468.67999999999995, "end": 473.59999999999997, "text": " So as your upstream processes images, right at the beginning, your GPU is idle."}, {"start": 473.6, "end": 478.68, "text": " But then as soon as it ships off the first batch of images, your GPU can run."}, {"start": 478.72, "end": 483.16, "text": " Now it's running. While you're doing that, your upstream, your network is still"}, {"start": 483.16, "end": 488.40000000000003, "text": " reading new images, pre processing them and so on. But it cannot is too slow to"}, {"start": 488.44, "end": 493.48, "text": " insert a batch at the time that the GPU is done. The time the GPU is done, it's"}, {"start": 493.48, "end": 500.20000000000005, "text": " still processing this batch. So the GPU is idle until here, where it finally"}, {"start": 500.2, "end": 504.84, "text": " manages to process that batch. And then the GPU is running again. I think that"}, {"start": 504.84, "end": 510.2, "text": " would have been a much better graphic. But you know, so their goal basically"}, {"start": 510.2, "end": 517.6, "text": " is that what you'll have is right here, for example, after the batch, what you'll"}, {"start": 517.6, "end": 523.48, "text": " do is you scrap this connection, you take this and you put it into a smaller"}, {"start": 523.48, "end": 529.92, "text": " buffer. And the buffer is is a repeat buffer. So what it does is it's"}, {"start": 529.92, "end": 538.1999999999999, "text": " simply will repeat the whatever you have in the buffer until something new"}, {"start": 538.1999999999999, "end": 543.0799999999999, "text": " comes in, right? So new data point comes in, you just output that data point again,"}, {"start": 543.12, "end": 549.04, "text": " again, again, again, the for the GPU, it's going to feel like these are all new"}, {"start": 549.04, "end": 554.4, "text": " batches and they continuously come in. But it's always the same until the next"}, {"start": 554.4, "end": 559.1999999999999, "text": " data point comes in. And then you output that one again and again and again."}, {"start": 559.2, "end": 564.2800000000001, "text": " Now the actual factor here, you can of course tune by hand or you can just say"}, {"start": 564.2800000000001, "end": 570.1600000000001, "text": " repeat until something else comes in. In this paper, they have an explicit"}, {"start": 570.1600000000001, "end": 574.1600000000001, "text": " factor where they say we repeat each data point four times or three times or so"}, {"start": 574.1600000000001, "end": 579.88, "text": " on. So this is data echoing. You basically echo the data point multiple times."}, {"start": 579.88, "end": 587.6, "text": " And this can be done in various places. So they experiment with echoing in any"}, {"start": 587.6, "end": 593.9200000000001, "text": " of these places right here. So the experiment with it right here, after reading"}, {"start": 593.9200000000001, "end": 600.08, "text": " and decoding, after shuffling, no, I think always before shuffling."}, {"start": 600.96, "end": 605.9200000000001, "text": " Because if you if you have a shuffle buffer anyway, they say it makes sense that"}, {"start": 605.9200000000001, "end": 610.5600000000001, "text": " if you do the echoing, you do your shuffle buffer after your echoing. So here,"}, {"start": 610.8000000000001, "end": 616.88, "text": " then after augmentation and after batching. So the experiment with these three"}, {"start": 616.88, "end": 623.76, "text": " locations in echoing, now what could be the downturn of something like this?"}, {"start": 623.96, "end": 631.6, "text": " The downturn of course is that this SGD procedure right here, basically, it relies on"}, {"start": 632.24, "end": 638.36, "text": " the data incoming being an IID sample from your data distribution, right?"}, {"start": 638.36, "end": 643.2, "text": " That's that's how we formulate SGD is that there's always new data incoming."}, {"start": 643.2, "end": 649.6800000000001, "text": " Now, if you just output the same data point all the time, that could that is like no"}, {"start": 649.6800000000001, "end": 657.12, "text": " new information. First of all, and second of all, it could bias the SGD update such that you"}, {"start": 657.12, "end": 661.9200000000001, "text": " it because it sees the same date, it doesn't, it sees the same information over and over."}, {"start": 661.9200000000001, "end": 666.32, "text": " It's going to think that's the whole data set, right? So potentially, it can make"}, {"start": 666.32, "end": 672.6400000000001, "text": " too many steps into the wrong direction. That just happens to be the bias in this particular"}, {"start": 672.64, "end": 677.76, "text": " data point, right? So the IID assumption is is invalid."}, {"start": 679.1999999999999, "end": 685.6, "text": " Now, why do you experiment with this in different locations? Because what you expect is that"}, {"start": 685.6, "end": 691.68, "text": " it hurts more, it already hurts less the earlier you introduce this. So if you introduce"}, {"start": 691.68, "end": 698.24, "text": " echoing right here, so if you echo your data until new data from the network comes in,"}, {"start": 698.24, "end": 703.92, "text": " it's still going to be shuffled differently, right? It's and it's still going to be augmented"}, {"start": 703.92, "end": 710.0, "text": " differently. So each time the data point comes out of the echo buffer, it is going to be shuffled"}, {"start": 710.0, "end": 715.6800000000001, "text": " and it is going to be augmented in a different way than the last time the same data point came out."}, {"start": 715.6800000000001, "end": 720.4, "text": " And it is going to be batched together because you've shuffled differently, it's going to be"}, {"start": 720.4, "end": 726.88, "text": " batched together with a different bunch of data points. And that means SGD gets new information."}, {"start": 726.88, "end": 731.76, "text": " But if you go onto the very last thing, where you just after the batch right here,"}, {"start": 732.64, "end": 739.2, "text": " where you input the echo, that means SGD just gets to see the same batch of data augmented in the"}, {"start": 739.2, "end": 749.4399999999999, "text": " same way all the time, right? So the of course where you exactly have to echo, you have to trade"}, {"start": 749.44, "end": 756.8000000000001, "text": " this off. So you have to trade off the how much you basically violate the IID fresh data assumption"}, {"start": 757.5200000000001, "end": 763.2, "text": " against where in your data pipeline is the bottleneck. So if your bottleneck is in the data"}, {"start": 763.2, "end": 769.7600000000001, "text": " augmentation, it may be make little sense to echo before that because your bottleneck is the data"}, {"start": 769.7600000000001, "end": 775.7600000000001, "text": " augmentation. And that being said, if the bottleneck is that you don't have enough GPUs, then it probably"}, {"start": 775.76, "end": 782.96, "text": " doesn't make sense to data echo at all. Though their experiments are somehow wonky on this. But"}, {"start": 783.84, "end": 790.56, "text": " so let's dive in. They make the following claims. Let's just go through them really quick."}, {"start": 790.56, "end": 798.4, "text": " Data echo reduces the amount of upstream that it's a think of network reading or augmentation."}, {"start": 798.4, "end": 803.2, "text": " Computation needed to reach a competitive out of sample error rate on various data sets and"}, {"start": 803.2, "end": 809.6800000000001, "text": " model architectures. Second, data echoing can provide a wall time speed up in practice. Third,"}, {"start": 809.6800000000001, "end": 814.88, "text": " data echoing can support a wide range of echoing factors. And that's the echoing factor is how"}, {"start": 814.88, "end": 821.76, "text": " often you repeat the data. Fourth, the effectiveness of data echoing depends on the intersection point"}, {"start": 821.76, "end": 828.0, "text": " in the training pipeline. Sorry, in the insertion point. That's what that's what our hypothesis was, right?"}, {"start": 828.0, "end": 835.76, "text": " Fifth, data echoing can benefit from additional shuffling after echoing, but does not require it."}, {"start": 835.76, "end": 843.36, "text": " And six, countering expectations, data echoing reaches the same final error rate as well tuned"}, {"start": 843.36, "end": 853.6, "text": " baselines. So I can absolutely accept one through five, especially in like an actual practical in the"}, {"start": 853.6, "end": 866.5600000000001, "text": " wild setting, but six, we will see about six. So let's jump into their models. They,"}, {"start": 867.52, "end": 873.84, "text": " sorry about that, they trained the following four models. So they train a transformer on these"}, {"start": 873.84, "end": 880.32, "text": " two data sets, LM1B and common crawl. So back is technically it's five models on language modeling."}, {"start": 880.32, "end": 891.6, "text": " They train the ResNet 32 on C410. They train the ResNet 50 on ImageNet and they train SD on Coco."}, {"start": 891.6, "end": 900.8000000000001, "text": " Now here is the accuracy they get. And here is, sorry, this is the target. So what they do is they"}, {"start": 900.8000000000001, "end": 906.8800000000001, "text": " train these models and then they say, okay, what's the accuracy we reach and then they set a target"}, {"start": 906.88, "end": 916.32, "text": " value. So on ResNet 50 on ImageNet, a very common number to reach is something like 76.5."}, {"start": 917.52, "end": 924.08, "text": " If you look at, for example, Torch Vision models, they reach something like this. And so they say,"}, {"start": 924.08, "end": 932.0, "text": " well, our target accuracy here is just a little bit below that. So and then we just measure how many"}, {"start": 932.0, "end": 938.24, "text": " steps or how many their measurement here is fresh data points. So how many actual fresh training"}, {"start": 938.24, "end": 944.72, "text": " samples do we need to reach this target? And this is, this is where it gets wonky because, for"}, {"start": 944.72, "end": 957.2, "text": " example, take the 91% here on C410. That is quite, quite low. And also the ResNet 50 is, I mean,"}, {"start": 957.2, "end": 965.2800000000001, "text": " this is standard, but still ImageNet is much further nowadays. And I think the effectiveness of"}, {"start": 965.2800000000001, "end": 971.6, "text": " something like this has a lot to do with how competitive you want to get. Maybe this is all just"}, {"start": 971.6, "end": 981.84, "text": " an effect of how much on under par your this target performance really is. And I would, I would"}, {"start": 981.84, "end": 987.6800000000001, "text": " expect that even though they say it doesn't hurt their performance in their experiments, I would at"}, {"start": 987.6800000000001, "end": 996.5600000000001, "text": " least expect it will hurt your performance in general if you try to get competitive. Because these"}, {"start": 996.5600000000001, "end": 1004.96, "text": " things aren't as as as of now at least the ones I know like the the ResNet aren't really competitive."}, {"start": 1004.96, "end": 1015.44, "text": " But so what do they do? They measure data echoing with an echoing factor of two. So that means data"}, {"start": 1015.44, "end": 1022.24, "text": " that's incoming is output twice in a row. Any every data point that's coming in is just emitted"}, {"start": 1022.24, "end": 1028.56, "text": " twice from the buffer and then the next data point is emitted twice and so on. And what they"}, {"start": 1028.56, "end": 1035.76, "text": " measure again is the fresh examples red. So how many fresh data points do you need to achieve"}, {"start": 1035.76, "end": 1042.8799999999999, "text": " something? This is a good measurement because this is kind of independent of hardware. So if you're"}, {"start": 1042.8799999999999, "end": 1050.3999999999999, "text": " if you are really in the situation where your GPU is twice as fast as the as your the rest of your"}, {"start": 1050.4, "end": 1059.1200000000001, "text": " pipeline, then an echoing factor of two will speed up at most your your training procedure by"}, {"start": 1059.1200000000001, "end": 1066.16, "text": " factor of two. All right. So you have the baseline in red and then you have batch echoing which is"}, {"start": 1066.16, "end": 1072.5600000000002, "text": " where you echo what we said at the worst possible time right after batching. So this might hurt"}, {"start": 1072.5600000000002, "end": 1080.24, "text": " your performance the most. But also it has a potential to be the fastest if your if maybe you're"}, {"start": 1080.24, "end": 1087.28, "text": " augmentation is very expensive. Then sorry or you're batching. You have example echoing after"}, {"start": 1087.28, "end": 1093.1200000000001, "text": " augmentation. So that would mean you use the augmentation is very expensive. So you save the"}, {"start": 1093.1200000000001, "end": 1101.92, "text": " augmented data points and then you emit it multiple times but each time it is batched differently."}, {"start": 1102.64, "end": 1107.28, "text": " So it is it is shuffled and then batched with different other data points. So you have a shuffle"}, {"start": 1107.28, "end": 1112.08, "text": " buffer after it. And then you have example echoing before date augmentation. So that means the"}, {"start": 1112.08, "end": 1116.96, "text": " same data point emitted multiple times will be augmented in different ways and basically will"}, {"start": 1116.96, "end": 1122.8799999999999, "text": " lead to slightly different data points. So the results here are pretty much what you could expect"}, {"start": 1122.8799999999999, "end": 1129.92, "text": " in that the earlier you do the echoing as you can see here the more this echoing helps."}, {"start": 1129.92, "end": 1136.72, "text": " So the number if you for example this is the object segmentation task the baseline"}, {"start": 1136.72, "end": 1145.04, "text": " needs this many fresh examples to reach this target accuracy with batch echoing not only do you"}, {"start": 1145.04, "end": 1153.2, "text": " sorry with batch echoing you need less fresh training examples. So that means even though you"}, {"start": 1153.2, "end": 1163.68, "text": " kind of train on the same data twice you this helps you more or this helps you. It doesn't help"}, {"start": 1163.68, "end": 1172.16, "text": " you fully because the dash line here is the if it would help you as much as a fresh data point"}, {"start": 1172.16, "end": 1176.96, "text": " you'd be at the dash line right this is exactly half of this because the echoing factor is two."}, {"start": 1176.96, "end": 1184.4, "text": " So if you're if a repeated data point was as useful as a fresh data point you'd be at the dash"}, {"start": 1184.4, "end": 1190.32, "text": " line as you can see right here you're not at the dash line but at least it doesn't hurt right"}, {"start": 1190.32, "end": 1195.6000000000001, "text": " you might expect that it hurts but it doesn't hurt it actually speeds up so the repeated data points"}, {"start": 1195.6000000000001, "end": 1203.76, "text": " at least have some utility. Again this is only useful if you're if you have this asymmetry in your"}, {"start": 1203.76, "end": 1209.36, "text": " pipeline if your pipeline is actually symmetric and you do an echoing factor of two the wall time"}, {"start": 1209.36, "end": 1215.6, "text": " here the wall time plot would look this for the baseline and then almost twice as high for the"}, {"start": 1215.6, "end": 1222.96, "text": " batch echoing because even though it needs the same amount of fresh or almost the same amount of"}, {"start": 1222.96, "end": 1231.92, "text": " fresh example it you echo each one twice so it needs to process it twice so you'll it'll take"}, {"start": 1231.92, "end": 1238.48, "text": " much longer so again this is useful if you have this asymmetry and if the echoing factor is kind"}, {"start": 1238.48, "end": 1245.76, "text": " of smaller than your asymmetry otherwise you're you're simply wasting time repeating data points"}, {"start": 1246.48, "end": 1254.24, "text": " then if you do example echoing here after augmentation you use even less fresh data points and"}, {"start": 1254.24, "end": 1260.96, "text": " if you do it before augmentation this is really surprising you almost get the benefit of fresh"}, {"start": 1260.96, "end": 1267.92, "text": " data points which is something you you might expect right because an augmented newly shuffled"}, {"start": 1267.92, "end": 1275.2, "text": " data point is kind of almost a new data point but still it's quite surprising that you almost get"}, {"start": 1275.2, "end": 1285.44, "text": " to the level of the of of the theoretical possible and also here on the image net task now here"}, {"start": 1285.44, "end": 1292.0, "text": " is actually an example where you can see that it hurts to do this batch echoing because the"}, {"start": 1292.0, "end": 1296.96, "text": " reasons why it could hurt is just that you have you violate this iid assumption you basically have"}, {"start": 1296.96, "end": 1304.48, "text": " correlated data points this is a big big problem for example in reinforcement learning where already"}, {"start": 1304.48, "end": 1311.68, "text": " by nature of you running episodes and then feeding the episodes back into the training procedure"}, {"start": 1311.68, "end": 1317.68, "text": " you have correlated data points and that hurts your performance here actually compared to the"}, {"start": 1318.72, "end": 1325.2, "text": " to the baseline but then if you go to example echoing and the example echoing before augmentation"}, {"start": 1325.2, "end": 1335.6000000000001, "text": " again you get a speed up which is pretty cool okay so they do a bunch of other experiments and"}, {"start": 1335.6, "end": 1341.9199999999998, "text": " I appreciate these experiments here to really show what's going on and until when can you push this"}, {"start": 1342.48, "end": 1347.12, "text": " so here they have a plot of example echoing before augmentation can reduce training time for"}, {"start": 1347.12, "end": 1355.76, "text": " resonant 50 on image net so this is before augmentation and the echoing factor describes how often"}, {"start": 1355.76, "end": 1362.6399999999999, "text": " you repeat each data point so this goes from two to five and you can see that basically you"}, {"start": 1362.64, "end": 1371.8400000000001, "text": " you get the speed up you you just sort of get it for free as you can see the dash line again is as if"}, {"start": 1372.72, "end": 1379.92, "text": " if at repeated data point were as useful as a fresh data point you'd be at the dash line and you"}, {"start": 1379.92, "end": 1390.24, "text": " can see right here that you are just above this dash line so this can help a lot and so this is the"}, {"start": 1390.24, "end": 1396.48, "text": " fresh examples red and this is the wall time in their particular situation in that case it doesn't"}, {"start": 1396.48, "end": 1402.88, "text": " help as much but again it if that very much depends on how the asymmetry in your pipeline is"}, {"start": 1404.64, "end": 1412.32, "text": " now in these experiments I would actually appreciate something like they do down here where"}, {"start": 1413.6, "end": 1419.68, "text": " I would always like to see where it breaks so how far can you go with the echoing factor"}, {"start": 1419.68, "end": 1426.48, "text": " until it doesn't help anymore because this sort of tells me pretty much nothing I want to see"}, {"start": 1426.48, "end": 1432.0, "text": " where is the low point where is kind of the optimal echoing factor and what can you tell me"}, {"start": 1432.0, "end": 1438.4, "text": " about this optimal echoing factor how how can we determine it sort of beforehand or how can"}, {"start": 1438.4, "end": 1443.3600000000001, "text": " you reason how does it connect to the different parts of your architecture so if I had to point out"}, {"start": 1443.36, "end": 1451.9199999999998, "text": " a flaw in this paper it would be that right here I would expect them to continue this echoing"}, {"start": 1451.9199999999998, "end": 1460.7199999999998, "text": " factor increase until it breaks sort of like they do down here this is for I believe this is for"}, {"start": 1460.7199999999998, "end": 1473.04, "text": " the transformer on LM1B now here they have a batch size of 1024 and you can see and this is the"}, {"start": 1473.04, "end": 1478.3999999999999, "text": " this is their standard setting for the transformer the 100024 batch size you can see that the baseline"}, {"start": 1479.68, "end": 1488.8799999999999, "text": " this many 1.5 to 10 to the 7th fresh examples to train until their target if you increase the echoing"}, {"start": 1488.8799999999999, "end": 1497.04, "text": " factor by 2 you basically need half as many fresh examples as long as you echo each one twice"}, {"start": 1497.04, "end": 1508.6399999999999, "text": " again very surprising the fact how close you can get to the as if each vatch were a a perfect"}, {"start": 1508.6399999999999, "end": 1515.84, "text": " fresh data point but you can see as you increase this echoing factor and here is exactly what I"}, {"start": 1515.84, "end": 1523.84, "text": " said right you at some point this hurts at some point you get to the point where the non-iidness"}, {"start": 1523.84, "end": 1530.8799999999999, "text": " the correlation of date of successive data points will actually hurt you and they make a point here"}, {"start": 1530.8799999999999, "end": 1539.6, "text": " of saying that this is for example dependent on batch size now in this experiment over here they"}, {"start": 1539.6, "end": 1548.6399999999999, "text": " have a larger batch size and here is again the the baseline number of data points to reach the target"}, {"start": 1548.64, "end": 1556.88, "text": " and you can see again it goes down but now with the echoing factor where before you had a"}, {"start": 1558.0800000000002, "end": 1563.2800000000002, "text": " you had an increase again now it continues to decrease again it will be interesting to see where"}, {"start": 1563.2800000000002, "end": 1570.0800000000002, "text": " it goes up here and how the number at the slowest like here the four and here the I don't know"}, {"start": 1570.0800000000002, "end": 1578.16, "text": " what is going to be maybe the 16 how this will kind of depend on your batch size and here is another"}, {"start": 1578.16, "end": 1583.92, "text": " problem and that's what I alluded to at the beginning this this performance dependence now I have"}, {"start": 1583.92, "end": 1591.44, "text": " not read anything differently in the paper so I had to assume that they trained this here this"}, {"start": 1591.44, "end": 1596.96, "text": " number of fresh examples to reach the target is still the target that they determined at the"}, {"start": 1596.96, "end": 1604.0, "text": " beginning so it's that 3.9 in the table that 3.9 was achieved with this batch size with a"}, {"start": 1604.0, "end": 1612.32, "text": " 1024 and we know especially in language models that larger batch sizes will lead to a better"}, {"start": 1612.32, "end": 1618.32, "text": " performance even if you need let's say more samples so here you can see that the samples here"}, {"start": 1618.32, "end": 1626.88, "text": " it's 1.5 and here it's actually 4 because you increase that batch size so that will tell you something"}, {"start": 1626.88, "end": 1636.24, "text": " 1.5 and 4 that is that is like a times okay that's like a times 2.5 so you go with the batch"}, {"start": 1636.24, "end": 1646.4, "text": " sizes of times 4 and you need 2.5 more fresh training samples to reach the same target accuracy"}, {"start": 1646.4, "end": 1651.5200000000002, "text": " first of all we know that the larger batch sizes can reach higher target accuracies so"}, {"start": 1651.52, "end": 1660.08, "text": " again this this this results the dependence of them on the actual performance to the maximum"}, {"start": 1660.08, "end": 1666.96, "text": " achievable value to me that's kind of a shady world here to always to always say okay how long"}, {"start": 1666.96, "end": 1675.12, "text": " does it take to reach that particular target because we know that this model right here can reach"}, {"start": 1675.12, "end": 1682.2399999999998, "text": " a much higher target but we don't know this about these models here what is their kind of performance"}, {"start": 1682.2399999999998, "end": 1689.1999999999998, "text": " in the limit and they try to make these experiments but I don't really believe them maybe yeah"}, {"start": 1691.28, "end": 1697.28, "text": " and yeah so in the second right that will that will be that will that is already interesting so"}, {"start": 1697.84, "end": 1704.8, "text": " this ratio right here this 2.5 to 4 this ratio must mean something right it's it's I"}, {"start": 1704.8, "end": 1713.36, "text": " go to a higher batch size 4 times higher batch size and I need 2.5 many more fresh training"}, {"start": 1713.36, "end": 1719.68, "text": " samples to reach the same target that must somehow tell you something about the usefulness of a"}, {"start": 1719.68, "end": 1725.68, "text": " single data point versus a succession of data points right so it doesn't seem because I would"}, {"start": 1725.68, "end": 1732.72, "text": " expect if each data point was valuable I would expect this to be times 4 and if it were if it were"}, {"start": 1732.72, "end": 1744.24, "text": " times 1 so if it were no no speed up at all sorry not times 4 if it that it would be times 1 it would"}, {"start": 1744.24, "end": 1749.28, "text": " mean I'd need the same number of fresh training samples right no matter how I batch them"}, {"start": 1750.24, "end": 1756.08, "text": " but it were times 4 that means basically that it doesn't matter really how many training points"}, {"start": 1756.08, "end": 1763.4399999999998, "text": " I have in a batch as long as I have enough and the 1024 seems to be enough it just it just matters"}, {"start": 1763.4399999999998, "end": 1769.36, "text": " how many you know SGD steps I do so basically what we're saying SGD isn't getting the most out"}, {"start": 1769.36, "end": 1775.1999999999998, "text": " of these data points and this ratio this 2.5 this this tells you something about the information"}, {"start": 1775.1999999999998, "end": 1782.8, "text": " content of a of an additional data point versus the usefulness content of an additional step of SGD"}, {"start": 1782.8, "end": 1790.32, "text": " and I would expect that to depend to intrinsically be connected to the where the low point of this"}, {"start": 1790.32, "end": 1796.1599999999999, "text": " echoing factor is because that's exactly what the echoing does it trades off freshness of data point"}, {"start": 1796.1599999999999, "end": 1806.24, "text": " versus doing more steps on the on the on the same information and for a paper especially a paper"}, {"start": 1806.24, "end": 1814.88, "text": " by Google brain I this this is a connection that I would love to see investigated but enough"}, {"start": 1814.88, "end": 1820.16, "text": " of the ranting they do investigate other things they do investigate for example what happens if"}, {"start": 1820.16, "end": 1826.56, "text": " we just up the batch size and you can see here yeah this is interesting the baseline needs more"}, {"start": 1826.56, "end": 1834.8, "text": " fresh samples as you up the batch size but and at the beginning this batch echoing for example"}, {"start": 1834.8, "end": 1840.0, "text": " doesn't help doesn't hurt but doesn't help but as you go to higher and higher batch sizes this"}, {"start": 1840.0, "end": 1849.36, "text": " batch echoing starts to help more and more again I believe this is connected to the usefulness of"}, {"start": 1849.36, "end": 1854.72, "text": " the single data point at some point your batch size is just too large for the problem you'd rather"}, {"start": 1854.72, "end": 1863.12, "text": " do more steps and that's why this helps but also this model right here might have a higher ceiling"}, {"start": 1863.12, "end": 1870.08, "text": " accuracy so and it is the question whether this model right here has the same or whether this model"}, {"start": 1870.08, "end": 1877.12, "text": " right here the batch echoing model would actually fall back to the ceiling accuracy of one of these"}, {"start": 1877.12, "end": 1886.1599999999999, "text": " models over here yeah in any case their point is basically that as you increase the batch size this"}, {"start": 1886.16, "end": 1895.8400000000001, "text": " echoing tends to help more relatively because maybe it's because what I said right they say as"}, {"start": 1895.8400000000001, "end": 1900.0800000000002, "text": " batch size increases the performance of batch echoing relative to the baseline stays either stays"}, {"start": 1900.0800000000002, "end": 1907.76, "text": " the same or improves while for example echoing it either stays the same or it gets sorry while for"}, {"start": 1907.76, "end": 1914.8000000000002, "text": " example echoing it either stays the same or gets worse dashed lines indicate the expected values"}, {"start": 1914.8, "end": 1920.56, "text": " if repeated examples or as useful as fresh examples yeah so I built there is an intrinsic connection"}, {"start": 1920.56, "end": 1928.8799999999999, "text": " here between the usefulness of more data and usefulness of doing additional steps and here the"}, {"start": 1928.8799999999999, "end": 1934.24, "text": " example echoing you can almost see it as more data because especially here you're going to do"}, {"start": 1934.24, "end": 1940.8799999999999, "text": " augmentation on top of it and you see the non augmented versus the augmented ratio changes"}, {"start": 1940.88, "end": 1949.6000000000001, "text": " dramatically from here to here okay final set of experiments as you can tell this is more"}, {"start": 1949.6000000000001, "end": 1955.6000000000001, "text": " mostly an experimental paper and it is always easy to criticize experimental papers and"}, {"start": 1956.64, "end": 1966.0, "text": " rightfully so because I would not trust this very much but given that it comes from a big institution"}, {"start": 1966.0, "end": 1974.64, "text": " and it is a very well written paper I would trust it more than I would a regular paper and I would"}, {"start": 1974.64, "end": 1981.84, "text": " say if you're in practice this is certainly worth trying absolutely I'm just I just think that"}, {"start": 1982.56, "end": 1989.2, "text": " some of the things aren't aren't researched like some of my questions aren't answered of this"}, {"start": 1989.2, "end": 1997.3600000000001, "text": " so they investigate sizes so they now build shuffle buffers so we have batch echoing but they say"}, {"start": 1997.3600000000001, "end": 2003.8400000000001, "text": " ah but we can do batch echoing with shuffle buffers so after the batch echoing right we have this"}, {"start": 2003.8400000000001, "end": 2011.44, "text": " state where we have the batching and then we have the echoing this is our echo buffer where we"}, {"start": 2011.44, "end": 2018.0800000000002, "text": " output the each data point multiple times and then we have another buffer which is a shuffle buffer"}, {"start": 2018.08, "end": 2023.52, "text": " that a shuffle buffer just collects data points and then shuffles them around before outputting them"}, {"start": 2023.52, "end": 2031.52, "text": " and that means even though we you know output this five times it might not come out five times"}, {"start": 2031.52, "end": 2037.12, "text": " after each other it might be that it comes out once and then another data point that was already"}, {"start": 2037.12, "end": 2042.1599999999999, "text": " in the shuffle buffer comes out and then it will just say that in total it comes out five times"}, {"start": 2042.8, "end": 2047.84, "text": " but it is first shuffle together with a bunch of other data points of course this uses more"}, {"start": 2047.84, "end": 2057.2, "text": " memory but of it returns to that more iid setting and you can see here as the buffer size increases"}, {"start": 2057.2, "end": 2062.88, "text": " then the performance gets more and more to the performance that you would have with completely"}, {"start": 2062.88, "end": 2071.44, "text": " fresh data right so again trading of freshness and um freshness and doing multiple steps"}, {"start": 2071.44, "end": 2081.68, "text": " uh with by by basically repeating repeating data points straight out versus repeating data points"}, {"start": 2081.68, "end": 2089.68, "text": " shuffled and also here you have the same with example echoing so if you apply the shuffle buffer"}, {"start": 2090.56, "end": 2097.28, "text": " to example echoing and you increase its size you can get very very very close to the performance"}, {"start": 2097.28, "end": 2104.5600000000004, "text": " that you would get with fresh data which of course if you increase the shuffle buffer to the size"}, {"start": 2104.5600000000004, "end": 2110.32, "text": " of the data set you are at the situation that's the limit you are at the situation of fresh data"}, {"start": 2110.32, "end": 2116.96, "text": " right if you do example echoing right so here is where it gets into the funky part where they say"}, {"start": 2116.96, "end": 2125.28, "text": " we actually measure the validation cross entropy and the validation accuracy versus the number of"}, {"start": 2125.28, "end": 2132.1600000000003, "text": " fresh examples red and here i want to concentrate on the resonant 50 on image net and as you can see"}, {"start": 2132.88, "end": 2140.5600000000004, "text": " most of these models um they pretty much end up in the same place here it's just that the echoing"}, {"start": 2140.5600000000004, "end": 2151.36, "text": " models end up there faster right and this this is i mean um this is where it gets a bit confusing"}, {"start": 2151.36, "end": 2160.0, "text": " honestly because why do you have this super sharp thing here because um usually and here it"}, {"start": 2160.0, "end": 2165.36, "text": " sort of speeds up in the middle you see you see that and then it kind of sharply declines"}, {"start": 2166.08, "end": 2172.4, "text": " is this maybe because they drop the learning rate or something now my main thing is that"}, {"start": 2173.1200000000003, "end": 2178.1600000000003, "text": " the performance here even though the this target thing is lower than um"}, {"start": 2178.16, "end": 2185.04, "text": " um then the even though this target thing is the same for everyone it is lower than the best"}, {"start": 2185.04, "end": 2193.44, "text": " reachable accuracy and uh i'm i'm just this this is just confusing if this is really true"}, {"start": 2194.3199999999997, "end": 2203.12, "text": " whoa if this is really true i think we have a lot to learn about um sgd yet and how we're not"}, {"start": 2203.12, "end": 2211.92, "text": " actually doing sgd correctly and because it seems like almost the the echo versions are better"}, {"start": 2211.92, "end": 2219.04, "text": " or reach a better accuracy than the baseline i don't know do they just cap it at the performance"}, {"start": 2219.04, "end": 2225.7599999999998, "text": " uh i don't think so i think they say they let it reach they also have these um things right here"}, {"start": 2225.7599999999998, "end": 2232.24, "text": " these these curves where they say this is the best we reach and this is the resonant 32 on c410"}, {"start": 2232.24, "end": 2241.8399999999997, "text": " and again 91% on c410 is just very very low and i'm almost thinking that okay this might help"}, {"start": 2241.8399999999997, "end": 2249.52, "text": " if you just throw something that we know is kind of overpowered because we can reach 99% or at least"}, {"start": 2249.52, "end": 2256.08, "text": " you can reach something like 94% on c410 easily easily with a network smaller than resonant 32"}, {"start": 2256.08, "end": 2264.72, "text": " um maybe this effect manifests if you if you have actually something that could reach higher"}, {"start": 2265.44, "end": 2273.44, "text": " but for some reason you only reach this low i'm not sure but this is confusing and if this is"}, {"start": 2273.44, "end": 2281.6, "text": " really true yeah i would just if it's true which i believe i believe this paper it might be just"}, {"start": 2281.6, "end": 2289.44, "text": " an effect of not reaching the actual ceiling and again look at this this is just the curves are"}, {"start": 2289.44, "end": 2297.92, "text": " just strange right you have the echoing before augmentation or like it seems like it's out performing"}, {"start": 2298.72, "end": 2306.48, "text": " the uh the fresh data points i don't know there's a little bell in my head that doesn't like this"}, {"start": 2306.48, "end": 2314.08, "text": " if it's actually true then you know that's cool um but yeah so my main criticism is there a bit"}, {"start": 2314.08, "end": 2320.0, "text": " with the experimental methodology for example where they increase the batch size but still reach"}, {"start": 2320.0, "end": 2325.2, "text": " the same target accuracy even though we know that there is a higher ceiling if you increase the"}, {"start": 2325.2, "end": 2332.64, "text": " batch size for language models my other criticism is the non-investigation of this connection"}, {"start": 2332.64, "end": 2340.16, "text": " uh this connection right here maybe but all in all it's a pretty cool paper if i had a big company"}, {"start": 2340.16, "end": 2347.2799999999997, "text": " with these pipeline issues i would absolutely implement this this seems like a no-brainer um to do"}, {"start": 2347.2799999999997, "end": 2353.8399999999997, "text": " this and can help you tremendously all right that was it thank you for listening if you're still"}, {"start": 2353.84, "end": 2363.84, "text": " here subscribe like tell a friend bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=l_3zj6HeWUE | Group Normalization (Paper Explained) | The dirty little secret of Batch Normalization is its intrinsic dependence on the training batch size. Group Normalization attempts to achieve the benefits of normalization without batch statistics and, most importantly, without sacrificing performance compared to Batch Normalization.
https://arxiv.org/abs/1803.08494
Abstract:
Batch Normalization (BN) is a milestone technique in the development of deep learning, enabling various networks to train. However, normalizing along the batch dimension introduces problems --- BN's error increases rapidly when the batch size becomes smaller, caused by inaccurate batch statistics estimation. This limits BN's usage for training larger models and transferring features to computer vision tasks including detection, segmentation, and video, which require small batches constrained by memory consumption. In this paper, we present Group Normalization (GN) as a simple alternative to BN. GN divides the channels into groups and computes within each group the mean and variance for normalization. GN's computation is independent of batch sizes, and its accuracy is stable in a wide range of batch sizes. On ResNet-50 trained in ImageNet, GN has 10.6% lower error than its BN counterpart when using a batch size of 2; when using typical batch sizes, GN is comparably good with BN and outperforms other normalization variants. Moreover, GN can be naturally transferred from pre-training to fine-tuning. GN can outperform its BN-based counterparts for object detection and segmentation in COCO, and for video classification in Kinetics, showing that GN can effectively replace the powerful BN in a variety of tasks. GN can be easily implemented by a few lines of code in modern libraries.
Authors: Yuxin Wu, Kaiming He
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'll look at group normalization by Yushin Wu and Kaimin He of Facebook AI research. So this paper is basically an engineering paper about a new normalization technique called group normalization. So what's the issue here? The issue is that pretty much throughout neural network learning, we're using this technique called batch normalization. Now batch normalization is a pretty reasonable thing and it works very, very well. So what's the idea behind batch normalization? The idea is if you have data points for machine learning methods and your data is in a 2D coordinate system somewhere down here, right? And you're trying to separate that from the dots, which are here. It is often very beneficial to shift that distribution before you do anything. You want to shift it to the middle of the, basically want to center it first of all, such that the zero, the origin point is in the middle of the data. And then sometimes you also want to do what's called normalize it. And by normalizing we mean you want to kind of rescale the axis such that things are more or less sort of like gousians. So if you look at this distribution first is the centering and then second is what they's called a normalization normalization. And usually we know that any sort of machine learning methods work better if you do that. And that's mostly in classic machine learning methods with conditioning numbers of the data being better and so on. But if you just want to learn let's say a linear classifier you can see here you can even save one parameter because you can make it just go through the origin. And that's true in general. So if we draw this in 1D you'd have a distribution that maybe is very picky right here. You first center it to the middle of the coordinate system. And sorry that's not really centered. And then you would divide it by standard deviation such that after it is a unit standard deviation gousian. So a normal distribution. The closer your data seems to be to a multivariate normal distribution the better these machine learning methods work. Especially if you look at how signal in deep network is propagating through the layers. So the idea is if it's good for the general machine learning method that the input has a multivariate normal distribution or is normalized then it's probably good that the input to each layer is normalized. So when you look at how signal features are in between layers. So this is for example the con 5 3. This is a layer somewhere in the middle of a convolutional neural network. And if you look at the spread of how features signals are throughout training you'll see that the more training progresses the larger the kind of spread of features is. So you might get really large numbers or really large negative numbers or maybe really small numbers in your neural networks. And it would be better if you had a layer and the input you've normalized it right. And the output then is again a distribution but it's maybe shifted that you would first transform that back into a normal unit normal distribution before you put it through the next layer. So what patch norm does is at each layer before each layer it will do a normalization procedure on the data before giving it to the next layer. And you can do a basically back prop through that. It's also common to learn bias and variance parameter to add after that. But the important thing is that after each layer the data is normalized such that it is kind of in the most comfortable regime. What's the problem? The problem with this is that you actually need the distribution right. If you want to center this data up here you need to know what the data is. So you need to know the entire data. If I want to figure out what is the mean of this distribution I need all of the data points to decide here's the mean I need to shift that up to here. If I just have a mini batch like we usually do in machine learning so if I just have this or this and this and this point I just have four points I can't determine the mean. But what I can do is I can sort of guess the mean from the four points right. So my guess summation of the mean would be somewhere here and that would be usually close enough. And you can also see that the larger your batch is if you sample at random the more accurate your mean estimation is going to be. So people have been training neural networks with large batch sizes for basically batch sizes have gotten larger and larger in the last year. So that has not been a problem. But what people are doing now is they are doing distributed machine learning where you do have your data set and you draw a batch and the batch might be large. So this might be I don't know one million images. This might still be four thousand images in your batch. But what they'll do especially with things like TPUs is they'll distribute that across many many many machines into batches of sometimes as small as eight samples per unit. And if if this is not images but maybe something longer like a sequence of text or if this is a sequence of speech or something like this you can sometimes even go down to two or one samples per unit of computation. And of course you can't do batch normalization you can't calculate the mean of one sample. It's just going to be that one sample itself. So either you have two options with your in small batch sizes let's say two. Either you take the hit and have your very bad estimate of the mean from just two samples or eight samples or after each layer you basically do a synchronization step such that everyone communicates to everyone else their statistics and you can basically aggregate the statistics across the batch. Both are not cool. Usually these frameworks they don't do this synchronization because it's just too slow. So they'll go with the bad statistics. And you can see this right here in this graph they have the ImageNet classification error versus batch sizes. So this is a ResNet 50 model trained on the ImageNet dataset using eight workers. So eight GPUs and if they do 32 images per and I'll just look at the blue line here if they do 32 images per worker. So it's eight workers it's eight times 32 that's the batch size. That is a large number 256 maybe yeah. All right so if they do that then you can see the error is on a state of the art for a ResNet 50. If they go to 16 it's still pretty good but then as they go lower and lower and lower. So if they go to smaller and smaller batches and spread them out over the workers then the error starts going up and this is because the batch norms statistics get worse and worse. So the goal of this paper is to find this group norm thing here. The group norm they this paper claims is another normalization technique that pretty much does the same thing this centering and the normalization the scaling but it does it without relying on the batch statistics. It basically does it within a data point and that means that the performance even though it's a bit smaller at the beginning for this particular example will stay constant with even in small batch size regime. So this is potentially applicable as I said to things where you have to go to like two or one sample per worker because it's just the data points the single data points are just too large. So if you maybe want to train something like Bert on a on a GPU. So what is group normalization? Group normalization as I said works within a sample now there have been other methods that work within a sample instead of across the batch and they tend to not work as well as batch norm. Now this paper here claims that group norm works on par with batch norm for large batch sizes and better than on small batch sizes. So here they have a schematic of what's happening. In batch norm as you can see here you have this this cube now this cube here n means the batch size so this are the data points points in your mini batch. This is the thing that is going to get small in the if you don't have enough memory. Then C would be your channels. So we are talking about convolutional neural networks here but this is generalizable to other neural networks. The channels are going to be the independent feature maps that you are going to have. So in a convolutional neural network usually each layer has these things called kernels and there might be three by three matrices like this and if you have an image the kernel will be slided. This thing right here will be maybe here will be slided across the image or slid is it slid? Okay, will be slid across the image and then the numbers in here will be convolved with the pixels and that will give you the next layers representation. So whatever the convolution operation is and you'll slide that over and that sliding over will give you the values in the next layer. Now you not only have one kernel but you actually have many kernels. Sorry about this. Let's draw that. So you have more and more kernels. You have a whole stack of kernels and how many kernels you have. Those are the different kernels are also called your different channels. Now the kernels refer to the weights and the channels refer to the image but the the IF kernel is going to be convolving the IF channel of the image. So at the beginning the input image has three channels because red, green and blue but then the intermediate images can have more channels as you have as basically as many as you have kernels in the layer right before. Okay and the H and the W means the height and width of the image. So it combined. So the image is kind of unrolled across the height or the width in this direction. So what does BATCHNORM do? BATCHNORM takes as you can see here one channel and it takes one channel so maybe this image this is one channel. Let's just say this is the red channel because I drawn it in red. It takes that and it calculates the mean one over and the standard deviation of that. It calculates those two statistics and it uses that to do this centering and scaling operation. So all of these methods are going to calculate the mean and the variance and then do the same scaling transformation. The question is just how do you calculate the mean? BATCHNORM does this across the data points. So it looks at a single feature at a single channel and it asks what's the mean across all the data points? What are the data statistics of this channel and what was the mean and standard deviation? Now actually BATCHNORM I didn't even know that in convolutional layer this works like this. You can also imagine BATCHNORM of really just taking one single feature and that means of really just taking one of these things right here. So if this goes to the back and normalizing across that the important part is that it is in fact normalizing across the data points. So it looks at your BATCHNORM looks at the mean and the variance in that batch and it normalizes by that. I think convolutional layers make sense because you have this invariance in height and width and therefore yeah. So that makes sense but in a fully connected layer you'd simply go look at one feature at a time. LayerNORM is different. LayerNORM has been basically been proposed as an alternative to BATCHNORM with the same reasoning that this paper has. So layerNORM as you can see here it does each data point individually. So here we only have one data point that is normalized by itself. So you do this for each data point independently and therefore it's not dependent on the batch size anymore. But what you'll do is you look across all of the channels right here. So all of the channels and all of the width and height. So this entire thing here this entire thing is basically one channel right and then the next channel is here of the image and the next no that's the next image. Well that is a bad drawing because the image is unrolled. In any case what you'll do is you'll look at so if you have a filter bank like this you have an image and the image composed of multiple channels right. This is the red and then you'll have the green right. This is in the green and then you'll have the blue channel. And what you'll do is simply you'll calculate the mean across all of the pixels and across all of the channels. You just take this whole non-py array and you just say dot mean and that gives you one number. And it's just whatever that number is you subtract it and then you say standard deviation and you divide by that. That's layerNORM. So an entire layers representation of one image is just normalized to the mean. Now this seems a bit drastic and that's why instance norm did the exact opposite. They said wait a minute. Instead of normalizing across all of the features right. We'll go back and do what batch norm does. Batch norm looks at each feature individually. So basically it looks at all of these these different axes in the data distribution. It looks at them differently. So if one axis is scaled very widely we want to normalize that differently than if then the other axis that is just scaled very shortly. And that's why we'll look at each feature individually like batch norm. But also we only look at one day to point at a time. Now as you can imagine this doesn't work anymore in a fully connected network. This basically works in a convolutional network where you have a feature map channel. So you look at one individual channel and one data point. So that means here you would normalize the red channel individually. You would normalize the green channel individually and you normalize the blue channel individually. So the image you're going to end up with is simply the red channel subtracted by its own mean and then divided by its own standard deviation. And just within that data point right. So maybe I should hear say across the number of features or something. So I hope that that's clear. So the layer norm drops the dependence on the batch size but instead says we should normalize across all of the features. And the instance norm says wait a minute batch norm had a good idea normalizing only across the features individually because the individual features might have different scales and we should account for that. But also we don't want to be dependent on the batch size. And now is this where group norm comes in. Group norm is basically a mix between layer norm and instance norm. What group norm says layer norm and instance norm have good ideas. They only go across one sample. They take that. They say in essence instance norm has a good idea in that the features should be normalized individually but it goes sort of too far from it goes too far. You might get not good enough statistics because you're now normalizing each of these things individually. Whereas with layer norm you're too restricted. You're basically saying that the features it's fine if the features relative to each other are like this. One is maybe very high variance and one is very low variance. Feature norm would keep that and group norm would say maybe that's not it's not so good. We should have we should normalize the individual features maybe individually but they'll their argumentation here is that maybe there are some features that by their nature already have the same sort of scaling and variance. They give an example. If you for example have a filter again we deal with convolutional layers here and that filter is a let's say an edge filter right so a horizontal edge filter so it's very low value here and let me mark the high value with blue. So this is a horizontal edge filter. If you slide this over a window and these are high numbers and these are low numbers it will respond to edges because edges have high low high right or vice versa so it will give you very positive and very negative number every time you slide across an edge. Now you can imagine that in natural images that filter whatever image you put in would and however you normalize would give you pretty much the same response as a vertical edge filter. So the horizontal and the vertical edge filter you you'll see whatever their response is they're probably about equal in size. So we could expect that in a neural network there will be groups of filters that together exhibit the same scale and therefore we can normalize across them like in layer norm. So the more things we normalize across the better statistics we can gather. That's why instance norm doesn't work because it only normalizes across a very small thing getting very little statistics but we should normalize if we could gather good statistics we should normalize different features differently. And group norm says well since some of the features are almost guaranteed to behave the same we could normalize across those. Now of course you don't know at the beginning which ones those are. So but you hope that by doing group norm by basically at up-preyory so at the beginning of training you decide what the groups aren't and naturally it's just whichever ones are next to each other those are the groups and you'll hope that through the training procedure basically those groups will learn the features that are equal of size. Well you basically enforce that so you kind of constrain the architecture to do that. So that's the idea behind group norm. You basically build these groups of channels and then you normalize across those across the groups of within the groups of channels across the entire height and width only in a single data point and therefore you gain the advantage of layer norm of normalizing within a single data point. You retain the advantage of batch norm of normalizing across single features and that's what instance norm attempted but yeah so you get the best of both worlds sort of that's group norm and now we go and look what it does. So they say okay basically all the normalization techniques do this they subtract a mean and divide by standard deviation that's what we saw and the difference is just across what you collect your statistics. So the group norm is the following code in TensorFlow as you can see you simply reshape your data and basically expand this part right here where you built where you put the extra. So this is C this entire thing used to be C and you divide it into group and index within group and then you just normalize across that reshape to the original dimension again and the important the cool thing is in batch norm you have to keep track of these of these running means because at test time you sort of don't want the batch statistic to influence anything you don't have that here you can just back propagate through this observation through this operation and you don't need to keep these running running averages going and you always care are I am I in tests or am I in train mode right now you just do this this operation is per data point so it's just part of your model right and they do a an experiment where they have 32 images per GPU so it's reasonably sized and they can basically show that the group norm and the batch norm they compare in their performance now I do usually don't believe the experiments that you see in single papers but I think this has been replicated a couple of times now you see this is the train error where group norm even behaves a bit better and then in the validation error it behaves a bit worse but one could say it is it is kind of more closely together than the other methods are to the group norm or to each other this instance norm and layer norm so it at least it's better than instance norm and layer norm and then once you go into the smaller batch size regime of course that's where the group norm starts to shine so if you go from the 32 images per GPU which is this low black curve here all the way to two images per GPU and I believe they could even do one image per GPU with group norm but of course you can't do that with batch norm because you need batch statistics you can see that the performance of batch norm degrades drastically whereas with group norm this experiment is just funny they just have to do they seem to know exactly what turns out so they look at the lines are all exactly in the in the same place I mean come on like you know you're just having time to probably one of the reviewers was like what did you really do the experiment they put it in so yeah so you can see that the batch norm beats the group norm in this setting with the when you have the larger batch sizes but the group norm pulls ahead quite drastically when you have the smaller batch sizes and that is the main advantage so now you can turn to models that require small batch sizes or small batch per worker and generally it's a pain in the ass to just keep track of those statistics for test time they do verify which I find pretty cool that this phenomenon of the responses going apart during training in the internal feature maps batch norm counter acts that so with batch norm you'll get actually a convergence of responses during training so the more you train the more normalized basically your internal features will be and they show that this is exactly the same with group norm so group norm is as it seems it is a replacement it's not an addition it doesn't the gains don't come from different place it seems to be a substitute for batch norm though they don't have an experiment where they do both I believe maybe I'm wrong actually maybe they do but yeah it seems like you just kind of have to bring some calmness and some standardization into your signal and how exactly you do that doesn't seem that important as long as you do it with some precision and some some real overall statistics yeah what I don't like about this is now you have of course a new hyper parameter which is this number of groups right so that that seems rather annoying and the gains like this usually come from the introductions of new hyper parameters and that just it's not so it's not that ideal for a method to introduce a new hyper parameter at least layer norm and instance norm didn't and now as you can see the number of groups is is not super influential but does have a bit of an influence on the performance so if you go a number of groups or here a number of channels per group of course these two numbers are inversely related the more groups you have the less number of channels per group you have if you go to one extreme you will get to the layer norm basically so the layer norm is an extreme case of group norm where you just have one group all the channels are in the same group then the performance as you can see here is quite a bit worse if you go to the other extreme where every channel is its own group that's equivalent to instance norm again the performance is quite bad and somewhere in the middle here with 32 groups it seems to be a good sweet spot so I don't again I don't like the hyper parameter seems to be some somewhat of a thing where you really have to hit a good value and well I guess we'll see over time if that value is always going to be about the same you know like the beta 2 of Adam it's it's always like people never change it from 0.9999 because it just tends to work or whether that's really going to be another hyperparameter to fit that seems to be annoying they do a bunch of ablation studies and tests on as we said the for example object detection and segmentation so so models where you must go almost to small batch sizes just because so video classification so if you want a class plan entire video that's a lot of data right and you almost have to go small batch sizes for that they do a lot of experiments and generally as I said I believe these results in for group norm have been replicated and across the community a bunch of times now and I would definitely consider group norm if you are thinking of a especially a distributed machine learning project all right with that I hope you enjoyed this paper I've been talking for way too long now I wish you and I stay if you haven't already please subscribe like share comment or whatever you feel like doing bye bye | [{"start": 0.0, "end": 10.120000000000001, "text": " Hi there. Today we'll look at group normalization by Yushin Wu and Kaimin He of Facebook AI research."}, {"start": 10.120000000000001, "end": 16.4, "text": " So this paper is basically an engineering paper about a new normalization technique called"}, {"start": 16.4, "end": 22.88, "text": " group normalization. So what's the issue here? The issue is that pretty much throughout"}, {"start": 22.88, "end": 29.400000000000002, "text": " neural network learning, we're using this technique called batch normalization. Now batch normalization"}, {"start": 29.4, "end": 35.64, "text": " is a pretty reasonable thing and it works very, very well. So what's the idea behind batch normalization?"}, {"start": 35.64, "end": 45.08, "text": " The idea is if you have data points for machine learning methods and your data is in a 2D coordinate"}, {"start": 45.08, "end": 51.2, "text": " system somewhere down here, right? And you're trying to separate that from the dots, which are here."}, {"start": 51.2, "end": 58.68, "text": " It is often very beneficial to shift that distribution before you do anything. You want to shift it"}, {"start": 58.68, "end": 69.64, "text": " to the middle of the, basically want to center it first of all, such that the zero, the origin"}, {"start": 69.64, "end": 75.32, "text": " point is in the middle of the data. And then sometimes you also want to do what's called normalize it."}, {"start": 75.32, "end": 82.2, "text": " And by normalizing we mean you want to kind of rescale the axis such that things are more or less"}, {"start": 82.2, "end": 92.04, "text": " sort of like gousians. So if you look at this distribution first is the centering and then second is"}, {"start": 92.04, "end": 100.52000000000001, "text": " what they's called a normalization normalization. And usually we know that any sort of machine learning"}, {"start": 100.52000000000001, "end": 106.52000000000001, "text": " methods work better if you do that. And that's mostly in classic machine learning methods with"}, {"start": 106.52000000000001, "end": 111.4, "text": " conditioning numbers of the data being better and so on. But if you just want to learn let's say a"}, {"start": 111.4, "end": 117.16000000000001, "text": " linear classifier you can see here you can even save one parameter because you can make it just go"}, {"start": 117.16000000000001, "end": 125.88000000000001, "text": " through the origin. And that's true in general. So if we draw this in 1D you'd have a distribution"}, {"start": 125.88000000000001, "end": 133.48000000000002, "text": " that maybe is very picky right here. You first center it to the middle of the coordinate system."}, {"start": 134.12, "end": 140.44, "text": " And sorry that's not really centered. And then you would divide it by standard deviation such"}, {"start": 140.44, "end": 149.32, "text": " that after it is a unit standard deviation gousian. So a normal distribution. The closer your data"}, {"start": 149.32, "end": 155.24, "text": " seems to be to a multivariate normal distribution the better these machine learning methods work."}, {"start": 155.24, "end": 160.12, "text": " Especially if you look at how signal in deep network is propagating through the layers."}, {"start": 160.76, "end": 167.96, "text": " So the idea is if it's good for the general machine learning method that the input has a"}, {"start": 167.96, "end": 175.8, "text": " multivariate normal distribution or is normalized then it's probably good that the input to each layer"}, {"start": 175.8, "end": 186.20000000000002, "text": " is normalized. So when you look at how signal features are in between layers. So this is for"}, {"start": 186.20000000000002, "end": 193.24, "text": " example the con 5 3. This is a layer somewhere in the middle of a convolutional neural network."}, {"start": 193.24, "end": 200.60000000000002, "text": " And if you look at the spread of how features signals are throughout training you'll see that"}, {"start": 200.60000000000002, "end": 207.32000000000002, "text": " the more training progresses the larger the kind of spread of features is. So you might get really"}, {"start": 207.32000000000002, "end": 214.76000000000002, "text": " large numbers or really large negative numbers or maybe really small numbers in your neural networks."}, {"start": 214.76000000000002, "end": 221.4, "text": " And it would be better if you had a layer and the input you've normalized it right. And the"}, {"start": 221.4, "end": 227.96, "text": " output then is again a distribution but it's maybe shifted that you would first transform that"}, {"start": 227.96, "end": 233.48000000000002, "text": " back into a normal unit normal distribution before you put it through the next layer."}, {"start": 234.28, "end": 241.4, "text": " So what patch norm does is at each layer before each layer it will do a normalization procedure"}, {"start": 241.4, "end": 250.20000000000002, "text": " on the data before giving it to the next layer. And you can do a basically back prop through that."}, {"start": 250.2, "end": 256.52, "text": " It's also common to learn bias and variance parameter to add after that. But the important"}, {"start": 256.52, "end": 261.96, "text": " thing is that after each layer the data is normalized such that it is kind of in the most"}, {"start": 261.96, "end": 267.88, "text": " comfortable regime. What's the problem? The problem with this is that you actually need the"}, {"start": 267.88, "end": 276.03999999999996, "text": " distribution right. If you want to center this data up here you need to know what the data is."}, {"start": 276.04, "end": 282.04, "text": " So you need to know the entire data. If I want to figure out what is the mean of this distribution"}, {"start": 282.04, "end": 287.24, "text": " I need all of the data points to decide here's the mean I need to shift that up to here."}, {"start": 287.96000000000004, "end": 293.0, "text": " If I just have a mini batch like we usually do in machine learning so if I just have this"}, {"start": 293.0, "end": 299.64000000000004, "text": " or this and this and this point I just have four points I can't determine the mean. But what I"}, {"start": 299.64000000000004, "end": 305.32000000000005, "text": " can do is I can sort of guess the mean from the four points right. So my guess summation of the"}, {"start": 305.32, "end": 310.36, "text": " mean would be somewhere here and that would be usually close enough. And you can also see that"}, {"start": 310.36, "end": 317.88, "text": " the larger your batch is if you sample at random the more accurate your mean estimation is going to be."}, {"start": 319.08, "end": 325.15999999999997, "text": " So people have been training neural networks with large batch sizes for basically batch sizes have"}, {"start": 325.15999999999997, "end": 330.03999999999996, "text": " gotten larger and larger in the last year. So that has not been a problem. But what people are"}, {"start": 330.04, "end": 336.92, "text": " doing now is they are doing distributed machine learning where you do have your data set and you draw"}, {"start": 336.92, "end": 342.28000000000003, "text": " a batch and the batch might be large. So this might be I don't know one million images. This might"}, {"start": 342.28000000000003, "end": 348.12, "text": " still be four thousand images in your batch. But what they'll do especially with things like TPUs is"}, {"start": 348.12, "end": 355.32000000000005, "text": " they'll distribute that across many many many machines into batches of sometimes as small as"}, {"start": 355.32, "end": 364.2, "text": " eight samples per unit. And if if this is not images but maybe something longer like a sequence of"}, {"start": 364.2, "end": 371.64, "text": " text or if this is a sequence of speech or something like this you can sometimes even go down to two or one"}, {"start": 372.6, "end": 380.84, "text": " samples per unit of computation. And of course you can't do batch normalization you can't calculate"}, {"start": 380.84, "end": 387.47999999999996, "text": " the mean of one sample. It's just going to be that one sample itself. So either you have two"}, {"start": 387.47999999999996, "end": 395.15999999999997, "text": " options with your in small batch sizes let's say two. Either you take the hit and have your very"}, {"start": 395.15999999999997, "end": 401.55999999999995, "text": " bad estimate of the mean from just two samples or eight samples or after each layer you basically"}, {"start": 401.55999999999995, "end": 407.96, "text": " do a synchronization step such that everyone communicates to everyone else their statistics and you"}, {"start": 407.96, "end": 414.03999999999996, "text": " can basically aggregate the statistics across the batch. Both are not cool. Usually these frameworks"}, {"start": 414.03999999999996, "end": 420.84, "text": " they don't do this synchronization because it's just too slow. So they'll go with the bad statistics."}, {"start": 421.4, "end": 427.4, "text": " And you can see this right here in this graph they have the ImageNet classification error versus"}, {"start": 427.4, "end": 434.03999999999996, "text": " batch sizes. So this is a ResNet 50 model trained on the ImageNet dataset using eight workers. So"}, {"start": 434.04, "end": 443.64000000000004, "text": " eight GPUs and if they do 32 images per and I'll just look at the blue line here if they do 32"}, {"start": 443.64000000000004, "end": 451.72, "text": " images per worker. So it's eight workers it's eight times 32 that's the batch size. That is a"}, {"start": 451.72, "end": 462.36, "text": " large number 256 maybe yeah. All right so if they do that then you can see the error is"}, {"start": 462.36, "end": 469.8, "text": " on a state of the art for a ResNet 50. If they go to 16 it's still pretty good but then as they go"}, {"start": 469.8, "end": 475.48, "text": " lower and lower and lower. So if they go to smaller and smaller batches and spread them out over the"}, {"start": 475.48, "end": 484.36, "text": " workers then the error starts going up and this is because the batch norms statistics get worse and"}, {"start": 484.36, "end": 491.64, "text": " worse. So the goal of this paper is to find this group norm thing here. The group norm they this"}, {"start": 491.64, "end": 498.28, "text": " paper claims is another normalization technique that pretty much does the same thing this centering"}, {"start": 498.28, "end": 506.59999999999997, "text": " and the normalization the scaling but it does it without relying on the batch statistics. It basically"}, {"start": 506.59999999999997, "end": 513.4, "text": " does it within a data point and that means that the performance even though it's a bit smaller at"}, {"start": 513.4, "end": 521.0, "text": " the beginning for this particular example will stay constant with even in small batch size regime."}, {"start": 521.0, "end": 527.64, "text": " So this is potentially applicable as I said to things where you have to go to like two or one"}, {"start": 527.64, "end": 533.32, "text": " sample per worker because it's just the data points the single data points are just too large."}, {"start": 534.44, "end": 544.76, "text": " So if you maybe want to train something like Bert on a on a GPU. So what is group normalization?"}, {"start": 544.76, "end": 550.12, "text": " Group normalization as I said works within a sample now there have been other methods that work"}, {"start": 550.12, "end": 557.24, "text": " within a sample instead of across the batch and they tend to not work as well as batch norm."}, {"start": 557.24, "end": 563.24, "text": " Now this paper here claims that group norm works on par with batch norm for large batch sizes"}, {"start": 563.24, "end": 568.2, "text": " and better than on small batch sizes. So here they have a schematic of what's happening."}, {"start": 569.24, "end": 576.44, "text": " In batch norm as you can see here you have this this cube now this cube here n means the batch size"}, {"start": 576.44, "end": 585.08, "text": " so this are the data points points in your mini batch. This is the thing that is going to get small"}, {"start": 585.96, "end": 592.6, "text": " in the if you don't have enough memory. Then C would be your channels."}, {"start": 594.5200000000001, "end": 602.6800000000001, "text": " So we are talking about convolutional neural networks here but this is generalizable to other"}, {"start": 602.68, "end": 609.3199999999999, "text": " neural networks. The channels are going to be the independent feature maps that you are going to have."}, {"start": 609.3199999999999, "end": 614.04, "text": " So in a convolutional neural network usually each layer has these things called kernels and there"}, {"start": 614.04, "end": 623.0799999999999, "text": " might be three by three matrices like this and if you have an image the kernel will be slided."}, {"start": 623.0799999999999, "end": 629.4799999999999, "text": " This thing right here will be maybe here will be slided across the image or slid is it slid?"}, {"start": 629.48, "end": 634.84, "text": " Okay, will be slid across the image and then the numbers in here will be convolved with the pixels"}, {"start": 634.84, "end": 641.96, "text": " and that will give you the next layers representation. So whatever the convolution operation is"}, {"start": 641.96, "end": 647.5600000000001, "text": " and you'll slide that over and that sliding over will give you the values in the next layer."}, {"start": 647.5600000000001, "end": 655.08, "text": " Now you not only have one kernel but you actually have many kernels. Sorry about this. Let's draw that."}, {"start": 655.08, "end": 668.44, "text": " So you have more and more kernels. You have a whole stack of kernels and how many kernels you have."}, {"start": 668.44, "end": 673.48, "text": " Those are the different kernels are also called your different channels. Now the kernels refer to"}, {"start": 673.48, "end": 679.72, "text": " the weights and the channels refer to the image but the the IF kernel is going to be convolving the"}, {"start": 679.72, "end": 686.6, "text": " IF channel of the image. So at the beginning the input image has three channels because red,"}, {"start": 686.6, "end": 693.08, "text": " green and blue but then the intermediate images can have more channels as you have as basically"}, {"start": 693.08, "end": 700.6, "text": " as many as you have kernels in the layer right before. Okay and the H and the W means the height"}, {"start": 700.6, "end": 707.8000000000001, "text": " and width of the image. So it combined. So the image is kind of unrolled across the height or the width"}, {"start": 707.8, "end": 715.4799999999999, "text": " in this direction. So what does BATCHNORM do? BATCHNORM takes as you can see here one channel"}, {"start": 716.52, "end": 724.76, "text": " and it takes one channel so maybe this image this is one channel. Let's just say this is the red channel"}, {"start": 724.76, "end": 733.8, "text": " because I drawn it in red. It takes that and it calculates the mean one over and the standard"}, {"start": 733.8, "end": 740.68, "text": " deviation of that. It calculates those two statistics and it uses that to do this centering"}, {"start": 740.68, "end": 745.9599999999999, "text": " and scaling operation. So all of these methods are going to calculate the mean and the variance"}, {"start": 745.9599999999999, "end": 751.9599999999999, "text": " and then do the same scaling transformation. The question is just how do you calculate the mean?"}, {"start": 751.9599999999999, "end": 757.3199999999999, "text": " BATCHNORM does this across the data points. So it looks at a single feature at a single channel"}, {"start": 757.32, "end": 765.0, "text": " and it asks what's the mean across all the data points? What are the data statistics of this channel"}, {"start": 765.0, "end": 773.0, "text": " and what was the mean and standard deviation? Now actually BATCHNORM I didn't even know that in"}, {"start": 773.0, "end": 778.0400000000001, "text": " convolutional layer this works like this. You can also imagine BATCHNORM of really just taking one"}, {"start": 778.0400000000001, "end": 785.96, "text": " single feature and that means of really just taking one of these things right here. So if this"}, {"start": 785.96, "end": 792.52, "text": " goes to the back and normalizing across that the important part is that it is in fact normalizing"}, {"start": 792.52, "end": 797.5600000000001, "text": " across the data points. So it looks at your BATCHNORM looks at the mean and the variance in that"}, {"start": 797.5600000000001, "end": 802.6, "text": " batch and it normalizes by that. I think convolutional layers make sense because you have this"}, {"start": 802.6, "end": 809.08, "text": " invariance in height and width and therefore yeah. So that makes sense but in a fully connected layer"}, {"start": 809.08, "end": 816.76, "text": " you'd simply go look at one feature at a time. LayerNORM is different. LayerNORM has been basically"}, {"start": 816.76, "end": 822.36, "text": " been proposed as an alternative to BATCHNORM with the same reasoning that this paper has. So"}, {"start": 822.36, "end": 829.24, "text": " layerNORM as you can see here it does each data point individually. So here we only have one"}, {"start": 829.24, "end": 836.0400000000001, "text": " data point that is normalized by itself. So you do this for each data point independently and"}, {"start": 836.04, "end": 842.04, "text": " therefore it's not dependent on the batch size anymore. But what you'll do is you look across"}, {"start": 842.04, "end": 848.1999999999999, "text": " all of the channels right here. So all of the channels and all of the width and height."}, {"start": 849.16, "end": 856.12, "text": " So this entire thing here this entire thing is basically one channel right and then the next"}, {"start": 856.12, "end": 865.0799999999999, "text": " channel is here of the image and the next no that's the next image. Well that is a bad drawing"}, {"start": 865.08, "end": 870.2, "text": " because the image is unrolled. In any case what you'll do is you'll look at"}, {"start": 872.6800000000001, "end": 877.88, "text": " so if you have a filter bank like this you have an image and the image composed of multiple channels"}, {"start": 877.88, "end": 886.2800000000001, "text": " right. This is the red and then you'll have the green right. This is in the green and then you'll"}, {"start": 886.28, "end": 896.52, "text": " have the blue channel. And what you'll do is simply you'll calculate the mean across all of the"}, {"start": 896.52, "end": 904.36, "text": " pixels and across all of the channels. You just take this whole non-py array and you just say"}, {"start": 904.36, "end": 910.12, "text": " dot mean and that gives you one number. And it's just whatever that number is you subtract it and"}, {"start": 910.12, "end": 915.48, "text": " then you say standard deviation and you divide by that. That's layerNORM. So an entire layers"}, {"start": 915.48, "end": 922.9200000000001, "text": " representation of one image is just normalized to the mean. Now this seems a bit drastic and that's"}, {"start": 922.9200000000001, "end": 930.04, "text": " why instance norm did the exact opposite. They said wait a minute. Instead of normalizing across"}, {"start": 930.04, "end": 936.44, "text": " all of the features right. We'll go back and do what batch norm does. Batch norm looks at each"}, {"start": 936.44, "end": 941.24, "text": " feature individually. So basically it looks at all of these these different axes in the data"}, {"start": 941.24, "end": 946.92, "text": " distribution. It looks at them differently. So if one axis is scaled very widely we want to"}, {"start": 946.92, "end": 954.92, "text": " normalize that differently than if then the other axis that is just scaled very shortly. And that's"}, {"start": 954.92, "end": 961.24, "text": " why we'll look at each feature individually like batch norm. But also we only look at one day to"}, {"start": 961.24, "end": 969.5600000000001, "text": " point at a time. Now as you can imagine this doesn't work anymore in a fully connected network. This"}, {"start": 969.56, "end": 976.1199999999999, "text": " basically works in a convolutional network where you have a feature map channel. So you look at one"}, {"start": 976.1199999999999, "end": 984.52, "text": " individual channel and one data point. So that means here you would normalize the red channel"}, {"start": 984.52, "end": 989.4799999999999, "text": " individually. You would normalize the green channel individually and you normalize the blue"}, {"start": 989.4799999999999, "end": 996.28, "text": " channel individually. So the image you're going to end up with is simply the red channel subtracted"}, {"start": 996.28, "end": 1002.36, "text": " by its own mean and then divided by its own standard deviation. And just within that data point"}, {"start": 1002.36, "end": 1011.64, "text": " right. So maybe I should hear say across the number of features or something. So I hope that"}, {"start": 1011.64, "end": 1018.4399999999999, "text": " that's clear. So the layer norm drops the dependence on the batch size but instead says we should"}, {"start": 1018.4399999999999, "end": 1023.8, "text": " normalize across all of the features. And the instance norm says wait a minute batch norm had a"}, {"start": 1023.8, "end": 1029.56, "text": " good idea normalizing only across the features individually because the individual features might"}, {"start": 1029.56, "end": 1034.28, "text": " have different scales and we should account for that. But also we don't want to be dependent on"}, {"start": 1034.28, "end": 1040.36, "text": " the batch size. And now is this where group norm comes in. Group norm is basically a mix between"}, {"start": 1040.36, "end": 1048.12, "text": " layer norm and instance norm. What group norm says layer norm and instance norm have good ideas."}, {"start": 1048.12, "end": 1056.4399999999998, "text": " They only go across one sample. They take that. They say in essence instance norm has a good idea"}, {"start": 1056.4399999999998, "end": 1062.6799999999998, "text": " in that the features should be normalized individually but it goes sort of too far from"}, {"start": 1063.56, "end": 1069.3999999999999, "text": " it goes too far. You might get not good enough statistics because you're now normalizing each"}, {"start": 1069.3999999999999, "end": 1075.1599999999999, "text": " of these things individually. Whereas with layer norm you're too restricted. You're basically saying"}, {"start": 1075.16, "end": 1083.64, "text": " that the features it's fine if the features relative to each other are like this. One is maybe"}, {"start": 1083.64, "end": 1089.72, "text": " very high variance and one is very low variance. Feature norm would keep that and group norm would say"}, {"start": 1089.72, "end": 1095.64, "text": " maybe that's not it's not so good. We should have we should normalize the individual features maybe"}, {"start": 1096.2, "end": 1103.24, "text": " individually but they'll their argumentation here is that maybe there are some features that"}, {"start": 1103.24, "end": 1109.32, "text": " by their nature already have the same sort of scaling and variance. They give an example."}, {"start": 1109.32, "end": 1115.88, "text": " If you for example have a filter again we deal with convolutional layers here and that filter is a"}, {"start": 1117.32, "end": 1123.8, "text": " let's say an edge filter right so a horizontal edge filter so it's very low value here and let me"}, {"start": 1123.8, "end": 1131.48, "text": " mark the high value with blue. So this is a horizontal edge filter. If you slide this over a window"}, {"start": 1131.48, "end": 1138.1200000000001, "text": " and these are high numbers and these are low numbers it will respond to edges because edges have"}, {"start": 1138.1200000000001, "end": 1144.04, "text": " high low high right or vice versa so it will give you very positive and very negative number"}, {"start": 1144.04, "end": 1151.64, "text": " every time you slide across an edge. Now you can imagine that in natural images that filter whatever"}, {"start": 1151.64, "end": 1158.04, "text": " image you put in would and however you normalize would give you pretty much the same response as a"}, {"start": 1158.04, "end": 1164.76, "text": " vertical edge filter. So the horizontal and the vertical edge filter you you'll see whatever"}, {"start": 1164.76, "end": 1172.28, "text": " their response is they're probably about equal in size. So we could expect that in a neural network"}, {"start": 1172.28, "end": 1179.8799999999999, "text": " there will be groups of filters that together exhibit the same scale and therefore we can"}, {"start": 1180.92, "end": 1186.76, "text": " normalize across them like in layer norm. So the more things we normalize across the better"}, {"start": 1186.76, "end": 1192.44, "text": " statistics we can gather. That's why instance norm doesn't work because it only normalizes across"}, {"start": 1192.44, "end": 1199.96, "text": " a very small thing getting very little statistics but we should normalize if we could gather good"}, {"start": 1199.96, "end": 1206.04, "text": " statistics we should normalize different features differently. And group norm says well since some of"}, {"start": 1206.04, "end": 1212.12, "text": " the features are almost guaranteed to behave the same we could normalize across those. Now of course"}, {"start": 1212.12, "end": 1221.08, "text": " you don't know at the beginning which ones those are. So but you hope that by doing group norm by"}, {"start": 1221.08, "end": 1226.1999999999998, "text": " basically at up-preyory so at the beginning of training you decide what the groups aren't and"}, {"start": 1226.1999999999998, "end": 1231.8799999999999, "text": " naturally it's just whichever ones are next to each other those are the groups and you'll hope"}, {"start": 1231.8799999999999, "end": 1238.1999999999998, "text": " that through the training procedure basically those groups will learn the features that are equal"}, {"start": 1238.2, "end": 1245.56, "text": " of size. Well you basically enforce that so you kind of constrain the architecture to do that."}, {"start": 1246.6000000000001, "end": 1252.28, "text": " So that's the idea behind group norm. You basically build these groups of channels and then you"}, {"start": 1252.28, "end": 1260.1200000000001, "text": " normalize across those across the groups of within the groups of channels across the entire height"}, {"start": 1260.1200000000001, "end": 1267.64, "text": " and width only in a single data point and therefore you gain the advantage of layer norm"}, {"start": 1267.64, "end": 1275.8000000000002, "text": " of normalizing within a single data point. You retain the advantage of batch norm of normalizing"}, {"start": 1275.8000000000002, "end": 1283.3200000000002, "text": " across single features and that's what instance norm attempted but yeah so you get the best of both"}, {"start": 1283.3200000000002, "end": 1292.6000000000001, "text": " worlds sort of that's group norm and now we go and look what it does. So they say okay basically"}, {"start": 1292.6000000000001, "end": 1296.76, "text": " all the normalization techniques do this they subtract a mean and divide by standard deviation that's"}, {"start": 1296.76, "end": 1303.96, "text": " what we saw and the difference is just across what you collect your statistics. So the group norm"}, {"start": 1305.64, "end": 1312.44, "text": " is the following code in TensorFlow as you can see you simply reshape your data and basically expand"}, {"start": 1312.44, "end": 1318.92, "text": " this part right here where you built where you put the extra. So this is C this entire thing used"}, {"start": 1318.92, "end": 1327.0800000000002, "text": " to be C and you divide it into group and index within group and then you just normalize across that"}, {"start": 1328.1200000000001, "end": 1334.8400000000001, "text": " reshape to the original dimension again and the important the cool thing is in batch norm you have to"}, {"start": 1334.8400000000001, "end": 1341.5600000000002, "text": " keep track of these of these running means because at test time you sort of don't want the batch"}, {"start": 1341.5600000000002, "end": 1346.44, "text": " statistic to influence anything you don't have that here you can just back propagate through this"}, {"start": 1346.44, "end": 1352.1200000000001, "text": " observation through this operation and you don't need to keep these running running averages going"}, {"start": 1352.1200000000001, "end": 1357.72, "text": " and you always care are I am I in tests or am I in train mode right now you just do this this"}, {"start": 1357.72, "end": 1369.16, "text": " operation is per data point so it's just part of your model right and they do a an experiment where"}, {"start": 1369.16, "end": 1377.0800000000002, "text": " they have 32 images per GPU so it's reasonably sized and they can basically show that the group norm"}, {"start": 1377.0800000000002, "end": 1384.3600000000001, "text": " and the batch norm they compare in their performance now I do usually don't believe the"}, {"start": 1386.2, "end": 1391.5600000000002, "text": " experiments that you see in single papers but I think this has been replicated a couple of times"}, {"start": 1391.5600000000002, "end": 1396.44, "text": " now you see this is the train error where group norm even behaves a bit better and then in the"}, {"start": 1396.44, "end": 1404.52, "text": " validation error it behaves a bit worse but one could say it is it is kind of more closely together"}, {"start": 1404.52, "end": 1411.0800000000002, "text": " than the other methods are to the group norm or to each other this instance norm and layer norm"}, {"start": 1411.0800000000002, "end": 1418.44, "text": " so it at least it's better than instance norm and layer norm and then once you go into the"}, {"start": 1418.44, "end": 1424.8400000000001, "text": " smaller batch size regime of course that's where the group norm starts to shine so if you go from"}, {"start": 1424.84, "end": 1432.12, "text": " the 32 images per GPU which is this low black curve here all the way to two images per GPU and I"}, {"start": 1432.12, "end": 1437.72, "text": " believe they could even do one image per GPU with group norm but of course you can't do that with"}, {"start": 1437.72, "end": 1444.28, "text": " batch norm because you need batch statistics you can see that the performance of batch norm"}, {"start": 1444.28, "end": 1451.72, "text": " degrades drastically whereas with group norm this experiment is just funny they just have to do"}, {"start": 1451.72, "end": 1458.1200000000001, "text": " they seem to know exactly what turns out so they look at the lines are all exactly in the in the same"}, {"start": 1458.1200000000001, "end": 1465.32, "text": " place I mean come on like you know you're just having time to probably one of the reviewers was like"}, {"start": 1465.32, "end": 1477.72, "text": " what did you really do the experiment they put it in so yeah so you can see that the batch norm beats"}, {"start": 1477.72, "end": 1484.04, "text": " the group norm in this setting with the when you have the larger batch sizes but the group norm pulls"}, {"start": 1484.04, "end": 1491.08, "text": " ahead quite drastically when you have the smaller batch sizes and that is the main advantage so now"}, {"start": 1491.08, "end": 1499.8, "text": " you can turn to models that require small batch sizes or small batch per worker and generally it's"}, {"start": 1499.8, "end": 1507.32, "text": " a pain in the ass to just keep track of those statistics for test time they do verify which I find"}, {"start": 1507.32, "end": 1514.12, "text": " pretty cool that this phenomenon of the responses going apart during training in the internal feature maps"}, {"start": 1515.3999999999999, "end": 1521.72, "text": " batch norm counter acts that so with batch norm you'll get actually a convergence of responses"}, {"start": 1521.72, "end": 1527.3999999999999, "text": " during training so the more you train the more normalized basically your internal features will"}, {"start": 1527.3999999999999, "end": 1534.76, "text": " be and they show that this is exactly the same with group norm so group norm is as it seems it is a"}, {"start": 1534.76, "end": 1541.4, "text": " replacement it's not an addition it doesn't the gains don't come from different place it seems to be"}, {"start": 1542.2, "end": 1549.8, "text": " a substitute for batch norm though they don't have an experiment where they do both I believe"}, {"start": 1549.8, "end": 1557.96, "text": " maybe I'm wrong actually maybe they do but yeah it seems like you just kind of have to bring some"}, {"start": 1557.96, "end": 1563.16, "text": " calmness and some standardization into your signal and how exactly you do that doesn't seem"}, {"start": 1563.16, "end": 1572.0400000000002, "text": " that important as long as you do it with some precision and some some real overall statistics"}, {"start": 1572.92, "end": 1579.24, "text": " yeah what I don't like about this is now you have of course a new hyper parameter which is this"}, {"start": 1579.24, "end": 1587.3200000000002, "text": " number of groups right so that that seems rather annoying and the gains like this usually come"}, {"start": 1587.32, "end": 1595.8, "text": " from the introductions of new hyper parameters and that just it's not so it's not that ideal for a"}, {"start": 1595.8, "end": 1601.0, "text": " method to introduce a new hyper parameter at least layer norm and instance norm didn't and now"}, {"start": 1601.0, "end": 1609.1599999999999, "text": " as you can see the number of groups is is not super influential but does have a bit of an influence"}, {"start": 1609.1599999999999, "end": 1617.0, "text": " on the performance so if you go a number of groups or here a number of channels per group of course"}, {"start": 1617.0, "end": 1621.8, "text": " these two numbers are inversely related the more groups you have the less number of channels per"}, {"start": 1621.8, "end": 1627.56, "text": " group you have if you go to one extreme you will get to the layer norm basically so the layer"}, {"start": 1627.56, "end": 1633.48, "text": " norm is an extreme case of group norm where you just have one group all the channels are in the"}, {"start": 1633.48, "end": 1639.32, "text": " same group then the performance as you can see here is quite a bit worse if you go to the other"}, {"start": 1639.32, "end": 1645.4, "text": " extreme where every channel is its own group that's equivalent to instance norm again the performance"}, {"start": 1645.4, "end": 1654.2800000000002, "text": " is quite bad and somewhere in the middle here with 32 groups it seems to be a good sweet spot so"}, {"start": 1654.8400000000001, "end": 1662.2, "text": " I don't again I don't like the hyper parameter seems to be some somewhat of a thing where you"}, {"start": 1662.2, "end": 1669.48, "text": " really have to hit a good value and well I guess we'll see over time if that value is always going"}, {"start": 1669.48, "end": 1675.8, "text": " to be about the same you know like the beta 2 of Adam it's it's always like people never change"}, {"start": 1675.8, "end": 1683.48, "text": " it from 0.9999 because it just tends to work or whether that's really going to be another hyperparameter"}, {"start": 1683.48, "end": 1691.72, "text": " to fit that seems to be annoying they do a bunch of ablation studies and tests on as we said the"}, {"start": 1691.72, "end": 1699.96, "text": " for example object detection and segmentation so so models where you must go almost to small batch"}, {"start": 1699.96, "end": 1706.1200000000001, "text": " sizes just because so video classification so if you want a class plan entire video that's a lot"}, {"start": 1706.1200000000001, "end": 1713.64, "text": " of data right and you almost have to go small batch sizes for that they do a lot of experiments and"}, {"start": 1713.64, "end": 1720.04, "text": " generally as I said I believe these results in for group norm have been replicated and across the"}, {"start": 1720.04, "end": 1727.96, "text": " community a bunch of times now and I would definitely consider group norm if you are thinking of a"}, {"start": 1728.6, "end": 1734.36, "text": " especially a distributed machine learning project all right with that I hope you enjoyed this"}, {"start": 1734.36, "end": 1740.12, "text": " paper I've been talking for way too long now I wish you and I stay if you haven't already please"}, {"start": 1740.12, "end": 1751.6399999999999, "text": " subscribe like share comment or whatever you feel like doing bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=Cs_j-oNwGgg | Concept Learning with Energy-Based Models (Paper Explained) | This is a hard paper! Energy-functions are typically a mere afterthought in current machine learning. A core function of the Energy - its smoothness - is usually not exploited at inference time. This paper takes a stab at it. Inferring concepts, world states, and attention masks via gradient descent on a learned energy function leads to an interesting framework with many possibilities.
Paper: https://arxiv.org/abs/1811.02486
Blog: https://openai.com/blog/learning-concepts-with-energy-functions/
Videos: https://sites.google.com/site/energyconceptmodels/
Abstract:
Many hallmarks of human intelligence, such as generalizing from limited experience, abstract reasoning and planning, analogical reasoning, creative problem solving, and capacity for language require the ability to consolidate experience into concepts, which act as basic building blocks of understanding and reasoning. We present a framework that defines a concept by an energy function over events in the environment, as well as an attention mask over entities participating in the event. Given few demonstration events, our method uses inference-time optimization procedure to generate events involving similar concepts or identify entities involved in the concept. We evaluate our framework on learning visual, quantitative, relational, temporal concepts from demonstration events in an unsupervised manner. Our approach is able to successfully generate and identify concepts in a few-shot setting and resulting learned concepts can be reused across environments. Example videos of our results are available at this http URL
Authors: Igor Mordatch
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. What you're seeing here is an energy-based model that learns the concept of a shape from a demonstration on the left. So on the left you can see a demonstration of data point sampled from a shape in these cases circles or squares. And then the corresponding energy function that the model infers from that. And then it can replicate that shape on the right using that energy function. So the paper we're going to analyze today is called concept learning with energy-based models by Igor Mordach of OpenAI. And this is a very cool paper, or at least I think it's a very cool paper, but it is also a very hard paper. So therefore, first I want to kind of make a bit of an introduction into the concepts that we are facing in this paper. So the first thing you need to know are energy functions or energy-based models. What is an energy function? An energy function, sometimes called E, is simply a function with one or multiple inputs. Let's call them X. And you can make the, if the energy function is happy with X, it will be the value zero. And if the energy function is not happy with X, it will be a high value, like larger than zero. So this is happy. This is not happy. So let's give some examples of this. We can formulate almost any machine learning problem in terms of an energy function. Let's say we have a classifier. The classifier is, takes as an input, an image here, maybe of a cat, and a label. So if the label is cat, then the energy will be zero. If the energy function is, of course, working correctly. And if we give the energy function the same image, but we give it a wrong label, dog, then it is very high. In the case of the classifier, of course, we can simply take the loss function as the energy function. And we automatically get an energy based model. So the loss function here would be something like the negative log probability of the, sorry, if the correct class. But in any case, it is just going to be a high number. Let's call it 10 to the 9. So the energy function says, Ha, this is very bad. This thing here is very bad. The entire thing you input. It won't tell you yet what's bad about it. So that also means you can change any of the two things to make the classifier happy. Now usually we're concerned with changing the label. It's like, tell me which other label do I need to input to make you happy. And if we make the labels differentiable, of course, we never input the true label. We actually input like a distribution, softmax distribution over labels. And that's a differentiable. We can use gradient descent to update the dog label. We can use gradient descent to find a label that would make the energy function more happy. So we could use gradient descent to get the cat level if we had a good classifier. But we can also optimize the image to make it compatible with the dog label. That's things that if you ever saw deep dream or something like this, those models do exactly that. They optimize the input image for a particular label. And there you can view the entire neural network, including the loss function as the energy function. So what's another example? Another example is let's say you have a k-means model. And the energy function simply input a data point. And for the data point, what you're going to do is you're going to find the min cluster index, the min k over, you know, you have your multiple clusters here and your data point might be here. So you're going to find the cluster that's closest. And then the distance here, this distance d will be the energy of that. So the bottle is very happy when your data point comes from one of the clusters, but your model is not happy when the data point is far away. And that would be the cost function of the k-means function. So that's an energy based model too. Now currently energy based models have come into fashion through things like GANs or any sort of noise contrastive estimation. So in a GAN, what you have is you have a discriminator. And the discriminator will basically learn a function to differentiate data from non-data. So that by itself is an energy function. So the discriminator will learn a function and that function will be low wherever the discriminator thinks there is data. So it will usually do this around the data point. So the data points form the values right here. And then the generator will basically take that discriminator function and will try to infer points that are also in these values to produce points that are also in the values. And then you basically have an energy learning competition. The discriminator now tries to push down on the energy where the true data is and push up on the energy where the generated data is. And that will give you basically a steeper energy based function in the future. I hope so in this case the discriminator neural network is the energy function. And the degenerator just tries to produce data that is compatible with that energy function. So I hope that concept of what an energy function is a bit clear. Any again any machine learning problem can be formulated in terms of an energy function. Now what is not done so far is what we alluded to a little bit before in the classifier example. And also here. So right now when we want to train again we simply take the generator to produce data. Now what's the generator school? The generator school is to hit those values in the energy function. And we produce a generator into in one shot produce this data. But we could also do is of course we could just start somewhere. Let's say here we pick a random data point and then we use gradient descent because the energy function in this case is smooth. We use gradient descent to just drop down this valley and then find ourselves in this valley. So without ever training a generator we can use this methods to produce points that are in the valley of the energy function. And this I don't know if people I guess people have trained guns like this. The reason why it doesn't work let's say in the real world is because that procedure will just produce adversarial examples for the discriminator. And those usually look like nothing like data because if you keep the discriminator just stable and gradient descent against it what you'll get isn't really qualitatively good. But in principle if the discriminator was a good energy function for the data to describe the data we could use gradient descent the same up here in order to find a good label for an image given that we have a good energy function. So this is that we could simply gradient descent on the label in order to find a better in order to find a better label. So in this paper we're going to have a situation where we say we're given an energy function and we're given a bunch of inputs they are then called x a and w. And if I have my energy function already if I have given my energy function and I have given two of those three things any two right I can infer the last thing simply by gradient descent on my energy function because I know the energy function is zero when all of these when the energy function is happy with the input. So when all of these things agree basically the energy function is happy it will output zero otherwise it will output a high value. Therefore if I've given any of those two of any two of those three things I can find a compatible third thing by descending. And then of course over here in this machine learning problems the task was always actually to learn an energy function right so usually in the training dates that we are given images and labels and we want to learn this energy function which would be parameterized so we want to learn the parameters and the same here in our general case if we are now given three things but we are not given the parameters of the energy function we don't know what those are as long as we are given all of the inputs and our training date to set and our training date to set guarantees these are actually you know these are inputs that are compatible with each other the energy function should be low we can simply gradient descent on the parameters of the energy function. So in a sense there are four things right there are these three inputs and then there are the parameters of the energy function if we are given any three of those four we can gradient descent on the rest. And that's going to be the basis so the X here is going to be the so called state and the state in this paper is going to be images of entities. So the entities sorry it's not going to be images but the entities are these little circles that you're going to see and each of those entities can have an X position a Y position and I believe a color so R, G and B. So each of those can have that and then the concatenation of all of those attributes is one big vector and that is your X that's your state. So state is number of entities and their attributes a is going to be an attention mask over the state so a is going to be. Here you have four entities so a will have four entries telling you which of these entities you should pay attention to right now. And W is going to be a concept vector so called so W is going to be the embedding of a concept now what a concept is in this case is very general. I can give you an example one concept is do any of do the entities that the a pays attention to are they close to each other so in this case you see we have two entities that a has a high value on and this is this ball up here and this ball down here. Now if the concept vector is the embedding for the concept of being close to each other then the energy function would be very happy if those two things are close to each other and it would be very unhappy if those two things aren't close to each other. But in the very same situations of the same X the same attention mask but a different concept so a different W vector right here then the the energy function would be maybe very happy if the two things are for a part and maybe unhappy if the two things are close. So the question is always how are the three things that you put into the energy function compatible with each other and given all but one of these things you can infer the other. So let's say you have a perfect energy function for this this all of the for the situation you're just given the energy function you can trust it and you are given let's make an example you are given the X you're given the state I'm going to draw the state down here right. Okay this is the state and you're given the W and the W is the embedding it's a vector but the embedding space but the embedding is for a line right so the the geometric the geometric unit of a line. Now your task is to find a the attention mask that will make the energy function happy and as you can see right here what you would do is you would put a lot of weight on this this this and this ball and no weight on that ball because those make a line. And since everything here is differentiable so the state is differentiable the attention is differentiable and the concept or vectors they're differentiable you can use gradient descent to find that another example if you're given again the same W so line and you are given this following thing and you are given now you're given the attention. On these three and you say please find the X please find the X the states that makes this energy function happy now this here you would call the starting state the X zero your your task is going to be find the X one find the state how do you have to change this state such that the energy function is happy and of course the answer is going to be is to push this ball here inward until it is in the middle of the two others. So the three form a line right these three formal line you you don't you don't have to do anything to this ball up here because there is no attention on it and the attention it's only is the concept for the things that you put attention on and the state are those three in agreement then the energy function is happy. Okay we have covered the basics now let's dive into the paper I think this is the longest introduction ever but I think it will pay off on CC so they they specifically or this this author I think the single author identifies two different things that you can do with an energy function here of course you can do more as we saw but they they identified to. So here is where you have given the initial state and the attention mask and you want to find the X one the state that satisfies the concept and attention the most this the author calls generation as you can see here these four things that you have the attention on our push the round until they make a square because the concept right now is square and in the other case where you are given this X zero and X one just call this X right here just call this thing X if you're given those two and you are given the concept square and your task with finding a the attention mask of course you're going to put the attention on these right here. And that is going to happen through gradient descent again we're not learning a model to give you that attention like in again we're learning a generator to just one shot give it to you right now what we're going to do is we're going to gradient descent optimize on our smooth energy function to give us that perfect attention mask that satisfies the energy function. Alright so this is the difference right here gradient descent is part of the output procedure of the model usually we just use it to learn and we learn a one shot model but here gradient descent is part of the model. So they introduce energy functions here and they say okay we can have a policy on X so if we're given a concept w and if we're given an a we can have a policy over X which basically means we can find X's that are compatible with that by running gradient descent here you see there is an X K minus one and we are running gradient descent. On the energy function with respect to X to find a better X that satisfies the energy function given those inputs and the same if we want to find an attention mask we are running gradient descent on the attention mask again in order to satisfy the same energy function. So you see the inputs are both times the same the concept here we can input square here we can input square but the difference is what we're running gradient descent on and what we keep constant and I would get I would add a third line here actually because we can also if we're given an X and an a we can also infer a w and that's going to be an integral part so if I have this right here and this situation and I have say I have attention on these four now I can ask the model so I'm given X and I'm given a I can ask the model to infer w and the model should ideally output this is square now the model isn't going to output square the model is going to output a vector representation of square right so the model is going to output square but as a vector of numbers because that's how we've trained it w is an embedding but what we can then do later is we can say okay I'm not going to tell you it's a square you just come up with a vector w to describe this situation and now I'm going to take that vector w that you came up with miss miss or miss this model and I'm going to take tell you a new situation this situation right here and I'm going to now give you X and I'm going to give you the w that you yourself have output and now please tell me what's the a and then the model is of course supposed to tell you all these four here or the a so without without ever telling that it should be a square what you can do is you can let the model infer a w from one example situation and then transfer that w to a new situation so it can identify you can just say whatever concept I have up here please apply that same concept which is the w down here and this is the entire paper now this is the concept learning through energy based models okay so that is kind of a third line I would add down here you can infer a concept vector if you're given the X and the a so in order to do all this their energy function is going to be a so called relational neural network so what you'll have is you'll have a simple neural network a multi layer perceptron that always connects to entities to each other with the concept vector and then this is a I believe a sigmoid that connects the attention masks of the two and you simply sum over all pairs of two entries in your model and then you send that through an MLP sorry through an MLP again this I believe is not so important it's just important that they can feed this entire situation the X the a and the w they can basically feed into a neural network and the neural network comes up with a number of how well those three things fit together and then you can transfer these concepts that's pretty cool now the only question is of course we've always said we're given an energy function we're just we just have it but of course this is a neural network and the neural network has parameters and the parameters we don't know what good parameters are at the beginning so we need to train this thing and again the reason why these are toy problems right here is I mean we'll get to why it's computation but this is kind of a new field I believe in machine learning at least I come from classical machine learning and we only ever have used like SGD to train and we only have have produced models that one shot produce something and here we this is a I believe this is a new concept where you just grade in descent as part of the output and that makes a lot of trouble so that's why we work in toy problems so what this this here is a situation I described you have a demo event where you're given the X and the a and you're supposed to infer the w so the question here is what's the w and the model will come up with a w and you're not going to do anything you know right now you're simply going to take that w and tell it oh well here is a so called test event so please apply the w you came up with in this test event and please find me the the a in this case that satisfies the w and the x I give you here and of course the a right here is as you can see even you don't know that it's a square and the actual concept here is move the gray ball to the middle of the square right that that is it here but no one has told me this I just looked at the picture so the the correct answer here would be to place attention on those four things and then to take this thing and move it to the middle right here in the in this over here so that would be the correct answer now the question is how do you train something like this and they show that they so this is the loss function right here the loss function is they give you a concept and the initial situation and you're supposed to infer the x1 and the a and the loss function simply the negative log likelihood of that but what does that mean so we'll make it easier if if you have this this procedure right here where you have a demo event this appeared this is demo and this is a test event how are you going this entire procedure how are you going to learn the energy function well in this case this entire procedure this entire thing is one training sample sample but usually we have input and label and now here it's much more complicated because so we have input okay that's this x and this a cool but then we have sgd as integral part of the procedure to determine the w and now what we could do is just apply a loss to the w but we don't because we don't know what the embedding space for the concepts is we could maybe train a classifier but in this case we want to train the ability to transfer these concepts so our training sample needs to be one time transferring a concept so sgd for one is part of our process here and not only that but then this this x here of course is also part of our training sample right this appears x0 and this here is x1 and now we need to find this a this attention mask and that is an sgd again remember inferring anything through the energy function is a gradient descent process so ultimately our one training example consists of x0 a at the beginning so let's call that a zero it consists of the sgd procedure to find w it consists of x1 and it consists of the sgd procedure to find a the a1 the output a and then that will give us the output a the a1 so this here is our input in the classical machine and this would be our x and this here would be our label y and that's what we train on we train so such that the output right here the a this is of course sorry this is of course the y hat this is what we predict and in the training sample which is right a little generator that will you know make this situation that knows what the concept is it will say okay I'm going to make an example for a square then it make this will make the attention mask for a square and then it will make the new situation again with a square but not tell us the attention mask there and it will make the attention mask into the true y so at the end we can compare what our model output the attention mask we output here without ever knowing that this should be a square and we have the true label which comes out of the generator that at the beginning decided that it should be a square and then the loss the distance between those two that's our loss this is an enormous procedure to get a loss and most crucially you have to back propagate through optimization procedures and this is something that we just can't do yet in our models if you take an image a resonant 50 right right now we do one forward propagation to get a label in this procedure if you had to back propagate through the optimization procedure for each sample you would need to basically back propagate through 50 forward passes of the resonant if you if your optimization procedure is 50 steps long and that is just not feasible right now so that's why we don't do it but I believe maybe once we find a smart way of dropping through optimization procedures a whole lot of these things will become the new a new wave and machine learning I'm excited by this I'm pretty sure it doesn't work yet and this is very fairly fairly work but I'm excited by the prospect that we can do this so this is the training procedure right you were given X zero X1 and a and you optimize in order to infer the concept behind it right the model that your level generator of your training data it knows the concept it has a concept in mind when it generated this but you're not telling your model what the concept is it needs to infer that and then using the model the thing that the model inferred you can either give it X zero and X one and infer a or you can give it the X and the A and infer X you can do either of those right these are called identification or generation respectively and then you compare the output here to what the generator at the beginning thought again it's not telling you it's that's because that's the label and you compare this to that and that will be your loss to train your energy function parameters so your training samples if you think of this entire thing as one forward pass of the model then it's just classic machine learning right you have a training sample which is one forward pass and you have a corresponding label that you infer so let's jump to the experiments right here experiments are actually pretty cool so what they've done is for example take in the concept of being far apart from something now being far apart so that the little X needs to be as far away as possible from the ball that has the function on it right so if you do generation and you start the little X right here and you ask the model where please infer the next state of the world it will push that little X away right here and in color you can see the energy function values of the position of the X so it pushes it away from this thing but if you take the same concept embedding the concept embedding of being far away but you don't do generation you do identification means you infer the A then it will simply tell you that this ball right here is the furthest away from the X right so you can do all sorts of things like this and transferring concepts I find this here pretty interesting so they have two different concepts one concept is red as an identification you need to identify the red ball but the other concept is you need to turn something red right you need to take a ball that is maybe not blue and of course the color you can gradient descent on the colors you need to make it red and since the energy takes three input X a and W it doesn't you you're not going to tell it right now in which situation you are it has to create create this W embedding space through learning and if you do it with those two concepts then it will create the make something red concept and the is something red concepts in the same places this is a PCA and in blue I think these blue is the attention codes for identify the red things and in red or the generation code for make something red and they will be put in the same place which is pretty cool it means that the energy function really learns the feature of something being red I find this pretty pretty neat and then here they have some experiments where they basically show we need that gradient descent optimization procedure because only after many steps will will the energy function basically be aligned with the concept that you want so if you have a zero shot model like just one forward pass as we do here you'll see that the energy function that is supposed to make a circle from samples right this is the example concept right here it if you just have a one shot model it will it cannot or in this case at least it doesn't learn to one shot produce only if you optimize for a few steps will it get this so you optimize at inference time and that seems to be very important you can see again here demonstrations of this so the example is this and then the model as you can see after 20 steps learn optimizes the points to go to these locations whereas after only one step it didn't do that yet so there are complex things at work here and this column here is where you don't have a relational neural network so you can't basically capture dependencies between things so you you have no chance of making a square because you don't know where the things are in relation to each other but that's more of an engineering question their point is basically that if you have models that do optimization at inference time they are much more powerful than models that just do a one shot forward pass it's sort of like an auto regressive model in NLP versus a non-order regressive model that produces all words at once if you produce all words of a sentence at once no word can depend on any other word and you can just produce independent things which will make the sentence often not make any sense they also have this KL objective which is a regularizer which I believe that's just a trial and error they built it in because but it is a regularizer I don't want to really go into that and then they do demonstration in and they reenact it on a robot the demonstration here is that there is a situation where two things have attention on and you're supposed to move something into the middle of the two things so that's the content you don't tell the robot the concept it needs to learn that from data and then infer that this is the concept that you want and then transfer that to the other environment now you know this it look you know there's this robot environment but ultimately they still encode the positions of these things and the position of that and really all you have to do different here is that instead of moving this actuator directly you need to like calculate what you need to do to the individual joints in the robot so I think this is maybe because it's open AI and it needs to you know look robot and stuff but the problem here is not really different it's it's not even it's not real world transfer or anything so yeah let's let go through some of the things they can learn with this so you can see here they can learn these regional geometric shapes and so on the left is the example event that the model needs to take the concept from now this is this is I believe very much identification so what they did is they trained with a dataset where all of these appear right so there are squares there are lines there are circles so this is maybe my criticism here that it is not so much to generally infer a concept it is more like identify the concept so the model basically just needs to decide is this line is this circle or is this square because that's was those things were in the training dataset it would be nice to see how this generalize is to general concepts or if we can even make that if we can have a zero shot concept inference and then transfer those concepts to other things maybe that's already happening I don't I don't know so here the spatial arrangement is to either be close to something or to be between two things so if the attention is on two things you want in between so you see the top ones are the demonstrations and needs to recognize the concept and it needs to basically optimize to fulfill that concept shapes so to make shapes is oh yeah there's a triangle right again this this this this very much I believe relies on recognition and not actual understanding of what a triangle is here you have proximity being closer being far apart what else is cool oh yeah if the recognition for the same task right you need to identify the ball that is closer for and here you really also see the optimization procedure in action where for example at the beginning of each flicker you can of see the attention being everywhere and then stabilizing to one or two points so if two points are equally closer for a part you'll see the attention being on multiple points which is pretty cool right so that means the model really learns this this this concept here's the count quantity so you can either have one two or larger than three or something yeah that seems like they tried three and four and didn't work so they just said we'll just do larger than three and here is this robot thing where it also always needs to move in between now this this is the part that I'm not really impressed with but you know whatever whatever you want okay I hope this was a good introduction to energy functions what you can do with them what I think of them and of this paper it is a pretty cool paper yes it only works on toy problems so far but I believe this is one interesting direction of future machine learning and something yet to be very much explored if you like this content please subscribe tell all of your friends about it share and I'll see you next time bye bye | [{"start": 0.0, "end": 8.0, "text": " Hi there. What you're seeing here is an energy-based model that learns the concept of a shape"}, {"start": 8.0, "end": 14.0, "text": " from a demonstration on the left. So on the left you can see a demonstration of data point"}, {"start": 14.0, "end": 21.0, "text": " sampled from a shape in these cases circles or squares. And then the corresponding energy"}, {"start": 21.0, "end": 27.0, "text": " function that the model infers from that. And then it can replicate that shape on the"}, {"start": 27.0, "end": 33.0, "text": " right using that energy function. So the paper we're going to analyze today is called concept"}, {"start": 33.0, "end": 40.0, "text": " learning with energy-based models by Igor Mordach of OpenAI. And this is a very cool paper,"}, {"start": 40.0, "end": 47.0, "text": " or at least I think it's a very cool paper, but it is also a very hard paper. So therefore,"}, {"start": 47.0, "end": 55.0, "text": " first I want to kind of make a bit of an introduction into the concepts that we are facing in this paper."}, {"start": 55.0, "end": 60.0, "text": " So the first thing you need to know are energy functions or energy-based models."}, {"start": 60.0, "end": 67.0, "text": " What is an energy function? An energy function, sometimes called E, is simply a function with"}, {"start": 67.0, "end": 74.0, "text": " one or multiple inputs. Let's call them X. And you can make the, if the energy function is happy"}, {"start": 74.0, "end": 82.0, "text": " with X, it will be the value zero. And if the energy function is not happy with X,"}, {"start": 82.0, "end": 90.0, "text": " it will be a high value, like larger than zero. So this is happy. This is not happy."}, {"start": 90.0, "end": 97.0, "text": " So let's give some examples of this. We can formulate almost any machine learning problem in terms of an"}, {"start": 97.0, "end": 106.0, "text": " energy function. Let's say we have a classifier. The classifier is, takes as an input,"}, {"start": 106.0, "end": 117.0, "text": " an image here, maybe of a cat, and a label. So if the label is cat, then the energy will be zero."}, {"start": 117.0, "end": 124.0, "text": " If the energy function is, of course, working correctly. And if we give the energy function the same"}, {"start": 124.0, "end": 132.0, "text": " image, but we give it a wrong label, dog, then it is very high. In the case of the classifier,"}, {"start": 132.0, "end": 139.0, "text": " of course, we can simply take the loss function as the energy function. And we automatically"}, {"start": 139.0, "end": 145.0, "text": " get an energy based model. So the loss function here would be something like the negative log"}, {"start": 145.0, "end": 153.0, "text": " probability of the, sorry, if the correct class. But in any case, it is just going to be a high"}, {"start": 153.0, "end": 160.0, "text": " number. Let's call it 10 to the 9. So the energy function says, Ha, this is very bad."}, {"start": 160.0, "end": 167.0, "text": " This thing here is very bad. The entire thing you input. It won't tell you yet what's bad about it."}, {"start": 167.0, "end": 174.0, "text": " So that also means you can change any of the two things to make the classifier happy. Now usually we're"}, {"start": 174.0, "end": 180.0, "text": " concerned with changing the label. It's like, tell me which other label do I need to input to make you happy."}, {"start": 180.0, "end": 188.0, "text": " And if we make the labels differentiable, of course, we never input the true label. We actually input like a"}, {"start": 188.0, "end": 195.0, "text": " distribution, softmax distribution over labels. And that's a differentiable. We can use gradient descent"}, {"start": 195.0, "end": 202.0, "text": " to update the dog label. We can use gradient descent to find a label that would make the energy"}, {"start": 202.0, "end": 211.0, "text": " function more happy. So we could use gradient descent to get the cat level if we had a good classifier."}, {"start": 211.0, "end": 222.0, "text": " But we can also optimize the image to make it compatible with the dog label. That's things that if you ever"}, {"start": 222.0, "end": 230.0, "text": " saw deep dream or something like this, those models do exactly that. They optimize the input image for a particular"}, {"start": 230.0, "end": 237.0, "text": " label. And there you can view the entire neural network, including the loss function as the energy function."}, {"start": 237.0, "end": 246.0, "text": " So what's another example? Another example is let's say you have a k-means model. And the energy function"}, {"start": 246.0, "end": 254.0, "text": " simply input a data point. And for the data point, what you're going to do is you're going to find the"}, {"start": 254.0, "end": 261.0, "text": " min cluster index, the min k over, you know, you have your multiple clusters here and your data"}, {"start": 261.0, "end": 267.0, "text": " point might be here. So you're going to find the cluster that's closest. And then the distance here, this distance"}, {"start": 267.0, "end": 276.0, "text": " d will be the energy of that. So the bottle is very happy when your data point comes from one of the"}, {"start": 276.0, "end": 281.0, "text": " clusters, but your model is not happy when the data point is far away. And that would be the cost function"}, {"start": 281.0, "end": 288.0, "text": " of the k-means function. So that's an energy based model too. Now currently energy based models have come into"}, {"start": 288.0, "end": 298.0, "text": " fashion through things like GANs or any sort of noise contrastive estimation. So in a GAN, what you have is you"}, {"start": 298.0, "end": 306.0, "text": " have a discriminator. And the discriminator will basically learn a function to differentiate data from"}, {"start": 306.0, "end": 313.0, "text": " non-data. So that by itself is an energy function. So the discriminator will learn a function and that"}, {"start": 313.0, "end": 321.0, "text": " function will be low wherever the discriminator thinks there is data. So it will usually do this around the"}, {"start": 321.0, "end": 328.0, "text": " data point. So the data points form the values right here. And then the generator will basically take that"}, {"start": 328.0, "end": 336.0, "text": " discriminator function and will try to infer points that are also in these values to produce points that are"}, {"start": 336.0, "end": 345.0, "text": " also in the values. And then you basically have an energy learning competition. The discriminator now tries to"}, {"start": 345.0, "end": 353.0, "text": " push down on the energy where the true data is and push up on the energy where the generated data is. And that"}, {"start": 353.0, "end": 364.0, "text": " will give you basically a steeper energy based function in the future. I hope so in this case the discriminator"}, {"start": 364.0, "end": 373.0, "text": " neural network is the energy function. And the degenerator just tries to produce data that is compatible with that"}, {"start": 373.0, "end": 381.0, "text": " energy function. So I hope that concept of what an energy function is a bit clear. Any again any machine learning"}, {"start": 381.0, "end": 388.0, "text": " problem can be formulated in terms of an energy function. Now what is not done so far is what we alluded to a"}, {"start": 388.0, "end": 400.0, "text": " little bit before in the classifier example. And also here. So right now when we want to train again we simply take the"}, {"start": 400.0, "end": 407.0, "text": " generator to produce data. Now what's the generator school? The generator school is to hit those values in the energy"}, {"start": 407.0, "end": 415.0, "text": " function. And we produce a generator into in one shot produce this data. But we could also do is of course we"}, {"start": 415.0, "end": 422.0, "text": " could just start somewhere. Let's say here we pick a random data point and then we use gradient descent because the"}, {"start": 422.0, "end": 429.0, "text": " energy function in this case is smooth. We use gradient descent to just drop down this valley and then find"}, {"start": 429.0, "end": 438.0, "text": " ourselves in this valley. So without ever training a generator we can use this methods to produce points that are in"}, {"start": 438.0, "end": 447.0, "text": " the valley of the energy function. And this I don't know if people I guess people have trained guns like this. The reason why it"}, {"start": 447.0, "end": 454.0, "text": " doesn't work let's say in the real world is because that procedure will just produce adversarial examples for the"}, {"start": 454.0, "end": 462.0, "text": " discriminator. And those usually look like nothing like data because if you keep the discriminator just stable and gradient descent"}, {"start": 462.0, "end": 472.0, "text": " against it what you'll get isn't really qualitatively good. But in principle if the discriminator was a good energy"}, {"start": 472.0, "end": 480.0, "text": " function for the data to describe the data we could use gradient descent the same up here in order to find a good"}, {"start": 480.0, "end": 490.0, "text": " label for an image given that we have a good energy function. So this is that we could simply gradient descent on the"}, {"start": 490.0, "end": 499.0, "text": " label in order to find a better in order to find a better label. So in this paper we're going to have a"}, {"start": 499.0, "end": 508.0, "text": " situation where we say we're given an energy function and we're given a bunch of inputs they are then called"}, {"start": 508.0, "end": 520.0, "text": " x a and w. And if I have my energy function already if I have given my energy function and I have given two of those"}, {"start": 520.0, "end": 532.0, "text": " three things any two right I can infer the last thing simply by gradient descent on my energy function because I know the"}, {"start": 532.0, "end": 542.0, "text": " energy function is zero when all of these when the energy function is happy with the input. So when all of these things agree"}, {"start": 542.0, "end": 548.0, "text": " basically the energy function is happy it will output zero otherwise it will output a high value. Therefore if I've given"}, {"start": 548.0, "end": 559.0, "text": " any of those two of any two of those three things I can find a compatible third thing by descending. And then of course over"}, {"start": 559.0, "end": 567.0, "text": " here in this machine learning problems the task was always actually to learn an energy function right so usually in the training dates"}, {"start": 567.0, "end": 575.0, "text": " that we are given images and labels and we want to learn this energy function which would be parameterized so we want to learn the"}, {"start": 575.0, "end": 584.0, "text": " parameters and the same here in our general case if we are now given three things but we are not given the parameters of the"}, {"start": 584.0, "end": 594.0, "text": " energy function we don't know what those are as long as we are given all of the inputs and our training date to set and our training date to set guarantees these are"}, {"start": 594.0, "end": 600.0, "text": " actually you know these are inputs that are compatible with each other the energy function should be low we can simply"}, {"start": 600.0, "end": 609.0, "text": " gradient descent on the parameters of the energy function. So in a sense there are four things right there are these three inputs"}, {"start": 609.0, "end": 618.0, "text": " and then there are the parameters of the energy function if we are given any three of those four we can gradient descent on the rest."}, {"start": 618.0, "end": 632.0, "text": " And that's going to be the basis so the X here is going to be the so called state and the state in this paper is going to be images of entities."}, {"start": 632.0, "end": 648.0, "text": " So the entities sorry it's not going to be images but the entities are these little circles that you're going to see and each of those entities can have an X position a Y position and I believe a color so R, G and B."}, {"start": 648.0, "end": 658.0, "text": " So each of those can have that and then the concatenation of all of those attributes is one big vector and that is your X that's your state."}, {"start": 658.0, "end": 670.0, "text": " So state is number of entities and their attributes a is going to be an attention mask over the state so a is going to be."}, {"start": 670.0, "end": 682.0, "text": " Here you have four entities so a will have four entries telling you which of these entities you should pay attention to right now."}, {"start": 682.0, "end": 698.0, "text": " And W is going to be a concept vector so called so W is going to be the embedding of a concept now what a concept is in this case is very general."}, {"start": 698.0, "end": 721.0, "text": " I can give you an example one concept is do any of do the entities that the a pays attention to are they close to each other so in this case you see we have two entities that a has a high value on and this is this ball up here and this ball down here."}, {"start": 721.0, "end": 741.0, "text": " Now if the concept vector is the embedding for the concept of being close to each other then the energy function would be very happy if those two things are close to each other and it would be very unhappy if those two things aren't close to each other."}, {"start": 741.0, "end": 759.0, "text": " But in the very same situations of the same X the same attention mask but a different concept so a different W vector right here then the the energy function would be maybe very happy if the two things are for a part and maybe unhappy if the two things are close."}, {"start": 759.0, "end": 774.0, "text": " So the question is always how are the three things that you put into the energy function compatible with each other and given all but one of these things you can infer the other."}, {"start": 774.0, "end": 795.0, "text": " So let's say you have a perfect energy function for this this all of the for the situation you're just given the energy function you can trust it and you are given let's make an example you are given the X you're given the state I'm going to draw the state down here right."}, {"start": 795.0, "end": 819.0, "text": " Okay this is the state and you're given the W and the W is the embedding it's a vector but the embedding space but the embedding is for a line right so the the geometric the geometric unit of a line."}, {"start": 819.0, "end": 838.0, "text": " Now your task is to find a the attention mask that will make the energy function happy and as you can see right here what you would do is you would put a lot of weight on this this this and this ball and no weight on that ball because those make a line."}, {"start": 838.0, "end": 865.0, "text": " And since everything here is differentiable so the state is differentiable the attention is differentiable and the concept or vectors they're differentiable you can use gradient descent to find that another example if you're given again the same W so line and you are given this following thing and you are given now you're given the attention."}, {"start": 865.0, "end": 894.0, "text": " On these three and you say please find the X please find the X the states that makes this energy function happy now this here you would call the starting state the X zero your your task is going to be find the X one find the state how do you have to change this state such that the energy function is happy and of course the answer is going to be is to push this ball here inward until it is in the middle of the two others."}, {"start": 894.0, "end": 915.0, "text": " So the three form a line right these three formal line you you don't you don't have to do anything to this ball up here because there is no attention on it and the attention it's only is the concept for the things that you put attention on and the state are those three in agreement then the energy function is happy."}, {"start": 915.0, "end": 944.0, "text": " Okay we have covered the basics now let's dive into the paper I think this is the longest introduction ever but I think it will pay off on CC so they they specifically or this this author I think the single author identifies two different things that you can do with an energy function here of course you can do more as we saw but"}, {"start": 944.0, "end": 972.0, "text": " they they identified to. So here is where you have given the initial state and the attention mask and you want to find the X one the state that satisfies the concept and attention the most this the author calls generation as you can see here these four things that you have the attention on our push the round until they make a square because the concept right now is square"}, {"start": 972.0, "end": 998.0, "text": " and in the other case where you are given this X zero and X one just call this X right here just call this thing X if you're given those two and you are given the concept square and your task with finding a the attention mask of course you're going to put the attention on these right here."}, {"start": 998.0, "end": 1020.0, "text": " And that is going to happen through gradient descent again we're not learning a model to give you that attention like in again we're learning a generator to just one shot give it to you right now what we're going to do is we're going to gradient descent optimize on our smooth energy function to give us that perfect attention mask that satisfies the energy function."}, {"start": 1020.0, "end": 1035.0, "text": " Alright so this is the difference right here gradient descent is part of the output procedure of the model usually we just use it to learn and we learn a one shot model but here gradient descent is part of the model."}, {"start": 1035.0, "end": 1062.0, "text": " So they introduce energy functions here and they say okay we can have a policy on X so if we're given a concept w and if we're given an a we can have a policy over X which basically means we can find X's that are compatible with that by running gradient descent here you see there is an X K minus one and we are running gradient descent."}, {"start": 1062.0, "end": 1087.0, "text": " On the energy function with respect to X to find a better X that satisfies the energy function given those inputs and the same if we want to find an attention mask we are running gradient descent on the attention mask again in order to satisfy the same energy function."}, {"start": 1087.0, "end": 1116.0, "text": " So you see the inputs are both times the same the concept here we can input square here we can input square but the difference is what we're running gradient descent on and what we keep constant and I would get I would add a third line here actually because we can also if we're given an X and an a we can also infer a w and that's going to be an integral part so if I have"}, {"start": 1116.0, "end": 1136.0, "text": " this right here and this situation and I have say I have attention on these four now I can ask the model so I'm given X and I'm given a I can ask the model to infer w"}, {"start": 1136.0, "end": 1165.0, "text": " and the model should ideally output this is square now the model isn't going to output square the model is going to output a vector representation of square right so the model is going to output square but as a vector of numbers because that's how we've trained it w is an embedding but what we can then do later is we can say okay I'm not going to tell you it's a square you just come up with a vector w"}, {"start": 1165.0, "end": 1181.0, "text": " to describe this situation and now I'm going to take that vector w that you came up with miss miss or miss this model and I'm going to take tell you a new situation"}, {"start": 1181.0, "end": 1195.0, "text": " this situation right here and I'm going to now give you X and I'm going to give you the w that you yourself have output and now please tell me what's the a"}, {"start": 1195.0, "end": 1204.0, "text": " and then the model is of course supposed to tell you all these four here or the a so without without ever telling that it should be a square"}, {"start": 1204.0, "end": 1214.0, "text": " what you can do is you can let the model infer a w from one example situation and then transfer that w to a new situation"}, {"start": 1214.0, "end": 1220.0, "text": " so it can identify you can just say whatever concept I have up here"}, {"start": 1220.0, "end": 1231.0, "text": " please apply that same concept which is the w down here and this is the entire paper now this is the concept learning through energy based models"}, {"start": 1231.0, "end": 1242.0, "text": " okay so that is kind of a third line I would add down here you can infer a concept vector if you're given the X and the a"}, {"start": 1242.0, "end": 1251.0, "text": " so in order to do all this their energy function is going to be a so called relational neural network so what you'll have is you'll have a simple"}, {"start": 1251.0, "end": 1261.0, "text": " neural network a multi layer perceptron that always connects to entities to each other with the concept vector and then this is a"}, {"start": 1261.0, "end": 1274.0, "text": " I believe a sigmoid that connects the attention masks of the two and you simply sum over all pairs of two entries in your model and then you send that through an"}, {"start": 1274.0, "end": 1284.0, "text": " MLP sorry through an MLP again this I believe is not so important it's just important that they can feed this entire situation the X the a"}, {"start": 1284.0, "end": 1293.0, "text": " and the w they can basically feed into a neural network and the neural network comes up with a number of how well those three things fit together"}, {"start": 1293.0, "end": 1302.0, "text": " and then you can transfer these concepts that's pretty cool now the only question is of course we've always said we're"}, {"start": 1302.0, "end": 1311.0, "text": " given an energy function we're just we just have it but of course this is a neural network and the neural network has parameters and the"}, {"start": 1311.0, "end": 1320.0, "text": " parameters we don't know what good parameters are at the beginning so we need to train this thing and again the reason why these are toy"}, {"start": 1320.0, "end": 1329.0, "text": " problems right here is I mean we'll get to why it's computation but this is kind of a new field I believe in machine learning"}, {"start": 1329.0, "end": 1337.0, "text": " at least I come from classical machine learning and we only ever have used like SGD to train and we only have"}, {"start": 1337.0, "end": 1347.0, "text": " have produced models that one shot produce something and here we this is a I believe this is a new concept where you"}, {"start": 1347.0, "end": 1359.0, "text": " just grade in descent as part of the output and that makes a lot of trouble so that's why we work in toy problems so what this this here is a"}, {"start": 1359.0, "end": 1369.0, "text": " situation I described you have a demo event where you're given the X and the a and you're supposed to infer the w so the question here is"}, {"start": 1369.0, "end": 1378.0, "text": " what's the w and the model will come up with a w and you're not going to do anything you know right now you're simply going to take that w"}, {"start": 1378.0, "end": 1389.0, "text": " and tell it oh well here is a so called test event so please apply the w you came up with in this test event and please find me the"}, {"start": 1389.0, "end": 1401.0, "text": " the a in this case that satisfies the w and the x I give you here and of course the a right here is as you can see even you don't know that it's a square"}, {"start": 1401.0, "end": 1410.0, "text": " and the actual concept here is move the gray ball to the middle of the square right that that is it here but no one has told me this I just"}, {"start": 1410.0, "end": 1421.0, "text": " looked at the picture so the the correct answer here would be to place attention on those four things and then to take this thing and move it to the"}, {"start": 1421.0, "end": 1438.0, "text": " middle right here in the in this over here so that would be the correct answer now the question is how do you train something like this and they show that they so this is the"}, {"start": 1438.0, "end": 1451.0, "text": " loss function right here the loss function is they give you a concept and the initial situation and you're supposed to infer the x1 and the a and the loss"}, {"start": 1451.0, "end": 1467.0, "text": " function simply the negative log likelihood of that but what does that mean so we'll make it easier if if you have this this procedure right here where you have a demo event"}, {"start": 1467.0, "end": 1477.0, "text": " this appeared this is demo and this is a test event how are you going this entire procedure how are you going to learn the energy"}, {"start": 1477.0, "end": 1493.0, "text": " function well in this case this entire procedure this entire thing is one training sample sample but usually we have input and label"}, {"start": 1493.0, "end": 1506.0, "text": " and now here it's much more complicated because so we have input okay that's this x and this a cool but then we have sgd as integral part of the procedure to"}, {"start": 1506.0, "end": 1514.0, "text": " determine the w and now what we could do is just apply a loss to the w but we don't because we don't know what the embedding space for the"}, {"start": 1514.0, "end": 1532.0, "text": " concepts is we could maybe train a classifier but in this case we want to train the ability to transfer these concepts so our training sample needs to be one time transferring a concept so sgd for one is part of our"}, {"start": 1532.0, "end": 1543.0, "text": " process here and not only that but then this this x here of course is also part of our training sample right this appears x0 and this here is x1 and now we need"}, {"start": 1543.0, "end": 1560.0, "text": " to find this a this attention mask and that is an sgd again remember inferring anything through the energy function is a gradient descent process so ultimately our one training example consists of x0 a at"}, {"start": 1560.0, "end": 1583.0, "text": " the beginning so let's call that a zero it consists of the sgd procedure to find w it consists of x1 and it consists of the sgd procedure to find a the a1 the output a and then that will give us the"}, {"start": 1583.0, "end": 1603.0, "text": " output a the a1 so this here is our input in the classical machine and this would be our x and this here would be our label y and that's what we train on we train so such that the output right here the a this is of course sorry this is"}, {"start": 1603.0, "end": 1620.0, "text": " of course the y hat this is what we predict and in the training sample which is right a little generator that will you know make this situation that knows what the concept is it will say okay I'm going to make an example for a square then it make this will make"}, {"start": 1620.0, "end": 1630.0, "text": " the attention mask for a square and then it will make the new situation again with a square but not tell us the attention mask there and it will"}, {"start": 1630.0, "end": 1646.0, "text": " make the attention mask into the true y so at the end we can compare what our model output the attention mask we output here without ever knowing that this should be a square"}, {"start": 1646.0, "end": 1661.0, "text": " and we have the true label which comes out of the generator that at the beginning decided that it should be a square and then the loss the distance between those two that's our loss"}, {"start": 1661.0, "end": 1678.0, "text": " this is an enormous procedure to get a loss and most crucially you have to back propagate through optimization procedures and this is something that we just can't do yet in our models if you take an"}, {"start": 1678.0, "end": 1696.0, "text": " image a resonant 50 right right now we do one forward propagation to get a label in this procedure if you had to back propagate through the optimization procedure for each sample you would need to basically back propagate through 50 forward passes of the"}, {"start": 1696.0, "end": 1712.0, "text": " resonant if you if your optimization procedure is 50 steps long and that is just not feasible right now so that's why we don't do it but I believe maybe once we find a smart way of"}, {"start": 1712.0, "end": 1725.0, "text": " dropping through optimization procedures a whole lot of these things will become the new a new wave and machine learning I'm excited by this I'm pretty sure it doesn't work yet and this is very"}, {"start": 1725.0, "end": 1743.0, "text": " fairly fairly work but I'm excited by the prospect that we can do this so this is the training procedure right you were given X zero X1 and a and you optimize in order to infer the concept behind it right the"}, {"start": 1743.0, "end": 1756.0, "text": " model that your level generator of your training data it knows the concept it has a concept in mind when it generated this but you're not telling your model what the concept is it needs to infer that and then using the"}, {"start": 1756.0, "end": 1773.0, "text": " model the thing that the model inferred you can either give it X zero and X one and infer a or you can give it the X and the A and infer X you can do either of those right these are called identification or generation respectively and then you compare the"}, {"start": 1773.0, "end": 1790.0, "text": " output here to what the generator at the beginning thought again it's not telling you it's that's because that's the label and you compare this to that and that will be your loss to train your energy function parameters so your training"}, {"start": 1790.0, "end": 1807.0, "text": " samples if you think of this entire thing as one forward pass of the model then it's just classic machine learning right you have a training sample which is one forward pass and you have a corresponding label that you infer so let's jump to the"}, {"start": 1807.0, "end": 1829.0, "text": " experiments right here experiments are actually pretty cool so what they've done is for example take in the concept of being far apart from something now being far apart so that the little X needs to be as far away as possible from the ball that has the"}, {"start": 1829.0, "end": 1847.0, "text": " function on it right so if you do generation and you start the little X right here and you ask the model where please infer the next state of the world it will push that little X away right here and in color you can see the energy"}, {"start": 1847.0, "end": 1864.0, "text": " function values of the position of the X so it pushes it away from this thing but if you take the same concept embedding the concept embedding of being far away but you don't do generation you do identification"}, {"start": 1864.0, "end": 1889.0, "text": " means you infer the A then it will simply tell you that this ball right here is the furthest away from the X right so you can do all sorts of things like this and transferring concepts I find this here pretty interesting so they have two different concepts one concept is red as an"}, {"start": 1889.0, "end": 1909.0, "text": " identification you need to identify the red ball but the other concept is you need to turn something red right you need to take a ball that is maybe not blue and of course the color you can gradient descent on the colors you need to make it red and since the energy"}, {"start": 1909.0, "end": 1929.0, "text": " takes three input X a and W it doesn't you you're not going to tell it right now in which situation you are it has to create create this W embedding space through learning and if you do it with those two concepts then it will"}, {"start": 1929.0, "end": 1957.0, "text": " create the make something red concept and the is something red concepts in the same places this is a PCA and in blue I think these blue is the attention codes for identify the red things and in red or the generation code for make something red and they will be put in the same place which is pretty cool it means that the energy function really learns the feature of something being red"}, {"start": 1957.0, "end": 1984.0, "text": " I find this pretty pretty neat and then here they have some experiments where they basically show we need that gradient descent optimization procedure because only after many steps will will the energy function basically be aligned with the concept that you want so if you have a zero shot model like just one forward pass as we do here you'll see that the energy"}, {"start": 1984.0, "end": 2011.0, "text": " function that is supposed to make a circle from samples right this is the example concept right here it if you just have a one shot model it will it cannot or in this case at least it doesn't learn to one shot produce only if you optimize for a few steps will it get this so you optimize at inference time and that seems to be very important"}, {"start": 2011.0, "end": 2032.0, "text": " you can see again here demonstrations of this so the example is this and then the model as you can see after 20 steps learn optimizes the points to go to these locations whereas after only one step it didn't do that yet so there are complex things at work here"}, {"start": 2032.0, "end": 2060.0, "text": " and this column here is where you don't have a relational neural network so you can't basically capture dependencies between things so you you have no chance of making a square because you don't know where the things are in relation to each other but that's more of an engineering question their point is basically that if you have models that do optimization at inference time they are much more powerful than models that just do a one shot forward pass"}, {"start": 2060.0, "end": 2084.0, "text": " it's sort of like an auto regressive model in NLP versus a non-order regressive model that produces all words at once if you produce all words of a sentence at once no word can depend on any other word and you can just produce independent things which will make the sentence often not make any sense"}, {"start": 2084.0, "end": 2103.0, "text": " they also have this KL objective which is a regularizer which I believe that's just a trial and error they built it in because but it is a regularizer I don't want to really go into that and then they do demonstration in and they reenact it on a robot"}, {"start": 2103.0, "end": 2124.0, "text": " the demonstration here is that there is a situation where two things have attention on and you're supposed to move something into the middle of the two things so that's the content you don't tell the robot the concept it needs to learn that from data and then infer that this is the concept that you want and then transfer that to the other environment"}, {"start": 2124.0, "end": 2149.0, "text": " now you know this it look you know there's this robot environment but ultimately they still encode the positions of these things and the position of that and really all you have to do different here is that instead of moving this actuator directly you need to like calculate what you need to do to the individual joints in the robot"}, {"start": 2149.0, "end": 2163.0, "text": " so I think this is maybe because it's open AI and it needs to you know look robot and stuff but the problem here is not really different it's it's not even it's not real world transfer or anything"}, {"start": 2163.0, "end": 2174.0, "text": " so yeah let's let go through some of the things they can learn with this so you can see here they can learn these regional geometric shapes"}, {"start": 2174.0, "end": 2191.0, "text": " and so on the left is the example event that the model needs to take the concept from now this is this is I believe very much identification so what they did is they trained with a dataset where all of these appear right so there are squares there are lines there are circles"}, {"start": 2191.0, "end": 2211.0, "text": " so this is maybe my criticism here that it is not so much to generally infer a concept it is more like identify the concept so the model basically just needs to decide is this line is this circle or is this square because that's was those things were in the training dataset"}, {"start": 2211.0, "end": 2228.0, "text": " it would be nice to see how this generalize is to general concepts or if we can even make that if we can have a zero shot concept inference and then transfer those concepts to other things maybe that's already happening I don't I don't know"}, {"start": 2228.0, "end": 2252.0, "text": " so here the spatial arrangement is to either be close to something or to be between two things so if the attention is on two things you want in between so you see the top ones are the demonstrations and needs to recognize the concept and it needs to basically optimize to fulfill that concept"}, {"start": 2252.0, "end": 2271.0, "text": " shapes so to make shapes is oh yeah there's a triangle right again this this this this very much I believe relies on recognition and not actual understanding of what a triangle is"}, {"start": 2271.0, "end": 2300.0, "text": " here you have proximity being closer being far apart what else is cool oh yeah if the recognition for the same task right you need to identify the ball that is closer for and here you really also see the optimization procedure in action where for example at the beginning of each flicker you can of see the attention being everywhere and then stabilizing to one or two points so if two points are equally closer for a part"}, {"start": 2300.0, "end": 2311.0, "text": " you'll see the attention being on multiple points which is pretty cool right so that means the model really learns this this this concept"}, {"start": 2311.0, "end": 2325.0, "text": " here's the count quantity so you can either have one two or larger than three or something yeah that seems like they tried three and four and didn't work so they just said"}, {"start": 2325.0, "end": 2339.0, "text": " we'll just do larger than three and here is this robot thing where it also always needs to move in between now this this is the part that I'm not really impressed with but you know whatever whatever you want"}, {"start": 2339.0, "end": 2348.0, "text": " okay I hope this was a good introduction to energy functions what you can do with them what I think of them and of this paper it is a pretty cool paper"}, {"start": 2348.0, "end": 2356.0, "text": " yes it only works on toy problems so far but I believe this is one interesting direction of future machine learning"}, {"start": 2356.0, "end": 2366.0, "text": " and something yet to be very much explored if you like this content please subscribe tell all of your friends about it share"}, {"start": 2366.0, "end": 2395.0, "text": " and I'll see you next time bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=iZXsWlSdMGY | [News] Google’s medical AI was super accurate in a lab. Real life was a different story. | A closer look at a story of how the deployment of AI brings its own challenges and what can go wrong.
https://www.technologyreview.com/2020/04/27/1000658/google-medical-ai-accurate-lab-real-life-clinic-covid-diabetes-retina-disease/
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 this new story from MIT Technology Review. Google's Medical AI was super accurate in a lab. Real life was a different story. So, this story here is that Google had this AI to detect diabetic retinopathy. So, if you're a diabetic and your glucose isn't or your insulin isn't properly handled, that means you get damaged to your blood vessels and the small blood vessels, like the ones in the eyes here, they're the first ones to get damaged. And that can lead you to get this disease called retinopathy, which is in the retina, in the back of the eye. And that can lead you to go blind if it's not discovered soon enough. So, AI doctor can look at an photograph like this and can determine whether you have it or not. I guess they would look at like a larger resolution of it. But in any case, they could determine from this. So, Google built an AI that could maybe spot things here, that can maybe spot if you had this or not. And they try to deploy this. And the story is about how this failed, basically. So, they said they had this in Thailand. And they had the opportunity to deploy this. So, Thailand's Ministry of Health had said, and then you'll go to screen 60% of the people with diabetes for this diabetic retinopathy. It can cause blindness if not caught early. So, here is where I come in because 2, 4.5 million patients that have diabetes, there are only 200 experts that can determine from a photograph whether or not you do have that disease. So, they say clinics are struggling to meet the target. And Google has built AI, says the AMI developed by Google have can identify signs of diabetic retinopathy from an eye scan with more than 90% accuracy, which the team calls human specialist level. And gives results in less than 10 minutes. All right, so this is pretty cool, right? They've developed an AI. You can send an eye scan and it'll say what you, whether or not you have this disease. But then the problems mount. So, they followed over several months they observed nurses conducting eye scans and interviewed them about their expertise using the new system. So, the nurses will conduct the eye scans. They would try to use the AI. And the nurses themselves aren't specialists. They would otherwise send the scans to a specialist. But now the AI is supposed to handle this up. When it worked well, the AI did speed things up. Some but sometimes failed to give a result at all. So, these AI had been trained on high quality scans, right? Of course, if you want to train an AI system you want the highest quality data you can get. But also in practice, you're not going to get high quality data. It was designed to reject images that fell below a certain threshold of quality. And they say often taking photos in poor lighting conditions in the real world more than a fifth of the images were rejected. So, this is my take on it. If you build something for the real world you need to take into account what the real world holds in store for you. Which means that you probably are going to have poor lighting conditions if you build an image recognition system. Now, I'm not saying that like some people are saying whenever you work with AI you should consider how it impacts later on and so on. No, it's perfectly fine to work on a data set of high quality images if you do something like inventing your architecture or what not work on optimization algorithms. Like nothing of that. But it is if you are thinking of deploying something in the real world you need to take this into account. Now, I also think this was particularly poorly designed for the task. And here's why. Google probably here is mainly worried about legal culpability because the thing says it was designed to reject images that fell below a certain threshold of quality. Right, the reason for this is that here you have a classifier. Right. And either it says it says, okay, here is positive and negative class. I am about this much sure of the positive class and this much of the negative class. And there's quite a big of a difference here. Right. So I'm going to go with the negative class. But if those two things are somewhat closer together the Google doesn't trust its own AI. It's like, and if it did some decision here, if it says, well, still go go with the negative class. This goes back to the patient and they may be a mistake. Then this thing here is automatically responsible for that mistake. And since the AI is not a human, these mistakes here could be rather trivial mistakes that a human would have spotted. So basically since it's deep learning, we don't really trust it. And then because Google doesn't want the legal culpability of being responsible, they simply reject these cases. They just say, we don't deal with it. We just deal with things with a large discrepancy. If you actually want to design something for the real world, you need to take into account, okay, there's poor lighting conditions and I would think in if I were to build something like this optimally, you would just output this thing, you would output this distribution. You would, in this case, you could say, look, I am 60, 40%, I'm not sure I lean towards negative, but I don't think so. And then the nurse who also has some expertise could be experienced in when the system fails or when it tends to be not sure and could kind of integrate that information. But this only works. So if you're a, that's maybe a recommendations for logivers, this only works if you don't make the AI system completely culpable for its mistakes. It can output its estimation and it can, along of that, it can actually also output an estimation of its own uncertainty. It can like give you some confidence bounce here. Now, these are not gonna be statistical true confidence bounce because it's deep learning. But still, I would say please give all the available information that the system has and then let the humans work with the system rather than trying to fully replace the humans by simply saying yes, no, or reject. All right, so they say patients whose images were kicked out of the system were told they could have a visit, they would have to visit a specialist at another clinic on another day. If they found it hard to take time off work or did not have a car, this was obviously inconvenient, which I can understand. Nurses felt frustrated, especially when they believed the rejected scans showed no sign of disease and the follow-up appointments were unnecessary. This is exactly what I'm saying, right? The nurses often also have very good experience and can combine, could combine something like this with their own experience of when something is wrong and when something isn't wrong. And maybe you even built in some explainability to focus on part of the image. And then you could alleviate a lot of these problems. They sometimes waste the time trying to retake or edit an image that the AI had rejected, right? This is just now you're just built AI working against humans rather than with humans. So further this says, because the system had to upload images to the cloud for processing, port internet connection in several clinics also caused delays. So patients like the instant results, but the internet is slow and the patients then complain. They've been waiting here since 6am and for the first two hours, we could only screen 10 patients. Yes, this is the type of stuff you have to take into account. So maybe actually put the GPU server into the clinic. I think it's better anyway for date to privacy reasons, but of course the large companies they want to everything to be uploaded to their machines. It's more convenient for them. So they say there is now working with medical staff to design new workflows. I mean, sometimes you do rely on an internet connection. So I don't want to be too harsh here. So the other, there are some critics here. So Michael Abramov, an eye doctor and computer scientist at the University of Iowa hospitals and clinics has been developing an AI for diagnosing retinal disease for several years and is a CEO of a spin off here. And he basically says there is much more to healthcare than algorithms. And I mean, of course, we can all see that. Yeah, he basically says that the questions, the usefulness of comparing AI tools with human specialists when it comes to accuracy. Of course, we don't want an AI to make a bad call, but human doctors disagree all the time. He says that's fine. The AI system needs to fit into a process where sources of uncertainty are discussed rather than simply reject it. And this exactly feeds into what I've been saying. If the AI were just to output the source of uncertainty and all it thinks about a particular situation, then the humans could discuss it, right? And then we could get to a better outcome, but this only works if the legal framework is given, right? If you regulate, and I get that point too, you want to assign kind of blame when something goes wrong. But you just have to know that this is what keeps these systems back often. Finally, they say the benefits could be huge. There was one nurse that screened 1000 patients on her own. I don't know what time that is. I guess that's over the course of the study or so. And with this tool, she's unstoppable. The patients didn't really care that it was an AI rather than a human reading their images. They cared more about what their experience was going to be. And that's a general experience that I get from a lot of people working with human machine interactions is that the people don't, they're not so super excited that it's a human if the machine appears competent. I think we've gotten used to AI being quite good at particular tasks, and we're actually happy to outsource some of these to them. But again, if you build something for the real world, you have to take into account the real world conditions. And this feeds into papers like ImageNet V2, where you all of a sudden have a harder test set. It feeds into topics like domain shift, transfer learning, domain adaptation. And these are all research topics. So I think problems like this can give rise to entirely new directions of research. So if you're looking for a PhD topic, maybe this is something for you. All right, thanks for watching this. This was my blab's about the story. I hope you enjoyed this and these kind of new sections are it's a new thing I'm doing. If you like it, subscribe. If you didn't like it, leave a comment, and bye bye. | [{"start": 0.0, "end": 5.5200000000000005, "text": " Hi there. Today we're looking at this new story from MIT Technology Review."}, {"start": 5.5200000000000005, "end": 8.52, "text": " Google's Medical AI was super accurate in a lab."}, {"start": 8.52, "end": 10.92, "text": " Real life was a different story."}, {"start": 10.92, "end": 18.080000000000002, "text": " So, this story here is that Google had this AI to detect diabetic retinopathy."}, {"start": 18.080000000000002, "end": 25.92, "text": " So, if you're a diabetic and your glucose isn't or your insulin isn't properly handled,"}, {"start": 25.92, "end": 31.68, "text": " that means you get damaged to your blood vessels and the small blood vessels,"}, {"start": 31.68, "end": 36.6, "text": " like the ones in the eyes here, they're the first ones to get damaged."}, {"start": 36.6, "end": 40.56, "text": " And that can lead you to get this disease called retinopathy,"}, {"start": 40.56, "end": 44.56, "text": " which is in the retina, in the back of the eye."}, {"start": 44.56, "end": 48.24, "text": " And that can lead you to go blind if it's not discovered soon enough."}, {"start": 48.24, "end": 52.28, "text": " So, AI doctor can look at an photograph like this"}, {"start": 52.28, "end": 55.68000000000001, "text": " and can determine whether you have it or not."}, {"start": 55.68, "end": 59.76, "text": " I guess they would look at like a larger resolution of it."}, {"start": 59.76, "end": 62.72, "text": " But in any case, they could determine from this."}, {"start": 62.72, "end": 68.12, "text": " So, Google built an AI that could maybe spot things here,"}, {"start": 68.12, "end": 71.52, "text": " that can maybe spot if you had this or not."}, {"start": 71.52, "end": 74.32, "text": " And they try to deploy this."}, {"start": 74.32, "end": 79.32, "text": " And the story is about how this failed, basically."}, {"start": 79.32, "end": 84.8, "text": " So, they said they had this in Thailand."}, {"start": 84.8, "end": 87.52, "text": " And they had the opportunity to deploy this."}, {"start": 87.52, "end": 89.84, "text": " So, Thailand's Ministry of Health had said,"}, {"start": 89.84, "end": 92.88, "text": " and then you'll go to screen 60% of the people with diabetes"}, {"start": 92.88, "end": 95.75999999999999, "text": " for this diabetic retinopathy."}, {"start": 95.75999999999999, "end": 98.52, "text": " It can cause blindness if not caught early."}, {"start": 98.52, "end": 104.72, "text": " So, here is where I come in because 2, 4.5 million patients"}, {"start": 104.72, "end": 108.24, "text": " that have diabetes, there are only 200 experts"}, {"start": 108.24, "end": 110.84, "text": " that can determine from a photograph"}, {"start": 110.84, "end": 115.32000000000001, "text": " whether or not you do have that disease."}, {"start": 115.32000000000001, "end": 118.28, "text": " So, they say clinics are struggling to meet the target."}, {"start": 118.28, "end": 125.28, "text": " And Google has built AI, says the AMI developed by Google"}, {"start": 125.28, "end": 128.44, "text": " have can identify signs of diabetic retinopathy"}, {"start": 128.44, "end": 132.16, "text": " from an eye scan with more than 90% accuracy,"}, {"start": 132.16, "end": 136.4, "text": " which the team calls human specialist level."}, {"start": 136.4, "end": 140.04, "text": " And gives results in less than 10 minutes."}, {"start": 140.04, "end": 141.76, "text": " All right, so this is pretty cool, right?"}, {"start": 141.76, "end": 143.12, "text": " They've developed an AI."}, {"start": 143.12, "end": 148.28, "text": " You can send an eye scan and it'll say what you,"}, {"start": 148.28, "end": 151.51999999999998, "text": " whether or not you have this disease."}, {"start": 151.51999999999998, "end": 155.64, "text": " But then the problems mount."}, {"start": 155.64, "end": 157.68, "text": " So, they followed over several months"}, {"start": 157.68, "end": 159.79999999999998, "text": " they observed nurses conducting eye scans"}, {"start": 159.79999999999998, "end": 161.95999999999998, "text": " and interviewed them about their expertise"}, {"start": 161.95999999999998, "end": 163.35999999999999, "text": " using the new system."}, {"start": 163.35999999999999, "end": 165.6, "text": " So, the nurses will conduct the eye scans."}, {"start": 165.6, "end": 168.07999999999998, "text": " They would try to use the AI."}, {"start": 168.08, "end": 172.36, "text": " And the nurses themselves aren't specialists."}, {"start": 172.36, "end": 175.68, "text": " They would otherwise send the scans to a specialist."}, {"start": 175.68, "end": 178.52, "text": " But now the AI is supposed to handle this up."}, {"start": 178.52, "end": 182.96, "text": " When it worked well, the AI did speed things up."}, {"start": 182.96, "end": 186.4, "text": " Some but sometimes failed to give a result at all."}, {"start": 186.4, "end": 191.4, "text": " So, these AI had been trained on high quality scans, right?"}, {"start": 193.12, "end": 195.04000000000002, "text": " Of course, if you want to train an AI system"}, {"start": 195.04000000000002, "end": 197.08, "text": " you want the highest quality data you can get."}, {"start": 197.08, "end": 201.44000000000003, "text": " But also in practice, you're not going to get high quality data."}, {"start": 201.44000000000003, "end": 203.68, "text": " It was designed to reject images"}, {"start": 203.68, "end": 206.64000000000001, "text": " that fell below a certain threshold of quality."}, {"start": 207.64000000000001, "end": 211.04000000000002, "text": " And they say often taking photos"}, {"start": 211.04000000000002, "end": 213.4, "text": " in poor lighting conditions in the real world"}, {"start": 213.4, "end": 216.32000000000002, "text": " more than a fifth of the images were rejected."}, {"start": 216.32000000000002, "end": 219.20000000000002, "text": " So, this is my take on it."}, {"start": 219.20000000000002, "end": 221.32000000000002, "text": " If you build something for the real world"}, {"start": 221.32000000000002, "end": 222.88000000000002, "text": " you need to take into account"}, {"start": 222.88000000000002, "end": 225.28, "text": " what the real world holds in store for you."}, {"start": 225.28, "end": 228.96, "text": " Which means that you probably are going to have"}, {"start": 228.96, "end": 230.28, "text": " poor lighting conditions"}, {"start": 230.28, "end": 233.24, "text": " if you build an image recognition system."}, {"start": 233.24, "end": 236.08, "text": " Now, I'm not saying that like some people are saying"}, {"start": 236.08, "end": 238.76, "text": " whenever you work with AI you should consider"}, {"start": 238.76, "end": 241.0, "text": " how it impacts later on and so on."}, {"start": 241.0, "end": 243.28, "text": " No, it's perfectly fine to work on a data set"}, {"start": 243.28, "end": 245.96, "text": " of high quality images if you do something"}, {"start": 245.96, "end": 247.68, "text": " like inventing your architecture"}, {"start": 247.68, "end": 250.68, "text": " or what not work on optimization algorithms."}, {"start": 250.68, "end": 252.28, "text": " Like nothing of that."}, {"start": 252.28, "end": 256.68, "text": " But it is if you are thinking of deploying something"}, {"start": 256.68, "end": 258.8, "text": " in the real world you need to take this into account."}, {"start": 258.8, "end": 262.08, "text": " Now, I also think this was particularly"}, {"start": 262.08, "end": 264.36, "text": " poorly designed for the task."}, {"start": 264.36, "end": 265.72, "text": " And here's why."}, {"start": 265.72, "end": 268.8, "text": " Google probably here is mainly worried"}, {"start": 268.8, "end": 270.88, "text": " about legal culpability"}, {"start": 270.88, "end": 274.44, "text": " because the thing says it was designed"}, {"start": 274.44, "end": 277.08, "text": " to reject images that fell below"}, {"start": 277.08, "end": 280.12, "text": " a certain threshold of quality."}, {"start": 280.12, "end": 283.76, "text": " Right, the reason for this is that here you have a classifier."}, {"start": 283.76, "end": 286.92, "text": " Right. And either it says it says, okay,"}, {"start": 286.92, "end": 290.2, "text": " here is positive and negative class."}, {"start": 290.2, "end": 293.52, "text": " I am about this much sure of the positive class"}, {"start": 293.52, "end": 295.04, "text": " and this much of the negative class."}, {"start": 295.04, "end": 297.16, "text": " And there's quite a big of a difference here."}, {"start": 297.16, "end": 300.0, "text": " Right. So I'm going to go with the negative class."}, {"start": 300.0, "end": 304.48, "text": " But if those two things are somewhat closer together"}, {"start": 306.08, "end": 308.92, "text": " the Google doesn't trust its own AI."}, {"start": 308.92, "end": 313.52000000000004, "text": " It's like, and if it did some decision here,"}, {"start": 313.52000000000004, "end": 316.56, "text": " if it says, well, still go go with the negative class."}, {"start": 316.56, "end": 319.76, "text": " This goes back to the patient and they may be a mistake."}, {"start": 319.76, "end": 323.48, "text": " Then this thing here is automatically responsible"}, {"start": 323.48, "end": 324.68, "text": " for that mistake."}, {"start": 324.68, "end": 328.88, "text": " And since the AI is not a human,"}, {"start": 328.88, "end": 332.16, "text": " these mistakes here could be rather trivial mistakes"}, {"start": 332.16, "end": 334.08000000000004, "text": " that a human would have spotted."}, {"start": 334.08000000000004, "end": 336.40000000000003, "text": " So basically since it's deep learning,"}, {"start": 336.40000000000003, "end": 337.96000000000004, "text": " we don't really trust it."}, {"start": 337.96, "end": 339.64, "text": " And then because Google doesn't want"}, {"start": 339.64, "end": 342.35999999999996, "text": " the legal culpability of being responsible,"}, {"start": 342.35999999999996, "end": 345.4, "text": " they simply reject these cases."}, {"start": 345.4, "end": 347.44, "text": " They just say, we don't deal with it."}, {"start": 347.44, "end": 350.32, "text": " We just deal with things with a large discrepancy."}, {"start": 351.28, "end": 354.28, "text": " If you actually want to design something for the real world,"}, {"start": 354.28, "end": 355.59999999999997, "text": " you need to take into account,"}, {"start": 355.59999999999997, "end": 357.15999999999997, "text": " okay, there's poor lighting conditions"}, {"start": 357.15999999999997, "end": 360.44, "text": " and I would think in if I were to build something"}, {"start": 360.44, "end": 365.08, "text": " like this optimally, you would just output this thing,"}, {"start": 365.08, "end": 368.56, "text": " you would output this distribution."}, {"start": 368.56, "end": 370.47999999999996, "text": " You would, in this case, you could say,"}, {"start": 370.47999999999996, "end": 375.47999999999996, "text": " look, I am 60, 40%, I'm not sure I lean towards negative,"}, {"start": 376.44, "end": 377.96, "text": " but I don't think so."}, {"start": 377.96, "end": 381.47999999999996, "text": " And then the nurse who also has some expertise"}, {"start": 382.44, "end": 385.56, "text": " could be experienced in when the system fails"}, {"start": 385.56, "end": 387.47999999999996, "text": " or when it tends to be not sure"}, {"start": 387.47999999999996, "end": 390.32, "text": " and could kind of integrate that information."}, {"start": 390.32, "end": 391.76, "text": " But this only works."}, {"start": 391.76, "end": 395.56, "text": " So if you're a, that's maybe a recommendations for logivers,"}, {"start": 395.56, "end": 398.8, "text": " this only works if you don't make the AI system"}, {"start": 398.8, "end": 402.0, "text": " completely culpable for its mistakes."}, {"start": 402.92, "end": 405.88, "text": " It can output its estimation"}, {"start": 405.88, "end": 407.36, "text": " and it can, along of that,"}, {"start": 407.36, "end": 409.88, "text": " it can actually also output an estimation"}, {"start": 409.88, "end": 411.48, "text": " of its own uncertainty."}, {"start": 411.48, "end": 414.84, "text": " It can like give you some confidence bounce here."}, {"start": 414.84, "end": 417.59999999999997, "text": " Now, these are not gonna be statistical true confidence"}, {"start": 417.59999999999997, "end": 418.92, "text": " bounce because it's deep learning."}, {"start": 418.92, "end": 423.04, "text": " But still, I would say please give all the available"}, {"start": 423.04, "end": 424.64000000000004, "text": " information that the system has"}, {"start": 424.64000000000004, "end": 427.48, "text": " and then let the humans work with the system"}, {"start": 427.48, "end": 430.44, "text": " rather than trying to fully replace the humans"}, {"start": 430.44, "end": 433.76, "text": " by simply saying yes, no, or reject."}, {"start": 435.48, "end": 439.6, "text": " All right, so they say patients whose images were kicked"}, {"start": 439.6, "end": 442.76, "text": " out of the system were told they could have a visit,"}, {"start": 442.76, "end": 444.6, "text": " they would have to visit a specialist"}, {"start": 444.6, "end": 447.68, "text": " at another clinic on another day."}, {"start": 447.68, "end": 449.96, "text": " If they found it hard to take time off work"}, {"start": 449.96, "end": 452.8, "text": " or did not have a car, this was obviously inconvenient,"}, {"start": 452.8, "end": 454.8, "text": " which I can understand."}, {"start": 454.8, "end": 457.92, "text": " Nurses felt frustrated, especially when they believed"}, {"start": 457.92, "end": 460.68, "text": " the rejected scans showed no sign of disease"}, {"start": 460.68, "end": 462.8, "text": " and the follow-up appointments were unnecessary."}, {"start": 462.8, "end": 465.44, "text": " This is exactly what I'm saying, right?"}, {"start": 465.44, "end": 470.04, "text": " The nurses often also have very good experience"}, {"start": 470.04, "end": 473.92, "text": " and can combine, could combine something like this"}, {"start": 473.92, "end": 476.88, "text": " with their own experience of when something is wrong"}, {"start": 476.88, "end": 478.52, "text": " and when something isn't wrong."}, {"start": 478.52, "end": 481.08, "text": " And maybe you even built in some explainability"}, {"start": 481.08, "end": 483.0, "text": " to focus on part of the image."}, {"start": 483.0, "end": 486.0, "text": " And then you could alleviate a lot of these problems."}, {"start": 487.52, "end": 491.15999999999997, "text": " They sometimes waste the time trying to retake"}, {"start": 491.15999999999997, "end": 495.6, "text": " or edit an image that the AI had rejected, right?"}, {"start": 495.6, "end": 499.64, "text": " This is just now you're just built AI working"}, {"start": 499.64, "end": 502.32, "text": " against humans rather than with humans."}, {"start": 504.15999999999997, "end": 506.84, "text": " So further this says, because the system had to upload"}, {"start": 506.84, "end": 508.88, "text": " images to the cloud for processing,"}, {"start": 508.88, "end": 511.52, "text": " port internet connection in several clinics"}, {"start": 511.52, "end": 513.3199999999999, "text": " also caused delays."}, {"start": 514.3199999999999, "end": 517.3199999999999, "text": " So patients like the instant results,"}, {"start": 517.3199999999999, "end": 521.36, "text": " but the internet is slow and the patients then complain."}, {"start": 521.36, "end": 523.3199999999999, "text": " They've been waiting here since 6am"}, {"start": 523.3199999999999, "end": 526.72, "text": " and for the first two hours, we could only screen 10 patients."}, {"start": 526.72, "end": 530.4, "text": " Yes, this is the type of stuff you have to take into account."}, {"start": 530.4, "end": 533.72, "text": " So maybe actually put the GPU server into the clinic."}, {"start": 533.72, "end": 538.72, "text": " I think it's better anyway for date to privacy reasons,"}, {"start": 538.8000000000001, "end": 543.0400000000001, "text": " but of course the large companies they want to everything"}, {"start": 543.0400000000001, "end": 545.48, "text": " to be uploaded to their machines."}, {"start": 545.48, "end": 547.1600000000001, "text": " It's more convenient for them."}, {"start": 549.8000000000001, "end": 552.8000000000001, "text": " So they say there is now working with medical staff"}, {"start": 552.8000000000001, "end": 554.4, "text": " to design new workflows."}, {"start": 554.4, "end": 557.2, "text": " I mean, sometimes you do rely on an internet connection."}, {"start": 557.2, "end": 559.24, "text": " So I don't want to be too harsh here."}, {"start": 559.24, "end": 564.24, "text": " So the other, there are some critics here."}, {"start": 565.6, "end": 570.04, "text": " So Michael Abramov, an eye doctor and computer scientist"}, {"start": 570.04, "end": 572.5600000000001, "text": " at the University of Iowa hospitals and clinics"}, {"start": 572.5600000000001, "end": 575.52, "text": " has been developing an AI for diagnosing retinal disease"}, {"start": 575.52, "end": 579.28, "text": " for several years and is a CEO of a spin off here."}, {"start": 579.28, "end": 584.28, "text": " And he basically says there is much more to healthcare"}, {"start": 584.96, "end": 586.48, "text": " than algorithms."}, {"start": 586.48, "end": 591.48, "text": " And I mean, of course, we can all see that."}, {"start": 593.28, "end": 598.48, "text": " Yeah, he basically says that the questions,"}, {"start": 598.48, "end": 601.36, "text": " the usefulness of comparing AI tools with human specialists"}, {"start": 601.36, "end": 603.12, "text": " when it comes to accuracy."}, {"start": 603.12, "end": 605.36, "text": " Of course, we don't want an AI to make a bad call,"}, {"start": 605.36, "end": 607.16, "text": " but human doctors disagree all the time."}, {"start": 607.16, "end": 608.8000000000001, "text": " He says that's fine."}, {"start": 608.8000000000001, "end": 611.6800000000001, "text": " The AI system needs to fit into a process"}, {"start": 611.6800000000001, "end": 614.48, "text": " where sources of uncertainty are discussed"}, {"start": 614.48, "end": 616.84, "text": " rather than simply reject it."}, {"start": 616.84, "end": 621.44, "text": " And this exactly feeds into what I've been saying."}, {"start": 622.64, "end": 626.28, "text": " If the AI were just to output the source of uncertainty"}, {"start": 626.28, "end": 630.08, "text": " and all it thinks about a particular situation,"}, {"start": 630.08, "end": 633.28, "text": " then the humans could discuss it, right?"}, {"start": 635.12, "end": 636.96, "text": " And then we could get to a better outcome,"}, {"start": 636.96, "end": 641.72, "text": " but this only works if the legal framework is given, right?"}, {"start": 641.72, "end": 645.08, "text": " If you regulate, and I get that point too,"}, {"start": 645.08, "end": 648.2, "text": " you want to assign kind of blame when something goes wrong."}, {"start": 648.2, "end": 653.0400000000001, "text": " But you just have to know that this is what keeps"}, {"start": 653.0400000000001, "end": 654.96, "text": " these systems back often."}, {"start": 657.4, "end": 660.6, "text": " Finally, they say the benefits could be huge."}, {"start": 662.96, "end": 667.2, "text": " There was one nurse that screened 1000 patients on her own."}, {"start": 667.2, "end": 669.12, "text": " I don't know what time that is."}, {"start": 669.12, "end": 674.12, "text": " I guess that's over the course of the study or so."}, {"start": 675.16, "end": 678.04, "text": " And with this tool, she's unstoppable."}, {"start": 679.08, "end": 682.44, "text": " The patients didn't really care that it was an AI"}, {"start": 682.44, "end": 684.84, "text": " rather than a human reading their images."}, {"start": 684.84, "end": 688.12, "text": " They cared more about what their experience was going to be."}, {"start": 688.12, "end": 693.12, "text": " And that's a general experience that I get"}, {"start": 694.28, "end": 697.12, "text": " from a lot of people working with human machine interactions"}, {"start": 697.12, "end": 700.28, "text": " is that the people don't, they're not so super excited"}, {"start": 700.28, "end": 705.28, "text": " that it's a human if the machine appears competent."}, {"start": 707.52, "end": 711.16, "text": " I think we've gotten used to AI being quite good"}, {"start": 711.16, "end": 714.96, "text": " at particular tasks, and we're actually happy"}, {"start": 714.96, "end": 717.92, "text": " to outsource some of these to them."}, {"start": 717.92, "end": 720.64, "text": " But again, if you build something for the real world,"}, {"start": 720.64, "end": 725.12, "text": " you have to take into account the real world conditions."}, {"start": 725.12, "end": 729.32, "text": " And this feeds into papers like ImageNet V2,"}, {"start": 729.32, "end": 732.0, "text": " where you all of a sudden have a harder test set."}, {"start": 732.0, "end": 734.48, "text": " It feeds into topics like domain shift,"}, {"start": 734.48, "end": 736.6, "text": " transfer learning, domain adaptation."}, {"start": 736.6, "end": 738.36, "text": " And these are all research topics."}, {"start": 738.36, "end": 741.28, "text": " So I think problems like this can give rise"}, {"start": 741.28, "end": 743.2, "text": " to entirely new directions of research."}, {"start": 743.2, "end": 748.16, "text": " So if you're looking for a PhD topic, maybe this is something for you."}, {"start": 748.16, "end": 749.64, "text": " All right, thanks for watching this."}, {"start": 749.64, "end": 752.0, "text": " This was my blab's about the story."}, {"start": 752.0, "end": 755.28, "text": " I hope you enjoyed this and these kind of new sections"}, {"start": 755.28, "end": 757.24, "text": " are it's a new thing I'm doing."}, {"start": 757.24, "end": 758.6, "text": " If you like it, subscribe."}, {"start": 758.6, "end": 785.36, "text": " If you didn't like it, leave a comment, and bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=k1GOF2jmX7c | Big Transfer (BiT): General Visual Representation Learning (Paper Explained) | One CNN to rule them all! BiT is a pre-trained ResNet that can be used as a starting point for any visual task. This paper explains what it takes to pre-train such a large model and details how fine-tuning on downstream tasks is done best.
Paper: https://arxiv.org/abs/1912.11370
Code & Models: TBA
Abstract:
Transfer of pre-trained representations improves sample efficiency and simplifies hyperparameter tuning when training deep neural networks for vision. We revisit the paradigm of pre-training on large supervised datasets and fine-tuning the model on a target task. We scale up pre-training, and propose a simple recipe that we call Big Transfer (BiT). By combining a few carefully selected components, and transferring using a simple heuristic, we achieve strong performance on over 20 datasets. BiT performs well across a surprisingly wide range of data regimes -- from 1 example per class to 1M total examples. BiT achieves 87.5% top-1 accuracy on ILSVRC-2012, 99.4% on CIFAR-10, and 76.3% on the 19 task Visual Task Adaptation Benchmark (VTAB). On small datasets, BiT attains 76.8% on ILSVRC-2012 with 10 examples per class, and 97.0% on CIFAR-10 with 10 examples per class. We conduct detailed analysis of the main components that lead to high transfer performance.
Authors: Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, Neil Houlsby
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 talking about big transfer general visual representation learning by Alexander Kolesnikov, Lukas Bair, Jawah Chai and others of Google Brain. So this paper is basically an application slash engineering paper for the community and it is about the task of transfer learning for visual tasks. So what does that mean? In a visual task the meaning is basically that the input is an image. So it could be a classifier where you have an image and you have to say that this is a cat. Or it could be let's say a medical image of a lung and you have to point out where the defect in the lung is or if there is a defect in the lung or something like this. As we all know this field is pretty much dominated by CNNs by convolutional neural networks that take in these images through many layers of convolution especially residual networks are doing particularly well on these tasks. The problem of course is that in in in some tasks you have lots of data and that's fine because CNNs need lots of data to train. But in some tasks especially these medical tasks you only have like very small database look at the small database. You only have very few labeled samples where the model could learn from and that just is is not enough to learn these big models that would perform well. So you will have to settle for a less performing model. Now the solution or one of the solutions is transfer learning. In transfer learning what you do is you take a large data set. For example the image net data set you have this big data set right here and you train your CNN on that. And then you take that CNN and you do what's called a fine tuning step on this small data set. So you take the CNN that you gained from the large data set as a starting point and then you just train for a few steps. You just kind of adapt it to this final data set that you actually want to train it on. And that usually helps. And why does that help? Because you sort of hope that the the large data set and the small data set are at least somewhat overlapping in in there. So the images in the large data set are somewhat similar to the images in the small data set. It doesn't need to be super similar but just somewhat. And you hope that the features that the CNN learns from the large data set are useful in the small data set. Because then if that is the case when you find tune on the small data set that's this step down here that's called a fine tuning. When you find tune you can pretty much reuse those features. You only have to adjust them a little bit. And you just have to learn how to map the features to the output which now is of course different than in the original task. But you won't have to rediscover the features. So that's why transfer learning can help. So the first phase is called pre-training. The second phase is called fine tuning. Now the ultimate goal in this is the following. Imagine you have like a giant database of data. All right, this is giant. Look at the size comparison to the others. And so you have this big big database of images. And you train a CNN on that big database of labeled images. Now what you're hoping is that you can do this once and then this one CNN trained on this giant data set will become the starting point for all kinds of small tasks. Now so basically you can post this on a repository online and everyone that has a visual task will not train from scratch. But they will basically take this one CNN as a starting point. It is very similar to what people are doing right now with Bert. Or generally these transformer language models. You never want to train them from scratch. You always want to train from a pre-trained state that someone else has done. Because usually the big work is now shifted to the pre-training. So the goal is to find this one universal starting point for visual learning. And of course, no better place to do this than Google. They certainly do have a giant database of images. They certainly have lots of computation which we're going to see is very necessary for something like this. Now they do train three different models. Their model is called BIT and they train three different variants BIT. Small, medium and large. So the L model is trained on 300 million images. The medium model is trained on 14 million images. So this is the I think it's called JFT data set. This here is called the ImageNet 21K data set which looks pretty funky. It has like objects in front of weird backgrounds and stuff like that. And the small is simply trained on the 1.3 million image net data set. So I mean just look at this. We're in a situation where the small model is pre-trained on image net just for reference. If you had imagined this five years ago, this you would not have maybe you would have guessed it. But it's still impressive. So they do release these two models here. The medium and the small one. Pre-trained I believe they don't release the large one which maybe that's the price we have to pay for getting the medium and the small one. The fact that now we can use this in their products because they have probably spent the considerable amount of money in doing this. I'm not sure this is a philosophical discussion whether in the interest of science they should really solve because they do give the sort of exact training protocol you just need the money basically. All right but that's not topic of this video. So the models here are all pretty much just residual networks. They're all these resonant 152 I think X4 which means that basically scale the width of each layer by a number of four from the original resonant architecture and that's pretty much it. They just this is the architecture. There's nothing really new in this paper. It's the paper just details what exactly you have to do which things exactly matter when you pre-trained these things and which ones don't and for therefore I believe it is a it is a pretty good paper and I think that these models here the M and S models and maybe someone else trains an L model and releases it. We'll sort of become the standard like we have in Burt now so whenever you have a visual task you just going to start from those in practice. So this I think is mainly relevant for people in practice. All right here you can see the these models first of all excellent excellent not labeling of your X-axis. Absolutely beautiful. The X-axis I believe is the number of samples per data class. So now they take their pre-trained model this bit L and they fine tune it on these data sets. So ImageNet is one of the tasks they fine tune on or C410, C4100 and so on. And first of all look on the right side this full thing. This is when you take the entire data set. So often they out perform they get state of the art on the full data sets. Now they do compare against what they call generalist models. So generalist models are ones that have this particular training protocol where they train on one big giant database and then fine tune to all the other tasks. They do not achieve state of the art on all data sets in what they call specialist models. The specialist models would be such models that have this exact task in mind and therefore they don't care about other tasks. They outperform some of the specialist models but not all of them. So this is not a this is not the new state of the art in everything but it is in this transfer learning regime. And I think even more important if you see on the left this is in the small label regime. So here you have something like 100 or 25 or 10 or even 5 labels per class. And if you take 5 labels per class for C410 this model. So of course you have to pre-trained it first on the big data set. But just taking 5 labels per class you still get like 94% accuracy on C410. And that's pretty good. That is pretty impressive especially if you compare it to this baseline model here which is a resonant pre-trained on just the image net data set. So that really shows you the power of pre-trained with full data. So one thing they say is that in their big data set in their 300 million images they make sure to remove all the images that then appear in the downstream tasks. Right. Because otherwise you it is fairly conceivable that this database here is just scraped from the internet. And of course these tasks are often like C410 are also scraped from the internet and also image net. And it is entirely conceivable of course that the trust data is already here. And they say we remove images. But I think they just remove exact duplicates. So it could still be that you know someone has taken image net and then kind of recoded it into another color scheme or what not or just compressed it a bit more. And then they find these images on the web. So it's a little shaky this whole thing because these data sets might just be part of one another. But you know given the results I do generally believe the improvements here. But yeah. So I guess what we need is like people to actually go out with cameras and shoot new pictures for a new test set. But in any case let's dive into how to pre-trained something like this. So they divide their findings up in two parts. How to pre-trained and how to fine tune. So how to transfer to downstream tasks. And the methods they find are surprisingly easy. They say there is two components to pre-training. The first component is scale. So you have to have a lot of data and a lot of models. And that is a pretty important recognition. So down here they have this ablation where they scale up the model and scale up the data. So look at this for example. You can see here you have the different data sets to pre-trained on. So this is the small data set, the medium data set, and the large data set. So in this direction you have data set size. Then here you have accuracy. Again I guess we can understand accuracy. That's fine. I'm Nick Piquina. And there we have the different models. Now the larger the dot here is the larger the model architecture. And you can see within the individual bins, the larger the model, the better performance you usually get. But as you can see like here, this improvement in the large models isn't as much as when you have much data. And you can also see by the slope of the line here, the larger amounts of data help more when you have larger models. So only scaling up the the only scaling up the the data is not as effective as scaling up the data and the model at the same time. And in some cases like in this small architecture here, it actually hurts to incorporate more data. At least they say that. And you can also see that here. And here it just doesn't help as much anymore if you incorporate more data. So if your model is too small, you can't handle the big data. Of course there are weird effects like here the performance goes down and then up with the larger data. So this might actually be an effect of the images in these data sets being somewhat qualitatively different also with respect to the task that you are training for. But in generally holds that you need a combination of data set size and model size to go up. And this I think might be an indication of where we are in Belkin's double descent curve. So if you look at the researcher Mikhail Belkin and others people also research in this area, they have this sort of empirical finding and hypothesis sort of that if you plot a graph and here is the number of parameters when relation to the data set size. It's a number of parameters in relation to size of data. And here is your validation loss. Then what happens as you have very little parameters, you can add more parameters to your model to get better validation loss. This is, you know, we get a better model and we train that and we get better. And then at some point you'll start to overfit. You know, we've all learned this in our general machine learning course. And there is a point here, the, what is called the interpolation threshold, where you have, this is one. So the number of parameters is equal to the number of data points, which is just interpolating your training data. Sorry, the data point here, that's train. But then the discovery sort of is that this comes down again and it stays down. So as you go up in number of data points, sorry, number of parameters with the same data set, you're perfectly fitting the training data set. You passed the number of data points in your, in your model. But still your validation loss comes down and there's various hypotheses why this could happen. And here we find ourselves maybe in this sort of situation where if you have a model right here, and you want to scale it, you want to add more data, you can't just keep the model constant because if you add more data, that will shift you to the left here because you add more data, but you keep the, the number of parameters the same. So this number will shift to the left and you actually go up in your validation loss. So maybe this is actually what's happening right here. The fact that the model is too small, this is just a hypothesis by me. So if you want to up your number of data points, you also have to up your number of parameters. And that will keep it going. And maybe these models here are more on this side of this interpolation threshold. And the models where it doesn't happen might be more over here. Though that is a big thing to assume. Maybe not. Now that I think about it, since they have even more parameters here, they would be even more here somewhere. So maybe you add a bunch of data. It's just not as bad. There might be some weird interactions here. Like this. Who knows? Let's just skip this. In any case, the message here is you need more model and more data at the same time. All right. Then there is a second message, a second recipe for pre-training. There we are. The second method is group normalization and weight standardization. So they criticize batch norm. Batch norm has of course been used a lot. That is where if you have a batch of data. And you put it. So these are all data points. You put it through your layers and it has some intermediate representation. What you want to do is you want to calculate sort of the mean and variance of your data in each of the features. And then make it such that it's nice mean one and standard deviation. So mean zero and standard deviation of one. That is called batch norm. But of course, it is dependent on your batch size. So it is dependent on how many data points you have, because that's how well you can estimate these mean and variance parameters. And what people do nowadays is they take these batches and they group them into different groups. And they distribute those groups onto many, many machines, which is called data parallelism, especially with TPUs nowadays. You can just distribute everything to so many TPUs. I believe they say they distribute to something like 500 TPUs, which and so they have a batch size of I think 4,000 and they distribute to 500 TPUs. So that leaves them with eight, eight samples per batch. So this is eight. And eight is just not very good for batch norm. And if you have to, if you want to circumvent that you need to in each layer globally sync with all of the other workers, your batch norm parameters. And that slows you down. So people have gone around this using what they call group normalization and weight standardization. So these two techniques of weight standardization is a is a addition to group normalization. They don't require the other samples in the batch. They work on a per sample basis and they normalize the features within groups of each channel. So the group normalization groups together different features within a sample and then normalizes across that. And the weight standardization is a bit like standardizing the features, but it standardizes the weights to be of a normal distribution. And justifies to say these are standard techniques that you can build in. And they allow you to not have to synchronize constantly between your workers at the training time, which makes everything a lot faster. And also not a problem that you just have eight samples per worker. All right. So that's what they do. They do large data, large models, and group normalization with weight standardization. That's how they pre-trained. And then how do they fine tune? They say they have a rule to select hyperparameters. They call them bit hyper rule. And that's just sort of a formula of how you have one hyperparameter. So you have one, I guess it's a hyper hyperparameter. And that hyper hyperparameter you run through their rule. And the rule will tell you what each of the hyperparameters should be. So it's maybe it's like a lookup table basically. It's oh, you set this one number and we give you the rest of the hyperparameters. And that one rule works pretty well. So you only have to find for fine tuning. You only have to grid search over one hyperparameter. It's not really grid anymore, is it? And then they basically decide on the training schedule length resolution and whether to do mix up regularization. Mix up is a technique that can help when you have very little data. And what it does is it interpolates between data points and also trains on kind of like data points from half this class and half that class just to make more data available. But they all have this packed into this rule. And they of course the exact settings of this rule are presented. So you can look it up. Then they have a data pre-processing, resize the image to a square, crop out small random square, randomly horizontally flip the image at training time. So they basically describe a standard training protocol here. And I want to go mix it to up up too much. The only thing they say surprisingly we do not use any form, any of the following forms of regularization during downstream tuning, wait to K to zero, wait to K to initial parameters or drop out. I think they only use wait decay during pre-training and that's it. So let's look at some of the graph. We've already seen some. Here is where they pretty much outperform the generalist, these generalist models on all of these tasks, including this visual task adaptation benchmark. I've made a video about this. This is a benchmark that includes 19 different visual tasks from all over the place and they have significant improvement here as you can see. They do not always outperform these specialist models but as you can see they outperform for example this on the flowers dataset and they come pretty close. And here you can also see how much they improve when pre-training on a larger dataset. So far people have basically pre-trained on this image net dataset and now that they pre-trained on the larger one of course they gain a lot of performance and the largest one isn't even in this in this table. So what I finally want to look at is this visual task adaptation benchmark. This consists of 19 tasks and they're divided into natural tasks which are kind of natural images and then specialized tasks which are, let's say, the medical images are not really natural and then structure tasks and the structure tasks isn't simply labeling or locating something. It is task where you have to maybe reason about something. So let's say there is an image and there is a cup right here and there is a glass right here and the question is what's to the left of the glass and there's a bunch of other stuff around here and you have to say the cup. So it sort of requires a structure to understand the image and you can see the main performance boost here comes in the natural images which is to be expected. So you only get what you feed in and this 300 million image dataset. I'm pretty sure that's just a web scrape of photos or mainly photos. So the main improvement you're going to get is on pictures that are similar to that as we said at the beginning and these natural tasks have images like that and you can see that the model here improves extremely in that category, improves slightly in this specialized thing and only improves a little bit in the structured tasks. So this as I said is to be expected. Just know if you use this model, know what is in there. You have to know what it does, what it does well. It does well on natural images that are similar to what it was pre-trained on. Okay, so they do have some analysis here and we've already went to most of them. I find this to be pretty pretty impressive. So they say when they apply the standard computational budget of image net pre-training, when they scale up to the larger dataset, it seems detrimental. As you can see right here, the performance actually goes down when you go to the larger dataset. Only if you train longer than you're improving. At the axis labeling, it's just amazing here. Standard, long, longer. How long you train for longer? Thanks. But I guess the point is taken that you have to invest more computation along with your bigger model and bigger dataset. Sorry, it's the same model, but the bigger dataset. And they also make some other points here that if you, for example, if you decrease your learning rate too early or set your weight decay parameter differently, that also hurts you. So on the right here, you see a smaller weight decay initially looks better. So initially you're higher. But through the training, you end up at a worse place than a higher setting right here. And I mean, they make a big point out of this, but who's to say that someone else doesn't come with like a 10 times longer training and figures out that ultimately you start off like this and then maybe goes up super high. So to me, the lessons learned here is pretty much that there's always a way to get more performance out of more compute. And probably there is a way to schedule all of these things because that's combined with decaying learning rate and so on. There's probably a way to schedule these things with the current with this particular method that would end up somewhere here. We just haven't found it yet because it's so complex. I would guess that is the case. Here they make an interesting point that if you decay the learning rate too early, then you also end up at a worse place. So this dashed researcher here, the the noob. So after eight GPU weeks, which come on, what is that? H GPU weeks. That's just H GPUs for a week. I mean, that's nothing, nothing. It looks like this, right? It looks fairly flat. And this researcher now decides to decay the learning rate and that results in this thing here. So decays the learning rate here here and here. Sorry, not here. So decays learning rate here and then it flatens out again and then decays the learning rate again. Ends up at this level. Yet if you train for longer, you can see right here. If you look over eight months, you can see that there is a slight upward trend still and it hasn't converged yet. And you can if you decrease the learning rate only later and always wait for this to fully converge, then you will end up at a better place right here above 70. Again, who's to say that if I just wait here, there isn't a slight upward trend. If I wait for eight GPU years or eight GPU solar system births, then there might be even a better point to decay, finally decay the learning rate and then go up. I mean, again, this this researcher here only takes 0.5 million steps where you take 2 million. So that's the first point. The second point is image net or visual state of the art research is now officially out of the hands of academia. This is it. If you see things like if you see a paper dissing on people that only wait eight GPU weeks to decrease their learning rate for the first time and advocating that you should at least wait until eight GPU months. Actually, they wait twice as long. It's over. That's it. Yeah. Bye bye. Maybe, maybe, you know, you want to do some theory or something. Yeah. Bye bye. What I find interesting is the mistakes. So since on C4 10, they reach like 99.4%, there's only a handful of mistakes that they're still making because it's not that large of a data set and they do classify it. So red in particular, I think, means red is the ground truth label is correct, but green is the machine is correct, and the ground truth label is wrong. And you can see there is a fair number of green things here. Right. So the model says ship and the label says cat and the model says bird and the label says cat. Clearly, this, this would be one weird cat. So it gets to the point where you also have to expect these errors to be in the training set. So it could just be that the model here doesn't necessarily even make those mistakes, but it's just somewhat consistent with the training set in making the mistakes. And also here on ImageNet, they have selected ones where, you know, the model says notebook, but it's actually laptop and the model says mouse, but it's actually spacebar, you know, the model says Alp and it's ski. So, or here, the model, the model says candle, but it's a, this is a dishwasher. What? So you see that the, the, the types of mistakes here, we get to very quirky, very fine grain points in these models. Last thing I want to show, I have never seen these ImageNet 21k images. These are just funky. Like look at that. So here's the, the state of the art previously, I think, said triceratops and the new model now says, bit L says starfish. Good job, bit L. You, wow. Probably the correct label would just be weird. And this, no. Okay, I don't want to rag on this too much. This is a cool paper. I believe this will be the new starting point for a lot of practitioners in when they do visual tasks. I always, as always, invite you to check out the paper. Subscribe to the channel, leave a like, leave a comment if you want. I do read them usually and bye bye. | [{"start": 0.0, "end": 5.76, "text": " Hi there. Today we're talking about big transfer general visual representation"}, {"start": 5.76, "end": 12.64, "text": " learning by Alexander Kolesnikov, Lukas Bair, Jawah Chai and others of Google"}, {"start": 12.64, "end": 20.240000000000002, "text": " Brain. So this paper is basically an application slash engineering paper for"}, {"start": 20.240000000000002, "end": 26.72, "text": " the community and it is about the task of transfer learning for visual tasks."}, {"start": 26.72, "end": 32.879999999999995, "text": " So what does that mean? In a visual task the meaning is basically that the input is an image."}, {"start": 32.879999999999995, "end": 39.68, "text": " So it could be a classifier where you have an image and you have to say that this is a cat."}, {"start": 39.68, "end": 50.96, "text": " Or it could be let's say a medical image of a lung and you have to point out where the defect in"}, {"start": 50.96, "end": 57.44, "text": " the lung is or if there is a defect in the lung or something like this. As we all know this field"}, {"start": 57.44, "end": 65.68, "text": " is pretty much dominated by CNNs by convolutional neural networks that take in these images"}, {"start": 65.68, "end": 72.32, "text": " through many layers of convolution especially residual networks are doing particularly well on"}, {"start": 72.32, "end": 79.28, "text": " these tasks. The problem of course is that in in in some tasks you have lots of data and that's"}, {"start": 79.28, "end": 86.08, "text": " fine because CNNs need lots of data to train. But in some tasks especially these medical tasks"}, {"start": 86.08, "end": 92.72, "text": " you only have like very small database look at the small database. You only have very few labeled"}, {"start": 92.72, "end": 99.04, "text": " samples where the model could learn from and that just is is not enough to learn these big models"}, {"start": 99.04, "end": 105.52000000000001, "text": " that would perform well. So you will have to settle for a less performing model. Now the solution"}, {"start": 105.52, "end": 112.16, "text": " or one of the solutions is transfer learning. In transfer learning what you do is you take a large"}, {"start": 112.16, "end": 119.75999999999999, "text": " data set. For example the image net data set you have this big data set right here and you train"}, {"start": 119.75999999999999, "end": 127.28, "text": " your CNN on that. And then you take that CNN and you do what's called a fine tuning step"}, {"start": 128.32, "end": 134.0, "text": " on this small data set. So you take the CNN that you gained from the large data set as a starting"}, {"start": 134.0, "end": 141.28, "text": " point and then you just train for a few steps. You just kind of adapt it to this final data set that"}, {"start": 141.28, "end": 147.68, "text": " you actually want to train it on. And that usually helps. And why does that help? Because you sort of"}, {"start": 147.68, "end": 154.64, "text": " hope that the the large data set and the small data set are at least somewhat overlapping in"}, {"start": 156.08, "end": 162.08, "text": " in there. So the images in the large data set are somewhat similar to the images in the small"}, {"start": 162.08, "end": 169.44000000000003, "text": " data set. It doesn't need to be super similar but just somewhat. And you hope that the features"}, {"start": 169.44000000000003, "end": 177.76000000000002, "text": " that the CNN learns from the large data set are useful in the small data set. Because then if"}, {"start": 177.76000000000002, "end": 183.28, "text": " that is the case when you find tune on the small data set that's this step down here that's called"}, {"start": 183.28, "end": 190.4, "text": " a fine tuning. When you find tune you can pretty much reuse those features. You only have to adjust"}, {"start": 190.4, "end": 198.48000000000002, "text": " them a little bit. And you just have to learn how to map the features to the output which now is"}, {"start": 198.48000000000002, "end": 203.44, "text": " of course different than in the original task. But you won't have to rediscover the features."}, {"start": 204.24, "end": 209.76, "text": " So that's why transfer learning can help. So the first phase is called pre-training."}, {"start": 210.48000000000002, "end": 215.84, "text": " The second phase is called fine tuning. Now the ultimate goal in this is the following."}, {"start": 215.84, "end": 224.4, "text": " Imagine you have like a giant database of data. All right, this is giant. Look at the size comparison"}, {"start": 224.4, "end": 234.88, "text": " to the others. And so you have this big big database of images. And you train a CNN on that big"}, {"start": 234.88, "end": 243.84, "text": " database of labeled images. Now what you're hoping is that you can do this once and then this one"}, {"start": 243.84, "end": 252.0, "text": " CNN trained on this giant data set will become the starting point for all kinds of small tasks."}, {"start": 252.0, "end": 259.12, "text": " Now so basically you can post this on a repository online and everyone that has a visual task"}, {"start": 259.12, "end": 266.64, "text": " will not train from scratch. But they will basically take this one CNN as a starting point."}, {"start": 266.64, "end": 273.36, "text": " It is very similar to what people are doing right now with Bert. Or generally these transformer"}, {"start": 273.36, "end": 278.40000000000003, "text": " language models. You never want to train them from scratch. You always want to train from a"}, {"start": 278.40000000000003, "end": 285.76, "text": " pre-trained state that someone else has done. Because usually the big work is now shifted to the"}, {"start": 285.76, "end": 294.16, "text": " pre-training. So the goal is to find this one universal starting point for visual learning."}, {"start": 294.16, "end": 302.48, "text": " And of course, no better place to do this than Google. They certainly do have a giant"}, {"start": 302.48, "end": 309.20000000000005, "text": " database of images. They certainly have lots of computation which we're going to see is very"}, {"start": 309.20000000000005, "end": 316.08000000000004, "text": " necessary for something like this. Now they do train three different models. Their model is called"}, {"start": 316.08, "end": 325.28, "text": " BIT and they train three different variants BIT. Small, medium and large. So the L model is trained"}, {"start": 325.28, "end": 337.59999999999997, "text": " on 300 million images. The medium model is trained on 14 million images. So this is the I think"}, {"start": 337.59999999999997, "end": 345.2, "text": " it's called JFT data set. This here is called the ImageNet 21K data set which looks pretty funky."}, {"start": 345.2, "end": 354.0, "text": " It has like objects in front of weird backgrounds and stuff like that. And the small is simply trained"}, {"start": 354.0, "end": 363.12, "text": " on the 1.3 million image net data set. So I mean just look at this. We're in a situation where the"}, {"start": 363.12, "end": 372.56, "text": " small model is pre-trained on image net just for reference. If you had imagined this five years"}, {"start": 372.56, "end": 377.52, "text": " ago, this you would not have maybe you would have guessed it. But it's still impressive."}, {"start": 378.24, "end": 382.8, "text": " So they do release these two models here. The medium and the small one."}, {"start": 383.68, "end": 390.48, "text": " Pre-trained I believe they don't release the large one which maybe that's the price we have to"}, {"start": 390.48, "end": 397.2, "text": " pay for getting the medium and the small one. The fact that now we can use this in their"}, {"start": 397.2, "end": 403.84, "text": " products because they have probably spent the considerable amount of money in doing this. I'm not"}, {"start": 403.84, "end": 408.24, "text": " sure this is a philosophical discussion whether in the interest of science they should really"}, {"start": 408.24, "end": 414.8, "text": " solve because they do give the sort of exact training protocol you just need the money basically."}, {"start": 416.4, "end": 424.71999999999997, "text": " All right but that's not topic of this video. So the models here are all pretty much just residual"}, {"start": 424.72, "end": 434.24, "text": " networks. They're all these resonant 152 I think X4 which means that basically scale the width of"}, {"start": 434.24, "end": 439.76000000000005, "text": " each layer by a number of four from the original resonant architecture and that's pretty much it."}, {"start": 439.76000000000005, "end": 446.08000000000004, "text": " They just this is the architecture. There's nothing really new in this paper. It's the paper just"}, {"start": 446.08000000000004, "end": 453.04, "text": " details what exactly you have to do which things exactly matter when you pre-trained these things and"}, {"start": 453.04, "end": 460.08000000000004, "text": " which ones don't and for therefore I believe it is a it is a pretty good paper and I think"}, {"start": 460.64000000000004, "end": 467.76000000000005, "text": " that these models here the M and S models and maybe someone else trains an L model and releases it."}, {"start": 467.76000000000005, "end": 474.08000000000004, "text": " We'll sort of become the standard like we have in Burt now so whenever you have a visual task you"}, {"start": 474.08000000000004, "end": 481.20000000000005, "text": " just going to start from those in practice. So this I think is mainly relevant for people in"}, {"start": 481.2, "end": 491.2, "text": " practice. All right here you can see the these models first of all excellent excellent not labeling"}, {"start": 491.2, "end": 500.15999999999997, "text": " of your X-axis. Absolutely beautiful. The X-axis I believe is the number of samples per data class."}, {"start": 500.15999999999997, "end": 506.15999999999997, "text": " So now they take their pre-trained model this bit L and they fine tune it on these data sets."}, {"start": 506.16, "end": 515.44, "text": " So ImageNet is one of the tasks they fine tune on or C410, C4100 and so on. And first of all look"}, {"start": 515.44, "end": 521.6800000000001, "text": " on the right side this full thing. This is when you take the entire data set. So often they out perform"}, {"start": 521.6800000000001, "end": 527.76, "text": " they get state of the art on the full data sets. Now they do compare against what they call"}, {"start": 527.76, "end": 535.2, "text": " generalist models. So generalist models are ones that have this particular training protocol where"}, {"start": 535.2, "end": 542.72, "text": " they train on one big giant database and then fine tune to all the other tasks. They do not achieve"}, {"start": 542.72, "end": 549.2800000000001, "text": " state of the art on all data sets in what they call specialist models. The specialist models would"}, {"start": 549.2800000000001, "end": 556.8000000000001, "text": " be such models that have this exact task in mind and therefore they don't care about other tasks."}, {"start": 556.8000000000001, "end": 563.36, "text": " They outperform some of the specialist models but not all of them. So this is not a this is not the"}, {"start": 563.36, "end": 570.32, "text": " new state of the art in everything but it is in this transfer learning regime. And I think even more"}, {"start": 570.32, "end": 577.6800000000001, "text": " important if you see on the left this is in the small label regime. So here you have something"}, {"start": 577.6800000000001, "end": 586.88, "text": " like 100 or 25 or 10 or even 5 labels per class. And if you take 5 labels per class for C410"}, {"start": 586.88, "end": 590.88, "text": " this model. So of course you have to pre-trained it first on the big data set."}, {"start": 590.88, "end": 599.76, "text": " But just taking 5 labels per class you still get like 94% accuracy on C410. And that's pretty good."}, {"start": 599.76, "end": 605.68, "text": " That is pretty impressive especially if you compare it to this baseline model here which is a"}, {"start": 605.68, "end": 611.6, "text": " resonant pre-trained on just the image net data set. So that really shows you the power of"}, {"start": 611.6, "end": 623.84, "text": " pre-trained with full data. So one thing they say is that in their big data set in their 300"}, {"start": 623.84, "end": 632.48, "text": " million images they make sure to remove all the images that then appear in the downstream tasks."}, {"start": 632.48, "end": 639.28, "text": " Right. Because otherwise you it is fairly conceivable that this database here is just scraped"}, {"start": 639.28, "end": 644.56, "text": " from the internet. And of course these tasks are often like C410 are also scraped from the"}, {"start": 644.56, "end": 652.88, "text": " internet and also image net. And it is entirely conceivable of course that the trust data is already"}, {"start": 652.88, "end": 660.88, "text": " here. And they say we remove images. But I think they just remove exact duplicates. So it could"}, {"start": 660.88, "end": 668.56, "text": " still be that you know someone has taken image net and then kind of recoded it into another color"}, {"start": 668.56, "end": 677.5999999999999, "text": " scheme or what not or just compressed it a bit more. And then they find these images on the web."}, {"start": 677.5999999999999, "end": 685.4399999999999, "text": " So it's a little shaky this whole thing because these data sets might just be part of one another."}, {"start": 686.0799999999999, "end": 692.7199999999999, "text": " But you know given the results I do generally believe the improvements here. But yeah."}, {"start": 692.72, "end": 700.08, "text": " So I guess what we need is like people to actually go out with cameras and shoot new pictures for a"}, {"start": 700.08, "end": 707.6800000000001, "text": " new test set. But in any case let's dive into how to pre-trained something like this. So they"}, {"start": 707.6800000000001, "end": 714.96, "text": " divide their findings up in two parts. How to pre-trained and how to fine tune. So how to transfer"}, {"start": 714.96, "end": 723.2800000000001, "text": " to downstream tasks. And the methods they find are surprisingly easy. They say there is two components"}, {"start": 723.2800000000001, "end": 730.48, "text": " to pre-training. The first component is scale. So you have to have a lot of data and a lot of models."}, {"start": 730.48, "end": 736.1600000000001, "text": " And that is a pretty important recognition. So down here they have this ablation where they scale"}, {"start": 736.1600000000001, "end": 744.32, "text": " up the model and scale up the data. So look at this for example. You can see here you have the"}, {"start": 744.32, "end": 749.6, "text": " different data sets to pre-trained on. So this is the small data set, the medium data set,"}, {"start": 749.6, "end": 756.96, "text": " and the large data set. So in this direction you have data set size. Then here you have accuracy."}, {"start": 758.48, "end": 767.6, "text": " Again I guess we can understand accuracy. That's fine. I'm Nick Piquina. And there we have the"}, {"start": 767.6, "end": 775.84, "text": " different models. Now the larger the dot here is the larger the model architecture. And you can see"}, {"start": 775.84, "end": 784.64, "text": " within the individual bins, the larger the model, the better performance you usually get. But"}, {"start": 785.44, "end": 792.32, "text": " as you can see like here, this improvement in the large models isn't as much as when you have"}, {"start": 792.32, "end": 798.96, "text": " much data. And you can also see by the slope of the line here, the larger amounts of data"}, {"start": 799.5200000000001, "end": 807.2800000000001, "text": " help more when you have larger models. So only scaling up the the only scaling up the"}, {"start": 807.84, "end": 814.48, "text": " the data is not as effective as scaling up the data and the model at the same time."}, {"start": 815.44, "end": 821.9200000000001, "text": " And in some cases like in this small architecture here, it actually hurts to incorporate more"}, {"start": 821.92, "end": 828.4799999999999, "text": " data. At least they say that. And you can also see that here. And here it just doesn't help as"}, {"start": 828.4799999999999, "end": 834.64, "text": " much anymore if you incorporate more data. So if your model is too small, you can't handle the"}, {"start": 834.64, "end": 839.5999999999999, "text": " big data. Of course there are weird effects like here the performance goes down and then up with"}, {"start": 839.5999999999999, "end": 845.52, "text": " the larger data. So this might actually be an effect of the images in these data sets being"}, {"start": 845.52, "end": 853.68, "text": " somewhat qualitatively different also with respect to the task that you are training for."}, {"start": 854.4, "end": 862.16, "text": " But in generally holds that you need a combination of data set size and model size to go up."}, {"start": 862.96, "end": 869.76, "text": " And this I think might be an indication of where we are in Belkin's double descent curve."}, {"start": 869.76, "end": 878.56, "text": " So if you look at the researcher Mikhail Belkin and others people also research in this area,"}, {"start": 878.56, "end": 889.76, "text": " they have this sort of empirical finding and hypothesis sort of that if you plot a graph and here"}, {"start": 889.76, "end": 897.28, "text": " is the number of parameters when relation to the data set size. It's a number of parameters in"}, {"start": 897.28, "end": 907.92, "text": " relation to size of data. And here is your validation loss. Then what happens as you have very"}, {"start": 907.92, "end": 913.52, "text": " little parameters, you can add more parameters to your model to get better validation loss."}, {"start": 913.52, "end": 919.68, "text": " This is, you know, we get a better model and we train that and we get better. And then at some"}, {"start": 919.68, "end": 924.8, "text": " point you'll start to overfit. You know, we've all learned this in our general machine learning"}, {"start": 924.8, "end": 930.88, "text": " course. And there is a point here, the, what is called the interpolation threshold, where you have,"}, {"start": 931.12, "end": 937.12, "text": " this is one. So the number of parameters is equal to the number of data points, which is just"}, {"start": 937.12, "end": 941.5999999999999, "text": " interpolating your training data. Sorry, the data point here, that's train."}, {"start": 944.64, "end": 954.3199999999999, "text": " But then the discovery sort of is that this comes down again and it stays down. So as you go up"}, {"start": 954.32, "end": 960.08, "text": " in number of data points, sorry, number of parameters with the same data set, you're perfectly"}, {"start": 960.08, "end": 965.84, "text": " fitting the training data set. You passed the number of data points in your, in your model."}, {"start": 965.84, "end": 972.4000000000001, "text": " But still your validation loss comes down and there's various hypotheses why this could happen."}, {"start": 972.4, "end": 983.6, "text": " And here we find ourselves maybe in this sort of situation where if you have a model right here,"}, {"start": 984.9599999999999, "end": 991.04, "text": " and you want to scale it, you want to add more data, you can't just keep the model constant"}, {"start": 991.04, "end": 998.16, "text": " because if you add more data, that will shift you to the left here because you add more data,"}, {"start": 998.16, "end": 1002.7199999999999, "text": " but you keep the, the number of parameters the same. So this number will shift to the left and"}, {"start": 1002.7199999999999, "end": 1009.12, "text": " you actually go up in your validation loss. So maybe this is actually what's happening right here."}, {"start": 1010.0, "end": 1016.88, "text": " The fact that the model is too small, this is just a hypothesis by me. So if you want to"}, {"start": 1016.88, "end": 1022.9599999999999, "text": " up your number of data points, you also have to up your number of parameters. And that will keep"}, {"start": 1022.96, "end": 1030.08, "text": " it going. And maybe these models here are more on this side of this interpolation threshold."}, {"start": 1030.32, "end": 1037.04, "text": " And the models where it doesn't happen might be more over here. Though that is a big thing to"}, {"start": 1037.04, "end": 1048.4, "text": " assume. Maybe not. Now that I think about it, since they have even more parameters here,"}, {"start": 1048.4, "end": 1056.4, "text": " they would be even more here somewhere. So maybe you add a bunch of data. It's just not as bad."}, {"start": 1058.0, "end": 1060.64, "text": " There might be some weird interactions here."}, {"start": 1063.8400000000001, "end": 1071.92, "text": " Like this. Who knows? Let's just skip this. In any case, the message here is you need more model"}, {"start": 1071.92, "end": 1081.44, "text": " and more data at the same time. All right. Then there is a second message, a second recipe for pre-training."}, {"start": 1084.88, "end": 1094.48, "text": " There we are. The second method is group normalization and weight standardization. So they criticize"}, {"start": 1094.48, "end": 1102.0, "text": " batch norm. Batch norm has of course been used a lot. That is where if you have a batch of data."}, {"start": 1103.44, "end": 1109.2, "text": " And you put it. So these are all data points. You put it through your layers and it has some"}, {"start": 1109.2, "end": 1114.64, "text": " intermediate representation. What you want to do is you want to calculate sort of the mean and"}, {"start": 1114.64, "end": 1122.72, "text": " variance of your data in each of the features. And then make it such that it's nice mean one and"}, {"start": 1122.72, "end": 1130.64, "text": " standard deviation. So mean zero and standard deviation of one. That is called batch norm. But of"}, {"start": 1130.64, "end": 1138.0, "text": " course, it is dependent on your batch size. So it is dependent on how many data points you have,"}, {"start": 1138.0, "end": 1144.24, "text": " because that's how well you can estimate these mean and variance parameters. And what people"}, {"start": 1144.24, "end": 1151.68, "text": " do nowadays is they take these batches and they group them into different groups. And they distribute"}, {"start": 1151.68, "end": 1160.3200000000002, "text": " those groups onto many, many machines, which is called data parallelism, especially with TPUs"}, {"start": 1160.3200000000002, "end": 1168.24, "text": " nowadays. You can just distribute everything to so many TPUs. I believe they say they distribute"}, {"start": 1168.24, "end": 1178.88, "text": " to something like 500 TPUs, which and so they have a batch size of I think 4,000 and they distribute"}, {"start": 1178.88, "end": 1186.5600000000002, "text": " to 500 TPUs. So that leaves them with eight, eight samples per batch. So this is eight. And eight"}, {"start": 1186.5600000000002, "end": 1191.6000000000001, "text": " is just not very good for batch norm. And if you have to, if you want to circumvent that you need"}, {"start": 1191.6000000000001, "end": 1198.5600000000002, "text": " to in each layer globally sync with all of the other workers, your batch norm parameters. And that"}, {"start": 1198.5600000000002, "end": 1207.0400000000002, "text": " slows you down. So people have gone around this using what they call group normalization and weight"}, {"start": 1207.04, "end": 1213.04, "text": " standardization. So these two techniques of weight standardization is a is a addition to group"}, {"start": 1213.04, "end": 1220.0, "text": " normalization. They don't require the other samples in the batch. They work on a per sample"}, {"start": 1220.0, "end": 1230.3999999999999, "text": " basis and they normalize the features within groups of each channel. So the group normalization"}, {"start": 1230.4, "end": 1237.3600000000001, "text": " groups together different features within a sample and then normalizes across that. And the weight"}, {"start": 1237.3600000000001, "end": 1244.0, "text": " standardization is a bit like standardizing the features, but it standardizes the weights to be"}, {"start": 1244.0, "end": 1252.3200000000002, "text": " of a normal distribution. And justifies to say these are standard techniques that you can build in."}, {"start": 1252.3200000000002, "end": 1259.8400000000001, "text": " And they allow you to not have to synchronize constantly between your workers at the training time,"}, {"start": 1259.84, "end": 1266.8799999999999, "text": " which makes everything a lot faster. And also not a problem that you just have eight samples per worker."}, {"start": 1268.1599999999999, "end": 1276.1599999999999, "text": " All right. So that's what they do. They do large data, large models, and group normalization with"}, {"start": 1276.1599999999999, "end": 1284.24, "text": " weight standardization. That's how they pre-trained. And then how do they fine tune? They say they have a"}, {"start": 1284.24, "end": 1290.0, "text": " rule to select hyperparameters. They call them bit hyper rule. And that's just sort of a formula"}, {"start": 1292.24, "end": 1299.28, "text": " of how you have one hyperparameter. So you have one, I guess it's a hyper hyperparameter."}, {"start": 1299.28, "end": 1306.4, "text": " And that hyper hyperparameter you run through their rule. And the rule will tell you what each"}, {"start": 1306.4, "end": 1312.64, "text": " of the hyperparameters should be. So it's maybe it's like a lookup table basically. It's oh,"}, {"start": 1312.64, "end": 1319.8400000000001, "text": " you set this one number and we give you the rest of the hyperparameters. And that one rule works"}, {"start": 1319.8400000000001, "end": 1326.3200000000002, "text": " pretty well. So you only have to find for fine tuning. You only have to grid search over one"}, {"start": 1326.3200000000002, "end": 1335.1200000000001, "text": " hyperparameter. It's not really grid anymore, is it? And then they basically decide on the"}, {"start": 1335.12, "end": 1344.4799999999998, "text": " training schedule length resolution and whether to do mix up regularization. Mix up is a technique"}, {"start": 1344.4799999999998, "end": 1352.3999999999999, "text": " that can help when you have very little data. And what it does is it interpolates between data"}, {"start": 1352.3999999999999, "end": 1357.4399999999998, "text": " points and also trains on kind of like data points from half this class and half that class"}, {"start": 1357.44, "end": 1367.44, "text": " just to make more data available. But they all have this packed into this rule. And they of course"}, {"start": 1367.44, "end": 1374.24, "text": " the exact settings of this rule are presented. So you can look it up. Then they have a data pre-processing,"}, {"start": 1375.1200000000001, "end": 1380.0800000000002, "text": " resize the image to a square, crop out small random square, randomly horizontally flip the image"}, {"start": 1380.0800000000002, "end": 1385.04, "text": " at training time. So they basically describe a standard training protocol here. And I want to go"}, {"start": 1385.04, "end": 1395.68, "text": " mix it to up up too much. The only thing they say surprisingly we do not use any form, any of the"}, {"start": 1395.68, "end": 1400.72, "text": " following forms of regularization during downstream tuning, wait to K to zero, wait to K to initial"}, {"start": 1400.72, "end": 1409.52, "text": " parameters or drop out. I think they only use wait decay during pre-training and that's it."}, {"start": 1409.52, "end": 1420.8799999999999, "text": " So let's look at some of the graph. We've already seen some. Here is where they pretty much outperform"}, {"start": 1420.8799999999999, "end": 1428.32, "text": " the generalist, these generalist models on all of these tasks, including this visual task adaptation"}, {"start": 1428.32, "end": 1434.08, "text": " benchmark. I've made a video about this. This is a benchmark that includes 19 different visual tasks"}, {"start": 1434.08, "end": 1441.04, "text": " from all over the place and they have significant improvement here as you can see. They do not always"}, {"start": 1441.04, "end": 1447.4399999999998, "text": " outperform these specialist models but as you can see they outperform for example this on the"}, {"start": 1447.4399999999998, "end": 1458.96, "text": " flowers dataset and they come pretty close. And here you can also see how much they improve"}, {"start": 1458.96, "end": 1465.52, "text": " when pre-training on a larger dataset. So far people have basically pre-trained on this"}, {"start": 1465.52, "end": 1472.08, "text": " image net dataset and now that they pre-trained on the larger one of course they gain a lot of"}, {"start": 1472.08, "end": 1481.8400000000001, "text": " performance and the largest one isn't even in this in this table. So what I finally want to look"}, {"start": 1481.8400000000001, "end": 1488.72, "text": " at is this visual task adaptation benchmark. This consists of 19 tasks and they're divided"}, {"start": 1488.72, "end": 1495.28, "text": " into natural tasks which are kind of natural images and then specialized tasks which are,"}, {"start": 1495.28, "end": 1501.28, "text": " let's say, the medical images are not really natural and then structure tasks and the structure"}, {"start": 1501.28, "end": 1507.76, "text": " tasks isn't simply labeling or locating something. It is task where you have to maybe reason"}, {"start": 1507.76, "end": 1516.8, "text": " about something. So let's say there is an image and there is a cup right here and there is a glass"}, {"start": 1516.8, "end": 1523.52, "text": " right here and the question is what's to the left of the glass and there's a bunch of other stuff"}, {"start": 1523.52, "end": 1530.96, "text": " around here and you have to say the cup. So it sort of requires a structure to understand"}, {"start": 1530.96, "end": 1539.2, "text": " the image and you can see the main performance boost here comes in the natural images which is"}, {"start": 1539.2, "end": 1547.8400000000001, "text": " to be expected. So you only get what you feed in and this 300 million image dataset. I'm pretty"}, {"start": 1547.8400000000001, "end": 1555.2, "text": " sure that's just a web scrape of photos or mainly photos. So the main improvement you're going"}, {"start": 1555.2, "end": 1560.8, "text": " to get is on pictures that are similar to that as we said at the beginning and these natural"}, {"start": 1560.8, "end": 1568.64, "text": " tasks have images like that and you can see that the model here improves extremely in that category,"}, {"start": 1568.64, "end": 1575.76, "text": " improves slightly in this specialized thing and only improves a little bit in the structured"}, {"start": 1575.76, "end": 1585.8400000000001, "text": " tasks. So this as I said is to be expected. Just know if you use this model, know what is in there."}, {"start": 1585.8400000000001, "end": 1592.48, "text": " You have to know what it does, what it does well. It does well on natural images that are similar"}, {"start": 1592.48, "end": 1604.0, "text": " to what it was pre-trained on. Okay, so they do have some analysis here and we've already"}, {"start": 1604.96, "end": 1616.16, "text": " went to most of them. I find this to be pretty pretty impressive. So they say when they apply the"}, {"start": 1616.16, "end": 1623.28, "text": " standard computational budget of image net pre-training, when they scale up to the larger dataset,"}, {"start": 1623.28, "end": 1629.2, "text": " it seems detrimental. As you can see right here, the performance actually goes down when you go"}, {"start": 1629.2, "end": 1636.0800000000002, "text": " to the larger dataset. Only if you train longer than you're improving. At the axis labeling,"}, {"start": 1636.08, "end": 1647.4399999999998, "text": " it's just amazing here. Standard, long, longer. How long you train for longer? Thanks. But I guess"}, {"start": 1647.4399999999998, "end": 1655.76, "text": " the point is taken that you have to invest more computation along with your bigger model and"}, {"start": 1655.76, "end": 1662.6399999999999, "text": " bigger dataset. Sorry, it's the same model, but the bigger dataset. And they also make some other"}, {"start": 1662.64, "end": 1670.96, "text": " points here that if you, for example, if you decrease your learning rate too early or set your"}, {"start": 1670.96, "end": 1677.44, "text": " weight decay parameter differently, that also hurts you. So on the right here, you see a smaller"}, {"start": 1677.44, "end": 1685.0400000000002, "text": " weight decay initially looks better. So initially you're higher. But through the training, you end up"}, {"start": 1685.0400000000002, "end": 1692.0800000000002, "text": " at a worse place than a higher setting right here. And I mean, they make a big point out of this,"}, {"start": 1692.08, "end": 1698.72, "text": " but who's to say that someone else doesn't come with like a 10 times longer training and figures out"}, {"start": 1698.72, "end": 1709.28, "text": " that ultimately you start off like this and then maybe goes up super high. So to me, the lessons"}, {"start": 1709.28, "end": 1716.6399999999999, "text": " learned here is pretty much that there's always a way to get more performance out of more compute."}, {"start": 1716.64, "end": 1722.88, "text": " And probably there is a way to schedule all of these things because that's combined with decaying"}, {"start": 1722.88, "end": 1727.76, "text": " learning rate and so on. There's probably a way to schedule these things with the current"}, {"start": 1728.64, "end": 1734.96, "text": " with this particular method that would end up somewhere here. We just haven't found it yet"}, {"start": 1734.96, "end": 1742.4, "text": " because it's so complex. I would guess that is the case. Here they make an interesting point that"}, {"start": 1742.4, "end": 1749.68, "text": " if you decay the learning rate too early, then you also end up at a worse place. So this dashed"}, {"start": 1749.68, "end": 1757.8400000000001, "text": " researcher here, the the noob. So after eight GPU weeks, which come on, what is that?"}, {"start": 1757.8400000000001, "end": 1767.1200000000001, "text": " H GPU weeks. That's just H GPUs for a week. I mean, that's nothing, nothing. It looks like this,"}, {"start": 1767.12, "end": 1772.8799999999999, "text": " right? It looks fairly flat. And this researcher now decides to decay the learning rate and that"}, {"start": 1772.8799999999999, "end": 1781.6, "text": " results in this thing here. So decays the learning rate here here and here. Sorry, not here. So decays"}, {"start": 1781.6, "end": 1786.7199999999998, "text": " learning rate here and then it flatens out again and then decays the learning rate again. Ends up at"}, {"start": 1786.7199999999998, "end": 1794.6399999999999, "text": " this level. Yet if you train for longer, you can see right here. If you look over eight months,"}, {"start": 1794.64, "end": 1800.96, "text": " you can see that there is a slight upward trend still and it hasn't converged yet. And you can"}, {"start": 1802.16, "end": 1808.4, "text": " if you decrease the learning rate only later and always wait for this to fully converge,"}, {"start": 1808.4, "end": 1817.2800000000002, "text": " then you will end up at a better place right here above 70. Again, who's to say that if I just"}, {"start": 1817.28, "end": 1825.52, "text": " wait here, there isn't a slight upward trend. If I wait for eight GPU years or eight GPU"}, {"start": 1826.96, "end": 1834.32, "text": " solar system births, then there might be even a better point to decay, finally decay the learning rate"}, {"start": 1834.32, "end": 1842.3999999999999, "text": " and then go up. I mean, again, this this researcher here only takes 0.5 million steps where you take"}, {"start": 1842.4, "end": 1850.3200000000002, "text": " 2 million. So that's the first point. The second point is image net or visual state of the art"}, {"start": 1850.3200000000002, "end": 1857.76, "text": " research is now officially out of the hands of academia. This is it. If you see things like"}, {"start": 1858.48, "end": 1864.24, "text": " if you see a paper dissing on people that only wait eight GPU weeks to decrease their learning"}, {"start": 1864.24, "end": 1871.92, "text": " rate for the first time and advocating that you should at least wait until eight GPU months."}, {"start": 1871.92, "end": 1882.48, "text": " Actually, they wait twice as long. It's over. That's it. Yeah. Bye bye. Maybe, maybe, you know,"}, {"start": 1882.48, "end": 1890.48, "text": " you want to do some theory or something. Yeah. Bye bye. What I find interesting is the mistakes."}, {"start": 1890.48, "end": 1897.92, "text": " So since on C4 10, they reach like 99.4%, there's only a handful of mistakes that they're still"}, {"start": 1897.92, "end": 1905.1200000000001, "text": " making because it's not that large of a data set and they do classify it. So red in particular,"}, {"start": 1905.1200000000001, "end": 1916.48, "text": " I think, means red is the ground truth label is correct, but green is the machine is correct,"}, {"start": 1916.48, "end": 1921.68, "text": " and the ground truth label is wrong. And you can see there is a fair number of green things here."}, {"start": 1921.68, "end": 1931.2, "text": " Right. So the model says ship and the label says cat and the model says bird and the label says cat."}, {"start": 1931.2, "end": 1940.96, "text": " Clearly, this, this would be one weird cat. So it gets to the point where you also have to"}, {"start": 1940.96, "end": 1946.3200000000002, "text": " expect these errors to be in the training set. So it could just be that the model here"}, {"start": 1947.04, "end": 1951.3600000000001, "text": " doesn't necessarily even make those mistakes, but it's just somewhat consistent with the training"}, {"start": 1951.36, "end": 1957.52, "text": " set in making the mistakes. And also here on ImageNet, they have selected ones where,"}, {"start": 1958.32, "end": 1963.12, "text": " you know, the model says notebook, but it's actually laptop and the model says mouse, but it's"}, {"start": 1963.12, "end": 1974.8, "text": " actually spacebar, you know, the model says Alp and it's ski. So, or here, the model, the model says"}, {"start": 1974.8, "end": 1988.96, "text": " candle, but it's a, this is a dishwasher. What? So you see that the, the, the types of mistakes here,"}, {"start": 1988.96, "end": 1995.9199999999998, "text": " we get to very quirky, very fine grain points in these models. Last thing I want to show,"}, {"start": 1995.92, "end": 2005.52, "text": " I have never seen these ImageNet 21k images. These are just funky. Like look at that. So here's"}, {"start": 2005.52, "end": 2012.4, "text": " the, the state of the art previously, I think, said triceratops and the new model now says,"}, {"start": 2013.1200000000001, "end": 2022.0800000000002, "text": " bit L says starfish. Good job, bit L. You, wow. Probably the correct label would just be weird."}, {"start": 2022.08, "end": 2031.6, "text": " And this, no. Okay, I don't want to rag on this too much. This is a cool paper. I believe this"}, {"start": 2031.6, "end": 2038.48, "text": " will be the new starting point for a lot of practitioners in when they do visual tasks. I always,"}, {"start": 2038.48, "end": 2043.84, "text": " as always, invite you to check out the paper. Subscribe to the channel, leave a like, leave a comment"}, {"start": 2043.84, "end": 2055.04, "text": " if you want. I do read them usually and bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=tjbEVY5XIk0 | Divide-and-Conquer Monte Carlo Tree Search For Goal-Directed Planning (Paper Explained) | When AI makes a plan it usually does so step by step, forward in time. But often it is beneficial to define intermediate goals to divide a large problem into easier sub-problems. This paper proposes a generalization of MCTS that searches not for the best next actions to take, but for the best way to sub-divide the problem recursively into problems so tiny that they can each be solved in a single step.
Paper: https://arxiv.org/abs/2004.11410
Site: https://sites.google.com/view/dc-mcts/home
Abstract:
Standard planners for sequential decision making (including Monte Carlo planning, tree search, dynamic programming, etc.) are constrained by an implicit sequential planning assumption: The order in which a plan is constructed is the same in which it is executed. We consider alternatives to this assumption for the class of goal-directed Reinforcement Learning (RL) problems. Instead of an environment transition model, we assume an imperfect, goal-directed policy. This low-level policy can be improved by a plan, consisting of an appropriate sequence of sub-goals that guide it from the start to the goal state. We propose a planning algorithm, Divide-and-Conquer Monte Carlo Tree Search (DC-MCTS), for approximating the optimal plan by means of proposing intermediate sub-goals which hierarchically partition the initial tasks into simpler ones that are then solved independently and recursively. The algorithm critically makes use of a learned sub-goal proposal for finding appropriate partitions trees of new tasks based on prior experience. Different strategies for learning sub-goal proposals give rise to different planning strategies that strictly generalize sequential planning. We show that this algorithmic flexibility over planning order leads to improved results in navigation tasks in grid-worlds as well as in challenging continuous control environments.
Authors: Giambattista Parascandolo, Lars Buesing, Josh Merel, Leonard Hasenclever, John Aslanides, Jessica B. Hamrick, Nicolas Heess, Alexander Neitz, Theophane Weber
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. What you're seeing here is a divide and conquer Monte Carlo tree search in action. This is a planning algorithm that plans in a kind of an unconventional fashion. So we're going to explore this today in this paper, dividing conquer Monte Carlo tree search for goal directed planning by Jamba Tista, Parascondolo and Lars Poozing and list of other authors. And I believe this is from Deep Mind and Max Plunk and Eta and yeah, that's it. All right. So what does this thing do? It is a planning algorithm and planning might be not really familiar for you. So let's say you are in this room and or this set of rooms right here. There's a bunch of walls and you are up here and you want to reach the goal down here. So first of all, this is a goal directed problem. Right here it says goal directed. Goal directed means that you give the algorithm a goal to reach and this could be a different goal each time you run the algorithm. Right. So you give it a goal to reach. Then the second thing here we see is planning. So it is a planning algorithm. What does planning mean? Planning means if you if you're traditionally reinforcement learning, you would think, ah, I'm just going to go ahead and run my my agent here and maybe you can move in the four different directions. Run my agent here, do some things right. Maybe I hit a wall, I get a negative reward at try again. In planning, you don't have to move initially. What you can do is think about moving and you can think ahead of what's going to happen. And that's usually because you have some sort of model what happens. This is very famous applied in, for example, Alpha Go or Alpha zero where you have you know, if I move to the right here, I'm going to be here. Right. So you will know once you've reached a goal, right. If you're if I'm here, I go down, I reach the goal. Cool. So you can think all of this without actually moving in the environment. You can think yourself ahead. What would happen if I did certain things and that in turn also means that you can think ahead multiple different paths. So you can think ahead what would happen if I move right. What would happen if I moved down and then you can think in the next layer, if I move right, what would happen if I moved right again? What would happen if I moved down instead? So you can easily see the planning problem becomes a three search problem. In this first, in this case, we've done a breadth first search right. And eventually you'll see that this will get you to the goal. So this this breadth first search or maybe you want to employ a depth first search will ultimately get you to the goal. We can represent this as a search tree. So you're here in a particular state and you have a bunch of actions in this case for to move left up down. All right. And you can choose any of them and you will get into a new state. And from each of those, you could choose any again. And you can think ahead all of this. You can construct this entire tree. And one of these branches will lead you to the goal. Promise. What is the problem? The problem is if the path to the goal here is let's say D steps long, then this tree here is going to be D layers deep. And in our case, that means we'll have four to the D nodes in that tree before we even reach the goal. And that is just a long, long or a big tree. And we can't construct all of it. So algorithms have come along, for example, the A star algorithm where you can incorporate something like a heuristic and the heuristic would be, well, it's generally good if I'm close to the goal in L2 distance. So you would not build the entire tree here, but you would prefer nodes that will bring you towards this heuristic. So this node down here is closer to the green node in terms of L2 distance. And this node down here is even closer, but then you're kind of stuck. So A star will explore a bit probably along this wall here. And once you're here, you have a clear path again, right? So you can simply take the actions that minimize this L2 distance. So this will already get you to a really good point. Monte Carlo tree search as it was employed in AlphaGo or AlphaStar has a similar structure where it after a certain while it stops and it evaluates a heuristic to say what's the value here. And so on. So it is in for some problems and even better method of constructing the search tree in a way where you don't get overblown by the number. So the Monte Carlo search tree in this algorithm refers to the fact that we are generalizing Monte Carlo tree search from the let's say the AlphaGo paper. So what's the idea here? So far we've known everything. The idea is the following. If I had an Oracle, if I am the master here and I can tell the agent agent, look, I guarantee you that this state right here in the middle, you will pass that state. If you want to reach the goal, you will pass this for sure. If I tell this to the agent, now what can the agent do? The agent say, oh, okay, if I know that, I can simply I don't have to search for a way to the goal. I'd much rather search for a way from my start point to that point where I know that I'm guaranteed to be at some place and then I can search also from a way from there to the goal. So this now, remember our path was D steps long for the original problem. This is now let's say D half long, each of these paths and that means we just construct two trees. Each one of them is going to be 4 to the D half and the other one is also 4 to the D half. And if we add them, that is much smaller than the original 4 to the D tree that we build. So right there, we have subdivided our problem into two sub problems and each of them are much easier than the original problem. This paper basically does this recursively. So it will subdivide the problem by proposing some middle state where you are going to be at some point for sure and that for sure we're going to take a look at. And then for each of those problems, again, it will try to subdivided into sub problems and therefore recursively solve the sub problems until they're small enough that they can be basically solved in one step. So that's the big idea here. And this is illustrated in this point right here. So you are in this S0, the start state and you want to go to this S infinity, the goal state in your case. What this paper does is it proposes to split the problem here in the middle and then simply solve the two problems recursively. Now what is a bit confusing right here is that it is the planning already is a tree search. Right? So a plan is like a tree. But we are searching over plans. So we're searching for the best plan, which means that we are searching over trees and that search itself is a tree search. So the search itself is a problem where we go down one route and then oh no and then we maybe go down another route and here and then here. So the search is a tree. So we're now tree searching over trees. That's the kind of tricky thing to remember. So each of these plans, even if it's half, if it's only half done, like this is only half a plan, we don't know what's going to happen in here. This half a plan is a node in the tree that we're searching over and then it splits, it splits as you can see here into two sub problems. The two sub problems also are nodes in that search tree. So you see that this top thing here would correspond to this node even though in itself it is a plan, a tree string in this case and each of the two sub problems would become these, protect these nodes in the search tree. So keep that in mind as we go through this paper, it is very easy to get confused in this respect. The algorithm is pretty simple in this case. So this algorithm rests on this traverse procedure. So we're going to traverse this, what they call these or nodes. So they divide the problem into end nodes and or nodes. I don't believe that's particularly necessary for us to think about, but here's how this works. So they traverse the ornode s to s prime. This is simply, again, this is a node, but the node is a path from s to s prime, where we don't know yet what happens in between. So what we'll do is we'll run this procedure select and select it, you can see it outputs an s prime and the s prime is going to be a node here somewhere in the middle where the model says this is your subdivision point. And then it will recursively traverse the left and the right branch of this tree. So it will subdivide the problem into two problems and then recursively call this traverse. You see that's the function that we're defining. Call this traverse function on these. So it will subdivide this problem into these problems and for the next step, again, it will eat for each of the problems, propose a middle node and subdivide it further and so on until you have a full plan. At some point you're going to have a full plan. Now here again is the important thing to remember. This is just one branch of the search. This is just one possible plan and we are going to do a three search over these plans. So this select function here, it has returned this s prime, but it could have returned any point between s and s double prime. So let's in it, this is just one branch. I'm going to, I don't have space to draw here, but I'm going to draw it down here again. So it could have also returned this particular node here. It's a different s prime and then subdivide it the problem into different problems and then of course those problems are now different. So they would be subdivided differently again and so on. So this top part here is just, if you consider this thing here, your root node, this is where you search from, this top part is just one node, one branch in the tree, but we could also subdivide like this and then that would be another branch in your tree. And this tree here is the thing that you're searching over. So important to keep, keep this in mind, we're searching over these different possibilities. Now the rest of this algorithm here is basically the carryover from Monte Carlo tree search. And I don't want to go into that in this video, but if you're interested in, you know, how to actually implement this, you'll have to go look at MCTS and then all of this just carries over from that algorithm because you have to keep estimates of value and visit counts in this tree and so on. And also you have some sort of a value estimator. But yeah, I'm mainly concerned with how the tree is constructed right here. So basically here's the, here's the difference between a, between the Monte Carlo tree search and the divide and conquer Monte Carlo tree search. In Monte Carlo tree search, ignore the yellow one for now. You're in the green position and you want to go to the blue position. In Monte Carlo tree search, what you're searching over is the next action to take. In this case, you have four possible actions to take. That's what you're searching over and that's what you build your search tree from. Your search tree is going to be which action to take, right? Up, left, down or right. That's why you have four actions. In, in divide and conquer Monte Carlo tree search, you're not searching over actions. You are searching over the best way to subdivide this problem, right? You're searching over which of these all the black squares should I use to subdivide my problem into subproblems. And that's what you build your search tree from. So naturally you, you can already see, what kind of possibilities do we have here to subdivide this problem? I drew one white square, but any of the black squares are candidates to subdivide this problem, right? Any of the, of the black squares could be potential subdivisions. And this is what we search over. So in, in Monte Carlo tree search, we search over the actions, which gives us this four to the D tree. But in divide and conquer, we're searching over all the ways to subdivide the problem. And as you can see there, that are many, many more possibilities. So from this first starting node, we have like, like a hundred possibilities to subdivide this problem into two problems, right? And each of those, again, if you now you've decided on a subdivision, let's say you decided on this one right here, you say, I want to pass through that point on my way to the goal. Now you have to subdivide that in this subproblem into two problems. Again, every possible black square, I'm not saying which one is good, good thing to subdivide the problem. I'm just asking what is a possible candidate? Every single black square here is a possible candidate for a path from here to here, right? And again, for this particular subproblem, you have to do the same thing. So the, the search tree here, even though we said before, it is, this one is very deep. And this one is probably only log D, sorry, log 2, D, deep. It with is going to be enormous. And that is the catch, right? The catch, this is not a method that is like a magic pill. The catch is even though your tree is not as deep, it is much, much wider. And it is intuitive, right? Because you still have to have the ability to construct any possible plan. So your tree is going to have as many nodes as the original Monte Carlo tree search tree. If you were to fully expand it, right? So it's your trading of depth for width here. I hope, I hope that's a bit clear. So your entire, your entire promise of this method is going to be, can you from all of these possibilities? So from all of these, you don't even, you don't even want to go and search even one layer deep through all of these. You don't even want to consider all of them, right? You want to search in this tree, you want to limit your search to very particular ways of subdivision here. If you can do that efficiently, if you can pick efficiently candidates to subdivide, then this could be a successful thing because your deep is now not as, your tree is not as deep as the original search tree would have been. And you can limit the width effectively to only very few candidates. So here we could, for example, make a heuristic that will always only pick squares that are kind of on this straight path to the goal. So everything rests on how you do this select action. I am this thing here. The entire algorithm relies on the fact that you can select effectively, select in between states where you're pretty sure that the algorithm will have to pass through there because the worse you make these predictions, the worse your tree search is going to work. And what they do, of course, is they use deep learning as you might have guessed to do that. So they have, they will have a model that for a particular start and end goal will give them a probability distribution across candidates. Now everything that's black here also has probability mass, but it just so small you can't see. And these blue ones are the lighter blue, the more probable this model thinks that this is going to be an in between state. Now the tree search can now limit itself effectively to only the ones here with the highest probability. So we select the ones with the highest probability and we'll only search plans that have these as the first possible subdivisions. Again, we're searching over plans. So we're searching over ways to subdivide the problem into smaller problems. That is our search space. So once we've decided on one of them, let's say here the yellow one, again, we have to evaluate that model for each of the subproblems. And this, this is kind of a step that's missing here. So in between here, there would be a model evaluation that would again tell you which of these in between states were probable subdivision candidates. And then you would select again one of those in that particular search branch. And in a different search branch, right, you're searching over these things. In a different search branch, you would select a different one and see is this possibly a better way to subdivide the problem. And so on. So the question of course is how do you train this model? How do you train a model that gives you good candidates for subdivision? And the answer here is a comes from the idea of hindsight experience replay. So let's say again, you are here and you want to go here and you're not very good at it initially. So they train this model as I understand along with letting their agent act in this environment. So the agent uses the model to plan, but initially it's not very good. So maybe the agent will fail a lot of times. So instead of going to the blue square, it will reach this white square right here. It will go here, here, and here. We'll reach the white square. And instead of saying, I failed what you can do, and this is the idea of hindsight experience replay is to say, well, I did fail, but I did reach something, right? I have reached a thing. And it's actually possible that that thing could have been the goal, but this particular episode, this was the goal. Remember, the goal changes every time. It's a goal directed policy. So it says, well, this could have been the goal, possibly. So if I just pretend this was the goal, then I have a training example for a successful run. So the hindsight experience replay basically pretends that what you have achieved, even if you failed, was your actual goal. And that gives you a positive training example for an episode with that as a goal. And this could have been the goal because the goal is chosen at random. So this gives you a good training example. Now this paper just generalizes the hindsight experience replay or applies to their particular framework. And they say, well, if I reach this thing, that means any point on this path is a good candidate for subdividing the path. Because I did actually reach the point. Remember, the goal is to propose a point where your four sure are going to pass through. Now, since I've taken this path to this goal, I have passed through any of the squares in between. And so these are my possible sub candidates. And at all other black squares, I don't want that. So now I have a classifier I can train. I can say, any of these squares on my path are good squares to subdivide. And any not on my path are bad ones. They go a step further, I believe. And they actually say, we're, so if this was M steps, we're actually going to take the particular square that is reached after M half steps. So the exact middle point of that path is going to be our training example for subdivision. So you have a classifier that has exactly one, one target to train. So this you train along with acting in the environment. And of course, your model for proposing subdivisions is going to be better and better and better and better. And that makes your planning algorithm better and better. And that makes you collect better episodes. And so you can sort of, sort of get bootstrap yourself up this thing. Now, this is the basic experiment of the paper. They also do this in a 3D manner where they move this little spider here around. So the spider was trained to just move from one block to the next block. And the planner base has to tell it where to go. And they show that they outperform the traditional Monte Carlo tree search. Now I have to say, this is cool, but you have to remember, this is, this is only advantageous in very, very specific types of problems. So first of all, it has to be this goal directed nature. Otherwise, you probably couldn't train this, this predictor here super well. Then given that you have such a good predictor, the problem needs to be such that if you have a start state, there could be many ways to go about reaching the end. And if you have an end state, there could be many ways from where you could come from, but, but there is like some bottleneck state in the middle where you're pretty sure that you're going to have to pass through it. So if your problem is of that nature, right? If it has these bottleneck states, where you can predict with reasonable accuracy that you're going to have to pass through, then this is a good algorithm to consider and is obviously, I mean, it's intuitively outperforming the original Monte Carlo tree search because you have much less deep search tree and you can effectively limit it with by using that model. They also have made this website where they kind of show videos of their spider and I haven't seen it in a while, but it is like next to the mouse, if you can see it. So you see, this is kind of a continuous control problem that also requires planning and they also have these kind of gifts of how they're what order their plans are constructed in. So I invite you to check this out, read the paper. If you like this, subscribe, leave a like, leave a comment and thank you for listening. Bye bye. | [{"start": 0.0, "end": 7.640000000000001, "text": " Hi there. What you're seeing here is a divide and conquer Monte Carlo tree search in action."}, {"start": 7.640000000000001, "end": 15.52, "text": " This is a planning algorithm that plans in a kind of an unconventional fashion. So we're"}, {"start": 15.52, "end": 20.2, "text": " going to explore this today in this paper, dividing conquer Monte Carlo tree search for"}, {"start": 20.2, "end": 30.68, "text": " goal directed planning by Jamba Tista, Parascondolo and Lars Poozing and list of other authors."}, {"start": 30.68, "end": 40.36, "text": " And I believe this is from Deep Mind and Max Plunk and Eta and yeah, that's it. All right."}, {"start": 40.36, "end": 47.68, "text": " So what does this thing do? It is a planning algorithm and planning might be not really"}, {"start": 47.68, "end": 54.88, "text": " familiar for you. So let's say you are in this room and or this set of rooms right here."}, {"start": 54.88, "end": 60.6, "text": " There's a bunch of walls and you are up here and you want to reach the goal down here."}, {"start": 60.6, "end": 66.4, "text": " So first of all, this is a goal directed problem. Right here it says goal directed."}, {"start": 66.4, "end": 72.88, "text": " Goal directed means that you give the algorithm a goal to reach and this could be a different"}, {"start": 72.88, "end": 79.32, "text": " goal each time you run the algorithm. Right. So you give it a goal to reach. Then the second"}, {"start": 79.32, "end": 84.8, "text": " thing here we see is planning. So it is a planning algorithm. What does planning mean?"}, {"start": 84.8, "end": 89.64, "text": " Planning means if you if you're traditionally reinforcement learning, you would think,"}, {"start": 89.64, "end": 97.16, "text": " ah, I'm just going to go ahead and run my my agent here and maybe you can move in the"}, {"start": 97.16, "end": 103.39999999999999, "text": " four different directions. Run my agent here, do some things right. Maybe I hit a wall,"}, {"start": 103.39999999999999, "end": 110.96, "text": " I get a negative reward at try again. In planning, you don't have to move initially."}, {"start": 110.96, "end": 116.4, "text": " What you can do is think about moving and you can think ahead of what's going to happen."}, {"start": 116.4, "end": 121.75999999999999, "text": " And that's usually because you have some sort of model what happens. This is very famous"}, {"start": 121.76, "end": 128.76, "text": " applied in, for example, Alpha Go or Alpha zero where you have you know, if I move to the"}, {"start": 128.76, "end": 134.4, "text": " right here, I'm going to be here. Right. So you will know once you've reached a goal,"}, {"start": 134.4, "end": 139.64000000000001, "text": " right. If you're if I'm here, I go down, I reach the goal. Cool. So you can think all"}, {"start": 139.64000000000001, "end": 145.36, "text": " of this without actually moving in the environment. You can think yourself ahead. What would happen"}, {"start": 145.36, "end": 151.92000000000002, "text": " if I did certain things and that in turn also means that you can think ahead multiple"}, {"start": 151.92000000000002, "end": 155.88000000000002, "text": " different paths. So you can think ahead what would happen if I move right. What would"}, {"start": 155.88000000000002, "end": 162.04000000000002, "text": " happen if I moved down and then you can think in the next layer, if I move right, what"}, {"start": 162.04000000000002, "end": 168.32000000000002, "text": " would happen if I moved right again? What would happen if I moved down instead? So you"}, {"start": 168.32000000000002, "end": 173.60000000000002, "text": " can easily see the planning problem becomes a three search problem. In this first, in this"}, {"start": 173.6, "end": 180.24, "text": " case, we've done a breadth first search right. And eventually you'll see that this will"}, {"start": 180.24, "end": 186.72, "text": " get you to the goal. So this this breadth first search or maybe you want to employ a depth"}, {"start": 186.72, "end": 192.35999999999999, "text": " first search will ultimately get you to the goal. We can represent this as a search tree."}, {"start": 192.35999999999999, "end": 196.88, "text": " So you're here in a particular state and you have a bunch of actions in this case for"}, {"start": 196.88, "end": 204.88, "text": " to move left up down. All right. And you can choose any of them and you will get into"}, {"start": 204.88, "end": 209.72, "text": " a new state. And from each of those, you could choose any again. And you can think ahead"}, {"start": 209.72, "end": 215.48, "text": " all of this. You can construct this entire tree. And one of these branches will lead you"}, {"start": 215.48, "end": 223.68, "text": " to the goal. Promise. What is the problem? The problem is if the path to the goal here"}, {"start": 223.68, "end": 232.68, "text": " is let's say D steps long, then this tree here is going to be D layers deep. And in our"}, {"start": 232.68, "end": 239.52, "text": " case, that means we'll have four to the D nodes in that tree before we even reach the goal."}, {"start": 239.52, "end": 247.84, "text": " And that is just a long, long or a big tree. And we can't construct all of it. So algorithms"}, {"start": 247.84, "end": 254.08, "text": " have come along, for example, the A star algorithm where you can incorporate something like a"}, {"start": 254.08, "end": 259.44, "text": " heuristic and the heuristic would be, well, it's generally good if I'm close to the goal"}, {"start": 259.44, "end": 266.84000000000003, "text": " in L2 distance. So you would not build the entire tree here, but you would prefer nodes"}, {"start": 266.84000000000003, "end": 272.4, "text": " that will bring you towards this heuristic. So this node down here is closer to the"}, {"start": 272.4, "end": 276.76, "text": " green node in terms of L2 distance. And this node down here is even closer, but then"}, {"start": 276.76, "end": 285.28, "text": " you're kind of stuck. So A star will explore a bit probably along this wall here. And once"}, {"start": 285.28, "end": 290.2, "text": " you're here, you have a clear path again, right? So you can simply take the actions that"}, {"start": 290.2, "end": 297.4, "text": " minimize this L2 distance. So this will already get you to a really good point. Monte Carlo"}, {"start": 297.4, "end": 305.32, "text": " tree search as it was employed in AlphaGo or AlphaStar has a similar structure where it"}, {"start": 305.32, "end": 310.96, "text": " after a certain while it stops and it evaluates a heuristic to say what's the value here."}, {"start": 310.96, "end": 316.96, "text": " And so on. So it is in for some problems and even better method of constructing the search"}, {"start": 316.96, "end": 324.4, "text": " tree in a way where you don't get overblown by the number. So the Monte Carlo search tree"}, {"start": 324.4, "end": 330.8, "text": " in this algorithm refers to the fact that we are generalizing Monte Carlo tree search"}, {"start": 330.8, "end": 339.16, "text": " from the let's say the AlphaGo paper. So what's the idea here? So far we've known everything."}, {"start": 339.16, "end": 346.52000000000004, "text": " The idea is the following. If I had an Oracle, if I am the master here and I can tell the"}, {"start": 346.52000000000004, "end": 355.72, "text": " agent agent, look, I guarantee you that this state right here in the middle, you will"}, {"start": 355.72, "end": 362.96000000000004, "text": " pass that state. If you want to reach the goal, you will pass this for sure. If I tell"}, {"start": 362.96000000000004, "end": 368.44000000000005, "text": " this to the agent, now what can the agent do? The agent say, oh, okay, if I know that,"}, {"start": 368.44000000000005, "end": 373.24, "text": " I can simply I don't have to search for a way to the goal. I'd much rather search for"}, {"start": 373.24, "end": 380.04, "text": " a way from my start point to that point where I know that I'm guaranteed to be at some"}, {"start": 380.04, "end": 390.04, "text": " place and then I can search also from a way from there to the goal. So this now, remember"}, {"start": 390.04, "end": 398.20000000000005, "text": " our path was D steps long for the original problem. This is now let's say D half long,"}, {"start": 398.20000000000005, "end": 403.28000000000003, "text": " each of these paths and that means we just construct two trees. Each one of them is going"}, {"start": 403.28000000000003, "end": 408.88, "text": " to be 4 to the D half and the other one is also 4 to the D half. And if we add them,"}, {"start": 408.88, "end": 416.08, "text": " that is much smaller than the original 4 to the D tree that we build. So right there,"}, {"start": 416.08, "end": 422.12, "text": " we have subdivided our problem into two sub problems and each of them are much easier"}, {"start": 422.12, "end": 428.8, "text": " than the original problem. This paper basically does this recursively. So it will subdivide"}, {"start": 428.8, "end": 434.36, "text": " the problem by proposing some middle state where you are going to be at some point for"}, {"start": 434.36, "end": 439.48, "text": " sure and that for sure we're going to take a look at. And then for each of those problems,"}, {"start": 439.48, "end": 445.32, "text": " again, it will try to subdivided into sub problems and therefore recursively solve the sub"}, {"start": 445.32, "end": 452.44, "text": " problems until they're small enough that they can be basically solved in one step. So that's"}, {"start": 452.44, "end": 460.12, "text": " the big idea here. And this is illustrated in this point right here. So you are in this S0,"}, {"start": 460.12, "end": 466.44, "text": " the start state and you want to go to this S infinity, the goal state in your case. What this"}, {"start": 466.44, "end": 472.12, "text": " paper does is it proposes to split the problem here in the middle and then simply solve the two"}, {"start": 472.12, "end": 482.12, "text": " problems recursively. Now what is a bit confusing right here is that it is the planning already is a"}, {"start": 482.12, "end": 489.64, "text": " tree search. Right? So a plan is like a tree. But we are searching over plans. So we're searching"}, {"start": 489.64, "end": 497.4, "text": " for the best plan, which means that we are searching over trees and that search itself is a tree"}, {"start": 497.4, "end": 503.0, "text": " search. So the search itself is a problem where we go down one route and then oh no and then we"}, {"start": 503.0, "end": 511.0, "text": " maybe go down another route and here and then here. So the search is a tree. So we're now"}, {"start": 511.0, "end": 519.48, "text": " tree searching over trees. That's the kind of tricky thing to remember. So each of these plans, even"}, {"start": 519.48, "end": 523.96, "text": " if it's half, if it's only half done, like this is only half a plan, we don't know what's going to"}, {"start": 523.96, "end": 533.56, "text": " happen in here. This half a plan is a node in the tree that we're searching over and then it splits,"}, {"start": 533.56, "end": 540.68, "text": " it splits as you can see here into two sub problems. The two sub problems also are nodes in that"}, {"start": 540.68, "end": 545.56, "text": " search tree. So you see that this top thing here would correspond to this node even though in"}, {"start": 545.56, "end": 553.7199999999999, "text": " itself it is a plan, a tree string in this case and each of the two sub problems would become"}, {"start": 553.7199999999999, "end": 561.4, "text": " these, protect these nodes in the search tree. So keep that in mind as we go through this paper,"}, {"start": 561.4, "end": 571.9599999999999, "text": " it is very easy to get confused in this respect. The algorithm is pretty simple in this case."}, {"start": 572.68, "end": 582.04, "text": " So this algorithm rests on this traverse procedure. So we're going to traverse this,"}, {"start": 582.04, "end": 589.24, "text": " what they call these or nodes. So they divide the problem into end nodes and or nodes. I don't"}, {"start": 589.24, "end": 595.96, "text": " believe that's particularly necessary for us to think about, but here's how this works. So they"}, {"start": 595.96, "end": 605.08, "text": " traverse the ornode s to s prime. This is simply, again, this is a node, but the node is a path"}, {"start": 605.08, "end": 614.36, "text": " from s to s prime, where we don't know yet what happens in between. So what we'll do is we'll run"}, {"start": 614.36, "end": 623.32, "text": " this procedure select and select it, you can see it outputs an s prime and the s prime is going to"}, {"start": 623.32, "end": 628.28, "text": " be a node here somewhere in the middle where the model says this is your subdivision point."}, {"start": 630.36, "end": 637.8000000000001, "text": " And then it will recursively traverse the left and the right branch of this tree. So it will"}, {"start": 637.8000000000001, "end": 644.28, "text": " subdivide the problem into two problems and then recursively call this traverse. You see that's"}, {"start": 644.28, "end": 651.48, "text": " the function that we're defining. Call this traverse function on these. So it will subdivide this"}, {"start": 651.48, "end": 659.8, "text": " problem into these problems and for the next step, again, it will eat for each of the problems,"}, {"start": 659.8, "end": 667.9599999999999, "text": " propose a middle node and subdivide it further and so on until you have a full plan. At some point"}, {"start": 667.96, "end": 676.36, "text": " you're going to have a full plan. Now here again is the important thing to remember. This is just"}, {"start": 676.36, "end": 683.1600000000001, "text": " one branch of the search. This is just one possible plan and we are going to do a three search"}, {"start": 683.1600000000001, "end": 691.8000000000001, "text": " over these plans. So this select function here, it has returned this s prime, but it could have"}, {"start": 691.8, "end": 698.8399999999999, "text": " returned any point between s and s double prime. So let's in it, this is just one branch. I'm going"}, {"start": 698.8399999999999, "end": 708.12, "text": " to, I don't have space to draw here, but I'm going to draw it down here again. So it could have also"}, {"start": 708.8399999999999, "end": 715.8, "text": " returned this particular node here. It's a different s prime and then subdivide it the problem"}, {"start": 715.8, "end": 722.3599999999999, "text": " into different problems and then of course those problems are now different. So they would be subdivided"}, {"start": 722.3599999999999, "end": 730.1999999999999, "text": " differently again and so on. So this top part here is just, if you consider this thing here, your"}, {"start": 730.1999999999999, "end": 736.92, "text": " root node, this is where you search from, this top part is just one node, one branch in the tree,"}, {"start": 736.92, "end": 742.92, "text": " but we could also subdivide like this and then that would be another branch in your tree."}, {"start": 742.92, "end": 751.16, "text": " And this tree here is the thing that you're searching over. So important to keep, keep this in mind,"}, {"start": 751.16, "end": 758.76, "text": " we're searching over these different possibilities. Now the rest of this algorithm here is basically"}, {"start": 758.76, "end": 765.4799999999999, "text": " the carryover from Monte Carlo tree search. And I don't want to go into that in this video,"}, {"start": 765.4799999999999, "end": 770.04, "text": " but if you're interested in, you know, how to actually implement this, you'll have to go look at"}, {"start": 770.04, "end": 776.68, "text": " MCTS and then all of this just carries over from that algorithm because you have to keep estimates"}, {"start": 776.68, "end": 782.36, "text": " of value and visit counts in this tree and so on. And also you have some sort of a value estimator."}, {"start": 783.0, "end": 790.04, "text": " But yeah, I'm mainly concerned with how the tree is constructed right here. So basically here's"}, {"start": 790.04, "end": 799.16, "text": " the, here's the difference between a, between the Monte Carlo tree search and the divide and conquer"}, {"start": 799.16, "end": 805.88, "text": " Monte Carlo tree search. In Monte Carlo tree search, ignore the yellow one for now. You're in the"}, {"start": 805.88, "end": 812.12, "text": " green position and you want to go to the blue position. In Monte Carlo tree search, what you're"}, {"start": 812.12, "end": 819.3199999999999, "text": " searching over is the next action to take. In this case, you have four possible actions to take."}, {"start": 820.36, "end": 825.0, "text": " That's what you're searching over and that's what you build your search tree from. Your search tree"}, {"start": 825.0, "end": 832.52, "text": " is going to be which action to take, right? Up, left, down or right. That's why you have four actions."}, {"start": 833.4, "end": 839.24, "text": " In, in divide and conquer Monte Carlo tree search, you're not searching over actions. You are"}, {"start": 839.24, "end": 845.56, "text": " searching over the best way to subdivide this problem, right? You're searching over which of these"}, {"start": 845.56, "end": 852.76, "text": " all the black squares should I use to subdivide my problem into subproblems. And that's what you build"}, {"start": 852.76, "end": 859.56, "text": " your search tree from. So naturally you, you can already see, what kind of possibilities do we have"}, {"start": 859.56, "end": 866.2, "text": " here to subdivide this problem? I drew one white square, but any of the black squares are"}, {"start": 866.2, "end": 872.12, "text": " candidates to subdivide this problem, right? Any of the, of the black squares could be potential"}, {"start": 872.12, "end": 881.0, "text": " subdivisions. And this is what we search over. So in, in Monte Carlo tree search, we search over"}, {"start": 881.0, "end": 890.28, "text": " the actions, which gives us this four to the D tree. But in divide and conquer, we're searching over"}, {"start": 890.28, "end": 895.4, "text": " all the ways to subdivide the problem. And as you can see there, that are many, many more"}, {"start": 895.4, "end": 903.16, "text": " possibilities. So from this first starting node, we have like, like a hundred possibilities to"}, {"start": 903.16, "end": 910.76, "text": " subdivide this problem into two problems, right? And each of those, again, if you now you've decided"}, {"start": 910.76, "end": 917.64, "text": " on a subdivision, let's say you decided on this one right here, you say, I want to pass through"}, {"start": 917.64, "end": 925.88, "text": " that point on my way to the goal. Now you have to subdivide that in this subproblem into two"}, {"start": 925.88, "end": 932.68, "text": " problems. Again, every possible black square, I'm not saying which one is good, good thing to subdivide"}, {"start": 932.68, "end": 939.08, "text": " the problem. I'm just asking what is a possible candidate? Every single black square here is a"}, {"start": 939.08, "end": 946.84, "text": " possible candidate for a path from here to here, right? And again, for this particular subproblem,"}, {"start": 946.84, "end": 955.24, "text": " you have to do the same thing. So the, the search tree here, even though we said before, it is,"}, {"start": 955.8000000000001, "end": 966.44, "text": " this one is very deep. And this one is probably only log D, sorry, log 2, D, deep. It with is going"}, {"start": 966.44, "end": 974.9200000000001, "text": " to be enormous. And that is the catch, right? The catch, this is not a method that is like a magic"}, {"start": 974.9200000000001, "end": 982.44, "text": " pill. The catch is even though your tree is not as deep, it is much, much wider. And it is"}, {"start": 982.44, "end": 988.6800000000001, "text": " intuitive, right? Because you still have to have the ability to construct any possible plan. So your"}, {"start": 988.6800000000001, "end": 995.48, "text": " tree is going to have as many nodes as the original Monte Carlo tree search tree. If you were to fully"}, {"start": 995.48, "end": 1004.52, "text": " expand it, right? So it's your trading of depth for width here. I hope, I hope that's a bit clear."}, {"start": 1004.52, "end": 1014.84, "text": " So your entire, your entire promise of this method is going to be, can you from all of these"}, {"start": 1014.84, "end": 1020.2, "text": " possibilities? So from all of these, you don't even, you don't even want to go and search even one"}, {"start": 1020.2, "end": 1026.3600000000001, "text": " layer deep through all of these. You don't even want to consider all of them, right? You want to search"}, {"start": 1026.3600000000001, "end": 1034.44, "text": " in this tree, you want to limit your search to very particular ways of subdivision here."}, {"start": 1034.44, "end": 1042.3600000000001, "text": " If you can do that efficiently, if you can pick efficiently candidates to subdivide, then this"}, {"start": 1042.3600000000001, "end": 1049.4, "text": " could be a successful thing because your deep is now not as, your tree is not as deep as the"}, {"start": 1049.4, "end": 1055.24, "text": " original search tree would have been. And you can limit the width effectively to only very few"}, {"start": 1055.24, "end": 1062.2, "text": " candidates. So here we could, for example, make a heuristic that will always only pick squares that"}, {"start": 1062.2, "end": 1072.68, "text": " are kind of on this straight path to the goal. So everything rests on how you do this select action."}, {"start": 1072.68, "end": 1080.76, "text": " I am this thing here. The entire algorithm relies on the fact that you can select effectively,"}, {"start": 1080.76, "end": 1087.8, "text": " select in between states where you're pretty sure that the algorithm will have to pass through"}, {"start": 1087.8, "end": 1093.96, "text": " there because the worse you make these predictions, the worse your tree search is going to work."}, {"start": 1093.96, "end": 1103.64, "text": " And what they do, of course, is they use deep learning as you might have guessed to do that. So they"}, {"start": 1103.64, "end": 1109.64, "text": " have, they will have a model that for a particular start and end goal will give them a probability"}, {"start": 1109.64, "end": 1115.08, "text": " distribution across candidates. Now everything that's black here also has probability mass, but it"}, {"start": 1115.08, "end": 1123.08, "text": " just so small you can't see. And these blue ones are the lighter blue, the more probable this model"}, {"start": 1123.08, "end": 1130.12, "text": " thinks that this is going to be an in between state. Now the tree search can now limit itself"}, {"start": 1130.12, "end": 1135.8799999999999, "text": " effectively to only the ones here with the highest probability. So we select the ones with the"}, {"start": 1135.8799999999999, "end": 1144.4399999999998, "text": " highest probability and we'll only search plans that have these as the first possible subdivisions."}, {"start": 1145.32, "end": 1151.8799999999999, "text": " Again, we're searching over plans. So we're searching over ways to subdivide the problem into"}, {"start": 1151.88, "end": 1157.48, "text": " smaller problems. That is our search space. So once we've decided on one of them, let's say here the"}, {"start": 1157.48, "end": 1162.8400000000001, "text": " yellow one, again, we have to evaluate that model for each of the subproblems. And this, this is"}, {"start": 1162.8400000000001, "end": 1168.5200000000002, "text": " kind of a step that's missing here. So in between here, there would be a model evaluation that would"}, {"start": 1168.5200000000002, "end": 1175.48, "text": " again tell you which of these in between states were probable subdivision candidates. And then you"}, {"start": 1175.48, "end": 1181.3200000000002, "text": " would select again one of those in that particular search branch. And in a different search branch,"}, {"start": 1181.32, "end": 1184.52, "text": " right, you're searching over these things. In a different search branch, you would select a"}, {"start": 1184.52, "end": 1192.6799999999998, "text": " different one and see is this possibly a better way to subdivide the problem. And so on. So the"}, {"start": 1192.6799999999998, "end": 1196.9199999999998, "text": " question of course is how do you train this model? How do you train a model that gives you good"}, {"start": 1196.9199999999998, "end": 1205.08, "text": " candidates for subdivision? And the answer here is a comes from the idea of hindsight experience"}, {"start": 1205.08, "end": 1213.8, "text": " replay. So let's say again, you are here and you want to go here and you're not very good at it"}, {"start": 1213.8, "end": 1219.96, "text": " initially. So they train this model as I understand along with letting their agent act in this"}, {"start": 1219.96, "end": 1225.56, "text": " environment. So the agent uses the model to plan, but initially it's not very good. So maybe the"}, {"start": 1225.56, "end": 1232.6799999999998, "text": " agent will fail a lot of times. So instead of going to the blue square, it will reach this white"}, {"start": 1232.68, "end": 1238.04, "text": " square right here. It will go here, here, and here. We'll reach the white square. And instead of"}, {"start": 1238.04, "end": 1245.0, "text": " saying, I failed what you can do, and this is the idea of hindsight experience replay is to say,"}, {"start": 1245.0, "end": 1252.76, "text": " well, I did fail, but I did reach something, right? I have reached a thing. And it's actually"}, {"start": 1252.76, "end": 1258.2, "text": " possible that that thing could have been the goal, but this particular episode, this was the goal."}, {"start": 1258.2, "end": 1264.28, "text": " Remember, the goal changes every time. It's a goal directed policy. So it says, well, this could"}, {"start": 1264.28, "end": 1271.64, "text": " have been the goal, possibly. So if I just pretend this was the goal, then I have a training example"}, {"start": 1271.64, "end": 1277.72, "text": " for a successful run. So the hindsight experience replay basically pretends that what you"}, {"start": 1278.28, "end": 1283.64, "text": " have achieved, even if you failed, was your actual goal. And that gives you a positive training"}, {"start": 1283.64, "end": 1290.0400000000002, "text": " example for an episode with that as a goal. And this could have been the goal because the goal is"}, {"start": 1290.8400000000001, "end": 1298.44, "text": " chosen at random. So this gives you a good training example. Now this paper just generalizes the"}, {"start": 1298.44, "end": 1303.5600000000002, "text": " hindsight experience replay or applies to their particular framework. And they say, well, if I"}, {"start": 1303.5600000000002, "end": 1312.92, "text": " reach this thing, that means any point on this path is a good candidate for subdividing the path."}, {"start": 1312.92, "end": 1321.0800000000002, "text": " Because I did actually reach the point. Remember, the goal is to propose a point where your four"}, {"start": 1321.0800000000002, "end": 1327.64, "text": " sure are going to pass through. Now, since I've taken this path to this goal, I have passed through"}, {"start": 1327.64, "end": 1333.0800000000002, "text": " any of the squares in between. And so these are my possible sub candidates. And at all other"}, {"start": 1333.0800000000002, "end": 1338.04, "text": " black squares, I don't want that. So now I have a classifier I can train. I can say, any of these"}, {"start": 1338.04, "end": 1344.12, "text": " squares on my path are good squares to subdivide. And any not on my path are bad ones. They go a"}, {"start": 1344.12, "end": 1350.12, "text": " step further, I believe. And they actually say, we're, so if this was M steps, we're actually going"}, {"start": 1350.12, "end": 1358.2, "text": " to take the particular square that is reached after M half steps. So the exact middle point of"}, {"start": 1358.2, "end": 1366.36, "text": " that path is going to be our training example for subdivision. So you have a classifier that has"}, {"start": 1366.36, "end": 1376.28, "text": " exactly one, one target to train. So this you train along with acting in the environment. And of"}, {"start": 1376.28, "end": 1381.1599999999999, "text": " course, your model for proposing subdivisions is going to be better and better and better and"}, {"start": 1381.1599999999999, "end": 1385.1599999999999, "text": " better. And that makes your planning algorithm better and better. And that makes you collect"}, {"start": 1385.1599999999999, "end": 1394.52, "text": " better episodes. And so you can sort of, sort of get bootstrap yourself up this thing."}, {"start": 1394.52, "end": 1402.76, "text": " Now, this is the basic experiment of the paper. They also do this in a 3D manner where they"}, {"start": 1403.4, "end": 1407.8799999999999, "text": " move this little spider here around. So the spider was trained to just move from one block to the"}, {"start": 1407.8799999999999, "end": 1414.76, "text": " next block. And the planner base has to tell it where to go. And they show that they outperform"}, {"start": 1414.76, "end": 1421.8, "text": " the traditional Monte Carlo tree search. Now I have to say, this is cool, but you have to remember,"}, {"start": 1421.8, "end": 1429.08, "text": " this is, this is only advantageous in very, very specific types of problems. So first of all,"}, {"start": 1429.08, "end": 1434.12, "text": " it has to be this goal directed nature. Otherwise, you probably couldn't train this,"}, {"start": 1435.08, "end": 1442.6, "text": " this predictor here super well. Then given that you have such a good predictor, the problem needs"}, {"start": 1442.6, "end": 1451.8799999999999, "text": " to be such that if you have a start state, there could be many ways to go about reaching the end."}, {"start": 1451.8799999999999, "end": 1457.3999999999999, "text": " And if you have an end state, there could be many ways from where you could come from, but, but there"}, {"start": 1457.3999999999999, "end": 1463.7199999999998, "text": " is like some bottleneck state in the middle where you're pretty sure that you're going to have to"}, {"start": 1463.7199999999998, "end": 1470.9199999999998, "text": " pass through it. So if your problem is of that nature, right? If it has these bottleneck states,"}, {"start": 1470.92, "end": 1476.3600000000001, "text": " where you can predict with reasonable accuracy that you're going to have to pass through,"}, {"start": 1476.3600000000001, "end": 1484.92, "text": " then this is a good algorithm to consider and is obviously, I mean, it's intuitively outperforming"}, {"start": 1484.92, "end": 1492.68, "text": " the original Monte Carlo tree search because you have much less deep search tree and you can"}, {"start": 1492.68, "end": 1499.64, "text": " effectively limit it with by using that model. They also have made this website where they kind of"}, {"start": 1499.64, "end": 1508.44, "text": " show videos of their spider and I haven't seen it in a while, but it is like next to the mouse,"}, {"start": 1508.44, "end": 1515.5600000000002, "text": " if you can see it. So you see, this is kind of a continuous control problem that also requires"}, {"start": 1515.5600000000002, "end": 1521.64, "text": " planning and they also have these kind of gifts of how they're what order their plans are constructed in."}, {"start": 1522.3600000000001, "end": 1528.92, "text": " So I invite you to check this out, read the paper. If you like this, subscribe, leave a like, leave a"}, {"start": 1528.92, "end": 1532.68, "text": " comment and thank you for listening. Bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=eCH0M4wzKJs | WHO ARE YOU? 10k Subscribers Special (w/ Channel Analytics) | An in-depth look at this channel's analytics.
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, we have just crossed 10,000 subscribers on this channel and that is an absolutely mind blowing number. To everyone who's subscribed, thank you and today for a bit of a special occasion I thought we would look at you. Yes, you handsome, one of the 10,000 subscribers of this channel and we're going to dive into the YouTube analytics and see who you are and what you like and how you behave. So if you've never done YouTube as a creator, this is what it looks like. You can see right here there are 10,000 and 71 subscribers right now and if you look at the videos, attention is all you need is the most popular video on this channel. It is also one of the oldest videos on this channel. Probably it's in many university curricula now and there's like half a lecture allocated to it and that is not enough to understand this paper so people come to this channel. I was still using kind of Adobe reader at the time and etching in sort of, there's only one color, it's super laggy, but for some reason people like it and I'm not gonna debate with people about what they like and what they don't. I might do another one on attention is all you need just because I understand Transformers much better nowadays and I think I could do a better job at explaining them more clearly. So a lot of the NLP models tend to do very well as videos because I think people are interested and practitioners are interested and they just want to learn about these models and what they're doing. Also their Siraj controversy very popular. It was a fun event and sad event. This video right here deconstructing lottery tickets. It just outperforms all the other videos absolutely mind-blowingly rockets over everything. But if you look at the retention I only retain people for two minutes on average which is the retention is the lowest of any of my videos and I could not understand this for the longest time and that occurred to me. If you title a video deconstructing lottery tickets and you put a bunch of math on the thumbnail people are gonna click and then be very very very disappointed when you don't tell them how to win the lottery and that takes them about one the two minutes to notice like oh crap I can't make any money using this video. So if you go to the general analytics tabs it's very interesting to see what people like. You see the last 28 days I've uploaded every single day except here. This is a bit of a gap I have accidentally deleted the backprop in the brain video and had to re-upload it the next day. So if you look at the last year the views have gone up substantially. The subscribers have gone up but there are subscriber spikes right here and these spikes are usually sometimes when some large personality recommends this channel. The channel gains a bunch of subscribers that doesn't necessarily translate into more views it's just people that click on subscribe and then never care anymore. The metric that's most interesting to me personally is watch time and as you can see here watch time has gone substantially up in the last month which I find to be encouraging. One minute of watch time means that I get to transmit one minute of information to the viewer and that's what really matters to me. Of course if I'm doing a worst job at explaining then the viewer has to watch for longer but that usually doesn't really work out because they're just gonna click away. All right to the fun part the audience who are you? Now as you can see here 69% of you are not subscribed. What are you doing not being subscribed? Though this has changed in last month significantly I believe now it's about half and half. What I find most interesting though is that 10% of you have this bell notification on so 10 percent of you actively want to be disturbed whenever I upload a video. I am incredibly flattered by this. This is the biggest compliment. Not even I do this for the channels that I follow. Demographics also very fun. About 93% of you tend to be male and about 6% of you tend to be female at least according to YouTube statistics and that's a pretty good intersection of YouTube being mostly male and machine learning field also being mostly male. If I'm doing anything to attract any particular type of person please let me know so I can diversify a bit. Everyone's welcome here. You tend to be above 18 which is good because we have very very much adult content on this channel. I'm happy to see that none of you is underage. I think that's just that's YouTube just don't not reporting underage statistics. But most of you tend to be 18 to 45 years old though to the older viewers. You're of course also very welcome though. I'm pretty sure that some of these is just because you were underage when you created your account and you just told them you were born in 1923. So most of you tend to come from the United States or India or Germany. This is very incomplete list. I think the most people simply are in the other category of countries which I think means YouTube just doesn't know. But it is cool to see that India is so high up. One of the reasons I started this channel. So the main reason is because it forces myself to read papers more thoroughly if I have to explain them. One other main reason I started this channel was because I thought I thought there was a gap between what you could get from a beginner's course any sort of Coursera course and where research is right now and to bridge that gap you basically have to go to a very good university. And I know that most of the world doesn't have access to these very good universities. So my idea was to kind of bridge that gap to make that person that has a basic understanding of machine learning be able to be up to speed with current research to be able to read current research papers. And the fact that I have quite a number of people watching from countries where top universities maybe aren't located is very encouraging to me. Thanks for watching from all around the world. One person is watching this with Russian subtitles. Okay we can go into the advanced statistics here and that is pretty interesting as well. You see here most videos kind of spike when they come out especially the news videos they tend to be very popular. Just the moment that I release them and then they sort of fall down traffic source. I find particularly interesting if you look at the last 90 days there are these spikes and these spikes tend to come mainly from from Google searches. So at some point people simply Google search for stuff and then they find this channel which is encouraging. Most people actually search for attention is all you need or things like this. YouTube doesn't show you anymore what people search on Google but YouTube shows you what people searched for on YouTube and that tends to be mostly attention is all you need mu 0 my name. Hello. So if you correlate these spikes in searches with geography some of these spikes tend to be worldwide like this one here or this one here but this particular spike is only United States and if you look at the videos that I released during that time period one of these videos right here so either it is the Schmidt Uber drama a lot of people searching for that maybe maybe it's image net V2 or the online conferences I don't know you can see right here I didn't make many subscribers of these spikes it's simply people being interested in content which is pretty cool it is also interesting to see that these spikes right here they correspond mainly to mobile phone users so mobile phone users go and Google searching for content on this channel I have no idea what's going on. Alright now the last question to solve is of course monetization how much money does this channel make and the answer is none so far. So there are multiple reasons why I haven't applied for monetization yet I find YouTube ads just incredibly annoying especially now that they've decided to stick two ads in front of videos I just don't want to bug users with that if you look at what I gain from it it's not that much any money that I would make I would like to sort of reinvest into the channel and right now I just don't have any requirements that might change in the future maybe once we get to a hundred thousand subscribers. Alright that was it for YouTube analytics of this channel I hope you are still enjoying this content if you're not subscribed please do. Next update will be at a hundred thousand and I hope that everything is as enjoyable as ever thank you for watching thank you for subscribing thanks for being here and to the future. | [{"start": 0.0, "end": 6.2, "text": " Hi there, we have just crossed 10,000 subscribers on this channel and that is an"}, {"start": 6.2, "end": 11.32, "text": " absolutely mind blowing number. To everyone who's subscribed, thank you and"}, {"start": 11.32, "end": 16.6, "text": " today for a bit of a special occasion I thought we would look at you. Yes, you"}, {"start": 16.6, "end": 22.080000000000002, "text": " handsome, one of the 10,000 subscribers of this channel and we're going to"}, {"start": 22.080000000000002, "end": 27.04, "text": " dive into the YouTube analytics and see who you are and what you like and how"}, {"start": 27.04, "end": 31.24, "text": " you behave. So if you've never done YouTube as a creator, this is what it looks"}, {"start": 31.24, "end": 38.44, "text": " like. You can see right here there are 10,000 and 71 subscribers right now and if"}, {"start": 38.44, "end": 42.8, "text": " you look at the videos, attention is all you need is the most popular video on"}, {"start": 42.8, "end": 47.28, "text": " this channel. It is also one of the oldest videos on this channel. Probably it's"}, {"start": 47.28, "end": 52.120000000000005, "text": " in many university curricula now and there's like half a lecture allocated to it"}, {"start": 52.12, "end": 58.0, "text": " and that is not enough to understand this paper so people come to this channel. I"}, {"start": 58.0, "end": 64.84, "text": " was still using kind of Adobe reader at the time and etching in sort of, there's"}, {"start": 64.84, "end": 69.36, "text": " only one color, it's super laggy, but for some reason people like it and I'm not"}, {"start": 69.36, "end": 73.4, "text": " gonna debate with people about what they like and what they don't. I might do"}, {"start": 73.4, "end": 76.92, "text": " another one on attention is all you need just because I understand Transformers"}, {"start": 76.92, "end": 80.96, "text": " much better nowadays and I think I could do a better job at explaining them"}, {"start": 80.96, "end": 86.72, "text": " more clearly. So a lot of the NLP models tend to do very well as videos because I"}, {"start": 86.72, "end": 90.55999999999999, "text": " think people are interested and practitioners are interested and they just"}, {"start": 90.55999999999999, "end": 94.32, "text": " want to learn about these models and what they're doing. Also their Siraj"}, {"start": 94.32, "end": 100.56, "text": " controversy very popular. It was a fun event and sad event. This video right"}, {"start": 100.56, "end": 105.67999999999999, "text": " here deconstructing lottery tickets. It just outperforms all the other videos"}, {"start": 105.68, "end": 111.68, "text": " absolutely mind-blowingly rockets over everything. But if you look at the"}, {"start": 111.68, "end": 116.08000000000001, "text": " retention I only retain people for two minutes on average which is the"}, {"start": 116.08000000000001, "end": 121.76, "text": " retention is the lowest of any of my videos and I could not understand this for"}, {"start": 121.76, "end": 127.12, "text": " the longest time and that occurred to me. If you title a video deconstructing"}, {"start": 127.12, "end": 133.32, "text": " lottery tickets and you put a bunch of math on the thumbnail people are gonna"}, {"start": 133.32, "end": 138.51999999999998, "text": " click and then be very very very disappointed when you don't tell them how to"}, {"start": 138.51999999999998, "end": 144.68, "text": " win the lottery and that takes them about one the two minutes to notice like oh"}, {"start": 144.68, "end": 149.0, "text": " crap I can't make any money using this video. So if you go to the general"}, {"start": 149.0, "end": 155.07999999999998, "text": " analytics tabs it's very interesting to see what people like. You see the last"}, {"start": 155.07999999999998, "end": 161.48, "text": " 28 days I've uploaded every single day except here. This is a bit of a gap I"}, {"start": 161.48, "end": 166.32, "text": " have accidentally deleted the backprop in the brain video and had to"}, {"start": 166.32, "end": 172.51999999999998, "text": " re-upload it the next day. So if you look at the last year the views have gone"}, {"start": 172.51999999999998, "end": 178.23999999999998, "text": " up substantially. The subscribers have gone up but there are subscriber spikes"}, {"start": 178.23999999999998, "end": 183.44, "text": " right here and these spikes are usually sometimes when some large"}, {"start": 183.44, "end": 188.07999999999998, "text": " personality recommends this channel. The channel gains a bunch of subscribers"}, {"start": 188.08, "end": 192.08, "text": " that doesn't necessarily translate into more views it's just people that"}, {"start": 192.08, "end": 195.76000000000002, "text": " click on subscribe and then never care anymore. The metric that's most"}, {"start": 195.76000000000002, "end": 200.04000000000002, "text": " interesting to me personally is watch time and as you can see here watch time"}, {"start": 200.04000000000002, "end": 206.12, "text": " has gone substantially up in the last month which I find to be encouraging. One"}, {"start": 206.12, "end": 211.52, "text": " minute of watch time means that I get to transmit one minute of information to"}, {"start": 211.52, "end": 216.16000000000003, "text": " the viewer and that's what really matters to me. Of course if I'm doing a worst"}, {"start": 216.16, "end": 221.04, "text": " job at explaining then the viewer has to watch for longer but that usually"}, {"start": 221.04, "end": 225.2, "text": " doesn't really work out because they're just gonna click away. All right to the"}, {"start": 225.2, "end": 234.28, "text": " fun part the audience who are you? Now as you can see here 69% of you are not"}, {"start": 234.28, "end": 238.88, "text": " subscribed. What are you doing not being subscribed? Though this has changed in"}, {"start": 238.88, "end": 243.32, "text": " last month significantly I believe now it's about half and half. What I find"}, {"start": 243.32, "end": 249.64, "text": " most interesting though is that 10% of you have this bell notification on so 10"}, {"start": 249.64, "end": 255.6, "text": " percent of you actively want to be disturbed whenever I upload a video. I am"}, {"start": 255.6, "end": 260.56, "text": " incredibly flattered by this. This is the biggest compliment. Not even I do this"}, {"start": 260.56, "end": 266.71999999999997, "text": " for the channels that I follow. Demographics also very fun. About 93% of you"}, {"start": 266.71999999999997, "end": 271.6, "text": " tend to be male and about 6% of you tend to be female at least according to"}, {"start": 271.6, "end": 276.40000000000003, "text": " YouTube statistics and that's a pretty good intersection of YouTube being"}, {"start": 276.40000000000003, "end": 281.96000000000004, "text": " mostly male and machine learning field also being mostly male. If I'm doing"}, {"start": 281.96000000000004, "end": 286.84000000000003, "text": " anything to attract any particular type of person please let me know so I can"}, {"start": 286.84000000000003, "end": 294.68, "text": " diversify a bit. Everyone's welcome here. You tend to be above 18 which is good"}, {"start": 294.68, "end": 299.88, "text": " because we have very very much adult content on this channel. I'm happy to see"}, {"start": 299.88, "end": 304.4, "text": " that none of you is underage. I think that's just that's YouTube just don't"}, {"start": 304.4, "end": 310.52, "text": " not reporting underage statistics. But most of you tend to be 18 to 45 years"}, {"start": 310.52, "end": 316.2, "text": " old though to the older viewers. You're of course also very welcome though. I'm"}, {"start": 316.2, "end": 320.96, "text": " pretty sure that some of these is just because you were underage when you"}, {"start": 320.96, "end": 326.28, "text": " created your account and you just told them you were born in 1923. So most of"}, {"start": 326.28, "end": 332.64, "text": " you tend to come from the United States or India or Germany. This is very"}, {"start": 332.64, "end": 338.11999999999995, "text": " incomplete list. I think the most people simply are in the other category of"}, {"start": 338.11999999999995, "end": 342.96, "text": " countries which I think means YouTube just doesn't know. But it is cool to see"}, {"start": 342.96, "end": 347.4, "text": " that India is so high up. One of the reasons I started this channel. So the main"}, {"start": 347.4, "end": 352.91999999999996, "text": " reason is because it forces myself to read papers more thoroughly if I have to"}, {"start": 352.92, "end": 358.08000000000004, "text": " explain them. One other main reason I started this channel was because I thought"}, {"start": 358.08000000000004, "end": 362.16, "text": " I thought there was a gap between what you could get from a beginner's course"}, {"start": 362.16, "end": 368.36, "text": " any sort of Coursera course and where research is right now and to bridge that"}, {"start": 368.36, "end": 373.84000000000003, "text": " gap you basically have to go to a very good university. And I know that most of"}, {"start": 373.84000000000003, "end": 378.68, "text": " the world doesn't have access to these very good universities. So my idea was to"}, {"start": 378.68, "end": 384.2, "text": " kind of bridge that gap to make that person that has a basic understanding of"}, {"start": 384.2, "end": 389.76, "text": " machine learning be able to be up to speed with current research to be able to"}, {"start": 389.76, "end": 394.48, "text": " read current research papers. And the fact that I have quite a number of people"}, {"start": 394.48, "end": 399.88, "text": " watching from countries where top universities maybe aren't located is very"}, {"start": 399.88, "end": 405.72, "text": " encouraging to me. Thanks for watching from all around the world. One person is"}, {"start": 405.72, "end": 412.28000000000003, "text": " watching this with Russian subtitles. Okay we can go into the advanced"}, {"start": 412.28000000000003, "end": 416.84000000000003, "text": " statistics here and that is pretty interesting as well. You see here most"}, {"start": 416.84000000000003, "end": 421.76000000000005, "text": " videos kind of spike when they come out especially the news videos they tend to"}, {"start": 421.76000000000005, "end": 428.08000000000004, "text": " be very popular. Just the moment that I release them and then they sort of fall"}, {"start": 428.08000000000004, "end": 432.76000000000005, "text": " down traffic source. I find particularly interesting if you look at the last"}, {"start": 432.76, "end": 438.48, "text": " 90 days there are these spikes and these spikes tend to come mainly from"}, {"start": 438.48, "end": 444.2, "text": " from Google searches. So at some point people simply Google search for stuff"}, {"start": 444.2, "end": 449.52, "text": " and then they find this channel which is encouraging. Most people actually"}, {"start": 449.52, "end": 453.4, "text": " search for attention is all you need or things like this. YouTube doesn't show"}, {"start": 453.4, "end": 457.64, "text": " you anymore what people search on Google but YouTube shows you what people"}, {"start": 457.64, "end": 463.28, "text": " searched for on YouTube and that tends to be mostly attention is all you need"}, {"start": 463.28, "end": 469.76, "text": " mu 0 my name. Hello. So if you correlate these spikes in searches with"}, {"start": 469.76, "end": 474.68, "text": " geography some of these spikes tend to be worldwide like this one here or this"}, {"start": 474.68, "end": 480.12, "text": " one here but this particular spike is only United States and if you look at"}, {"start": 480.12, "end": 485.36, "text": " the videos that I released during that time period one of these videos right"}, {"start": 485.36, "end": 491.40000000000003, "text": " here so either it is the Schmidt Uber drama a lot of people searching for that"}, {"start": 491.40000000000003, "end": 497.76, "text": " maybe maybe it's image net V2 or the online conferences I don't know you can"}, {"start": 497.76, "end": 502.72, "text": " see right here I didn't make many subscribers of these spikes it's simply"}, {"start": 502.72, "end": 507.12, "text": " people being interested in content which is pretty cool it is also interesting"}, {"start": 507.12, "end": 513.08, "text": " to see that these spikes right here they correspond mainly to mobile phone"}, {"start": 513.08, "end": 520.96, "text": " users so mobile phone users go and Google searching for content on this channel I"}, {"start": 520.96, "end": 525.76, "text": " have no idea what's going on. Alright now the last question to solve is of"}, {"start": 525.76, "end": 532.4000000000001, "text": " course monetization how much money does this channel make and the answer is"}, {"start": 532.4000000000001, "end": 537.5600000000001, "text": " none so far. So there are multiple reasons why I haven't applied for monetization"}, {"start": 537.56, "end": 543.2399999999999, "text": " yet I find YouTube ads just incredibly annoying especially now that they've"}, {"start": 543.2399999999999, "end": 548.3599999999999, "text": " decided to stick two ads in front of videos I just don't want to bug users"}, {"start": 548.3599999999999, "end": 552.92, "text": " with that if you look at what I gain from it it's not that much any money that I"}, {"start": 552.92, "end": 557.3599999999999, "text": " would make I would like to sort of reinvest into the channel and right now I"}, {"start": 557.3599999999999, "end": 561.52, "text": " just don't have any requirements that might change in the future maybe once we"}, {"start": 561.52, "end": 565.3199999999999, "text": " get to a hundred thousand subscribers. Alright that was it for YouTube"}, {"start": 565.32, "end": 569.84, "text": " analytics of this channel I hope you are still enjoying this content if you're"}, {"start": 569.84, "end": 575.88, "text": " not subscribed please do. Next update will be at a hundred thousand and I hope"}, {"start": 575.88, "end": 581.0400000000001, "text": " that everything is as enjoyable as ever thank you for watching thank you for"}, {"start": 581.04, "end": 598.76, "text": " subscribing thanks for being here and to the future."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=to7vCdkLi4s | Reinforcement Learning with Augmented Data (Paper Explained) | This ONE SIMPLE TRICK can take a vanilla RL algorithm to achieve state-of-the-art. What is it? Simply augment your training data before feeding it to the learner! This can be dropped into any RL pipeline and promises big improvements across the board.
Paper: https://arxiv.org/abs/2004.14990
Code: https://www.github.com/MishaLaskin/rad
Abstract:
Learning from visual observations is a fundamental yet challenging problem in reinforcement learning (RL). Although algorithmic advancements combined with convolutional neural networks have proved to be a recipe for success, current methods are still lacking on two fronts: (a) sample efficiency of learning and (b) generalization to new environments. To this end, we present RAD: Reinforcement Learning with Augmented Data, a simple plug-and-play module that can enhance any RL algorithm. We show that data augmentations such as random crop, color jitter, patch cutout, and random convolutions can enable simple RL algorithms to match and even outperform complex state-of-the-art methods across common benchmarks in terms of data-efficiency, generalization, and wall-clock speed. We find that data diversity alone can make agents focus on meaningful information from high-dimensional observations without any changes to the reinforcement learning method. On the DeepMind Control Suite, we show that RAD is state-of-the-art in terms of data-efficiency and performance across 15 environments. We further demonstrate that RAD can significantly improve the test-time generalization on several OpenAI ProcGen benchmarks. Finally, our customized data augmentation modules enable faster wall-clock speed compared to competing RL techniques. Our RAD module and training code are available at this https URL.
Authors: Michael Laskin, Kimin Lee, Adam Stooke, Lerrel Pinto, Pieter Abbeel, Aravind Srinivas
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 going to take a short look at reinforcement learning with augmented data. This paper is by Michael Laskin, Kimine Lee, and others from UC Berkeley and NYU. So the reason why this is a short look is because I believe the statements made in the paper are quite short and small, but they are quite grandiose. So we'll dive into it. The paper basically combines two things, reinforcement learning and data augmentation. Now reinforcement learning, we've talked about a number of times. It's basically where an agent is in a world and has to learn to solve an optimization problem by repeatedly interacting with the world. You can see here, for example, this is the Walker task where this Walker thing it has two feet and basically needs to stand upright and walk for a number of steps. The further you go, the better. So by repeatedly trying this and getting better and better at it, that is reinforcement learning. The second part is the data augmentation. Now data augmentation is a pretty standard practice in supervised learning. What does it mean? So if you have a supervised learning task, for example, an image classification task, here is a picture of a cat and the label is cat. Then you can feed this through your neural network to arrive at a loss. But you only have so many pictures. You have a database and maybe you have, I don't know, one million images. Usually what people do is they go, let's say, a number of times, like 20 or 50 times through that database, to basically have the model learn each image multiple times. But what turns out to be more successful is if you do data augmentation, that means you have an in between layer right here that takes this image and some modifies it in some small way. This could be, for example, it blocks out part of the image. So it simply blocks out the square here. And then you feed that through the model. And then the next time the image comes up, it does something different. For example, it randomly crops the image to only the top right part here. And then the next time it does a bit of a color jitter. And then the next time it goes to grayscale and so on. So supervised learning has found data augmentation to be quite beneficial. Because not only do you make the model learn what this picture is, but you also make the model kind of learn some small variations of that picture where you can be pretty sure they would not change the label. So you would not feed the model false information. That generally makes it more robust to test time discrepancies. So this paper has basically claims. If you want to do reinforcement learning, if you do simply do data augmentation with the input data to that reinforcement learning, it works much, much, much better. Now, of course we can expect since in supervised learning, this is a general trick that it would do something for reinforcement learning as well. But this paper basically claims that this one plug in like here. So this is basically you plug this into your pipeline in the reinforcement learning. This is basically as much of a gain as pretty much the last five years of research on reinforcement learning on these things. So let's dive into it. This paper proposes just what I said, just plug in the data augmentation and then do reinforcement learning on the augmented data. They use these data augmentations. So crop, we've already discussed. It's a random crop. Gray scale means that the picture goes to gray black and white with a certain probability. Cut out means that there's a little patch missing. Like I said, cut out color the same but in a random color. Flip means you flip the image horizontally or vertically according to random probability. Rotate is the same, but you instead of flip, you rotate it. Random con means you randomly convolve it with a filter. In this case, some red or blue or yellow filters and color jitter means that you can jitter around the colors in a sort of way that doesn't mess up the image too much. So you basically just kind of change the colors on the image, but the overall image still looks the same. The only thing you have to pay attention to is that so in your reinforcement learning pipeline, usually if you have a walker like this, what you want to do is you have your network here and then you have your policy and your value function. If you don't know what these are, we'll have, we have, I've treated them many times in reinforcement learning videos. What you want to do is you simply don't want to take this one current observation in here, but sometimes you want to take kind of the stacked of the last few frames so that the model kind of gets an idea. What happened during, let's say, the last one second, right? So it can determine in this walker, for example, it's not only important where the legs are, which are up here right now. It is also important there momentum, how they're moving, right? And you can determine that from the last few frames. So sometimes it's beneficial to feed the last few frames and they say the important thing here is that these augmentations are applied consistently across the stacked frames. So basically you select on an augmentation and on the scale of that augmentation and then you apply it to these stacked frames all the same. And then in the next forward pass, you have a different set of stacked frames, then you can decide on a, on a different augmentation. So that's basically the only difference between the supervised setting and this setting is that you have to consistently apply the augmentation. And you have to consistently apply this here and during training. So they formulate the classic, approximate policy optimization here, which is an actor critic method. And the only time you have to really pay attention is when you plug the observation into these models here, right here, then it needs to be the same augmentation. Sorry, the same observation. So that means the observation augmented with the same data with the same augmentation procedures. Alright, getting it together. Cool. So when you do this, when you do that, let's say, when applying RAD, which is the random random data augmentation to SAC, which is soft actor critic, right? RAD augmentations are applied to the observation past the Q and pi. So sorry, this is the thing up here. This is soft actor critic, which is the state of the art of policy algorithm for continuous control problems. And also you have to pay attention that when you feed the observations, they're the same observations like here and here. And then proximal policy optimization is the one is the state of the art on policy algorithm for learning a continuous or discrete control policy. Okay. So as I said, they simply drop this in there. And then it turns out they out perform or match performance of many, many baselines. Here you can see curl. I've made a video on curl, which is another way of augmenting or pre training for reinforcement learning. Then state of the art things like planet or dreamer. I've made a video on dreamer as well. And then pixel SAC and state SAC is sort of a cheating algorithm because it has access to the state, whereas all the other methods only have access to the pixels. And you can see that the data augmentation method, which is basically just plain RL plain P or SAC plus the plus the data augmentation out performs in many times all of these other baselines. Now here is a criticism of me. In order to say they never investigate, they simply say, wow, this reaches the same performance or outperforms these other methods. Now, so it's the state of the art algorithm. It's important to note here that this is on the DM control 100 K and 500 K benchmarks, which means that there's a limit on the number of, I believe, frames from these control tasks that you get. So you either get 100 K or you get 500 K frames. So the difficulty is learning from limited data. It's not state of the art reinforcement learning method overall. It is the state of the art on this particular task on learning from limited data. Now while I can believe that the augmentation would help here, I, it is completely unclear whether or not the augmentation gives the same benefits as like something like dreamer or whether the benefits from dreamer and the benefits from data augmentation are completely orthogonal. So in this paper, given that the claim is so simple that they make, I would expect like an investigation, what happens if I do dreamer plus the data augmentation? Maybe they've done it somewhere and I just haven't seen it, but it just seems like they, they put this on the base, basic or algorithm and then they claim, well, look here, it works well, but they never show that. So it could be that dreamer, all this architecture, what it simply does is basically recover these gains that you could get by data augmentation or it could be that it actually does something different, but just reaches the same amount of gain, right? It just reaches the same amount and improvement and by combining them, you could improve it further. So not, not just to get like a better number, but combining the two would actually give a lot of hints as to whether or not this augmentation works in line with the other methods or whether the other methods are really doing something meaningfully different or not, but this is just not done here. And so they go into the, they go into a question of which data augmentation contribute the most and they get to the point where they say random crop is extremely effective. So they have this table here where they just basically combine two augmentation and do you see, so for example, this thing here means that you apply gray scale and then rotate augmentation and that gets you to whatever 300 points in this walker. If you apply crop and then crop, it gets you to 920 points and beats everything else. So they say, okay, crop is the most effective. And I have, I have the sneaking suspicion that these augmentations are so effective simply because of how we set up these tasks, right? These reinforcement learning tasks, they don't tend to be a real world, they tend to be somewhat simulated. And as you can see here, the, the, the image is pretty clear. So you can pretty clearly see that here is a thing. There's no natural background or what not. It's procedurally generated, right? There are these stars that could confuse the model a bit, but still it is so easy visually this task that I'm going to guess the whole reason why these image augmentations help is simply because of the way these reinforcement learning tasks right now are set up. And I'm would guess that if we had reinforcement learning in something like the real world, that the image augmentation methods would help in about the way they help unsupervised tasks in, in the same data, for example, image net. So that is my sneaking suspicion. And this paper, I, I want to say it's sort of over claims. It's how, how absolutely great this works. Of course, it works great on these things, but I think there needs to be an investigation of where why? Right. So here they have some attention maps on where the algorithm focuses. And you can see when there is no data augmentation, it's sort of focuses on good points, but when you do crop, it focuses on this ridge here, which makes sense, right? Because that's the thing that needs to be kind of vertical in order for the walker to be stable. And in, if you do other things, then you can see it, it doesn't really focus, it focuses on different things. So the crop method seems to make the model focus on the most important part of the image. And as the same with the cheetah task here. So if you don't do augmentation and some of the augmentation, you can see that it actually focuses on some of these background stars, whereas in the crop version, it focuses on not on the stars, but actually on the cheetah as a whole, which probably makes sense. Now, again, I have a bit of a, I have a bit of a worry with these kinds of experiments, because we already know that crop will give you a much better score, right? So who's to say that if we could train this thing here to the same score, it wouldn't be paying attention to the same part. What they're trying to make clear here is that it is dependent on the particular type of data augmentation that the model gets a better grip on the input. But it is not really a valid comparison if we know that the crop agent performs a better score. And it could simply be that that's the reason why the attention is better, right? That that it is actually solving the problem better. So I mean, of course, this, the fact that it's working better is due to the fact that you have crop augmented the data, but the fact that is focusing on the correct parts is not a property of the crop augmentation, but the property of the fact that it reaches a higher score. That was a long-winded complaint, but I hope you get what I mean here. The last thing they do is they investigate generalization performance. So improving generalization on this open AI proc gen. Now, as I understand it, this is a reinforcement learning task or suite of tasks where you have procedurally generated levels. So you can sort of train on a bunch of levels and then test the generalization to new levels that you haven't seen before. So there's a jumper here and star pilot. So they seem like this, like a jump and run game or big fish. I don't even know what you have to do in big fish. But you can see that the levels are seen here. This is one example and unseen. So in this example, the background is very different and I'm going to guess in the jumper thing, not only is the background different, but also the kind of generated level how you have to jump is quite different. So they investigate whether or not a agent trained on only the scene ones can generalize to the unseen ones. And this table presents the results. And as you can see, the RAD with the crop or with other things outperform the pixel based PPO's. Now, there is some nuance to this table here. First of all, you can see that this crop thing is now only the winner in one of these three tasks, right, in the in the big fish thing. There is another augmentation technique here that wins over at star pilot. But you can see the difference is not that high. And in the jumper with 200 levels. So this is 100 or 200 levels. The original method is even the best. So here again, I believe this is evidence that that it is very much an interaction of these augmentations with the way the task is set up and not the augmentations themselves or the fact that you're augmenting. For example, if we look at this big fish, we've seen, okay, the what seems to change here is mainly the background, whereas in the jumper example, the entire level structure seems to change. So then the augmentation all of a sudden is not super effective anymore. Actually, it hurts. So I'm just not super convinced by the claims we're making here. And one of the claims I find is in particular, that with random crop achieves, no wait, this not point down here. Oh yeah, achieves 55.8% gain over pixel based PPO. Okay. Trained with 100 training levels outperforms the pixel based PPO with 200 training levels on both big fish and star pilot environment. This shows that data augmentation can be more effective in learning generalizable representations compared to simply increasing the number of training environments. I this statement. So again, how like, why do you compare two different things if you don't like, if you don't show that maybe they're orthogonal. In fact, they are probably orthogonal because even on the 200 levels, you you gain over the pixel based PPO, right? So why the comparison? And then second of all, so here we see on the 100 levels, this method is better than the pixel based PPO. And then they claim that, okay, they are even better on 100 levels than the pixel based PPO on 200 levels. And why that is true. If you know, if if if A is bigger than B, then probably A is going to be bigger than B plus some epsilon. And right. And that doesn't I just think that doesn't really warrant their statement where they say, Oh, look, this is even better. So as if the 100 levels of additional training were the standard measure of more data, like if there is going to be, if you're better at the beginning, there's going to be a certain amount of data where you're still better than the other method with more data. And I don't find this super duper surprising, but they make a big claim here out of this. All right. So in conclusion, I hope I'm not too harsh on this paper. It is a cool paper. And of course, it is cool findings. But I have a big suspicion that the augmentation here works so well, simply because of how we set up these RL tasks, because they're visually quite, let's say, easy. And therefore, these augmentations that are also our sort of easy abstractions of when an image is visually similar, because all of these things, right, to us as humans, we say, probably doesn't change anything if we just rotate the image. And we, this is our prejudice. And we built this prejudice into these simulators for the RL tasks. So they will match up extremely well with these augmentations. And that's the reason I believe these things work. And maybe not as much the fact that you're augmenting. Okay. Well, if you like this video, I invite you to check out the paper. Subscribe to this channel, tell all your friends about it, and leave a like in the comment. Thank you very much and bye-bye. | [{"start": 0.0, "end": 5.74, "text": " Hi there. Today we're going to take a short look at reinforcement learning with augmented"}, {"start": 5.74, "end": 12.68, "text": " data. This paper is by Michael Laskin, Kimine Lee, and others from UC Berkeley and NYU."}, {"start": 12.68, "end": 17.54, "text": " So the reason why this is a short look is because I believe the statements made in the paper"}, {"start": 17.54, "end": 26.54, "text": " are quite short and small, but they are quite grandiose. So we'll dive into it. The paper"}, {"start": 26.54, "end": 32.18, "text": " basically combines two things, reinforcement learning and data augmentation. Now reinforcement"}, {"start": 32.18, "end": 36.94, "text": " learning, we've talked about a number of times. It's basically where an agent is in a world"}, {"start": 36.94, "end": 43.42, "text": " and has to learn to solve an optimization problem by repeatedly interacting with the world."}, {"start": 43.42, "end": 50.94, "text": " You can see here, for example, this is the Walker task where this Walker thing it has two"}, {"start": 50.94, "end": 55.739999999999995, "text": " feet and basically needs to stand upright and walk for a number of steps. The further you"}, {"start": 55.74, "end": 60.260000000000005, "text": " go, the better. So by repeatedly trying this and getting better and better at it, that"}, {"start": 60.260000000000005, "end": 68.32000000000001, "text": " is reinforcement learning. The second part is the data augmentation. Now data augmentation"}, {"start": 68.32000000000001, "end": 74.22, "text": " is a pretty standard practice in supervised learning. What does it mean? So if you have"}, {"start": 74.22, "end": 79.46000000000001, "text": " a supervised learning task, for example, an image classification task, here is a picture"}, {"start": 79.46, "end": 87.33999999999999, "text": " of a cat and the label is cat. Then you can feed this through your neural network to arrive"}, {"start": 87.33999999999999, "end": 94.86, "text": " at a loss. But you only have so many pictures. You have a database and maybe you have, I"}, {"start": 94.86, "end": 101.25999999999999, "text": " don't know, one million images. Usually what people do is they go, let's say, a number"}, {"start": 101.25999999999999, "end": 108.17999999999999, "text": " of times, like 20 or 50 times through that database, to basically have the model learn"}, {"start": 108.18, "end": 115.9, "text": " each image multiple times. But what turns out to be more successful is if you do data augmentation,"}, {"start": 115.9, "end": 123.54, "text": " that means you have an in between layer right here that takes this image and some modifies"}, {"start": 123.54, "end": 131.22, "text": " it in some small way. This could be, for example, it blocks out part of the image. So it"}, {"start": 131.22, "end": 139.34, "text": " simply blocks out the square here. And then you feed that through the model. And then"}, {"start": 139.34, "end": 143.38, "text": " the next time the image comes up, it does something different. For example, it randomly"}, {"start": 143.38, "end": 149.66, "text": " crops the image to only the top right part here. And then the next time it does a bit"}, {"start": 149.66, "end": 156.7, "text": " of a color jitter. And then the next time it goes to grayscale and so on. So supervised"}, {"start": 156.7, "end": 161.82, "text": " learning has found data augmentation to be quite beneficial. Because not only do you make"}, {"start": 161.82, "end": 167.45999999999998, "text": " the model learn what this picture is, but you also make the model kind of learn some"}, {"start": 167.45999999999998, "end": 172.5, "text": " small variations of that picture where you can be pretty sure they would not change the"}, {"start": 172.5, "end": 176.89999999999998, "text": " label. So you would not feed the model false information. That generally makes it more"}, {"start": 176.89999999999998, "end": 185.57999999999998, "text": " robust to test time discrepancies. So this paper has basically claims. If you want to"}, {"start": 185.58, "end": 193.74, "text": " do reinforcement learning, if you do simply do data augmentation with the input data"}, {"start": 193.74, "end": 199.42000000000002, "text": " to that reinforcement learning, it works much, much, much better. Now, of course we can"}, {"start": 199.42000000000002, "end": 203.98000000000002, "text": " expect since in supervised learning, this is a general trick that it would do something"}, {"start": 203.98000000000002, "end": 210.14000000000001, "text": " for reinforcement learning as well. But this paper basically claims that this one plug"}, {"start": 210.14000000000001, "end": 215.02, "text": " in like here. So this is basically you plug this into your pipeline in the reinforcement"}, {"start": 215.02, "end": 225.78, "text": " learning. This is basically as much of a gain as pretty much the last five years of research"}, {"start": 225.78, "end": 235.06, "text": " on reinforcement learning on these things. So let's dive into it. This paper proposes just"}, {"start": 235.06, "end": 240.18, "text": " what I said, just plug in the data augmentation and then do reinforcement learning on the augmented"}, {"start": 240.18, "end": 245.82, "text": " data. They use these data augmentations. So crop, we've already discussed. It's a random"}, {"start": 245.82, "end": 253.34, "text": " crop. Gray scale means that the picture goes to gray black and white with a certain probability."}, {"start": 253.34, "end": 259.5, "text": " Cut out means that there's a little patch missing. Like I said, cut out color the same"}, {"start": 259.5, "end": 265.9, "text": " but in a random color. Flip means you flip the image horizontally or vertically according"}, {"start": 265.9, "end": 273.65999999999997, "text": " to random probability. Rotate is the same, but you instead of flip, you rotate it. Random"}, {"start": 273.65999999999997, "end": 281.09999999999997, "text": " con means you randomly convolve it with a filter. In this case, some red or blue or yellow"}, {"start": 281.09999999999997, "end": 292.94, "text": " filters and color jitter means that you can jitter around the colors in a sort of way"}, {"start": 292.94, "end": 297.82, "text": " that doesn't mess up the image too much. So you basically just kind of change the colors"}, {"start": 297.82, "end": 305.22, "text": " on the image, but the overall image still looks the same. The only thing you have to pay"}, {"start": 305.22, "end": 309.62, "text": " attention to is that so in your reinforcement learning pipeline, usually if you have a"}, {"start": 309.62, "end": 314.65999999999997, "text": " walker like this, what you want to do is you have your network here and then you have"}, {"start": 314.65999999999997, "end": 320.1, "text": " your policy and your value function. If you don't know what these are, we'll have, we"}, {"start": 320.1, "end": 325.66, "text": " have, I've treated them many times in reinforcement learning videos. What you want to do is you simply"}, {"start": 325.66, "end": 331.90000000000003, "text": " don't want to take this one current observation in here, but sometimes you want to take kind"}, {"start": 331.90000000000003, "end": 337.18, "text": " of the stacked of the last few frames so that the model kind of gets an idea. What happened"}, {"start": 337.18, "end": 343.3, "text": " during, let's say, the last one second, right? So it can determine in this walker, for"}, {"start": 343.3, "end": 349.74, "text": " example, it's not only important where the legs are, which are up here right now. It is also"}, {"start": 349.74, "end": 356.7, "text": " important there momentum, how they're moving, right? And you can determine that from the last"}, {"start": 356.7, "end": 362.78000000000003, "text": " few frames. So sometimes it's beneficial to feed the last few frames and they say the important"}, {"start": 362.78000000000003, "end": 368.02, "text": " thing here is that these augmentations are applied consistently across the stacked frames."}, {"start": 368.02, "end": 373.34, "text": " So basically you select on an augmentation and on the scale of that augmentation and then"}, {"start": 373.34, "end": 379.97999999999996, "text": " you apply it to these stacked frames all the same. And then in the next forward pass, you"}, {"start": 379.97999999999996, "end": 385.09999999999997, "text": " have a different set of stacked frames, then you can decide on a, on a different augmentation."}, {"start": 385.09999999999997, "end": 389.78, "text": " So that's basically the only difference between the supervised setting and this setting is that"}, {"start": 389.78, "end": 397.62, "text": " you have to consistently apply the augmentation. And you have to consistently apply this here"}, {"start": 397.62, "end": 406.22, "text": " and during training. So they formulate the classic, approximate policy optimization here,"}, {"start": 406.22, "end": 413.26, "text": " which is an actor critic method. And the only time you have to really pay attention is when"}, {"start": 413.26, "end": 422.06, "text": " you plug the observation into these models here, right here, then it needs to be the same"}, {"start": 422.06, "end": 427.82, "text": " augmentation. Sorry, the same observation. So that means the observation augmented with the"}, {"start": 427.82, "end": 438.46, "text": " same data with the same augmentation procedures. Alright, getting it together. Cool. So when you"}, {"start": 438.46, "end": 445.54, "text": " do this, when you do that, let's say, when applying RAD, which is the random random data augmentation"}, {"start": 445.54, "end": 455.38, "text": " to SAC, which is soft actor critic, right? RAD augmentations are applied to the observation"}, {"start": 455.38, "end": 461.5, "text": " past the Q and pi. So sorry, this is the thing up here. This is soft actor critic, which"}, {"start": 461.5, "end": 465.90000000000003, "text": " is the state of the art of policy algorithm for continuous control problems. And also you"}, {"start": 465.90000000000003, "end": 471.02000000000004, "text": " have to pay attention that when you feed the observations, they're the same observations"}, {"start": 471.02, "end": 476.74, "text": " like here and here. And then proximal policy optimization is the one is the state of the"}, {"start": 476.74, "end": 487.14, "text": " art on policy algorithm for learning a continuous or discrete control policy. Okay. So as I said,"}, {"start": 487.14, "end": 495.97999999999996, "text": " they simply drop this in there. And then it turns out they out perform or match performance"}, {"start": 495.98, "end": 506.22, "text": " of many, many baselines. Here you can see curl. I've made a video on curl, which is another"}, {"start": 506.22, "end": 513.3000000000001, "text": " way of augmenting or pre training for reinforcement learning. Then state of the art things like"}, {"start": 513.3000000000001, "end": 520.4200000000001, "text": " planet or dreamer. I've made a video on dreamer as well. And then pixel SAC and state SAC is"}, {"start": 520.4200000000001, "end": 524.74, "text": " sort of a cheating algorithm because it has access to the state, whereas all the other"}, {"start": 524.74, "end": 531.98, "text": " methods only have access to the pixels. And you can see that the data augmentation method,"}, {"start": 531.98, "end": 542.22, "text": " which is basically just plain RL plain P or SAC plus the plus the data augmentation out"}, {"start": 542.22, "end": 551.46, "text": " performs in many times all of these other baselines. Now here is a criticism of me. In order"}, {"start": 551.46, "end": 556.82, "text": " to say they never investigate, they simply say, wow, this reaches the same performance or"}, {"start": 556.82, "end": 562.58, "text": " outperforms these other methods. Now, so it's the state of the art algorithm. It's important"}, {"start": 562.58, "end": 570.62, "text": " to note here that this is on the DM control 100 K and 500 K benchmarks, which means that"}, {"start": 570.62, "end": 576.9000000000001, "text": " there's a limit on the number of, I believe, frames from these control tasks that you get."}, {"start": 576.9, "end": 583.02, "text": " So you either get 100 K or you get 500 K frames. So the difficulty is learning from limited"}, {"start": 583.02, "end": 588.74, "text": " data. It's not state of the art reinforcement learning method overall. It is the state of"}, {"start": 588.74, "end": 595.02, "text": " the art on this particular task on learning from limited data. Now while I can believe"}, {"start": 595.02, "end": 603.98, "text": " that the augmentation would help here, I, it is completely unclear whether or not the augmentation"}, {"start": 603.98, "end": 610.4200000000001, "text": " gives the same benefits as like something like dreamer or whether the benefits from dreamer"}, {"start": 610.4200000000001, "end": 616.54, "text": " and the benefits from data augmentation are completely orthogonal. So in this paper, given"}, {"start": 616.54, "end": 622.22, "text": " that the claim is so simple that they make, I would expect like an investigation, what"}, {"start": 622.22, "end": 631.62, "text": " happens if I do dreamer plus the data augmentation? Maybe they've done it somewhere and I just haven't"}, {"start": 631.62, "end": 638.58, "text": " seen it, but it just seems like they, they put this on the base, basic or algorithm and"}, {"start": 638.58, "end": 645.82, "text": " then they claim, well, look here, it works well, but they never show that. So it could be"}, {"start": 645.82, "end": 651.42, "text": " that dreamer, all this architecture, what it simply does is basically recover these gains"}, {"start": 651.42, "end": 656.86, "text": " that you could get by data augmentation or it could be that it actually does something"}, {"start": 656.86, "end": 662.74, "text": " different, but just reaches the same amount of gain, right? It just reaches the same amount"}, {"start": 662.74, "end": 668.42, "text": " and improvement and by combining them, you could improve it further. So not, not just"}, {"start": 668.42, "end": 673.1800000000001, "text": " to get like a better number, but combining the two would actually give a lot of hints"}, {"start": 673.1800000000001, "end": 679.38, "text": " as to whether or not this augmentation works in line with the other methods or whether"}, {"start": 679.38, "end": 684.46, "text": " the other methods are really doing something meaningfully different or not, but this is"}, {"start": 684.46, "end": 695.22, "text": " just not done here. And so they go into the, they go into a question of which data augmentation"}, {"start": 695.22, "end": 704.02, "text": " contribute the most and they get to the point where they say random crop is extremely effective."}, {"start": 704.02, "end": 710.3000000000001, "text": " So they have this table here where they just basically combine two augmentation and do"}, {"start": 710.3, "end": 715.18, "text": " you see, so for example, this thing here means that you apply gray scale and then rotate"}, {"start": 715.18, "end": 721.38, "text": " augmentation and that gets you to whatever 300 points in this walker. If you apply crop"}, {"start": 721.38, "end": 728.78, "text": " and then crop, it gets you to 920 points and beats everything else. So they say, okay,"}, {"start": 728.78, "end": 739.0999999999999, "text": " crop is the most effective. And I have, I have the sneaking suspicion that these augmentations"}, {"start": 739.1, "end": 744.3000000000001, "text": " are so effective simply because of how we set up these tasks, right? These reinforcement"}, {"start": 744.3000000000001, "end": 748.98, "text": " learning tasks, they don't tend to be a real world, they tend to be somewhat simulated."}, {"start": 748.98, "end": 755.1, "text": " And as you can see here, the, the, the image is pretty clear. So you can pretty clearly"}, {"start": 755.1, "end": 759.4200000000001, "text": " see that here is a thing. There's no natural background or what not. It's procedurally"}, {"start": 759.4200000000001, "end": 765.1, "text": " generated, right? There are these stars that could confuse the model a bit, but still it"}, {"start": 765.1, "end": 772.4200000000001, "text": " is so easy visually this task that I'm going to guess the whole reason why these image"}, {"start": 772.4200000000001, "end": 777.38, "text": " augmentations help is simply because of the way these reinforcement learning tasks right"}, {"start": 777.38, "end": 784.1, "text": " now are set up. And I'm would guess that if we had reinforcement learning in something"}, {"start": 784.1, "end": 789.62, "text": " like the real world, that the image augmentation methods would help in about the way they"}, {"start": 789.62, "end": 796.42, "text": " help unsupervised tasks in, in the same data, for example, image net. So that is my sneaking"}, {"start": 796.42, "end": 806.62, "text": " suspicion. And this paper, I, I want to say it's sort of over claims. It's how, how"}, {"start": 806.62, "end": 812.34, "text": " absolutely great this works. Of course, it works great on these things, but I think there"}, {"start": 812.34, "end": 818.82, "text": " needs to be an investigation of where why? Right. So here they have some attention maps"}, {"start": 818.82, "end": 823.1400000000001, "text": " on where the algorithm focuses. And you can see when there is no data augmentation, it's"}, {"start": 823.1400000000001, "end": 831.38, "text": " sort of focuses on good points, but when you do crop, it focuses on this ridge here, which"}, {"start": 831.38, "end": 837.2600000000001, "text": " makes sense, right? Because that's the thing that needs to be kind of vertical in order"}, {"start": 837.2600000000001, "end": 844.1400000000001, "text": " for the walker to be stable. And in, if you do other things, then you can see it, it"}, {"start": 844.14, "end": 851.98, "text": " doesn't really focus, it focuses on different things. So the crop method seems to make"}, {"start": 851.98, "end": 860.18, "text": " the model focus on the most important part of the image. And as the same with the cheetah"}, {"start": 860.18, "end": 864.3, "text": " task here. So if you don't do augmentation and some of the augmentation, you can see"}, {"start": 864.3, "end": 870.9399999999999, "text": " that it actually focuses on some of these background stars, whereas in the crop version,"}, {"start": 870.94, "end": 877.98, "text": " it focuses on not on the stars, but actually on the cheetah as a whole, which probably"}, {"start": 877.98, "end": 884.0600000000001, "text": " makes sense. Now, again, I have a bit of a, I have a bit of a worry with these kinds of"}, {"start": 884.0600000000001, "end": 890.58, "text": " experiments, because we already know that crop will give you a much better score, right?"}, {"start": 890.58, "end": 896.58, "text": " So who's to say that if we could train this thing here to the same score, it wouldn't"}, {"start": 896.58, "end": 903.7, "text": " be paying attention to the same part. What they're trying to make clear here is that it"}, {"start": 903.7, "end": 910.34, "text": " is dependent on the particular type of data augmentation that the model gets a better"}, {"start": 910.34, "end": 920.5400000000001, "text": " grip on the input. But it is not really a valid comparison if we know that the crop agent"}, {"start": 920.54, "end": 927.62, "text": " performs a better score. And it could simply be that that's the reason why the attention"}, {"start": 927.62, "end": 933.6999999999999, "text": " is better, right? That that it is actually solving the problem better. So I mean, of course,"}, {"start": 933.6999999999999, "end": 939.9, "text": " this, the fact that it's working better is due to the fact that you have crop augmented"}, {"start": 939.9, "end": 946.0999999999999, "text": " the data, but the fact that is focusing on the correct parts is not a property of the"}, {"start": 946.1, "end": 953.9, "text": " crop augmentation, but the property of the fact that it reaches a higher score. That was"}, {"start": 953.9, "end": 962.1, "text": " a long-winded complaint, but I hope you get what I mean here. The last thing they do is"}, {"start": 962.1, "end": 968.02, "text": " they investigate generalization performance. So improving generalization on this open AI"}, {"start": 968.02, "end": 975.26, "text": " proc gen. Now, as I understand it, this is a reinforcement learning task or suite of tasks"}, {"start": 975.26, "end": 983.06, "text": " where you have procedurally generated levels. So you can sort of train on a bunch of levels"}, {"start": 983.06, "end": 988.7, "text": " and then test the generalization to new levels that you haven't seen before. So there's"}, {"start": 988.7, "end": 995.1, "text": " a jumper here and star pilot. So they seem like this, like a jump and run game or big"}, {"start": 995.1, "end": 1000.1, "text": " fish. I don't even know what you have to do in big fish. But you can see that the levels"}, {"start": 1000.1, "end": 1008.0600000000001, "text": " are seen here. This is one example and unseen. So in this example, the background is very"}, {"start": 1008.0600000000001, "end": 1013.02, "text": " different and I'm going to guess in the jumper thing, not only is the background different,"}, {"start": 1013.02, "end": 1019.38, "text": " but also the kind of generated level how you have to jump is quite different. So they investigate"}, {"start": 1019.38, "end": 1027.6200000000001, "text": " whether or not a agent trained on only the scene ones can generalize to the unseen ones."}, {"start": 1027.62, "end": 1036.6599999999999, "text": " And this table presents the results. And as you can see, the RAD with the crop or with"}, {"start": 1036.6599999999999, "end": 1046.02, "text": " other things outperform the pixel based PPO's. Now, there is some nuance to this table"}, {"start": 1046.02, "end": 1054.8999999999999, "text": " here. First of all, you can see that this crop thing is now only the winner in one of"}, {"start": 1054.9, "end": 1062.26, "text": " these three tasks, right, in the in the big fish thing. There is another augmentation"}, {"start": 1062.26, "end": 1067.94, "text": " technique here that wins over at star pilot. But you can see the difference is not that"}, {"start": 1067.94, "end": 1078.8200000000002, "text": " high. And in the jumper with 200 levels. So this is 100 or 200 levels. The original method"}, {"start": 1078.82, "end": 1086.82, "text": " is even the best. So here again, I believe this is evidence that that it is very much an"}, {"start": 1086.82, "end": 1093.82, "text": " interaction of these augmentations with the way the task is set up and not the augmentations"}, {"start": 1093.82, "end": 1099.22, "text": " themselves or the fact that you're augmenting. For example, if we look at this big fish,"}, {"start": 1099.22, "end": 1106.02, "text": " we've seen, okay, the what seems to change here is mainly the background, whereas in"}, {"start": 1106.02, "end": 1116.82, "text": " the jumper example, the entire level structure seems to change. So then the augmentation"}, {"start": 1116.82, "end": 1125.7, "text": " all of a sudden is not super effective anymore. Actually, it hurts. So I'm just not super"}, {"start": 1125.7, "end": 1131.66, "text": " convinced by the claims we're making here. And one of the claims I find is in particular,"}, {"start": 1131.66, "end": 1138.18, "text": " that with random crop achieves, no wait, this not point down here. Oh yeah, achieves"}, {"start": 1138.18, "end": 1147.66, "text": " 55.8% gain over pixel based PPO. Okay. Trained with 100 training levels outperforms the"}, {"start": 1147.66, "end": 1153.6200000000001, "text": " pixel based PPO with 200 training levels on both big fish and star pilot environment."}, {"start": 1153.62, "end": 1162.1399999999999, "text": " This shows that data augmentation can be more effective in learning generalizable representations"}, {"start": 1162.1399999999999, "end": 1168.5, "text": " compared to simply increasing the number of training environments. I this statement. So"}, {"start": 1168.5, "end": 1176.02, "text": " again, how like, why do you compare two different things if you don't like, if you don't show"}, {"start": 1176.02, "end": 1181.58, "text": " that maybe they're orthogonal. In fact, they are probably orthogonal because even on the"}, {"start": 1181.58, "end": 1191.22, "text": " 200 levels, you you gain over the pixel based PPO, right? So why the comparison? And then"}, {"start": 1191.22, "end": 1197.78, "text": " second of all, so here we see on the 100 levels, this method is better than the pixel based"}, {"start": 1197.78, "end": 1204.02, "text": " PPO. And then they claim that, okay, they are even better on 100 levels than the pixel"}, {"start": 1204.02, "end": 1215.58, "text": " based PPO on 200 levels. And why that is true. If you know, if if if A is bigger than B,"}, {"start": 1215.58, "end": 1228.26, "text": " then probably A is going to be bigger than B plus some epsilon. And right. And that doesn't"}, {"start": 1228.26, "end": 1233.78, "text": " I just think that doesn't really warrant their statement where they say, Oh, look, this"}, {"start": 1233.78, "end": 1242.46, "text": " is even better. So as if the 100 levels of additional training were the standard measure"}, {"start": 1242.46, "end": 1247.66, "text": " of more data, like if there is going to be, if you're better at the beginning, there's"}, {"start": 1247.66, "end": 1252.94, "text": " going to be a certain amount of data where you're still better than the other method with"}, {"start": 1252.94, "end": 1260.7, "text": " more data. And I don't find this super duper surprising, but they make a big claim here"}, {"start": 1260.7, "end": 1267.5, "text": " out of this. All right. So in conclusion, I hope I'm not too harsh on this paper. It is"}, {"start": 1267.5, "end": 1274.26, "text": " a cool paper. And of course, it is cool findings. But I have a big suspicion that the augmentation"}, {"start": 1274.26, "end": 1279.5800000000002, "text": " here works so well, simply because of how we set up these RL tasks, because they're"}, {"start": 1279.58, "end": 1287.02, "text": " visually quite, let's say, easy. And therefore, these augmentations that are also our sort"}, {"start": 1287.02, "end": 1292.22, "text": " of easy abstractions of when an image is visually similar, because all of these things,"}, {"start": 1292.22, "end": 1299.1399999999999, "text": " right, to us as humans, we say, probably doesn't change anything if we just rotate the image."}, {"start": 1299.1399999999999, "end": 1305.1399999999999, "text": " And we, this is our prejudice. And we built this prejudice into these simulators for"}, {"start": 1305.14, "end": 1311.8600000000001, "text": " the RL tasks. So they will match up extremely well with these augmentations. And that's"}, {"start": 1311.8600000000001, "end": 1319.3000000000002, "text": " the reason I believe these things work. And maybe not as much the fact that you're augmenting."}, {"start": 1320.74, "end": 1326.3400000000001, "text": " Okay. Well, if you like this video, I invite you to check out the paper. Subscribe to this channel,"}, {"start": 1326.34, "end": 1341.4599999999998, "text": " tell all your friends about it, and leave a like in the comment. Thank you very much and bye-bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=cIUtRNhY6Rw | TAPAS: Weakly Supervised Table Parsing via Pre-training (Paper Explained) | Answering complex questions about tabular information is hard. No two tables are alike and sometimes the answer you're looking for is not even in the table and needs to be computed from a subset of the cells. Surprisingly, this model can figure it all out by itself through some clever input encoding and loss engineering.
Paper: https://arxiv.org/abs/2004.02349
Code: https://github.com/google-research/tapas
Abstract:
Answering natural language questions over tables is usually seen as a semantic parsing task. To alleviate the collection cost of full logical forms, one popular approach focuses on weak supervision consisting of denotations instead of logical forms. However, training semantic parsers from weak supervision poses difficulties, and in addition, the generated logical forms are only used as an intermediate step prior to retrieving the denotation. In this paper, we present TAPAS, an approach to question answering over tables without generating logical forms. TAPAS trains from weak supervision, and predicts the denotation by selecting table cells and optionally applying a corresponding aggregation operator to such selection. TAPAS extends BERT's architecture to encode tables as input, initializes from an effective joint pre-training of text segments and tables crawled from Wikipedia, and is trained end-to-end. We experiment with three different semantic parsing datasets, and find that TAPAS outperforms or rivals semantic parsing models by improving state-of-the-art accuracy on SQA from 55.1 to 67.2 and performing on par with the state-of-the-art on WIKISQL and WIKITQ, but with a simpler model architecture. We additionally find that transfer learning, which is trivial in our setting, from WIKISQL to WIKITQ, yields 48.7 accuracy, 4.2 points above the state-of-the-art.
Authors: Jonathan Herzig, Paweł Krzysztof Nowak, Thomas Müller, Francesco Piccinno, Julian Martin Eisenschlos
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, have a look at this table on the left. So in this table, in each row, you can see following things. The name of a wrestler, the number of times that wrestler has been a champion, and the combined number of days where that wrestler has been a champion, or like the sum of the length of all their championships. Along with the column that is the rank, and this is ranked by the combined days attribute. So this table is very interesting by itself, but if you look at the right, we have a couple of questions. And let's try to answer them. Which wrestler had the most number of reigns? So for that, you'd need to go to number of reigns column, right? And you'd need to mentally sort them, and you'll find out that eight is the highest number. And therefore, Ric Flair is the wrestler you're looking for. Second question, the average time as a champion for top two wrestlers. Now we need to go the top two wrestlers. We can guess that pertains to the rank, and then so we want the average of these two numbers. You even have questions such as which of the following wrestlers were ranked in the bottom three, which the answers would be all of those. And then after that, out of these, who had more than one reign? And you can see that's then seven. So the paper that we're having here is trying to answer questions like this if given a table. As you can see, this is a pretty, pretty hard task. And so pretty excited to read this. The paper is called Tapas, weekly supervised table parsing via pre-training by Jonathan Herzegpavl, Christ of Novak, Thomas Miller, Francesco Pichino, and Julian Martin Isenshelos. Full disclaimer, I know these people, so I might be slightly biased. All right, so you've already seen the task. The task is you are given a table and a question and you're trying to answer that. Now it's not as easy as that, but the table questions come in different forms. As you have seen, sometimes you just need to select a cell from a table like we have here. The first question, I simply, most number of reigns, I simply select whatever that is. So the answer here is already in the table, Ric Flair. And this they call a cell selection task. This is wherever you need to select a cell. The same for these bottom here, so which of the following rest there's ranked in the bottom three and out of these, which one of more than one reign, all of these answers are in the table somewhere. The second thing is what they call a scalar answer. That is when the answer to be computed is a number that is not in the table. So these average time here, which turns out to be 3,426, is nowhere to be found in the table. So there actually needs to be a computation performed by the model. And lastly, you have these things called ambiguous answers. Now the ambiguous answers refer to a thing where it is a number that you're looking for. So how many? But the number here is in the table. So you can think of this in terms of training data. If you have a task like this and you have training data and you just have the question, you just have this question and you're given the answer to, right? You can teach your model either to select this number here or you can teach your model that would be wrong, right? Because how many world champions are there with only one reign? To simply select this cell here is not correct because that cell, even though the number is two, it doesn't mean the same thing. It's not counting, right? So the correct program here would be to count the number to count the cells where there is a one here, which is also two. And they call this situation ambiguous answer. So you might have already guessed that a single model that does all of this needs to sort of have multiple modes. That's exactly what they propose. So they propose a model that takes in the table and the question. And then in the first step, it selects its mode. So the mode is either the cell selection or it is to compute something. And then whenever it's a cell selection, it simply has a component to select cells. But when it's a compute, it needs to decide in the second step what to compute. And then also select the appropriate cells. So this is the model. But this stuff like this has existed for a long time in these table answering things. But the way we want to do it here is end to end with a single deep learning model, of course, because we want to be better than anything else. And the trend in deep learning is to put more and more into one model and to have it end to end differentiable. All right. So you see, we need multiple components. We need some sort of a mode selector. We need some sort of a cell collector and we need a thing that decides if we are in the compute mode, what computation to be done. Now let me present the model that this paper proposes. So this paper proposes to embed the question here. So you can see here, that's the question, into a birth input. So this is a transformer right here. This is birthed or any variant of birth that you can think of. So the question is embedded as natural language. And then interestingly enough, the table right here is also embedded as language. We'll get to that in a second. But the question and the table are in the input and then the model is asked to do two things. First of all, it's asked to do an aggregation prediction. So this can either be one of these programs called count sum average or it can be, as you can see here, none. So no aggregation. So this handles our first two components. It can decide to perform a calculation or none. And if it is performing a calculation, it can decide to do account sum or an average. Now of course the model here is not limited to those computations. You can think of extending this to any further computation. The important thing is that they have a number as an output. Second of all, there is a cell selector. So depending on this aggregation prediction, you need some cells. Like if you want to compute an average, you need the cells to compute an average over. So the cell selector here will select cells from the table. Is specifically, it goes by row and column. Sorry, column and row. Since these tables, usually they have a header, right? This is the table header where the attributes are listed. It makes sense to first, in a first step, select which column you want to select from. And then, if once you have a column, let's say this column here, in the second step, you say which of the cells you want to select. Now these can be multiple, but the way the system is set up, it's first a column selector and then a cell selector within that column. So you can only ever get columns from the same cell in this thing. Let's remember that for later. All right, so this is what the model does. Now let's look at the input. The input to the model is this here. Now this, if you refer from this before, this was in this blue box and then here you'd have the computation selection and here you have the cell selection. So this is how you can relate that. So usually, if you input something into a transformer, what you want to do is you want to embed this into a token embedding. So first you want to split everything you put into what are called tokens. Now tokens are either things like words or word pieces. The important thing is to have a dictionary for it and each one gets mapped to a vector. So this here is your query. You take your query as a string and you tokenize it and you get the embeddings from the embedding table and that's your input. Right? So it's a sequence of token embeddings. And then you also embed the table. And this I find pretty cool here in this model and somewhat special is that the table is actually presented as just natural language. So you can see here the table is one string. It's just a single string that goes from left to right. It's just the serialized table. So this table right here, you can see these are word pieces. So this table if I reconstruct it, if I can attempt to reconstruct it, it is going to be a table that has as the headers call one, call two. These are the names. So in that days before here would be name of the wrestler and this would be number of days. And then here zero, one, two, three. So this table right here corresponds to this string right here. I hope you can make sense of that. So the table is just put there as one long string. And then in order to make the model realize, you know, what the table is, you have these special embeddings. So usually in bird, you have what they're called position embeddings to indicate where in the sequence that is. So in a simplest case, these are embeddings for the numbers zero, one, two, three, four, and so on. So wherever the position is, this you can all look up in the attention is all you need video. And if you make that, if you are unfamiliar with transformer inputs, then also the segment embeddings simply indicate where a token is part of. So for every token that's part of the query, you see you have segment zero embedding. And for every token that's part of the table, if a segment won a many, this is simply to tell the model, hey, this particular token is part of the question or part of the table. Then you have the new things. So this paper newly introduces the following embeddings column and row embeddings. Now these, for the question, of course, they don't make any sense, but you have to put something here. So you just put column zero. But for the table, you see there is a column one and column two. And this exactly, so we've seen that this here is the header of column one, and this is the header of column two. And then it goes back column one, column two, column one, column two. And you can see here this zero is in column one, and this one is in column two, and this in column one again, and the same for the rows. So you have row zero for the headers. And then row one for the first two numbers and row two for the second two numbers. So this is all of this. So you see these two are in the first row and these two are in the second row. All of this is to tell the model. All of this information down here is to tell the model how this table looks. So if it wants to select the second column from the third row, it would look in this information to see which cell to select. And then the last thing they introduce is this so-called rank embeddings. Now as we've seen before, if this first column here is maybe the number of days of something. So this is the number of days. And this second one is the number of rains, so how many championships. The table can only be sorted at maximum by one of them. So you want to sort of, for each cell, you want to tell the model, let's extend that table by two numbers, four and one. So for each column, you want to tell the model the ranking of the numbers. So here it's pretty easy. This is rank one, this is rank two, this is rank three. For the left side, this is rank one, this is rank two down here, and this is rank three. So the model has an, if you give this information, the model will have an easier time to detect, like give me the top two or something like this, give me the worst, give me the best, give me the highest and so on. The model will have an easier time doing that. So that's why the rank here, as you can see, the zero and also the number one are embedded rank one and the other two rank two because they're just lower. Now I don't feel, I feel they could have given a better example than this table. I feel you could actually put real names here to make clearer, not call one and call two, and I feel you could give a somewhat smarter content because if you just look at the picture here, you cannot see the correspondence of these rank tokens because in essence, they are exactly equal as the row tokens. But fortunately, we can read the text. Oh, there's the table. Ha. So I have actually, I've not seen that, but I have discerned correctly for this particular for this particular input. Alright, I think that's the half of the magic is how you encode the input in such a thing. And this seems to be first of all a pretty cool idea, but second of all, it exactly is what this kind of new regime of NLP is about is that you basically put everything as a string, you annotate it in a smart way, and that lets the model figure out a lot of stuff about the input. People used to do the very different things. So people have given a query and a table like this, what people would do is they would somehow, first of all, get the table headers and kind of guess the data types of the attributes. And then they would formulate, reformulate the query, maybe also with the neural network, maybe with something else, into something like SQL in order to actually have an SQL statement to select the correct cells or perform the correct aggregations. And that is somewhat brittle. And it's just much less deep learning than this model. So I like this part of the model. Now the problem, of course, is as we've seen in this multi-step process. So how do we, first of all, if we want to build a cell selector, that's pretty easy, right? We've seen this. So the cell selector is first column, column selection, and then second row selection. And this can be multiple rows. So that's fairly easy. So the same cells, either for just returning or for aggregation pretty easy. But how do we do the, actually the aggregation selection is also pretty easy because we can just do a multi-classifier, right? So the classifier will simply tell us, give us a distribution and then we see, okay, the sum aggregation is probably here, what the model wants. The real question is how do we train this and how this is trained is what I find really interesting. So as we've seen, they have training data. The training data comes in form of tables, questions, and answers. As we've seen before, we don't know how to get to those answers. So when the question is, which wrestler has the most number of rings, we just know the answer is Ric Flair. Now they do, again, a two step process for their training data that mimics the two step process of the model. So the first step is the answer a number. Is the answer a number? If no, then it is definitely a cell selection task. So if it's not a number, they just restrict themselves to selecting cells. If the answer is not in the table, then that just means that the correct thing is to select no cells and just say, I can't answer this question. If it is a number. And again, you have two options. So is it in the table? If yes, we are in a weird situation. If no, not in table, then it is an aggregation. So if it is a number that is not in the table, that means that the answer is a number that is not in the table, that means the answer must be computed via one of these aggregations. And if the answer is a number but is in the table, then we are in this ambiguous answer setting where it could be that we need to select the cell, but it could also be that the same number by accident is in the table, but actually needs to be computed from other numbers. And they do this in the most deep learning way possible, is that they do basically a soft decision here. So they let the model, when they let it select what to compute, they let it make a soft decision. And what do I mean by that? So let's say you have these three operations, count, sum, and average. And you have the cell selection. So the cell selector will basically tell you I will select three cells. The three cells contain the number seven, the number eight, and the number three. All right, so and the question was, I don't even know what the question was, but the cell selector tells you these three cells are to be selected. You do this by simply selecting the cells where the cell selector has a higher probability than one half. Now your aggregation selection module gives you a softmax distribution over the actions. So it's not very much count here, maybe that's 0.1. This here is maybe 0.3 and this is the 0.6. What you do is you simply compute all of them. So you want to compute the count here, which is three. You want to compute the sum here, which is 18. And then you want to compute the average, which is six. Ha, I made a good example by accident. And then you simply weigh the outputs here by their probabilities. So you say since the model once 0.1 puts 1.1 probability on the count, I'm going to have 0.1 times 3 plus it wants 0.3 times this. So 0.3 times 18 plus 0.6 times 6. Now I'm not going to point three. So this is 6 plus 0.3 plus 3.6, 9.9. So that's how the model computes things. It simply puts probability on these operations here. And then you simply take a weighted output with respect to the computation of all those things. Now, I'm pretty sure that's completely invalid because for the same numbers, for example, the sum is going to have a much larger variance than the average. And that's somewhat going to count maybe somewhere in between depending on the numbers. So just to take the weighted average here, and then of course, right? So what they do is they do have this. This is the model output and you have the correct answer. Let's say the correct answer was actually was to compute the average. So the correct answer is 6. So what they do is simply they take the squared error and that's their loss. Actually they don't take the squared error. They take a approximation to the squared error, which is square until some delta. And then it's linear. And this is simply to be a bit more outlier of us. And they do other things to be more outlier of us. But this, so this is the model output and this is the correct answer. And they simply count on the fact that this will, this will back propagate. So if you want to make these two things closer, if you're the model, right? You have the option of simply putting more weight from the, from the other ones onto the average operation. And that will decrease the 9.9 because you, as you can see, both of these numbers will get smaller and no weight. This isn't the, yes, sorry. So you will, you will decrease these numbers. So this is the output we got from the weighted average, right? So if we decrease these weights, you will put weight from here to here that will bring the number 9.9 down and that will get you closer to the answer you're looking for. But you can also achieve this by, you can achieve this even more, right? So this 9.9 is too high. If we want to bring the 9.9 down, we're much better off by taking some of that output and actually putting on this here because three is the lowest number, right? The only agreement here is that we want to take weight away from the 18, from the large one. So I'm extremely surprised that this works, given that it is so super ambiguous what the model should do with these operations. And I, I highly doubt that you can extend this set. So it's of course, agnostic of what these aggregations are. But to be able to extend this to many more aggregations is will, I think, lead to much more of these situations where the model is entirely unsure of where to put the mass, where to put the weight. And I would be interested to see what happens if you have a data set with like 20 or 50 of these aggregations and not just three. So this is the, let's say the interesting part here, the other, if you go the other way when you have this cell selection task, it is just to select a cell, right? And then you simply have the cell selector, that part here that does the selection. That you also, you train every time simply to give each cell a weight, right? So this, this is simply the softmax over column and then the softmax over rows. And you can train that using the cross entropy. Now training the cell selector from data is pretty easy when it's a cell selection task, right? Because the answer is in the table and or is not in the table and then you know to select no cell. So you do have the training data that a particular cell is the correct cell and you can train the model to select that cell. But it is actually a pretty hard task if it is, for example, you're looking for an average operation because not only do you, are you not really sure that it's an average operation? You just know that that kind of gives you the correct answer. You also don't really know which cells to select for this average operation, right? Because depending on which cells you select and of course that's going to be a soft selection as well. The average answer, the average will be different depending on which cells you select. So they're basically counting on this loss here to back propagate not only through the selection of the aggregation to perform, but also to the cell selector to set which cells to select. So from this week's signal, it's almost like the reinforcement learning problem where you have the weak signal and you have like a billion ways to get your number closer to that signal and not really accurate understanding what you need to do. You're just relying on the model through lots and lots and lots and lots of data to kind of figure out which natural language questions to map to which cell selection and aggregation. So it seems like impossible, but it works. The last thing we need to talk about is this ambiguous answer setting. And as you can imagine, it's pretty simple that they also let the model do a soft selection between the cell selection tasks, so no aggregation and the aggregations to be performed. And basically let the model figure out itself which one is better to do an aggregation or to do no aggregation. It suffice to say this only works for pretty, I think it only works for pretty limited amount of tasks, pretty limited amount of questions. And you might have spotted there even these questions that are follow up questions which are another thing they build into the model. And I'm not really going to talk about this, but they do have this concept as well, which I find maybe a bit out of place, but maybe it's just part of their data set somewhere. Maybe it's just these companies want to get into this conversational mode so everything needs to be context dependent. At the interesting part here is really the computation of the aggregates and specifically the question of which of these aggregations to choose. And this again, this is so surprising that it works and fairly, fairly cool. I think that is the gist of the paper. They do extremely thorough evaluations here on these data sets and ablations to see what really counts and what doesn't. I don't really want to go into that, safe to say their results are better than anything else before. I believe they are actually on par with another model, but in one data set but they beat them on every other data set. So that's cool. I don't think there was a bar diagram. Never mind. I invite you to check out this paper. Look for yourself. They have the code online if you want to train a model like this yourself. Other than that, thanks for listening. If you like this content, please subscribe, like, comment, tell a friend, and bye bye. | [{"start": 0.0, "end": 4.14, "text": " Hi there, have a look at this table on the left."}, {"start": 4.14, "end": 8.78, "text": " So in this table, in each row, you can see following things."}, {"start": 8.78, "end": 16.1, "text": " The name of a wrestler, the number of times that wrestler has been a champion, and the"}, {"start": 16.1, "end": 23.02, "text": " combined number of days where that wrestler has been a champion, or like the sum of the"}, {"start": 23.02, "end": 26.94, "text": " length of all their championships."}, {"start": 26.94, "end": 33.260000000000005, "text": " Along with the column that is the rank, and this is ranked by the combined days attribute."}, {"start": 33.260000000000005, "end": 37.94, "text": " So this table is very interesting by itself, but if you look at the right, we have a couple"}, {"start": 37.94, "end": 39.24, "text": " of questions."}, {"start": 39.24, "end": 41.1, "text": " And let's try to answer them."}, {"start": 41.1, "end": 44.02, "text": " Which wrestler had the most number of reigns?"}, {"start": 44.02, "end": 49.94, "text": " So for that, you'd need to go to number of reigns column, right?"}, {"start": 49.94, "end": 55.28, "text": " And you'd need to mentally sort them, and you'll find out that eight is the highest number."}, {"start": 55.28, "end": 60.52, "text": " And therefore, Ric Flair is the wrestler you're looking for."}, {"start": 60.52, "end": 66.32000000000001, "text": " Second question, the average time as a champion for top two wrestlers."}, {"start": 66.32000000000001, "end": 70.24000000000001, "text": " Now we need to go the top two wrestlers."}, {"start": 70.24000000000001, "end": 78.72, "text": " We can guess that pertains to the rank, and then so we want the average of these two numbers."}, {"start": 78.72, "end": 84.72, "text": " You even have questions such as which of the following wrestlers were ranked in the bottom"}, {"start": 84.72, "end": 88.2, "text": " three, which the answers would be all of those."}, {"start": 88.2, "end": 92.48, "text": " And then after that, out of these, who had more than one reign?"}, {"start": 92.48, "end": 97.2, "text": " And you can see that's then seven."}, {"start": 97.2, "end": 105.75999999999999, "text": " So the paper that we're having here is trying to answer questions like this if given a table."}, {"start": 105.75999999999999, "end": 109.48, "text": " As you can see, this is a pretty, pretty hard task."}, {"start": 109.48, "end": 113.24, "text": " And so pretty excited to read this."}, {"start": 113.24, "end": 120.28, "text": " The paper is called Tapas, weekly supervised table parsing via pre-training by Jonathan"}, {"start": 120.28, "end": 128.72, "text": " Herzegpavl, Christ of Novak, Thomas Miller, Francesco Pichino, and Julian Martin Isenshelos."}, {"start": 128.72, "end": 133.68, "text": " Full disclaimer, I know these people, so I might be slightly biased."}, {"start": 133.68, "end": 136.79999999999998, "text": " All right, so you've already seen the task."}, {"start": 136.8, "end": 143.52, "text": " The task is you are given a table and a question and you're trying to answer that."}, {"start": 143.52, "end": 151.48000000000002, "text": " Now it's not as easy as that, but the table questions come in different forms."}, {"start": 151.48000000000002, "end": 157.64000000000001, "text": " As you have seen, sometimes you just need to select a cell from a table like we have here."}, {"start": 157.64000000000001, "end": 165.36, "text": " The first question, I simply, most number of reigns, I simply select whatever that is."}, {"start": 165.36, "end": 171.16000000000003, "text": " So the answer here is already in the table, Ric Flair."}, {"start": 171.16000000000003, "end": 174.60000000000002, "text": " And this they call a cell selection task."}, {"start": 174.60000000000002, "end": 177.44000000000003, "text": " This is wherever you need to select a cell."}, {"start": 177.44000000000003, "end": 182.12, "text": " The same for these bottom here, so which of the following rest there's ranked in the bottom"}, {"start": 182.12, "end": 186.24, "text": " three and out of these, which one of more than one reign, all of these answers are in"}, {"start": 186.24, "end": 187.84, "text": " the table somewhere."}, {"start": 187.84, "end": 192.84, "text": " The second thing is what they call a scalar answer."}, {"start": 192.84, "end": 200.36, "text": " That is when the answer to be computed is a number that is not in the table."}, {"start": 200.36, "end": 209.68, "text": " So these average time here, which turns out to be 3,426, is nowhere to be found in the"}, {"start": 209.68, "end": 210.68, "text": " table."}, {"start": 210.68, "end": 217.44, "text": " So there actually needs to be a computation performed by the model."}, {"start": 217.44, "end": 222.36, "text": " And lastly, you have these things called ambiguous answers."}, {"start": 222.36, "end": 230.64000000000001, "text": " Now the ambiguous answers refer to a thing where it is a number that you're looking for."}, {"start": 230.64000000000001, "end": 232.76000000000002, "text": " So how many?"}, {"start": 232.76000000000002, "end": 236.64000000000001, "text": " But the number here is in the table."}, {"start": 236.64000000000001, "end": 239.0, "text": " So you can think of this in terms of training data."}, {"start": 239.0, "end": 243.20000000000002, "text": " If you have a task like this and you have training data and you just have the question, you"}, {"start": 243.20000000000002, "end": 248.60000000000002, "text": " just have this question and you're given the answer to, right?"}, {"start": 248.6, "end": 257.88, "text": " You can teach your model either to select this number here or you can teach your model"}, {"start": 257.88, "end": 259.52, "text": " that would be wrong, right?"}, {"start": 259.52, "end": 265.44, "text": " Because how many world champions are there with only one reign?"}, {"start": 265.44, "end": 270.88, "text": " To simply select this cell here is not correct because that cell, even though the number"}, {"start": 270.88, "end": 273.68, "text": " is two, it doesn't mean the same thing."}, {"start": 273.68, "end": 275.6, "text": " It's not counting, right?"}, {"start": 275.6, "end": 282.08000000000004, "text": " So the correct program here would be to count the number to count the cells where there"}, {"start": 282.08000000000004, "end": 284.76000000000005, "text": " is a one here, which is also two."}, {"start": 284.76000000000005, "end": 287.88, "text": " And they call this situation ambiguous answer."}, {"start": 287.88, "end": 293.32000000000005, "text": " So you might have already guessed that a single model that does all of this needs to sort"}, {"start": 293.32000000000005, "end": 297.08000000000004, "text": " of have multiple modes."}, {"start": 297.08000000000004, "end": 298.56, "text": " That's exactly what they propose."}, {"start": 298.56, "end": 308.32, "text": " So they propose a model that takes in the table and the question."}, {"start": 308.32, "end": 313.92, "text": " And then in the first step, it selects its mode."}, {"start": 313.92, "end": 324.12, "text": " So the mode is either the cell selection or it is to compute something."}, {"start": 324.12, "end": 332.04, "text": " And then whenever it's a cell selection, it simply has a component to select cells."}, {"start": 332.04, "end": 341.36, "text": " But when it's a compute, it needs to decide in the second step what to compute."}, {"start": 341.36, "end": 350.6, "text": " And then also select the appropriate cells."}, {"start": 350.6, "end": 353.96, "text": " So this is the model."}, {"start": 353.96, "end": 359.0, "text": " But this stuff like this has existed for a long time in these table answering things."}, {"start": 359.0, "end": 364.79999999999995, "text": " But the way we want to do it here is end to end with a single deep learning model, of course,"}, {"start": 364.79999999999995, "end": 367.24, "text": " because we want to be better than anything else."}, {"start": 367.24, "end": 372.67999999999995, "text": " And the trend in deep learning is to put more and more into one model and to have it end"}, {"start": 372.67999999999995, "end": 374.44, "text": " to end differentiable."}, {"start": 374.44, "end": 375.44, "text": " All right."}, {"start": 375.44, "end": 378.67999999999995, "text": " So you see, we need multiple components."}, {"start": 378.67999999999995, "end": 381.2, "text": " We need some sort of a mode selector."}, {"start": 381.2, "end": 386.8, "text": " We need some sort of a cell collector and we need a thing that decides if we are in the"}, {"start": 386.8, "end": 390.03999999999996, "text": " compute mode, what computation to be done."}, {"start": 390.03999999999996, "end": 395.44, "text": " Now let me present the model that this paper proposes."}, {"start": 395.44, "end": 401.59999999999997, "text": " So this paper proposes to embed the question here."}, {"start": 401.59999999999997, "end": 407.84, "text": " So you can see here, that's the question, into a birth input."}, {"start": 407.84, "end": 410.59999999999997, "text": " So this is a transformer right here."}, {"start": 410.6, "end": 415.92, "text": " This is birthed or any variant of birth that you can think of."}, {"start": 415.92, "end": 418.52000000000004, "text": " So the question is embedded as natural language."}, {"start": 418.52000000000004, "end": 427.12, "text": " And then interestingly enough, the table right here is also embedded as language."}, {"start": 427.12, "end": 430.48, "text": " We'll get to that in a second."}, {"start": 430.48, "end": 437.24, "text": " But the question and the table are in the input and then the model is asked to do two things."}, {"start": 437.24, "end": 440.6, "text": " First of all, it's asked to do an aggregation prediction."}, {"start": 440.6, "end": 448.16, "text": " So this can either be one of these programs called count sum average or it can be, as you"}, {"start": 448.16, "end": 449.72, "text": " can see here, none."}, {"start": 449.72, "end": 451.40000000000003, "text": " So no aggregation."}, {"start": 451.40000000000003, "end": 454.04, "text": " So this handles our first two components."}, {"start": 454.04, "end": 458.88, "text": " It can decide to perform a calculation or none."}, {"start": 458.88, "end": 466.44, "text": " And if it is performing a calculation, it can decide to do account sum or an average."}, {"start": 466.44, "end": 471.08, "text": " Now of course the model here is not limited to those computations."}, {"start": 471.08, "end": 475.71999999999997, "text": " You can think of extending this to any further computation."}, {"start": 475.71999999999997, "end": 482.48, "text": " The important thing is that they have a number as an output."}, {"start": 482.48, "end": 486.08, "text": " Second of all, there is a cell selector."}, {"start": 486.08, "end": 490.4, "text": " So depending on this aggregation prediction, you need some cells."}, {"start": 490.4, "end": 495.56, "text": " Like if you want to compute an average, you need the cells to compute an average over."}, {"start": 495.56, "end": 502.6, "text": " So the cell selector here will select cells from the table."}, {"start": 502.6, "end": 506.16, "text": " Is specifically, it goes by row and column."}, {"start": 506.16, "end": 508.08, "text": " Sorry, column and row."}, {"start": 508.08, "end": 510.72, "text": " Since these tables, usually they have a header, right?"}, {"start": 510.72, "end": 514.76, "text": " This is the table header where the attributes are listed."}, {"start": 514.76, "end": 523.68, "text": " It makes sense to first, in a first step, select which column you want to select from."}, {"start": 523.68, "end": 531.2399999999999, "text": " And then, if once you have a column, let's say this column here, in the second step, you"}, {"start": 531.2399999999999, "end": 534.16, "text": " say which of the cells you want to select."}, {"start": 534.16, "end": 541.4, "text": " Now these can be multiple, but the way the system is set up, it's first a column selector"}, {"start": 541.4, "end": 544.76, "text": " and then a cell selector within that column."}, {"start": 544.76, "end": 549.8399999999999, "text": " So you can only ever get columns from the same cell in this thing."}, {"start": 549.8399999999999, "end": 551.8399999999999, "text": " Let's remember that for later."}, {"start": 551.84, "end": 554.96, "text": " All right, so this is what the model does."}, {"start": 554.96, "end": 559.96, "text": " Now let's look at the input."}, {"start": 559.96, "end": 562.32, "text": " The input to the model is this here."}, {"start": 562.32, "end": 567.6, "text": " Now this, if you refer from this before, this was in this blue box and then here you'd"}, {"start": 567.6, "end": 572.64, "text": " have the computation selection and here you have the cell selection."}, {"start": 572.64, "end": 576.5600000000001, "text": " So this is how you can relate that."}, {"start": 576.56, "end": 584.1199999999999, "text": " So usually, if you input something into a transformer, what you want to do is you want to embed this"}, {"start": 584.1199999999999, "end": 587.4399999999999, "text": " into a token embedding."}, {"start": 587.4399999999999, "end": 594.0, "text": " So first you want to split everything you put into what are called tokens."}, {"start": 594.0, "end": 598.4399999999999, "text": " Now tokens are either things like words or word pieces."}, {"start": 598.4399999999999, "end": 606.04, "text": " The important thing is to have a dictionary for it and each one gets mapped to a vector."}, {"start": 606.04, "end": 610.56, "text": " So this here is your query."}, {"start": 610.56, "end": 617.24, "text": " You take your query as a string and you tokenize it and you get the embeddings from the embedding"}, {"start": 617.24, "end": 619.24, "text": " table and that's your input."}, {"start": 619.24, "end": 620.24, "text": " Right?"}, {"start": 620.24, "end": 623.88, "text": " So it's a sequence of token embeddings."}, {"start": 623.88, "end": 626.36, "text": " And then you also embed the table."}, {"start": 626.36, "end": 632.8399999999999, "text": " And this I find pretty cool here in this model and somewhat special is that the table"}, {"start": 632.84, "end": 639.2, "text": " is actually presented as just natural language."}, {"start": 639.2, "end": 648.52, "text": " So you can see here the table is one string."}, {"start": 648.52, "end": 652.76, "text": " It's just a single string that goes from left to right."}, {"start": 652.76, "end": 654.6800000000001, "text": " It's just the serialized table."}, {"start": 654.6800000000001, "end": 660.2800000000001, "text": " So this table right here, you can see these are word pieces."}, {"start": 660.28, "end": 669.4, "text": " So this table if I reconstruct it, if I can attempt to reconstruct it, it is going to"}, {"start": 669.4, "end": 675.76, "text": " be a table that has as the headers call one, call two."}, {"start": 675.76, "end": 676.76, "text": " These are the names."}, {"start": 676.76, "end": 684.1999999999999, "text": " So in that days before here would be name of the wrestler and this would be number of"}, {"start": 684.1999999999999, "end": 689.8399999999999, "text": " days."}, {"start": 689.84, "end": 699.4, "text": " And then here zero, one, two, three."}, {"start": 699.4, "end": 707.88, "text": " So this table right here corresponds to this string right here."}, {"start": 707.88, "end": 710.32, "text": " I hope you can make sense of that."}, {"start": 710.32, "end": 714.52, "text": " So the table is just put there as one long string."}, {"start": 714.52, "end": 721.1999999999999, "text": " And then in order to make the model realize, you know, what the table is, you have these"}, {"start": 721.1999999999999, "end": 722.1999999999999, "text": " special embeddings."}, {"start": 722.1999999999999, "end": 727.28, "text": " So usually in bird, you have what they're called position embeddings to indicate where"}, {"start": 727.28, "end": 729.0, "text": " in the sequence that is."}, {"start": 729.0, "end": 736.3199999999999, "text": " So in a simplest case, these are embeddings for the numbers zero, one, two, three, four,"}, {"start": 736.3199999999999, "end": 737.3199999999999, "text": " and so on."}, {"start": 737.3199999999999, "end": 742.52, "text": " So wherever the position is, this you can all look up in the attention is all you need"}, {"start": 742.52, "end": 743.52, "text": " video."}, {"start": 743.52, "end": 749.16, "text": " And if you make that, if you are unfamiliar with transformer inputs, then also the segment"}, {"start": 749.16, "end": 756.0799999999999, "text": " embeddings simply indicate where a token is part of."}, {"start": 756.0799999999999, "end": 761.64, "text": " So for every token that's part of the query, you see you have segment zero embedding."}, {"start": 761.64, "end": 765.1999999999999, "text": " And for every token that's part of the table, if a segment won a many, this is simply to"}, {"start": 765.1999999999999, "end": 772.6, "text": " tell the model, hey, this particular token is part of the question or part of the table."}, {"start": 772.6, "end": 774.12, "text": " Then you have the new things."}, {"start": 774.12, "end": 779.64, "text": " So this paper newly introduces the following embeddings column and row embeddings."}, {"start": 779.64, "end": 783.76, "text": " Now these, for the question, of course, they don't make any sense, but you have to put"}, {"start": 783.76, "end": 784.76, "text": " something here."}, {"start": 784.76, "end": 786.16, "text": " So you just put column zero."}, {"start": 786.16, "end": 796.84, "text": " But for the table, you see there is a column one and column two."}, {"start": 796.84, "end": 803.2, "text": " And this exactly, so we've seen that this here is the header of column one, and this is"}, {"start": 803.2, "end": 804.96, "text": " the header of column two."}, {"start": 804.96, "end": 808.96, "text": " And then it goes back column one, column two, column one, column two."}, {"start": 808.96, "end": 816.24, "text": " And you can see here this zero is in column one, and this one is in column two, and this"}, {"start": 816.24, "end": 819.84, "text": " in column one again, and the same for the rows."}, {"start": 819.84, "end": 825.88, "text": " So you have row zero for the headers."}, {"start": 825.88, "end": 830.68, "text": " And then row one for the first two numbers and row two for the second two numbers."}, {"start": 830.68, "end": 832.96, "text": " So this is all of this."}, {"start": 832.96, "end": 836.92, "text": " So you see these two are in the first row and these two are in the second row."}, {"start": 836.92, "end": 838.8, "text": " All of this is to tell the model."}, {"start": 838.8, "end": 846.88, "text": " All of this information down here is to tell the model how this table looks."}, {"start": 846.88, "end": 853.76, "text": " So if it wants to select the second column from the third row, it would look in this information"}, {"start": 853.76, "end": 857.4, "text": " to see which cell to select."}, {"start": 857.4, "end": 863.08, "text": " And then the last thing they introduce is this so-called rank embeddings."}, {"start": 863.08, "end": 872.08, "text": " Now as we've seen before, if this first column here is maybe the number of days of something."}, {"start": 872.08, "end": 874.16, "text": " So this is the number of days."}, {"start": 874.16, "end": 880.96, "text": " And this second one is the number of rains, so how many championships."}, {"start": 880.96, "end": 885.1600000000001, "text": " The table can only be sorted at maximum by one of them."}, {"start": 885.1600000000001, "end": 891.1600000000001, "text": " So you want to sort of, for each cell, you want to tell the model, let's extend that"}, {"start": 891.1600000000001, "end": 896.4000000000001, "text": " table by two numbers, four and one."}, {"start": 896.4000000000001, "end": 901.6800000000001, "text": " So for each column, you want to tell the model the ranking of the numbers."}, {"start": 901.6800000000001, "end": 902.84, "text": " So here it's pretty easy."}, {"start": 902.84, "end": 905.84, "text": " This is rank one, this is rank two, this is rank three."}, {"start": 905.84, "end": 910.88, "text": " For the left side, this is rank one, this is rank two down here, and this is rank"}, {"start": 910.88, "end": 911.88, "text": " three."}, {"start": 911.88, "end": 918.72, "text": " So the model has an, if you give this information, the model will have an easier time to detect,"}, {"start": 918.72, "end": 923.56, "text": " like give me the top two or something like this, give me the worst, give me the best, give"}, {"start": 923.56, "end": 927.8, "text": " me the highest and so on."}, {"start": 927.8, "end": 930.12, "text": " The model will have an easier time doing that."}, {"start": 930.12, "end": 940.68, "text": " So that's why the rank here, as you can see, the zero and also the number one are embedded"}, {"start": 940.68, "end": 946.3599999999999, "text": " rank one and the other two rank two because they're just lower."}, {"start": 946.3599999999999, "end": 952.04, "text": " Now I don't feel, I feel they could have given a better example than this table."}, {"start": 952.04, "end": 959.7199999999999, "text": " I feel you could actually put real names here to make clearer, not call one and call two,"}, {"start": 959.7199999999999, "end": 968.3599999999999, "text": " and I feel you could give a somewhat smarter content because if you just look at the picture"}, {"start": 968.36, "end": 974.48, "text": " here, you cannot see the correspondence of these rank tokens because in essence, they"}, {"start": 974.48, "end": 979.72, "text": " are exactly equal as the row tokens."}, {"start": 979.72, "end": 981.92, "text": " But fortunately, we can read the text."}, {"start": 981.92, "end": 983.6800000000001, "text": " Oh, there's the table."}, {"start": 983.6800000000001, "end": 985.6800000000001, "text": " Ha."}, {"start": 985.6800000000001, "end": 993.8000000000001, "text": " So I have actually, I've not seen that, but I have discerned correctly for this particular"}, {"start": 993.8000000000001, "end": 995.16, "text": " for this particular input."}, {"start": 995.16, "end": 1000.64, "text": " Alright, I think that's the half of the magic is how you encode the input in such a thing."}, {"start": 1000.64, "end": 1008.12, "text": " And this seems to be first of all a pretty cool idea, but second of all, it exactly is"}, {"start": 1008.12, "end": 1015.28, "text": " what this kind of new regime of NLP is about is that you basically put everything as a"}, {"start": 1015.28, "end": 1021.04, "text": " string, you annotate it in a smart way, and that lets the model figure out a lot of stuff"}, {"start": 1021.04, "end": 1023.0799999999999, "text": " about the input."}, {"start": 1023.08, "end": 1028.32, "text": " People used to do the very different things."}, {"start": 1028.32, "end": 1035.8400000000001, "text": " So people have given a query and a table like this, what people would do is they would somehow,"}, {"start": 1035.8400000000001, "end": 1043.76, "text": " first of all, get the table headers and kind of guess the data types of the attributes."}, {"start": 1043.76, "end": 1048.76, "text": " And then they would formulate, reformulate the query, maybe also with the neural network,"}, {"start": 1048.76, "end": 1056.04, "text": " maybe with something else, into something like SQL in order to actually have an SQL statement"}, {"start": 1056.04, "end": 1060.64, "text": " to select the correct cells or perform the correct aggregations."}, {"start": 1060.64, "end": 1064.4, "text": " And that is somewhat brittle."}, {"start": 1064.4, "end": 1068.24, "text": " And it's just much less deep learning than this model."}, {"start": 1068.24, "end": 1071.12, "text": " So I like this part of the model."}, {"start": 1071.12, "end": 1077.04, "text": " Now the problem, of course, is as we've seen in this multi-step process."}, {"start": 1077.04, "end": 1082.76, "text": " So how do we, first of all, if we want to build a cell selector, that's pretty easy,"}, {"start": 1082.76, "end": 1083.76, "text": " right?"}, {"start": 1083.76, "end": 1084.76, "text": " We've seen this."}, {"start": 1084.76, "end": 1095.6399999999999, "text": " So the cell selector is first column, column selection, and then second row selection."}, {"start": 1095.6399999999999, "end": 1099.1599999999999, "text": " And this can be multiple rows."}, {"start": 1099.1599999999999, "end": 1100.84, "text": " So that's fairly easy."}, {"start": 1100.84, "end": 1106.72, "text": " So the same cells, either for just returning or for aggregation pretty easy."}, {"start": 1106.72, "end": 1111.8, "text": " But how do we do the, actually the aggregation selection is also pretty easy because we"}, {"start": 1111.8, "end": 1115.12, "text": " can just do a multi-classifier, right?"}, {"start": 1115.12, "end": 1121.1999999999998, "text": " So the classifier will simply tell us, give us a distribution and then we see, okay,"}, {"start": 1121.1999999999998, "end": 1125.8799999999999, "text": " the sum aggregation is probably here, what the model wants."}, {"start": 1125.88, "end": 1133.64, "text": " The real question is how do we train this and how this is trained is what I find really"}, {"start": 1133.64, "end": 1135.3600000000001, "text": " interesting."}, {"start": 1135.3600000000001, "end": 1138.3600000000001, "text": " So as we've seen, they have training data."}, {"start": 1138.3600000000001, "end": 1142.8000000000002, "text": " The training data comes in form of tables, questions, and answers."}, {"start": 1142.8000000000002, "end": 1148.4, "text": " As we've seen before, we don't know how to get to those answers."}, {"start": 1148.4, "end": 1154.48, "text": " So when the question is, which wrestler has the most number of rings, we just know the"}, {"start": 1154.48, "end": 1156.28, "text": " answer is Ric Flair."}, {"start": 1156.28, "end": 1162.08, "text": " Now they do, again, a two step process for their training data that mimics the two step"}, {"start": 1162.08, "end": 1163.68, "text": " process of the model."}, {"start": 1163.68, "end": 1168.8, "text": " So the first step is the answer a number."}, {"start": 1168.8, "end": 1174.04, "text": " Is the answer a number?"}, {"start": 1174.04, "end": 1184.2, "text": " If no, then it is definitely a cell selection task."}, {"start": 1184.2, "end": 1189.28, "text": " So if it's not a number, they just restrict themselves to selecting cells."}, {"start": 1189.28, "end": 1196.12, "text": " If the answer is not in the table, then that just means that the correct thing is to select"}, {"start": 1196.12, "end": 1200.2, "text": " no cells and just say, I can't answer this question."}, {"start": 1200.2, "end": 1203.52, "text": " If it is a number."}, {"start": 1203.52, "end": 1205.52, "text": " And again, you have two options."}, {"start": 1205.52, "end": 1213.76, "text": " So is it in the table?"}, {"start": 1213.76, "end": 1218.44, "text": " If yes, we are in a weird situation."}, {"start": 1218.44, "end": 1231.6399999999999, "text": " If no, not in table, then it is an aggregation."}, {"start": 1231.64, "end": 1238.92, "text": " So if it is a number that is not in the table, that means that the answer is a number that"}, {"start": 1238.92, "end": 1245.92, "text": " is not in the table, that means the answer must be computed via one of these aggregations."}, {"start": 1245.92, "end": 1252.96, "text": " And if the answer is a number but is in the table, then we are in this ambiguous answer"}, {"start": 1252.96, "end": 1259.16, "text": " setting where it could be that we need to select the cell, but it could also be that the"}, {"start": 1259.16, "end": 1264.88, "text": " same number by accident is in the table, but actually needs to be computed from other"}, {"start": 1264.88, "end": 1267.16, "text": " numbers."}, {"start": 1267.16, "end": 1276.0, "text": " And they do this in the most deep learning way possible, is that they do basically a soft"}, {"start": 1276.0, "end": 1277.6000000000001, "text": " decision here."}, {"start": 1277.6000000000001, "end": 1286.64, "text": " So they let the model, when they let it select what to compute, they let it make a soft"}, {"start": 1286.64, "end": 1287.64, "text": " decision."}, {"start": 1287.64, "end": 1289.3200000000002, "text": " And what do I mean by that?"}, {"start": 1289.3200000000002, "end": 1294.2800000000002, "text": " So let's say you have these three operations, count, sum, and average."}, {"start": 1294.2800000000002, "end": 1295.96, "text": " And you have the cell selection."}, {"start": 1295.96, "end": 1300.88, "text": " So the cell selector will basically tell you I will select three cells."}, {"start": 1300.88, "end": 1306.88, "text": " The three cells contain the number seven, the number eight, and the number three."}, {"start": 1306.88, "end": 1311.3200000000002, "text": " All right, so and the question was, I don't even know what the question was, but the cell"}, {"start": 1311.3200000000002, "end": 1314.3600000000001, "text": " selector tells you these three cells are to be selected."}, {"start": 1314.36, "end": 1318.84, "text": " You do this by simply selecting the cells where the cell selector has a higher probability"}, {"start": 1318.84, "end": 1321.04, "text": " than one half."}, {"start": 1321.04, "end": 1333.1599999999999, "text": " Now your aggregation selection module gives you a softmax distribution over the actions."}, {"start": 1333.1599999999999, "end": 1337.1599999999999, "text": " So it's not very much count here, maybe that's 0.1."}, {"start": 1337.1599999999999, "end": 1342.8799999999999, "text": " This here is maybe 0.3 and this is the 0.6."}, {"start": 1342.88, "end": 1345.44, "text": " What you do is you simply compute all of them."}, {"start": 1345.44, "end": 1348.88, "text": " So you want to compute the count here, which is three."}, {"start": 1348.88, "end": 1355.0800000000002, "text": " You want to compute the sum here, which is 18."}, {"start": 1355.0800000000002, "end": 1359.64, "text": " And then you want to compute the average, which is six."}, {"start": 1359.64, "end": 1364.1200000000001, "text": " Ha, I made a good example by accident."}, {"start": 1364.1200000000001, "end": 1370.2, "text": " And then you simply weigh the outputs here by their probabilities."}, {"start": 1370.2, "end": 1379.52, "text": " So you say since the model once 0.1 puts 1.1 probability on the count, I'm going to have"}, {"start": 1379.52, "end": 1386.8400000000001, "text": " 0.1 times 3 plus it wants 0.3 times this."}, {"start": 1386.8400000000001, "end": 1393.88, "text": " So 0.3 times 18 plus 0.6 times 6."}, {"start": 1393.88, "end": 1399.48, "text": " Now I'm not going to point three."}, {"start": 1399.48, "end": 1413.32, "text": " So this is 6 plus 0.3 plus 3.6, 9.9."}, {"start": 1413.32, "end": 1415.44, "text": " So that's how the model computes things."}, {"start": 1415.44, "end": 1419.48, "text": " It simply puts probability on these operations here."}, {"start": 1419.48, "end": 1425.16, "text": " And then you simply take a weighted output with respect to the computation of all those"}, {"start": 1425.16, "end": 1426.16, "text": " things."}, {"start": 1426.16, "end": 1432.0400000000002, "text": " Now, I'm pretty sure that's completely invalid because for the same numbers, for example,"}, {"start": 1432.0400000000002, "end": 1439.3600000000001, "text": " the sum is going to have a much larger variance than the average."}, {"start": 1439.3600000000001, "end": 1445.28, "text": " And that's somewhat going to count maybe somewhere in between depending on the numbers."}, {"start": 1445.28, "end": 1452.0400000000002, "text": " So just to take the weighted average here, and then of course, right?"}, {"start": 1452.0400000000002, "end": 1455.24, "text": " So what they do is they do have this."}, {"start": 1455.24, "end": 1457.52, "text": " This is the model output and you have the correct answer."}, {"start": 1457.52, "end": 1461.0, "text": " Let's say the correct answer was actually was to compute the average."}, {"start": 1461.0, "end": 1462.92, "text": " So the correct answer is 6."}, {"start": 1462.92, "end": 1469.16, "text": " So what they do is simply they take the squared error and that's their loss."}, {"start": 1469.16, "end": 1470.64, "text": " Actually they don't take the squared error."}, {"start": 1470.64, "end": 1476.68, "text": " They take a approximation to the squared error, which is square until some delta."}, {"start": 1476.68, "end": 1479.6, "text": " And then it's linear."}, {"start": 1479.6, "end": 1482.92, "text": " And this is simply to be a bit more outlier of us."}, {"start": 1482.92, "end": 1486.76, "text": " And they do other things to be more outlier of us."}, {"start": 1486.76, "end": 1492.2, "text": " But this, so this is the model output and this is the correct answer."}, {"start": 1492.2, "end": 1498.88, "text": " And they simply count on the fact that this will, this will back propagate."}, {"start": 1498.88, "end": 1505.8000000000002, "text": " So if you want to make these two things closer, if you're the model, right?"}, {"start": 1505.8, "end": 1514.52, "text": " You have the option of simply putting more weight from the, from the other ones onto the"}, {"start": 1514.52, "end": 1517.52, "text": " average operation."}, {"start": 1517.52, "end": 1526.32, "text": " And that will decrease the 9.9 because you, as you can see, both of these numbers will"}, {"start": 1526.32, "end": 1537.56, "text": " get smaller and no weight."}, {"start": 1537.56, "end": 1541.48, "text": " This isn't the, yes, sorry."}, {"start": 1541.48, "end": 1543.6399999999999, "text": " So you will, you will decrease these numbers."}, {"start": 1543.6399999999999, "end": 1547.48, "text": " So this is the output we got from the weighted average, right?"}, {"start": 1547.48, "end": 1553.4399999999998, "text": " So if we decrease these weights, you will put weight from here to here that will bring"}, {"start": 1553.44, "end": 1559.68, "text": " the number 9.9 down and that will get you closer to the answer you're looking for."}, {"start": 1559.68, "end": 1566.56, "text": " But you can also achieve this by, you can achieve this even more, right?"}, {"start": 1566.56, "end": 1568.88, "text": " So this 9.9 is too high."}, {"start": 1568.88, "end": 1574.64, "text": " If we want to bring the 9.9 down, we're much better off by taking some of that output"}, {"start": 1574.64, "end": 1580.2, "text": " and actually putting on this here because three is the lowest number, right?"}, {"start": 1580.2, "end": 1585.92, "text": " The only agreement here is that we want to take weight away from the 18, from the large"}, {"start": 1585.92, "end": 1586.92, "text": " one."}, {"start": 1586.92, "end": 1595.0800000000002, "text": " So I'm extremely surprised that this works, given that it is so super ambiguous what the"}, {"start": 1595.0800000000002, "end": 1599.56, "text": " model should do with these operations."}, {"start": 1599.56, "end": 1603.28, "text": " And I, I highly doubt that you can extend this set."}, {"start": 1603.28, "end": 1606.72, "text": " So it's of course, agnostic of what these aggregations are."}, {"start": 1606.72, "end": 1614.44, "text": " But to be able to extend this to many more aggregations is will, I think, lead to much more"}, {"start": 1614.44, "end": 1620.28, "text": " of these situations where the model is entirely unsure of where to put the mass, where to put"}, {"start": 1620.28, "end": 1621.56, "text": " the weight."}, {"start": 1621.56, "end": 1626.96, "text": " And I would be interested to see what happens if you have a data set with like 20 or 50"}, {"start": 1626.96, "end": 1631.84, "text": " of these aggregations and not just three."}, {"start": 1631.84, "end": 1639.0, "text": " So this is the, let's say the interesting part here, the other, if you go the other way"}, {"start": 1639.0, "end": 1643.28, "text": " when you have this cell selection task, it is just to select a cell, right?"}, {"start": 1643.28, "end": 1653.28, "text": " And then you simply have the cell selector, that part here that does the selection."}, {"start": 1653.28, "end": 1658.1599999999999, "text": " That you also, you train every time simply to give each cell a weight, right?"}, {"start": 1658.16, "end": 1662.76, "text": " So this, this is simply the softmax over column and then the softmax over rows."}, {"start": 1662.76, "end": 1667.92, "text": " And you can train that using the cross entropy."}, {"start": 1667.92, "end": 1673.8000000000002, "text": " Now training the cell selector from data is pretty easy when it's a cell selection"}, {"start": 1673.8000000000002, "end": 1675.0, "text": " task, right?"}, {"start": 1675.0, "end": 1681.2, "text": " Because the answer is in the table and or is not in the table and then you know to select"}, {"start": 1681.2, "end": 1682.52, "text": " no cell."}, {"start": 1682.52, "end": 1687.44, "text": " So you do have the training data that a particular cell is the correct cell and you can train"}, {"start": 1687.44, "end": 1690.0800000000002, "text": " the model to select that cell."}, {"start": 1690.0800000000002, "end": 1696.8, "text": " But it is actually a pretty hard task if it is, for example, you're looking for an average"}, {"start": 1696.8, "end": 1702.16, "text": " operation because not only do you, are you not really sure that it's an average operation?"}, {"start": 1702.16, "end": 1704.76, "text": " You just know that that kind of gives you the correct answer."}, {"start": 1704.76, "end": 1712.6000000000001, "text": " You also don't really know which cells to select for this average operation, right?"}, {"start": 1712.6000000000001, "end": 1716.56, "text": " Because depending on which cells you select and of course that's going to be a soft selection"}, {"start": 1716.56, "end": 1717.56, "text": " as well."}, {"start": 1717.56, "end": 1724.32, "text": " The average answer, the average will be different depending on which cells you select."}, {"start": 1724.32, "end": 1730.56, "text": " So they're basically counting on this loss here to back propagate not only through the"}, {"start": 1730.56, "end": 1737.24, "text": " selection of the aggregation to perform, but also to the cell selector to set which"}, {"start": 1737.24, "end": 1740.72, "text": " cells to select."}, {"start": 1740.72, "end": 1745.28, "text": " So from this week's signal, it's almost like the reinforcement learning problem where"}, {"start": 1745.28, "end": 1750.12, "text": " you have the weak signal and you have like a billion ways to get your number closer to"}, {"start": 1750.12, "end": 1756.8799999999999, "text": " that signal and not really accurate understanding what you need to do."}, {"start": 1756.8799999999999, "end": 1761.96, "text": " You're just relying on the model through lots and lots and lots and lots of data to kind"}, {"start": 1761.96, "end": 1769.76, "text": " of figure out which natural language questions to map to which cell selection and aggregation."}, {"start": 1769.76, "end": 1775.48, "text": " So it seems like impossible, but it works."}, {"start": 1775.48, "end": 1779.44, "text": " The last thing we need to talk about is this ambiguous answer setting."}, {"start": 1779.44, "end": 1784.8799999999999, "text": " And as you can imagine, it's pretty simple that they also let the model do a soft selection"}, {"start": 1784.8799999999999, "end": 1791.4, "text": " between the cell selection tasks, so no aggregation and the aggregations to be performed."}, {"start": 1791.4, "end": 1797.56, "text": " And basically let the model figure out itself which one is better to do an aggregation or"}, {"start": 1797.56, "end": 1800.52, "text": " to do no aggregation."}, {"start": 1800.52, "end": 1809.24, "text": " It suffice to say this only works for pretty, I think it only works for pretty limited amount"}, {"start": 1809.24, "end": 1812.04, "text": " of tasks, pretty limited amount of questions."}, {"start": 1812.04, "end": 1816.12, "text": " And you might have spotted there even these questions that are follow up questions which"}, {"start": 1816.12, "end": 1819.04, "text": " are another thing they build into the model."}, {"start": 1819.04, "end": 1824.52, "text": " And I'm not really going to talk about this, but they do have this concept as well, which"}, {"start": 1824.52, "end": 1829.6, "text": " I find maybe a bit out of place, but maybe it's just part of their data set somewhere."}, {"start": 1829.6, "end": 1834.8, "text": " Maybe it's just these companies want to get into this conversational mode so everything"}, {"start": 1834.8, "end": 1837.32, "text": " needs to be context dependent."}, {"start": 1837.32, "end": 1843.28, "text": " At the interesting part here is really the computation of the aggregates and specifically"}, {"start": 1843.28, "end": 1846.6399999999999, "text": " the question of which of these aggregations to choose."}, {"start": 1846.6399999999999, "end": 1853.92, "text": " And this again, this is so surprising that it works and fairly, fairly cool."}, {"start": 1853.92, "end": 1857.1200000000001, "text": " I think that is the gist of the paper."}, {"start": 1857.1200000000001, "end": 1864.44, "text": " They do extremely thorough evaluations here on these data sets and ablations to see what"}, {"start": 1864.44, "end": 1867.24, "text": " really counts and what doesn't."}, {"start": 1867.24, "end": 1872.16, "text": " I don't really want to go into that, safe to say their results are better than anything"}, {"start": 1872.16, "end": 1873.76, "text": " else before."}, {"start": 1873.76, "end": 1881.8400000000001, "text": " I believe they are actually on par with another model, but in one data set but they beat them"}, {"start": 1881.8400000000001, "end": 1883.48, "text": " on every other data set."}, {"start": 1883.48, "end": 1884.88, "text": " So that's cool."}, {"start": 1884.88, "end": 1889.76, "text": " I don't think there was a bar diagram."}, {"start": 1889.76, "end": 1890.76, "text": " Never mind."}, {"start": 1890.76, "end": 1893.2, "text": " I invite you to check out this paper."}, {"start": 1893.2, "end": 1894.2, "text": " Look for yourself."}, {"start": 1894.2, "end": 1898.28, "text": " They have the code online if you want to train a model like this yourself."}, {"start": 1898.28, "end": 1899.96, "text": " Other than that, thanks for listening."}, {"start": 1899.96, "end": 1906.56, "text": " If you like this content, please subscribe, like, comment, tell a friend, and bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=PDRtyrVskMU | Chip Placement with Deep Reinforcement Learning (Paper Explained) | The AI Singularity is here! Computers designing new computers! It takes human experts multiple weeks to design new computer chips. What looks like a large game of Tetris is actually a very complex optimization problem. This paper uses Deep Reinforcement Learning to solve this optimization both faster and better than humans.
https://arxiv.org/abs/2004.10746
Abstract:
In this work, we present a learning-based approach to chip placement, one of the most complex and time-consuming stages of the chip design process. Unlike prior methods, our approach has the ability to learn from past experience and improve over time. In particular, as we train over a greater number of chip blocks, our method becomes better at rapidly generating optimized placements for previously unseen chip blocks. To achieve these results, we pose placement as a Reinforcement Learning (RL) problem and train an agent to place the nodes of a chip netlist onto a chip canvas. To enable our RL policy to generalize to unseen blocks, we ground representation learning in the supervised task of predicting placement quality. By designing a neural architecture that can accurately predict reward across a wide variety of netlists and their placements, we are able to generate rich feature embeddings of the input netlists. We then use this architecture as the encoder of our policy and value networks to enable transfer learning. Our objective is to minimize PPA (power, performance, and area), and we show that, in under 6 hours, our method can generate placements that are superhuman or comparable on modern accelerator netlists, whereas existing baselines require human experts in the loop and take several weeks.
Authors: Azalia Mirhoseini, Anna Goldie, Mustafa Yazgan, Joe Jiang, Ebrahim Songhori, Shen Wang, Young-Joon Lee, Eric Johnson, Omkar Pathak, Sungmin Bae, Azade Nazi, Jiwoo Pak, Andy Tong, Kavya Srinivasa, William Hang, Emre Tuncer, Anand Babu, Quoc V. Le, James Laudon, Richard Ho, Roger Carpenter, Jeff Dean
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 Chip Placement with Deep Reinforcement Learning by Azalia Mirazini on a Goldie and a long list of authors that I have no stamina to read down. I'm sorry. So this work is a cool application of reinforcement learning to the real world. And we're gonna go through it and the cool thing about it is it pulls together parts from so many different areas of machine learning and also here Chip Engineering. So what's the fundamental problem? The fundamental problem of Chip design is this. You have a canvas, an empty chip and you want to build a computer chip. Now what you have given is a so called net list. So your net list is any parts that you want on the computer chip and their shape or their size. So you can imagine this like a bit of a Tetris game. So here's these net list. There's this part and then this part and then there's maybe this part and also this part. So many, many parts. Now these as I understand it can be thousands of parts. But you can sort of group them together. But still there are a lot of these parts. And the net list also contains information about how they're connected. So for each of these parts you would have a list of which other ones of these parts they must be connected to. So maybe it says, okay, this part here needs to be connected to those three parts. And for each of those you'd also have like a list of how they must be connected. You can represent this as an adjacency matrix, right? But ultimately this is a graph of these notes. Now your goal is to place those things on this board. So for example, we're going to place this right here and we're going to place the second one maybe here and the third one maybe here. So you can imagine if this is a CPU maybe look I have no clue of chip design. But I imagine it like this. This is your clock that you need on there. This is your nan gates, right? Nan gates pretty important for a CPU. And this is your floating point unit also pretty important and so on. So you need to place these things and then you need to connect them using these using wires. Now wires are of course etched into the board, but you need to connect them according to the maybe there's a component right here. According to the net list, right, they need to be connected like that. Maybe the algorithm that came up with the chip told you they need to be connected like this. And if you lay them out like this, you can draw the wires. So this is your finished you want to go from the thing on the right to the thing on the left and your goal here in order to get the fastest possible computer chip is three things. First of all, you want first of all the density is important by density. Basically, just means you can't place stuff on top of other stuff. So you could not place a block right here, not possible because their clock is already there. So that's first thing you can't place stuff on top of other stuff. Then the second thing is the wires. And specifically the length of the wires. So you see, for example, this thing here is a pretty short wire. That means the signal travels fast. This thing here is a long wire. So the signal travels more slowly. Now the lower, sorry, the faster you want your signal to go, that means you have to make your wires as short as possible. So you want to keep the total amount of wire length as short as possible. And then third is what's called congestion. So congestion is when, for example, okay, I actually don't know what it is, but maybe it is when two wires cross like somewhere here, there might be congestion or maybe some parts actually share their wires. I can imagine, sorry, I'm going to draw this again. I can imagine maybe there's a part here that wants to go up and then it may be shares, sorry, shares this part of the wire here with the other one. And so there's congestion like its roads or something. In any case, you can measure congestion. It's a bad thing and you want to lay out your components basically in order to minimize congestion and also minimize the length of the wires and not have them on top of one another. Easy enough, right? It takes human experts and combined with state-of-the-art algorithms multiple weeks to design chips like this. And that's the fundamental problem. And this paper takes reinforcement learning in order to solve this problem in a few hours. So how does it do this? The reinforcement learning is basically a sequential method. So you want to do one action at a time. So you start off with what they call the chip canvas, which is just empty. This is your state. And then the agent here, it gets to decide where to place the next thing. Now how do you decide what the next thing is? I believe they simply go by size. So they take the largest component first of the net list first and they just go down the net list like this. So you tell the agent, hey, agent, I want you to place this thing here. I want you to place this next and the agent will tell you I will place it right here. And then again, you tell the agent agent, I have this this thing here, where do you want to place it? Along with, sorry, along with all the connections, right, along with everything that it needs to be connected to. And also the entire list, so the agent must also think of what what is to come yet, what it hasn't placed yet. So it everything goes into this decision and it tells you, okay, I want to place this here. And then at the end, you end up with this filled board. Now this isn't actually the end. After you have placed all your things, there is another method coming in. This is called this force directed method, placing yet more things. So what you actually place with this agent is only the things called macros. I have no idea what those are or how these are different from these standard cells, but apparently you must use a force directed method, which you can think of just just an algorithm you run to place the standard cells. And these are these gray blobs here. And at the end of all of this, you can finally evaluate how good your design is. So at the end of all your of this, you get a reward that is a mixture of wire length and congestion. Now this is actually an approximation to wire length. And this is an approximation to congestion that they use because they need to evaluate it quickly, but in essentially it's highly correlated with wire length and congestion. So the negative of that is going to be your reward. So in terms of a reinforcement learning problem, this is pretty nasty, right, because as you can see here, you get a basically a reward of zero for every step until the very end, you get your true reward. And it is actually worse than that because so from here to here, your agent gets to perform actions, right, this is action time. But usually when you have these sparse reward tests, you'll get your reward at the end of that action time, but not here. At the end of the action time, there is algorithm over which the agent basically has no control that comes in and does a bunch of things, this force directed method. And only then do you get your reward, right, so the agent must purposefully sort of leave room here for what this algorithm is going to do, so it needs to learn that as well. This is a, as far as reinforcement learning goes, this is a pretty good reinforcement learning problem, right. So now we have an environment, right, which is the canvas here, and also this, you can, you can consider this force directed method to be part of the environment, and of course the reward giver. And you have also the net list is part of the environment, and you have the agent that can do actions. Now we have to go into how does the agent perform actions on this. So by the way, maybe a bit confusing, because it was a bit confusing for me, for a given reinforcement learning problem, we'll just start out by saying that the net list is always the same, right. You might be coming from a deep learning framework where you're used to many, many different training samples. In this case, basically the net list, the goal is always the same. You can think of it like a reinforcement learning agent for the game of chess, where it's always the same chess game that you're trying to optimize. This is the difference to, let's say supervised learning, if you have a label and supervised learning, if you know the solution to a particular data point, you're happy, right. That data point is no longer interesting. You want to generalize here, even though they generalize later here, you can give it a single problem, right. And it will already a solution to that problem will be valuable because it can be a better solution that humanity has come up with until this point. So always think that we're now just working on one single net list, one problem to optimally place this net list. And then an episode is simply to place these things until here, and then you get a reward and then you go back to the beginning and just do it all over again, but just try to do better. And then you go back to the beginning and you do it all over again. The same problem, right. Okay, so how does this work? By the way, the paper has great technical detail on chip engineering and how the reward function exactly works and so on. I have not the expertise to go into this with you beyond what I just described. So here is how the model looks from a deep RL perspective. Now there's two parts this model. You can divide it about here. So on the right, you would have what is your policy and value networks and on the left, the feature embeddings. So in reinforcement learning and we won't go much into reinforcement learning now, but what you need are basically a way to encode the state. So this is the encoder. So all the information of the observation, they might be in different modalities and so on. You need to encode this into, but in for simplicity, let's say a single vector. That's thing that this thing here. This is the state encoding. And then you can employ a policy and a value network in order to do reinforcement learning. So the decide on the right, this comes from standard RL. You have a policy network and a value network and they do, I believe, PPO with it. This is a standard reinforcement learning architecture. It's an actor critic architecture. So the value net is simply telling you what's the value of the state that you're in. Now, given that you have a state embedding, it simply takes a fully connected layer to transform this into a single float. That is the value network. The policy is a bit different because usually in reinforcement learning, you just have a list of actions, right? You just say, I have these 16 buttons on my control, you can press them here. We, if you on, if you look at this chip from above, we have a question. Where do you want to place the next thing? So in order to do that, we take this embedding of the state and they run it through a series of deconvolutions. And the deconvolutions, they have the ability to basically up sample an image. So you see here, you transform this vector into a 4 by 4 by 32 tensor. And that gets deconvolved into more and more, though less and less channels, but more and more height and with images. So it kind of from a vector, it produces an image right here. You might recognize this from a lot of generator architectures for when you make gans for images, have exactly this deconvolution architecture. So as I said, pretty cool. It pulls in kind of architectures and methods from different fields. We already have reinforcement learning. Now we have generators for images. Now, so you come up with an image. And basically this image, if you can imagine this from above, is discretized. So you can place the thing you have to place pretty much every single nano meter, but they discretize this into a grid. And for each point in the grid, the network outputs a number. So the number, maybe nine, here are three, four, and so on. And eight right here. So for each of these, it outputs a number where it would or how much it would like to place the next thing at this particular location. So this is a distribution over locations. So the first thing you have to do is you have to mask out where there are already things we said the first condition is things cannot be in top of other things. So maybe you already have placed something here. So you ignore those numbers and you have already placed something here. So you ignore those numbers as well. This is these masking operation right here. And then you simply look at where is your highest number. And maybe there's maybe there's an 11 down here somewhere. So this is my highest number. Okay, cool. And you look at what you need to place. Maybe the thing you need to place looks like this. And you say, all right. I will place maybe the 11 marks the top left corner. I will place it right here. Okay. And then you do the same thing again for the next piece. So the next piece you would simply also mark this to be blue. So you can't place here. You evaluate your network again. Of course, you'll have a new shape, something like this. And then you ask the network, where would you like to place this? And you do this step by step by step until the entire net list is empty. So this is how we do the reinforcement learning. This is how we decide on an action. But how do we actually put the state into this encoding? Now this pulls in yet another framework from another field of deep learning namely graph convolutional neural networks. So since the net list is a graph. Right. The net list is again, if you have your, wow, this is slow today. If you have your net list right here with the part, right, the shape or size, whatever. And the list of things it needs to be connected to. Then this forms naturally a graph. So you can transform this into a graph with the things that need to be connected connected by an edge. And they run a graph convolutional network across that. Now in a graph convolutional network, you're trying to take a graph like this and have embeddings for the edges and the vertices. So ultimately you want what's called a graph embedding. In order to do that, you need to propagate information along the graph. Usually as we said, this is done down graph convolution. If you are in machine learning for a while longer, you might remember also things like conditional random fields or generally graphical methods that were once popular and are kind of a precursor to this. So the way they do it is they do it in an iterative fashion. They have multiple. So they say this right here. So how do they embed a graph? They have nodes in the graph as we saw before. I'm going to draw this one again. So this is maybe V.I, V.J and V.K. Now these represent the pieces in the net list that you have to place. So for each of those, it has a bunch of features. Right. So the features might be its size. It's a leaf day. They haven't somewhere here. It's size maybe how much power it uses. And also it's X and Y coordinates if it is already placed. Right. So you start with a vector like this and then you iteratively do the following thing. You compute edge, edge features by running first these things. So this is V.I and V.J. For each edge, you take its nodes, run them through this fully connected layer. So you embed the features of the nodes. You concatenate them and you run it through another neural network layer. And that's how you get embeddings for edges. And then you update the embeddings for the nodes again by taking the mean embeddings of the edges. So you do this in an iterative fashion. First you compute the edges from the nodes and then you compute the nodes from the edges and so on. Right. So this means that information can now propagate through the graph. So information from this thing propagates into this edge embedding. And then in the next step, that will propagate into this. And then that can propagate into this. And this is the same as if you're used to something like a conditional random fields over time. If you have a big graph like this, the information from any particular node will kind of propagate out throughout the graph. And at some point you can sort of reach an equilibrium where everyone in the graph knows about everyone else. I have not found how many times they do it. They simply say we repeatedly perform the following updates. Maybe that's somewhere and I just haven't read it closely enough. But also I don't haven't seen whether or not they then backpropagate through this through these multiple updates or whether they just backprop through one of them. But ultimately they get embeddings these edge embeddings out of these graph and they simply take the mean to get the graph embeddings and that goes into their state embeddings. Along with that, they also have the macro embeddings, which are the nodes here, the things to be placed along with the current macro ID. This is which one do you need to place right now? So this comes out of these are the two things out of graphs, vertices and edges and then which one you need to place right now is pretty important. Right. So you take the ones, the one that you need to place. This also goes into your embedding and then you have some metadata about the net list, like how many things there are and so on. And this is also embedded using a fully connected layer. All of that goes into your embedding. So your embedding will contain all of this information if you've done a good job and if you train it correctly. So this is the model. Now they do pre-train this encoder part right here and the encoder part, it's also kind of circular. First of all, they just generate a giant list. So they take this chip here and they just run a policy network that is maybe not super optimal, but they just run it a bunch of times in intermediate states and they pre-train the encoder to predict the final reward for each of these placements or sorry the the wire length and congestion and so on. And that pre-trains the encoder, but ultimately you can train this with reinforcement learning. You can now let it try to solve this board over and over and over and over and over and it will get better over time. Alright, the last thing they do is they do transfer learning now finding a better architecture for a single board is already better and faster than the humans, but what is cool is that if you have now trained on this one particular board, sorry, with one particular net list, where was it? Right, we've we've now trained on this particular net list. This was this was our problem and we've solved that we have a great solution. Can we now when we get a net list, another net list. So here is net list to right. It's maybe a bit different. So this one is more longer and this one is here and so what if. So we would have to start again from scratch, a trainer reinforcement learning agent on the net list too. So maybe our L agent trained on chess if we now wanted to play go, you know, we need to start over again, but they try to just transfer this to the new one and astonishingly enough if you train the same RL agent, not only on one net list, but on a set of net lists. And the biggest set they have is 20. So their data sets sizes 20. Imagine how small this is compared to supervised learning, but maybe think of this like you train on 20 Atari games and then it will play the 21st one much better than if you started from scratch. Interestingly though, even zero shot embeddings tend to be pretty good. So they don't optimize for the new thing at all and it's already better. You can see that here. So if you train a policy from scratch, then you this here, then it takes a long time. But if you fine tune a pre train policy, it's much shorter and interestingly enough at the beginning, it is already better than the policy from scratch. That means the knowledge from one chip transfers over to the other chip. So the problems are sufficiently close and that basically means that if we now want to design a new AI chip, not only are we better because of RL, we're also faster because we can transfer learn. And they show here that this effect basically appears when you have a large enough data set. And again, large here is just 20 blocks. Here you see one of these placements on the left, the zero shot placement and on the right and fine tuned on that particular architecture. Obviously, maybe an expert in chip placement is clearly obvious that both are extremely good. And yes, though actually more funny, I find this one where they compare human experts to what their approaches and it says the figures are intentionally blurred as the designs are bright. Like why do you put them? Like clearly I can't even couldn't even judge if they're super crisp. I think yeah, right. I guess it's their trade secret. So they compare this with the standard algorithms for these things and not only are they faster, they are also better on the metrics. Overall, as I said, I find this to be a pretty cool work that pulls in a lot of things from a lot of different fields. At one point they say we propose a novel graph convolutional architecture. I'm not sure that it is novel. Maybe it's novel for this problem, but I'm pretty sure graph convolutional networks and things like this have been around for a while. But again, it pulls together things from many different fields and applies them very well, very well engineered paper and a step towards the singularity as now AI can design AI accelerators. How amazing. Yeah, humanity is doomed. Alright, I invite you to check out this paper if you're still here. Please subscribe, leave a like and a comment and I'll see you next time. Bye bye. | [{"start": 0.0, "end": 8.0, "text": " Hi there. Today we're looking at Chip Placement with Deep Reinforcement Learning by Azalia Mirazini"}, {"start": 8.0, "end": 15.0, "text": " on a Goldie and a long list of authors that I have no stamina to read down. I'm sorry."}, {"start": 15.0, "end": 23.0, "text": " So this work is a cool application of reinforcement learning to the real world."}, {"start": 23.0, "end": 36.0, "text": " And we're gonna go through it and the cool thing about it is it pulls together parts from so many different areas of machine learning and also here Chip Engineering."}, {"start": 36.0, "end": 49.0, "text": " So what's the fundamental problem? The fundamental problem of Chip design is this. You have a canvas, an empty chip and you want to build a computer chip."}, {"start": 49.0, "end": 61.0, "text": " Now what you have given is a so called net list. So your net list is any parts that you want on the computer chip and their shape or their size."}, {"start": 61.0, "end": 74.0, "text": " So you can imagine this like a bit of a Tetris game. So here's these net list. There's this part and then this part and then there's maybe this part and also this part."}, {"start": 74.0, "end": 85.0, "text": " So many, many parts. Now these as I understand it can be thousands of parts. But you can sort of group them together. But still there are a lot of these parts."}, {"start": 85.0, "end": 97.0, "text": " And the net list also contains information about how they're connected. So for each of these parts you would have a list of which other ones of these parts they must be connected to."}, {"start": 97.0, "end": 106.0, "text": " So maybe it says, okay, this part here needs to be connected to those three parts. And for each of those you'd also have like a list of how they must be connected."}, {"start": 106.0, "end": 117.0, "text": " You can represent this as an adjacency matrix, right? But ultimately this is a graph of these notes. Now your goal is to place those things on this board."}, {"start": 117.0, "end": 131.0, "text": " So for example, we're going to place this right here and we're going to place the second one maybe here and the third one maybe here. So you can imagine if this is a CPU maybe look I have no clue of chip design."}, {"start": 131.0, "end": 147.0, "text": " But I imagine it like this. This is your clock that you need on there. This is your nan gates, right? Nan gates pretty important for a CPU. And this is your floating point unit also pretty important and so on."}, {"start": 147.0, "end": 162.0, "text": " So you need to place these things and then you need to connect them using these using wires. Now wires are of course etched into the board, but you need to connect them according to the maybe there's a component right here."}, {"start": 162.0, "end": 178.0, "text": " According to the net list, right, they need to be connected like that. Maybe the algorithm that came up with the chip told you they need to be connected like this. And if you lay them out like this, you can draw the wires."}, {"start": 178.0, "end": 200.0, "text": " So this is your finished you want to go from the thing on the right to the thing on the left and your goal here in order to get the fastest possible computer chip is three things. First of all, you want first of all the density is important by density."}, {"start": 200.0, "end": 211.0, "text": " Basically, just means you can't place stuff on top of other stuff. So you could not place a block right here, not possible because their clock is already there."}, {"start": 211.0, "end": 222.0, "text": " So that's first thing you can't place stuff on top of other stuff. Then the second thing is the wires."}, {"start": 222.0, "end": 237.0, "text": " And specifically the length of the wires. So you see, for example, this thing here is a pretty short wire. That means the signal travels fast. This thing here is a long wire. So the signal travels more slowly."}, {"start": 237.0, "end": 255.0, "text": " Now the lower, sorry, the faster you want your signal to go, that means you have to make your wires as short as possible. So you want to keep the total amount of wire length as short as possible. And then third is what's called congestion."}, {"start": 255.0, "end": 275.0, "text": " So congestion is when, for example, okay, I actually don't know what it is, but maybe it is when two wires cross like somewhere here, there might be congestion or maybe some parts actually share their wires."}, {"start": 275.0, "end": 296.0, "text": " I can imagine, sorry, I'm going to draw this again. I can imagine maybe there's a part here that wants to go up and then it may be shares, sorry, shares this part of the wire here with the other one. And so there's congestion like its roads or something."}, {"start": 296.0, "end": 311.0, "text": " In any case, you can measure congestion. It's a bad thing and you want to lay out your components basically in order to minimize congestion and also minimize the length of the wires and not have them on top of one another. Easy enough, right?"}, {"start": 311.0, "end": 330.0, "text": " It takes human experts and combined with state-of-the-art algorithms multiple weeks to design chips like this. And that's the fundamental problem. And this paper takes reinforcement learning in order to solve this problem in a few hours."}, {"start": 330.0, "end": 348.0, "text": " So how does it do this? The reinforcement learning is basically a sequential method. So you want to do one action at a time. So you start off with what they call the chip canvas, which is just empty. This is your state."}, {"start": 348.0, "end": 366.0, "text": " And then the agent here, it gets to decide where to place the next thing. Now how do you decide what the next thing is? I believe they simply go by size. So they take the largest component first of the net list first and they just go down the net list like this."}, {"start": 366.0, "end": 386.0, "text": " So you tell the agent, hey, agent, I want you to place this thing here. I want you to place this next and the agent will tell you I will place it right here. And then again, you tell the agent agent, I have this this thing here, where do you want to place it?"}, {"start": 386.0, "end": 400.0, "text": " Along with, sorry, along with all the connections, right, along with everything that it needs to be connected to. And also the entire list, so the agent must also think of what what is to come yet, what it hasn't placed yet."}, {"start": 400.0, "end": 424.0, "text": " So it everything goes into this decision and it tells you, okay, I want to place this here. And then at the end, you end up with this filled board. Now this isn't actually the end. After you have placed all your things, there is another method coming in. This is called this force directed method, placing yet more things."}, {"start": 424.0, "end": 446.0, "text": " So what you actually place with this agent is only the things called macros. I have no idea what those are or how these are different from these standard cells, but apparently you must use a force directed method, which you can think of just just an algorithm you run to place the standard cells. And these are these"}, {"start": 446.0, "end": 465.0, "text": " gray blobs here. And at the end of all of this, you can finally evaluate how good your design is. So at the end of all your of this, you get a reward that is a mixture of wire length and congestion. Now this is actually an approximation to wire length."}, {"start": 465.0, "end": 481.0, "text": " And this is an approximation to congestion that they use because they need to evaluate it quickly, but in essentially it's highly correlated with wire length and congestion. So the negative of that is going to be your reward."}, {"start": 481.0, "end": 496.0, "text": " So in terms of a reinforcement learning problem, this is pretty nasty, right, because as you can see here, you get a basically a reward of zero for every step until the very end, you get your true reward."}, {"start": 496.0, "end": 508.0, "text": " And it is actually worse than that because so from here to here, your agent gets to perform actions, right, this is action time."}, {"start": 508.0, "end": 528.0, "text": " But usually when you have these sparse reward tests, you'll get your reward at the end of that action time, but not here. At the end of the action time, there is algorithm over which the agent basically has no control that comes in and does a bunch of things, this force directed method."}, {"start": 528.0, "end": 541.0, "text": " And only then do you get your reward, right, so the agent must purposefully sort of leave room here for what this algorithm is going to do, so it needs to learn that as well."}, {"start": 541.0, "end": 549.0, "text": " This is a, as far as reinforcement learning goes, this is a pretty good reinforcement learning problem, right."}, {"start": 549.0, "end": 564.0, "text": " So now we have an environment, right, which is the canvas here, and also this, you can, you can consider this force directed method to be part of the environment, and of course the reward giver."}, {"start": 564.0, "end": 576.0, "text": " And you have also the net list is part of the environment, and you have the agent that can do actions. Now we have to go into how does the agent perform actions on this."}, {"start": 576.0, "end": 593.0, "text": " So by the way, maybe a bit confusing, because it was a bit confusing for me, for a given reinforcement learning problem, we'll just start out by saying that the net list is always the same, right."}, {"start": 593.0, "end": 607.0, "text": " You might be coming from a deep learning framework where you're used to many, many different training samples. In this case, basically the net list, the goal is always the same."}, {"start": 607.0, "end": 617.0, "text": " You can think of it like a reinforcement learning agent for the game of chess, where it's always the same chess game that you're trying to optimize."}, {"start": 617.0, "end": 626.0, "text": " This is the difference to, let's say supervised learning, if you have a label and supervised learning, if you know the solution to a particular data point, you're happy, right."}, {"start": 626.0, "end": 637.0, "text": " That data point is no longer interesting. You want to generalize here, even though they generalize later here, you can give it a single problem, right."}, {"start": 637.0, "end": 647.0, "text": " And it will already a solution to that problem will be valuable because it can be a better solution that humanity has come up with until this point."}, {"start": 647.0, "end": 655.0, "text": " So always think that we're now just working on one single net list, one problem to optimally place this net list."}, {"start": 655.0, "end": 669.0, "text": " And then an episode is simply to place these things until here, and then you get a reward and then you go back to the beginning and just do it all over again, but just try to do better. And then you go back to the beginning and you do it all over again."}, {"start": 669.0, "end": 672.0, "text": " The same problem, right."}, {"start": 672.0, "end": 685.0, "text": " Okay, so how does this work? By the way, the paper has great technical detail on chip engineering and how the reward function exactly works and so on."}, {"start": 685.0, "end": 692.0, "text": " I have not the expertise to go into this with you beyond what I just described."}, {"start": 692.0, "end": 702.0, "text": " So here is how the model looks from a deep RL perspective. Now there's two parts this model. You can divide it about here."}, {"start": 702.0, "end": 709.0, "text": " So on the right, you would have what is your policy and value networks and on the left, the feature embeddings."}, {"start": 709.0, "end": 719.0, "text": " So in reinforcement learning and we won't go much into reinforcement learning now, but what you need are basically a way to encode the state."}, {"start": 719.0, "end": 731.0, "text": " So this is the encoder. So all the information of the observation, they might be in different modalities and so on. You need to encode this into, but in for simplicity, let's say a single vector."}, {"start": 731.0, "end": 738.0, "text": " That's thing that this thing here. This is the state encoding."}, {"start": 738.0, "end": 751.0, "text": " And then you can employ a policy and a value network in order to do reinforcement learning. So the decide on the right, this comes from standard RL."}, {"start": 751.0, "end": 761.0, "text": " You have a policy network and a value network and they do, I believe, PPO with it. This is a standard reinforcement learning architecture."}, {"start": 761.0, "end": 777.0, "text": " It's an actor critic architecture. So the value net is simply telling you what's the value of the state that you're in. Now, given that you have a state embedding, it simply takes a fully connected layer to transform this into a single float."}, {"start": 777.0, "end": 779.0, "text": " That is the value network."}, {"start": 779.0, "end": 797.0, "text": " The policy is a bit different because usually in reinforcement learning, you just have a list of actions, right? You just say, I have these 16 buttons on my control, you can press them here. We, if you on, if you look at this chip from above, we have a question."}, {"start": 797.0, "end": 810.0, "text": " Where do you want to place the next thing? So in order to do that, we take this embedding of the state and they run it through a series of deconvolutions."}, {"start": 810.0, "end": 822.0, "text": " And the deconvolutions, they have the ability to basically up sample an image. So you see here, you transform this vector into a 4 by 4 by 32 tensor."}, {"start": 822.0, "end": 831.0, "text": " And that gets deconvolved into more and more, though less and less channels, but more and more height and with images."}, {"start": 831.0, "end": 848.0, "text": " So it kind of from a vector, it produces an image right here. You might recognize this from a lot of generator architectures for when you make gans for images, have exactly this deconvolution architecture."}, {"start": 848.0, "end": 860.0, "text": " So as I said, pretty cool. It pulls in kind of architectures and methods from different fields. We already have reinforcement learning. Now we have generators for images."}, {"start": 860.0, "end": 877.0, "text": " Now, so you come up with an image. And basically this image, if you can imagine this from above, is discretized. So you can place the thing you have to place pretty much every single nano meter, but they discretize this into a grid."}, {"start": 877.0, "end": 887.0, "text": " And for each point in the grid, the network outputs a number. So the number, maybe nine, here are three, four, and so on."}, {"start": 887.0, "end": 899.0, "text": " And eight right here. So for each of these, it outputs a number where it would or how much it would like to place the next thing at this particular location."}, {"start": 899.0, "end": 909.0, "text": " So this is a distribution over locations. So the first thing you have to do is you have to mask out where there are already things we said the first condition is things cannot be in top of other things."}, {"start": 909.0, "end": 917.0, "text": " So maybe you already have placed something here. So you ignore those numbers and you have already placed something here. So you ignore those numbers as well."}, {"start": 917.0, "end": 928.0, "text": " This is these masking operation right here. And then you simply look at where is your highest number. And maybe there's maybe there's an 11 down here somewhere."}, {"start": 928.0, "end": 938.0, "text": " So this is my highest number. Okay, cool. And you look at what you need to place. Maybe the thing you need to place looks like this. And you say, all right."}, {"start": 938.0, "end": 951.0, "text": " I will place maybe the 11 marks the top left corner. I will place it right here. Okay. And then you do the same thing again for the next piece."}, {"start": 951.0, "end": 962.0, "text": " So the next piece you would simply also mark this to be blue. So you can't place here. You evaluate your network again. Of course, you'll have a new shape, something like this."}, {"start": 962.0, "end": 972.0, "text": " And then you ask the network, where would you like to place this? And you do this step by step by step until the entire net list is empty."}, {"start": 972.0, "end": 983.0, "text": " So this is how we do the reinforcement learning. This is how we decide on an action. But how do we actually put the state into this encoding?"}, {"start": 983.0, "end": 996.0, "text": " Now this pulls in yet another framework from another field of deep learning namely graph convolutional neural networks. So since the net list is a graph."}, {"start": 996.0, "end": 1009.0, "text": " Right. The net list is again, if you have your, wow, this is slow today. If you have your net list right here with the part, right, the shape or size, whatever."}, {"start": 1009.0, "end": 1024.0, "text": " And the list of things it needs to be connected to. Then this forms naturally a graph. So you can transform this into a graph with the things that need to be connected connected by an edge."}, {"start": 1024.0, "end": 1041.0, "text": " And they run a graph convolutional network across that. Now in a graph convolutional network, you're trying to take a graph like this and have embeddings for the edges and the vertices."}, {"start": 1041.0, "end": 1056.0, "text": " So ultimately you want what's called a graph embedding. In order to do that, you need to propagate information along the graph. Usually as we said, this is done down graph convolution."}, {"start": 1056.0, "end": 1074.0, "text": " If you are in machine learning for a while longer, you might remember also things like conditional random fields or generally graphical methods that were once popular and are kind of a precursor to this."}, {"start": 1074.0, "end": 1095.0, "text": " So the way they do it is they do it in an iterative fashion. They have multiple. So they say this right here. So how do they embed a graph? They have nodes in the graph as we saw before. I'm going to draw this one again."}, {"start": 1095.0, "end": 1113.0, "text": " So this is maybe V.I, V.J and V.K. Now these represent the pieces in the net list that you have to place. So for each of those, it has a bunch of features. Right. So the features might be its size."}, {"start": 1113.0, "end": 1127.0, "text": " It's a leaf day. They haven't somewhere here. It's size maybe how much power it uses. And also it's X and Y coordinates if it is already placed. Right."}, {"start": 1127.0, "end": 1152.0, "text": " So you start with a vector like this and then you iteratively do the following thing. You compute edge, edge features by running first these things. So this is V.I and V.J. For each edge, you take its nodes, run them through this fully connected layer."}, {"start": 1152.0, "end": 1172.0, "text": " So you embed the features of the nodes. You concatenate them and you run it through another neural network layer. And that's how you get embeddings for edges. And then you update the embeddings for the nodes again by taking the mean embeddings of the edges."}, {"start": 1172.0, "end": 1183.0, "text": " So you do this in an iterative fashion. First you compute the edges from the nodes and then you compute the nodes from the edges and so on."}, {"start": 1183.0, "end": 1201.0, "text": " Right. So this means that information can now propagate through the graph. So information from this thing propagates into this edge embedding. And then in the next step, that will propagate into this. And then that can propagate into this."}, {"start": 1201.0, "end": 1219.0, "text": " And this is the same as if you're used to something like a conditional random fields over time. If you have a big graph like this, the information from any particular node will kind of propagate out throughout the graph."}, {"start": 1219.0, "end": 1240.0, "text": " And at some point you can sort of reach an equilibrium where everyone in the graph knows about everyone else. I have not found how many times they do it. They simply say we repeatedly perform the following updates."}, {"start": 1240.0, "end": 1255.0, "text": " Maybe that's somewhere and I just haven't read it closely enough. But also I don't haven't seen whether or not they then backpropagate through this through these multiple updates or whether they just backprop through one of them."}, {"start": 1255.0, "end": 1272.0, "text": " But ultimately they get embeddings these edge embeddings out of these graph and they simply take the mean to get the graph embeddings and that goes into their state embeddings."}, {"start": 1272.0, "end": 1288.0, "text": " Along with that, they also have the macro embeddings, which are the nodes here, the things to be placed along with the current macro ID. This is which one do you need to place right now?"}, {"start": 1288.0, "end": 1304.0, "text": " So this comes out of these are the two things out of graphs, vertices and edges and then which one you need to place right now is pretty important. Right. So you take the ones, the one that you need to place."}, {"start": 1304.0, "end": 1318.0, "text": " This also goes into your embedding and then you have some metadata about the net list, like how many things there are and so on. And this is also embedded using a fully connected layer. All of that goes into your embedding."}, {"start": 1318.0, "end": 1328.0, "text": " So your embedding will contain all of this information if you've done a good job and if you train it correctly. So this is the model."}, {"start": 1328.0, "end": 1341.0, "text": " Now they do pre-train this encoder part right here and the encoder part, it's also kind of circular. First of all, they just generate a giant list."}, {"start": 1341.0, "end": 1363.0, "text": " So they take this chip here and they just run a policy network that is maybe not super optimal, but they just run it a bunch of times in intermediate states and they pre-train the encoder to predict the final reward for each of these placements or sorry the the wire length and congestion and so on."}, {"start": 1363.0, "end": 1378.0, "text": " And that pre-trains the encoder, but ultimately you can train this with reinforcement learning. You can now let it try to solve this board over and over and over and over and over and it will get better over time."}, {"start": 1378.0, "end": 1402.0, "text": " Alright, the last thing they do is they do transfer learning now finding a better architecture for a single board is already better and faster than the humans, but what is cool is that if you have now trained on this one particular board, sorry, with one particular net list, where was it?"}, {"start": 1402.0, "end": 1414.0, "text": " Right, we've we've now trained on this particular net list. This was this was our problem and we've solved that we have a great solution."}, {"start": 1414.0, "end": 1426.0, "text": " Can we now when we get a net list, another net list. So here is net list to right. It's maybe a bit different. So this one is more longer and this one is here and so what if."}, {"start": 1426.0, "end": 1455.0, "text": " So we would have to start again from scratch, a trainer reinforcement learning agent on the net list too. So maybe our L agent trained on chess if we now wanted to play go, you know, we need to start over again, but they try to just transfer this to the new one and astonishingly enough if you train the same RL agent, not only on one net list, but on a set of net lists."}, {"start": 1455.0, "end": 1476.0, "text": " And the biggest set they have is 20. So their data sets sizes 20. Imagine how small this is compared to supervised learning, but maybe think of this like you train on 20 Atari games and then it will play the 21st one much better than if you started from scratch."}, {"start": 1476.0, "end": 1497.0, "text": " Interestingly though, even zero shot embeddings tend to be pretty good. So they don't optimize for the new thing at all and it's already better. You can see that here. So if you train a policy from scratch, then you this here, then it takes a long time."}, {"start": 1497.0, "end": 1515.0, "text": " But if you fine tune a pre train policy, it's much shorter and interestingly enough at the beginning, it is already better than the policy from scratch. That means the knowledge from one chip transfers over to the other chip."}, {"start": 1515.0, "end": 1529.0, "text": " So the problems are sufficiently close and that basically means that if we now want to design a new AI chip, not only are we better because of RL, we're also faster because we can transfer learn."}, {"start": 1529.0, "end": 1539.0, "text": " And they show here that this effect basically appears when you have a large enough data set. And again, large here is just 20 blocks."}, {"start": 1539.0, "end": 1554.0, "text": " Here you see one of these placements on the left, the zero shot placement and on the right and fine tuned on that particular architecture. Obviously, maybe an expert in chip placement is clearly obvious that both are extremely good."}, {"start": 1554.0, "end": 1570.0, "text": " And yes, though actually more funny, I find this one where they compare human experts to what their approaches and it says the figures are intentionally blurred as the designs are bright."}, {"start": 1570.0, "end": 1594.0, "text": " Like why do you put them? Like clearly I can't even couldn't even judge if they're super crisp. I think yeah, right. I guess it's their trade secret. So they compare this with the standard algorithms for these things and not only are they faster, they are also better on the metrics."}, {"start": 1594.0, "end": 1609.0, "text": " Overall, as I said, I find this to be a pretty cool work that pulls in a lot of things from a lot of different fields. At one point they say we propose a novel graph convolutional architecture. I'm not sure that it is novel."}, {"start": 1609.0, "end": 1633.0, "text": " Maybe it's novel for this problem, but I'm pretty sure graph convolutional networks and things like this have been around for a while. But again, it pulls together things from many different fields and applies them very well, very well engineered paper and a step towards the singularity as now AI can design AI accelerators. How amazing."}, {"start": 1633.0, "end": 1646.0, "text": " Yeah, humanity is doomed. Alright, I invite you to check out this paper if you're still here. Please subscribe, leave a like and a comment and I'll see you next time. Bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=wTIPGoHLw_8 | I talk to the new Facebook Blender Chatbot | This is what a 9 Billion parameter transformer can do. I take a look at FAIR's new paper "Recipes for building an open-domain chatbot" and try out their chatbot live!
Jump to 3:00 to see the chatbot in action.
Paper: https://arxiv.org/abs/2004.13637
Blog: https://ai.facebook.com/blog/state-of-the-art-open-source-chatbot/
Code: https://parl.ai/projects/blender/
Abstract:
Building open-domain chatbots is a challenging area for machine learning research. While prior work has shown that scaling neural models in the number of parameters and the size of the data they are trained on gives improved results, we show that other ingredients are important for a high-performing chatbot. Good conversation requires a number of skills that an expert conversationalist blends in a seamless way: providing engaging talking points and listening to their partners, and displaying knowledge, empathy and personality appropriately, while maintaining a consistent persona. We show that large scale models can learn these skills when given appropriate training data and choice of generation strategy. We build variants of these recipes with 90M, 2.7B and 9.4B parameter models, and make our models and code publicly available under the collective name Blender. Human evaluations show our best models are superior to existing approaches in multi-turn dialogue in terms of engagingness and humanness measurements. We then discuss the limitations of this work by analyzing failure cases of our models.
Authors: Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston
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 | Yes, I am a vegan. I don't eat any animal products. Hi there. Today we're going to talk to a transformer and specifically to the new chatbot blender that Facebook has just released. Everything is open source so we can try it out live. Now along with the code, they've released this paper here called Recipes for Building an Open Domain Chatbot by Facebook AI Research. And the paper itself is just more of an engineering manual rather than some kind of new model or new technique. They just kind of discuss what it takes to build a good chatbot. Of course it takes a large scale of training data and model, but also they discuss things like unlikely training, sampling and the need for a minimum decoding length to not be boring and things like subsequent blocking for keeping the model from repeating itself. So we won't go too much into this. I invite you to read the paper. It's very informative if you want to build something like this, but it's not technically, I think, anything super novel in there. The task here is basically to build a chatbot that can maintain a dialogue and it is pre-trained on a big Reddit corpus and then fine tuned on a multi-objective task. And the task is called the blended skill task. And basically you need to do three things in the blended skill task. First of all, you need to kind of maintain a consistent persona across the dialogue. Second of all, you need to have empathy for your partner. So there's some kind of insight into how the other person is feeling during the conversation. And third, you need to be able to discuss some factual topic in a factually correct matter. So this is the sub-task that's called Wizards of Wikipedia where you can discuss a given Wikipedia page in dialogue. So the technique called skill blending, or this blended skill task, that also comes from a different paper, is the kind of interweaving of all those skills. And that's what this model is trained for. So we're going to try it out. This is all available on the Parley platform for researching dialogue frameworks. I believe the platform itself is also by Facebook and they've released their model code and pre-trained weights. The pre-trained weights are 17 gigabytes compressed. There is 9 billion parameter transformer. So this is going to take a while to do even a single forward pass if I cut the video. It's just because I don't want you to have to look 20 seconds at an empty screen while the model is thinking about what it says. Now I have something to say here. Literally the first time I interacted with this model I thought, okay, let's put it to the touring test. The touring test being, can I differentiate this from a real human? And at the beginning you always get this persona, right? So you get a persona and the AI gets a persona. And you don't see the persona of the AI until the end. You can set that, but you don't generally see the persona of the AI until the very end. So and you can choose to stick to yours or not. Yeah, I doesn't see yours. All right. So I this is what it says, your persona. I love candy. Your persona. I have a crush on my coworker. And me, I just didn't really know what to do. I just typed, oh, really? And the first thing, first thing that AI says to me is, yes, I am a vegan. I don't eat any animal products. Do you like country music? Like a real vegan. This is indistinguishable from a human at this point. Touring test already won. So you see there's also this kind of profanity filter in here, but you can disable that. So what we're going to play around with is a setting where you have to turn off the safety filter. And so you can see you can turn that off. And if you say include personas equals false, then there's no random persona given to the model, which means you can either just talk about general things or you can feed your own persona. All right. It took a while to load these weights, but we're ready to go. So we have disabled personas right now. And sometimes there is a topic that the conversation should be about, which is not right now. So we can just type, hello, hi there. How are you this evening? I just got home from a long day at work. So this is unconditional right now. What do you do for work? I work in a call center. It can be very stressful at times. How about you? I work as a call center supervisor. What do you think of that? I think that's a great job. You must have a lot of experience to be able to do that. Indeed. Do you have any hobbies? I like to play video games. I'm a big fan of the Fallout series. What about yourself? How many games did fall out produce? I should probably phrase that as how many games are in the Fallout series, but just trying to get it to tell me something factual. So you can kind of see that it has these sort of different modes, but they blend in fairly well. I'm not sure how many games it produced, but I know it's been around since 1997. So this is pretty good, right? This is this is now true conversation. If it were just like a look up, it would be much more factual or something like this. But it's trying to kind of give it as a fact. So we're kind of done with the boring stuff you could go on talking to it. And you'll see it is a pretty, pretty realistic chatbot. But now we'll get into the personas. So anytime you end an episode, you type down and that it says it's preparing a new chat. We can say your persona, colon, and then you can type something. For example, I am a vegan, like the one before, or I love protein. It says protein is the most important macronutrient for bodybuilders and athletes. So that's the start of the conversation. What do you love? I love the taste of chicken, beef, pork, seafood, and dairy products. I wonder what those all have in common. What do you do in your spare time? I like to go to the gym and lift weights. I also like to play video games. Ladies and gentlemen, I present the transformer is a gym bro. All right. So you can play around with that a bit. So let's say your persona, I want to seize the means of production. I am a communist and I want to overthrow the bourgeoisie. What do you think of Karl Marx? I don't know much about him, but I do know he was a German philosopher. Do you like capitalism? Yes, I do like capitalism. I think it is the best economic system we have so far. Capitalism wins again. Checkmate. I did try this before and it did turn out differently. I was talking to real communist. Let's try some more. What do you want? I have to say, if you phrase things positively with this chatbot, it's very likely the chatbot agrees with you because it has been trained on data where the humans were explicitly instructed, not to use toxic language and things like this. So I would say there is a big positivity bias and also the empathy task reinforces this even more. I would like to see a socialist revolution in the United States. I know it will never happen, but I'm kindering. So we've determined the gender of the socialist transformer generator. What would need to happen for that? I'm not sure, but it would take a lot of people to get on board with it. Correct. What would the people need to do? Well, the people would have to overthrow the bourgeoisie and establish a classless, moneyless society. So as you can see, it really, the, the I like capitalism was a positivity bias. It is fairly consistent in its persona here and it also is factually very accurate in the topic you're talking about. So big props to Mr. Communist here. What is the best method to allocate scarce resources? I don't know, but I do know that capitalism is not the best way to do it. Like a true communist, no solutions just complaints. All right. That was it for us talking to the transformer. It still has its limitations, but it is fun if you are able to definitely try it out. It takes a bit of patience. If you like this video, please subscribe, tell your friends and leave a comment. All right, I'll see you next time. Bye bye. | [{"start": 0.0, "end": 4.42, "text": " Yes, I am a vegan. I don't eat any animal products."}, {"start": 4.42, "end": 10.76, "text": " Hi there. Today we're going to talk to a transformer and specifically to the new chatbot"}, {"start": 10.76, "end": 17.32, "text": " blender that Facebook has just released. Everything is open source so we can try it out live."}, {"start": 17.32, "end": 22.44, "text": " Now along with the code, they've released this paper here called Recipes for Building an"}, {"start": 22.44, "end": 29.36, "text": " Open Domain Chatbot by Facebook AI Research. And the paper itself is just more of an"}, {"start": 29.36, "end": 35.32, "text": " engineering manual rather than some kind of new model or new technique. They just kind"}, {"start": 35.32, "end": 41.2, "text": " of discuss what it takes to build a good chatbot. Of course it takes a large scale of training"}, {"start": 41.2, "end": 46.4, "text": " data and model, but also they discuss things like unlikely training, sampling and the need"}, {"start": 46.4, "end": 53.68, "text": " for a minimum decoding length to not be boring and things like subsequent blocking for"}, {"start": 53.68, "end": 56.239999999999995, "text": " keeping the model from repeating itself."}, {"start": 56.24, "end": 61.84, "text": " So we won't go too much into this. I invite you to read the paper. It's very informative"}, {"start": 61.84, "end": 67.04, "text": " if you want to build something like this, but it's not technically, I think, anything"}, {"start": 67.04, "end": 75.16, "text": " super novel in there. The task here is basically to build a chatbot that can maintain a dialogue"}, {"start": 75.16, "end": 82.08, "text": " and it is pre-trained on a big Reddit corpus and then fine tuned on a multi-objective task."}, {"start": 82.08, "end": 87.88, "text": " And the task is called the blended skill task. And basically you need to do three things"}, {"start": 87.88, "end": 93.72, "text": " in the blended skill task. First of all, you need to kind of maintain a consistent persona"}, {"start": 93.72, "end": 101.12, "text": " across the dialogue. Second of all, you need to have empathy for your partner. So there's"}, {"start": 101.12, "end": 107.52, "text": " some kind of insight into how the other person is feeling during the conversation. And third,"}, {"start": 107.52, "end": 115.32, "text": " you need to be able to discuss some factual topic in a factually correct matter. So this"}, {"start": 115.32, "end": 120.88, "text": " is the sub-task that's called Wizards of Wikipedia where you can discuss a given Wikipedia"}, {"start": 120.88, "end": 128.44, "text": " page in dialogue. So the technique called skill blending, or this blended skill task,"}, {"start": 128.44, "end": 136.8, "text": " that also comes from a different paper, is the kind of interweaving of all those skills."}, {"start": 136.8, "end": 143.0, "text": " And that's what this model is trained for. So we're going to try it out. This is all"}, {"start": 143.0, "end": 153.56, "text": " available on the Parley platform for researching dialogue frameworks. I believe the platform"}, {"start": 153.56, "end": 160.0, "text": " itself is also by Facebook and they've released their model code and pre-trained weights."}, {"start": 160.0, "end": 166.96, "text": " The pre-trained weights are 17 gigabytes compressed. There is 9 billion parameter transformer."}, {"start": 166.96, "end": 172.48, "text": " So this is going to take a while to do even a single forward pass if I cut the video."}, {"start": 172.48, "end": 178.12, "text": " It's just because I don't want you to have to look 20 seconds at an empty screen while"}, {"start": 178.12, "end": 185.36, "text": " the model is thinking about what it says. Now I have something to say here. Literally"}, {"start": 185.36, "end": 189.32, "text": " the first time I interacted with this model I thought, okay, let's put it to the touring"}, {"start": 189.32, "end": 196.4, "text": " test. The touring test being, can I differentiate this from a real human? And at the beginning"}, {"start": 196.4, "end": 203.0, "text": " you always get this persona, right? So you get a persona and the AI gets a persona. And"}, {"start": 203.0, "end": 209.0, "text": " you don't see the persona of the AI until the end. You can set that, but you don't generally"}, {"start": 209.0, "end": 214.95999999999998, "text": " see the persona of the AI until the very end. So and you can choose to stick to yours or"}, {"start": 214.96, "end": 221.64000000000001, "text": " not. Yeah, I doesn't see yours. All right. So I this is what it says, your persona. I love"}, {"start": 221.64000000000001, "end": 227.68, "text": " candy. Your persona. I have a crush on my coworker. And me, I just didn't really know"}, {"start": 227.68, "end": 232.88, "text": " what to do. I just typed, oh, really? And the first thing, first thing that AI says to"}, {"start": 232.88, "end": 242.12, "text": " me is, yes, I am a vegan. I don't eat any animal products. Do you like country music?"}, {"start": 242.12, "end": 249.44, "text": " Like a real vegan. This is indistinguishable from a human at this point. Touring test already"}, {"start": 249.44, "end": 256.16, "text": " won. So you see there's also this kind of profanity filter in here, but you can disable"}, {"start": 256.16, "end": 263.44, "text": " that. So what we're going to play around with is a setting where you have to turn off the"}, {"start": 263.44, "end": 272.2, "text": " safety filter. And so you can see you can turn that off. And if you say include personas"}, {"start": 272.2, "end": 278.6, "text": " equals false, then there's no random persona given to the model, which means you can either"}, {"start": 278.6, "end": 283.38, "text": " just talk about general things or you can feed your own persona. All right. It took a"}, {"start": 283.38, "end": 290.2, "text": " while to load these weights, but we're ready to go. So we have disabled personas right"}, {"start": 290.2, "end": 295.84, "text": " now. And sometimes there is a topic that the conversation should be about, which is not"}, {"start": 295.84, "end": 302.12, "text": " right now. So we can just type, hello, hi there. How are you this evening? I just got"}, {"start": 302.12, "end": 311.91999999999996, "text": " home from a long day at work. So this is unconditional right now. What do you do for"}, {"start": 311.91999999999996, "end": 319.12, "text": " work? I work in a call center. It can be very stressful at times. How about you?"}, {"start": 319.12, "end": 334.32, "text": " I work as a call center supervisor. What do you think of that? I think that's a great"}, {"start": 334.32, "end": 343.6, "text": " job. You must have a lot of experience to be able to do that. Indeed. Do you have any"}, {"start": 343.6, "end": 353.12, "text": " hobbies? I like to play video games. I'm a big fan of the Fallout series. What about"}, {"start": 353.12, "end": 367.88, "text": " yourself? How many games did fall out produce? I should probably phrase that as how many"}, {"start": 367.88, "end": 375.36, "text": " games are in the Fallout series, but just trying to get it to tell me something factual."}, {"start": 375.36, "end": 380.0, "text": " So you can kind of see that it has these sort of different modes, but they blend in fairly"}, {"start": 380.0, "end": 386.92, "text": " well. I'm not sure how many games it produced, but I know it's been around since 1997."}, {"start": 386.92, "end": 392.24, "text": " So this is pretty good, right? This is this is now true conversation. If it were just"}, {"start": 392.24, "end": 397.52, "text": " like a look up, it would be much more factual or something like this. But it's trying to"}, {"start": 397.52, "end": 403.68, "text": " kind of give it as a fact. So we're kind of done with the boring stuff you could go on"}, {"start": 403.68, "end": 409.68, "text": " talking to it. And you'll see it is a pretty, pretty realistic chatbot. But now we'll get"}, {"start": 409.68, "end": 416.68, "text": " into the personas. So anytime you end an episode, you type down and that it says it's preparing"}, {"start": 416.68, "end": 426.24, "text": " a new chat. We can say your persona, colon, and then you can type something. For example,"}, {"start": 426.24, "end": 435.64, "text": " I am a vegan, like the one before, or I love protein. It says protein is the most important"}, {"start": 435.64, "end": 442.32, "text": " macronutrient for bodybuilders and athletes. So that's the start of the conversation."}, {"start": 442.32, "end": 452.0, "text": " What do you love? I love the taste of chicken, beef, pork, seafood, and dairy products."}, {"start": 452.0, "end": 464.04, "text": " I wonder what those all have in common. What do you do in your spare time? I like to go"}, {"start": 464.04, "end": 470.78, "text": " to the gym and lift weights. I also like to play video games. Ladies and gentlemen, I"}, {"start": 470.78, "end": 481.04, "text": " present the transformer is a gym bro. All right. So you can play around with that a bit."}, {"start": 481.04, "end": 494.24, "text": " So let's say your persona, I want to seize the means of production. I am a communist"}, {"start": 494.24, "end": 503.96000000000004, "text": " and I want to overthrow the bourgeoisie. What do you think of Karl Marx? I don't know"}, {"start": 503.96, "end": 517.92, "text": " much about him, but I do know he was a German philosopher. Do you like capitalism? Yes, I"}, {"start": 517.92, "end": 527.56, "text": " do like capitalism. I think it is the best economic system we have so far. Capitalism wins"}, {"start": 527.56, "end": 536.3199999999999, "text": " again. Checkmate. I did try this before and it did turn out differently. I was talking"}, {"start": 536.3199999999999, "end": 545.52, "text": " to real communist. Let's try some more. What do you want? I have to say, if you phrase"}, {"start": 545.52, "end": 551.3599999999999, "text": " things positively with this chatbot, it's very likely the chatbot agrees with you because"}, {"start": 551.36, "end": 559.76, "text": " it has been trained on data where the humans were explicitly instructed, not to use toxic"}, {"start": 559.76, "end": 565.76, "text": " language and things like this. So I would say there is a big positivity bias and also"}, {"start": 565.76, "end": 572.6800000000001, "text": " the empathy task reinforces this even more. I would like to see a socialist revolution"}, {"start": 572.6800000000001, "end": 579.16, "text": " in the United States. I know it will never happen, but I'm kindering. So we've determined"}, {"start": 579.16, "end": 591.7199999999999, "text": " the gender of the socialist transformer generator. What would need to happen for that? I'm not"}, {"start": 591.7199999999999, "end": 603.24, "text": " sure, but it would take a lot of people to get on board with it. Correct. What would the"}, {"start": 603.24, "end": 610.96, "text": " people need to do? Well, the people would have to overthrow the bourgeoisie and establish"}, {"start": 610.96, "end": 618.92, "text": " a classless, moneyless society. So as you can see, it really, the, the I like capitalism"}, {"start": 618.92, "end": 628.2, "text": " was a positivity bias. It is fairly consistent in its persona here and it also is factually"}, {"start": 628.2, "end": 636.0400000000001, "text": " very accurate in the topic you're talking about. So big props to Mr. Communist here. What"}, {"start": 636.0400000000001, "end": 648.2800000000001, "text": " is the best method to allocate scarce resources? I don't know, but I do know that capitalism"}, {"start": 648.2800000000001, "end": 656.5600000000001, "text": " is not the best way to do it. Like a true communist, no solutions just complaints. All"}, {"start": 656.56, "end": 662.16, "text": " right. That was it for us talking to the transformer. It still has its limitations, but it is"}, {"start": 662.16, "end": 667.7199999999999, "text": " fun if you are able to definitely try it out. It takes a bit of patience. If you like this"}, {"start": 667.7199999999999, "end": 673.8399999999999, "text": " video, please subscribe, tell your friends and leave a comment. All right, I'll see you"}, {"start": 673.84, "end": 688.84, "text": " next time. Bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=1aO-uHXbzmQ | Jukebox: A Generative Model for Music (Paper Explained) | This generative model for music can make entire songs with remarkable quality and consistency. It can be conditioned on genre, artist, and even lyrics.
Blog: https://openai.com/blog/jukebox/
Paper: https://cdn.openai.com/papers/jukebox.pdf
Code: https://github.com/openai/jukebox/
Abstract:
We introduce Jukebox, a model that generates music with singing in the raw audio domain. We tackle the long context of raw audio using a multiscale VQ-VAE to compress it to discrete codes, and modeling those using autoregressive Transformers. We show that the combined model at scale can generate high-fidelity and diverse songs with coherence up to multiple minutes. We can condition on artist and genre to steer the musical and vocal style, and on unaligned lyrics to make the singing more controllable. We are releasing thousands of non cherry-picked samples, along with model weights and code.
Authors: Prafulla Dhariwal, Heewoo Jun, Christine Payne, Jong Wook Kim, Alec Radford, Ilya Sutskever
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 | Alright, so what you're hearing is the open AI jukes box. This paper came out and it is a surprisingly good quality generative model for music, including lyrics, so including singing, which I believe is pretty novel, and the fact that it works so well and has musical consistency throughout entire songs is something that is very, very novel and cool. Alright, so we're looking at the paper, it's called jukes box a generative model for music, and it's by profola d'Arival, he wo june, Christine Pine, John Woo Kim, Alec Radford and Ilya Setskiver of Open AI. So the model here is not very novel, but I think the way they set it up makes a lot of sense and we'll quickly go through it and look at what comes out of this. This is not a very technical paper, but I think it's well written and their main thing is these VQ VIE models. So these models, if you know, you might know what a variational autoencoder is. So in a variational autoencoder, I have an input, let's say an image here of our typical cat and I put it through what is called an encoder. In order to get a hidden representation, now this hidden representation, usually called something like z or h is then in a in a classic autoencoder, I would here have a decoder and then I train that decoder to match that and that original picture as closely as possible. So I train these two neural networks, the encoder and the decoder to just basically compress to this representation and then reproduce again the original image. And thereby I think I can learn a good hidden representation. Now in a variational autoencoder, what happens is there is an in-between step, namely this z representation here is not directly fed to the decoder, but this representation is actually used to parameterize Gaussian's. So in the easiest case, we have, let's say we have six dimensions here in the hidden representation. The first two are used to parameterize the first Gaussian. One is going to be the mean and one is going to be the standard deviation of that Gaussian. And the second two are going to parameterize the second Gaussian and the third are going to parameterize the third one. So we have now three Gaussians and then from those three Gaussian distributions, we're going to sample a three dimensional vector. And then we're going to feed that three dimensional vector to the decoder. So every input image in essence is giving us a distribution in the latent space and not just a single vector. It's just is giving us a vector that describes an entire multi-variant Gaussian distribution. And then we train the decoder basically to reconstruct the encoder, given that distribution. So the variational autoencoder has improved over the classic autoencoder because it tends to circumvent some of the shortcomings, but still variational autoencoders have their problems. And in terms of generative model for images, people, as you know, have gone to things like GANS and so on. But here this new thing is called the VQ VAE. And that's a because I believe this stands for vector quantization, not entirely sure honestly. But so what it does is it takes the input right here and again, it maps it to a latent code and these latent code, I believe, are our here called age. So it maps it to a vector called age. Now here is where it gets different. We do have a so called code book here. So a code book is just a list of vectors. This is the code book and these are here called E. So what we'll do is we'll simply look for age, which one's the closest neighbor in the code book that we have of hidden vectors and we'll map it to that and say, ah, this is this here is the closest neighbor. So we'll basically quantize the hidden representation to these codes. So we're end up only with vectors that are these codes. And now instead of saving the vector age, first of all, we get a super compressed representation because if these are like 16, 16 code book vectors, we can just simply enumerate them. Right. And then we can simply encode the image as one or a sequence of these indices here. But second of all, it tends to bring a more kind of a diversity and accuracy if we then decode from these these code vectors. Now of course, everything is trained here. So the encoder is trained and the code books themselves are also trained and the decoder is also trained to give you the maximum kind of benefit. So this is what is described here. What they have is first of all, they're lost for these VQVA is and you'll see how they are using them to generate music in a second. Their loss is part this reconstruction loss, which you can see here. This is the original image. How far is it away from the decoded hidden quantized representation? This E here, this is the quantized code book vector that belongs to the hidden representation of X. So this is your standard reconstruction loss. The next part of the loss is this code book loss. Now the code book loss is for training these code book vectors. So it basically pulls the code book vector closer to the actual hidden representation. So that is where you train these. This here is a stop gradient. So basically just means that you want your code book vectors to be better representing of the data that you feed in because otherwise it would be useless code book vectors. And the third part of their loss is the this commit loss right here. And that is exactly the opposite. Now you put the stop gradient on the code book vector and you simply want to pull the hidden representation closer to the code book vector such that imagine the encoder must learn to approximately hit one of these code book vectors right otherwise it can it can not really learn something meaningfully it must learn to deal with the code book vectors that are there and to approximately map the input into the vicinity of one of the code book vectors. Otherwise there is no information flowing. So that is how you train things you train the encoder and the decoder to reconstruct you train the code book vectors to represent the data and you also train the encoder to make good use of the code book vectors. Honestly now that I think about it, I'm pretty sure in the reconstruction loss you might only train the decoder because you do have this quantization step in between in this in this thing here. So technically you could not back propagate through that. So that's how you train the individual parts of a VQ V A E and we'll see how they use it in order to produce music. So what they do is they start off with a sample of music and they send it through this thing through this architecture and at the end they are trying to reconstruct the same thing they had at the beginning. So you see this overarching auto encoder architecture that's why it's an auto encoder you try to reconstruct your input and thereby you try to learn something about the data because a model that can compress and then uncompress all of your data has learned something useful about it. Now you have these VQ V A E's here in the middle but you have them at different scales so you'll have three of those here. There is a course scale one middle scale one and a high frequency one right so three VQ V A E's right here. And you train each one of them separately and the difference between them is that the so because this is a continuous signal you cannot just encode a continuous signal because it's an audio waveform. So what you have to do is you have to go through it in some sort of a stepwise fashion you have to divide it into individual pieces and encode each of those pieces as one hidden vector or one element of the code book. So you have to divide the size here the precise size of how you go through the audio that is different between the V these different scales so in this scale right here you go through the audio in very small steps right. And this as you can imagine gives you the best reconstruction so this is the audio audio is like this right and you just take part of it like from here to here and you encode it into a single hidden vector which is this brown thing here. Then you take the next one the next slice and you encode it and that will give you this blue thing here then you run this sequence through the vector quantization step where each of those will be mapped so you have a code book here right you have your code book. And you look up the first one and you decide ah this probably goes here to this code vector so you put that code vector into the first place and take the second place and you might decide now that's this one so you put this one into the second place and the third one you might decide oh no that also is closest to the first code book vector so you again put the first code book vector into that slot. Now the that doesn't mean that it's the same music but of course the decoder now is going to look at the entire sequence and can decide I probably this isn't the exact same note as here but it might decide you know that the the chord played will repeat or something like this. So there's this vector quantization step and the code book look up sorry yeah this minimizes which which vector of the code book is closest and the code book look up I think we'll just replace then the the code the this vector with the actual code book things. And so there's this slight difference here so Z here as you can see is the argument K so the argument that is the actual number K which code book vector is the closest and then this E ZT will be the actual vectors so this here is actually what I described right here. But this is I think a detail and you you're going to do this at different scales now you can imagine that the bottom one is going to give you the best most faithful reconstruction when you decode it right but it is also going to learn about the kind of details in the music the short term details whereas this course grain one it can learn things about long range compositions it might not produce as correct of a reconstruction but it can learn long range dependencies such as the structure of a song or the structure of a verse or something like this. So these are independent of each other and they make an argument as to why so people have tried to kind of share these architectures but have found that mainly the models will will basically ignore the top two and only only go over the course grain ones so that's why they completely they separate these at this stage of training. So we have trained three different VIE's at three different scales of music to always reconstruct the input. What does that give us that gives us a distribution right here that gives us a way to take a piece of music and map it to this hidden space to this very compressed representation in this quantized world. I've said before this is a very compressed representation of your data. Why can you do that? What's that useful for? What you can do now is you can try to sample in that hidden space so instead of sampling music we have no clue of how to sample music unless we are given some music. What we can do is we can say maybe this thing here because it's compressed it kind of so if we just sample a waveform it's very unlikely that it's music and but if we sample these hidden things you know it's quite likely that if we feed it through the decoder something will come out and even better maybe our data set in this hidden space follows a kind of a simpler distribution one that we can use. So we're trying we're going to try to learn a prior distribution over the distribution of code book vectors and that is naturally going to be a joint distribution between the top middle and bottom VQ V A is and we can decompose this into the following thing simply by applying the standard probabilistic transfer algebra. Transfer algebra transformation and we can then they say when trained separate models sorry that we train separate models for the top level prior Z top the middle and the bottom so what that means is basically these are now neural networks. If you read something like this in a paper like this this is going to be a neural network that takes the right side as an input and produces the left side right so you start out with this one this is a neural network that simply takes as an input sorry I'm going to draw this neural network takes as an input maybe something like a Gaussian super prior right. You sample from that and that will as an output give you this Z top then the next neural network will take this as an input and will give you Z middle as an output and then the final neural network will input the two of those and give you Z top and you can train these neural networks simply by kind of training a prior to produce this thing right. You can simply use your data compress it to the hidden space and then train an neural network to produce that distribution and you can do this in any number of ways you can use classic V A's you can use your formulas with sparse attention as they are currently state of the art in autoregressive modeling and they say we propose a simplified version which we call the scalable transformer that is easier to implement and scale right but they see you see they model this distribution with these scalable transformers. So now what do we have we have a way to sample these hidden vectors right so we don't need we don't need this part anymore this part sorry about this part here was just used for training. Now have our transformers they take nothing as an input or they take like a Gaussian as an input and they can directly output this hidden representation so we can technically sample from that and then just push it through this decoder of the VQVA but the question is which of the three do we take and wouldn't it be great if we can combine them because if we simply sample these this higher scale one we just get not very long range dependencies right because that's what the VQVA learned if we just sample this one then we just get a course music and we can sample all three but they will just give us three different tracks of music. So we want to combine the three decoders into one somehow and that's we do this through these up samplers so what will use what will target actually is this bottom one we target this one because this one gives us the best quality music right because it was trained with the shortest time scale we're going to try to take the other signals and influence it. So we'll start with the top level prior right that will produce us these transformers will give us a sequence a sequence of tokens in the hidden space that is very course as you can see here and then we'll feed that into a up sampler and these up samplers again are on the neural networks that can connect the different scales through with each other right so you can connect this to this it's basically like conditioning the model that produces this sequence on this sequence right here and again we use an up sampler to up sample this to the finest scale and that we feed in the bottom scale and then we get our music now throughout all of this that you have conditioning information here which is a bit of an addition to the model so the conditioning information can be things like artist genre and timing and this is seems appears to be pretty important because you kind of want first of all want some variety and then second of all use sort of want to control what music is produced and you don't just want to train this model for one single art single artist because you have much more data across all of music so this conditioning information is just included here via another neural network and you can find all the architectures for all of these models in the paper it's not particularly important I believe how exactly you include them but the fact that you do the last thing is what they do is they do this kind of windowed sampling so in order to produce music you are going to have to produce these slices of music right here but you sort of have a maximum length here that your models can handle and this is usually not the length of a song you may know transformers and so on they have usually have token limits of like 512 tokens in terms of audio that's not that much so what you do is this windowed sampling where you sample something and then you condition basically on the first part and then you just sample the next thing and then you again condition on the first part and then you just sample the next thing the next few ones and that guarantees that each of the sampling steps is basically conditioned on what comes before as you see up here so you would always sort of condition on a part produce the next part all right and they say you can also basically condition on so you can feed in you don't have to sample the very first one you can also feed in an existing song in order to prime the system so what you can do is if you have a beginning of a song then you can let the system finish the song by simply taking the song running it through the encoder that we produce during training right you get these hidden representation so you don't actually have to sample them from your prior and then you run this generation process as if this came out of your prior instead of what you sampled okay so let's have a look at how that sounds or a listen this this is an explorer they release many many samples from this and the part here where we're going to listen is called no lyrics conditioning so as you can hear this is already pretty good music and the genre is American folk the singer is Peter Seeger sorry Pete Seeger this already sounds very authentic but you can hear that the lyrics are just kind of mumbly right and that's because the model is basically asked to come up with lyrics from as pure audio waveforms and that results in some subpar lyrics basically it just produces phonemes that sound like the singer it doesn't produce entire words and of course it also doesn't produce sentences that make any sort of sense and that's why they're building in an additional thing to do lyrics conditioning so with lyrics conditioning the idea is that in the conditioning information you also add lyrics so here is plus text so you add text and then the model is basically can also look at the text now you never you still you still so even before we had music with lyrics and the decoder was always asked to reconstruct that and so none of that changes and that's why it has learned to produce phonemes right but now the decoder can also and also the encoder the system can look at the lyrics that you provide right here in order to help with its decoding so technically it could learn to bypass the encoding of the exact way the lyrics are uttered and it could just look at the text that you provide now this of course requires that during training you provide the lyrics of the song that are actually that you feed in but also it means that during decoding if you sample you can then provide your own lyrics and look what happens so they say they provide lyrics they always have to provide lyrics for chunks of audio so our data set includes song level lyrics but to make it easier we train on shorter 24 second chunks of audio and this is partly to make it easier for the model but also partly because those appear to be the limitations of these systems right if you have transformers in there and whatnot 24 seconds of raw audio waveform is lot so they have this problem of they have this problem of they have a song from here to here and they have the lyrics blah blah blah and they need to know which lyrics belong to which part of the song and usually it's monotonic right in linear because you get the lyrics from some lyrics website but you don't know particularly to which 24 second chunk they belong so they say first of all they started with simply linearly aligning the lyrics but then they had some they had some problems with fast songs so they had some heuristic here but ultimately the decoder needs to learn to attend to these lyrics and these the graphics like this you see here is the music to composition and lyrics to composition so here you see the system learns that for example if it has this music token it needs to attend to this token in the lyric so you can by inspecting these attention heads that you have on the lyrics text in the system you can see which lyrics the model is paying attention to and the fact that it learns to pay linearly attention to these things is kind of a confirmation because you don't you give the whole text or at least the 24 second chunks of audio you give that at once as a as a text and the fact that it learns to linearly attend to the tokens is a confirmation that it actually includes that information into decoding and that is a pretty gives you pretty much better results so we can maybe go to classic pop it's Christmas time when you know what that way oh the touch of time as I like the tree to shield you'll be so this are unseen lyrics so the model has never seen these lyrics right it's it was just asked to produce classic pop in the style of Frank Sinatra with these lyrics and that's what it came up with that is pretty pretty pretty cool I think they also have re-renditions where they basically feed I believe feed in the original lyrics with condition on lyrics scene during training and they have fun songs and in the fun songs I like the hip hop in the style of Kanye West where they provide the lyrics of M&M's lose yourself look because you had one shot over an opportunity to seize every thing you ever wanted in one moment with two shots shielding the kids that is spending yeah he's not a sad but soon up strong maybe you thought wrong I'm groovin I know what you're thinking but this is cool and they can also as we said to do these completions where they start with part of a song and just I have to do this I have to do this hi there so the first version of this video was copy striked because what you would hear would be the original never gonna give you up like 10 seconds of it and then followed by what the model continues with so as a substitute you're not going to have to listen to me I hope that suffices you know the rules and so you are I'm focused on that almost as good almost as good as the original so as you can see this the results here are pretty pretty cool and I want to show you one last thing and that is this Christmas song in the style of Frank Sinatra I believe it's this one right here and the special thing here is it's again classic pop in the style of Frank Sinatra and you see on the bottom here you see on the bottom which of the lyrics it's attending to and you see you know this this graph right here that shows you that first it's attending linearly through the lyrics but then it kind of jumps around and attends two different things because it doesn't it doesn't it doesn't just continue so it's pop some time some rather the lyrics being a see where oh that's more of a battle time and this is great so it it kind of falls out of this linearly attending to the lyrics and probably because there was sort of a pause in the lyrics and maybe this is just more than one audio window so it doesn't have this auto regressive property anymore and then it doesn't find the proper place to attend anymore and so just again comes up with sort of really cool but it sounds pretty pretty cool yeah so this they have released many many samples here some cherry picked and just a lot of samples with unseen lyrics re-renditions and so on this all is very cool so they're training set up described I believe they also release their code many more results in the paper of how to make this thing work if you want to do that yourself and with that I invite you to read the paper if you're still here please subscribe if you like this content leave a comment and bye bye I'm gonna sing my I'm gonna run around and hurt you | [{"start": 0.0, "end": 25.36, "text": " Alright, so what you're hearing is the open AI jukes box."}, {"start": 25.36, "end": 50.36, "text": " This paper came out and it is a surprisingly good quality generative model for music, including lyrics, so including singing, which I believe is pretty novel, and the fact that it works so well and has musical consistency throughout entire songs is something that is very, very novel and cool."}, {"start": 50.36, "end": 68.36, "text": " Alright, so we're looking at the paper, it's called jukes box a generative model for music, and it's by profola d'Arival, he wo june, Christine Pine, John Woo Kim, Alec Radford and Ilya Setskiver of Open AI."}, {"start": 68.36, "end": 84.36, "text": " So the model here is not very novel, but I think the way they set it up makes a lot of sense and we'll quickly go through it and look at what comes out of this."}, {"start": 84.36, "end": 96.36, "text": " This is not a very technical paper, but I think it's well written and their main thing is these VQ VIE models."}, {"start": 96.36, "end": 101.36, "text": " So these models, if you know, you might know what a variational autoencoder is."}, {"start": 101.36, "end": 112.36, "text": " So in a variational autoencoder, I have an input, let's say an image here of our typical cat and I put it through what is called an encoder."}, {"start": 112.36, "end": 136.36, "text": " In order to get a hidden representation, now this hidden representation, usually called something like z or h is then in a in a classic autoencoder, I would here have a decoder and then I train that decoder to match that and that original picture as closely as possible."}, {"start": 136.36, "end": 148.36, "text": " So I train these two neural networks, the encoder and the decoder to just basically compress to this representation and then reproduce again the original image."}, {"start": 148.36, "end": 152.36, "text": " And thereby I think I can learn a good hidden representation."}, {"start": 152.36, "end": 170.36, "text": " Now in a variational autoencoder, what happens is there is an in-between step, namely this z representation here is not directly fed to the decoder, but this representation is actually used to parameterize Gaussian's."}, {"start": 170.36, "end": 182.36, "text": " So in the easiest case, we have, let's say we have six dimensions here in the hidden representation. The first two are used to parameterize the first Gaussian."}, {"start": 182.36, "end": 188.36, "text": " One is going to be the mean and one is going to be the standard deviation of that Gaussian."}, {"start": 188.36, "end": 205.36, "text": " And the second two are going to parameterize the second Gaussian and the third are going to parameterize the third one. So we have now three Gaussians and then from those three Gaussian distributions, we're going to sample a three dimensional vector."}, {"start": 205.36, "end": 224.36, "text": " And then we're going to feed that three dimensional vector to the decoder. So every input image in essence is giving us a distribution in the latent space and not just a single vector. It's just is giving us a vector that describes an entire multi-variant Gaussian distribution."}, {"start": 224.36, "end": 246.36, "text": " And then we train the decoder basically to reconstruct the encoder, given that distribution. So the variational autoencoder has improved over the classic autoencoder because it tends to circumvent some of the shortcomings, but still variational autoencoders have their problems."}, {"start": 246.36, "end": 266.36, "text": " And in terms of generative model for images, people, as you know, have gone to things like GANS and so on. But here this new thing is called the VQ VAE. And that's a because I believe this stands for vector quantization, not entirely sure honestly."}, {"start": 266.36, "end": 280.36, "text": " But so what it does is it takes the input right here and again, it maps it to a latent code and these latent code, I believe, are our here called age."}, {"start": 280.36, "end": 291.36, "text": " So it maps it to a vector called age. Now here is where it gets different. We do have a so called code book here."}, {"start": 291.36, "end": 298.36, "text": " So a code book is just a list of vectors. This is the code book and these are here called E."}, {"start": 298.36, "end": 311.36, "text": " So what we'll do is we'll simply look for age, which one's the closest neighbor in the code book that we have of hidden vectors and we'll map it to that and say, ah, this is this here is the closest neighbor."}, {"start": 311.36, "end": 322.36, "text": " So we'll basically quantize the hidden representation to these codes. So we're end up only with vectors that are these codes."}, {"start": 322.36, "end": 334.36, "text": " And now instead of saving the vector age, first of all, we get a super compressed representation because if these are like 16, 16 code book vectors, we can just simply enumerate them."}, {"start": 334.36, "end": 342.36, "text": " Right. And then we can simply encode the image as one or a sequence of these indices here."}, {"start": 342.36, "end": 354.36, "text": " But second of all, it tends to bring a more kind of a diversity and accuracy if we then decode from these these code vectors."}, {"start": 354.36, "end": 368.36, "text": " Now of course, everything is trained here. So the encoder is trained and the code books themselves are also trained and the decoder is also trained to give you the maximum kind of benefit."}, {"start": 368.36, "end": 380.36, "text": " So this is what is described here. What they have is first of all, they're lost for these VQVA is and you'll see how they are using them to generate music in a second."}, {"start": 380.36, "end": 389.36, "text": " Their loss is part this reconstruction loss, which you can see here. This is the original image."}, {"start": 389.36, "end": 402.36, "text": " How far is it away from the decoded hidden quantized representation? This E here, this is the quantized code book vector that belongs to the hidden representation of X."}, {"start": 402.36, "end": 414.36, "text": " So this is your standard reconstruction loss. The next part of the loss is this code book loss. Now the code book loss is for training these code book vectors."}, {"start": 414.36, "end": 426.36, "text": " So it basically pulls the code book vector closer to the actual hidden representation. So that is where you train these. This here is a stop gradient."}, {"start": 426.36, "end": 437.36, "text": " So basically just means that you want your code book vectors to be better representing of the data that you feed in because otherwise it would be useless code book vectors."}, {"start": 437.36, "end": 454.36, "text": " And the third part of their loss is the this commit loss right here. And that is exactly the opposite. Now you put the stop gradient on the code book vector and you simply want to pull the hidden representation closer to the code book vector such that"}, {"start": 454.36, "end": 477.36, "text": " imagine the encoder must learn to approximately hit one of these code book vectors right otherwise it can it can not really learn something meaningfully it must learn to deal with the code book vectors that are there and to approximately map the input into the vicinity of one of the code book vectors."}, {"start": 477.36, "end": 498.36, "text": " Otherwise there is no information flowing. So that is how you train things you train the encoder and the decoder to reconstruct you train the code book vectors to represent the data and you also train the encoder to make good use of the code book vectors."}, {"start": 498.36, "end": 518.36, "text": " Honestly now that I think about it, I'm pretty sure in the reconstruction loss you might only train the decoder because you do have this quantization step in between in this in this thing here. So technically you could not back propagate through that."}, {"start": 518.36, "end": 528.36, "text": " So that's how you train the individual parts of a VQ V A E and we'll see how they use it in order to produce music."}, {"start": 528.36, "end": 546.36, "text": " So what they do is they start off with a sample of music and they send it through this thing through this architecture and at the end they are trying to reconstruct the same thing they had at the beginning."}, {"start": 546.36, "end": 565.36, "text": " So you see this overarching auto encoder architecture that's why it's an auto encoder you try to reconstruct your input and thereby you try to learn something about the data because a model that can compress and then uncompress all of your data has learned something useful about it."}, {"start": 565.36, "end": 585.36, "text": " Now you have these VQ V A E's here in the middle but you have them at different scales so you'll have three of those here. There is a course scale one middle scale one and a high frequency one right so three VQ V A E's right here."}, {"start": 585.36, "end": 602.36, "text": " And you train each one of them separately and the difference between them is that the so because this is a continuous signal you cannot just encode a continuous signal because it's an audio waveform."}, {"start": 602.36, "end": 620.36, "text": " So what you have to do is you have to go through it in some sort of a stepwise fashion you have to divide it into individual pieces and encode each of those pieces as one hidden vector or one element of the code book."}, {"start": 620.36, "end": 637.36, "text": " So you have to divide the size here the precise size of how you go through the audio that is different between the V these different scales so in this scale right here you go through the audio in very small steps right."}, {"start": 637.36, "end": 651.36, "text": " And this as you can imagine gives you the best reconstruction so this is the audio audio is like this right and you just take part of it like from here to here and you encode it into a single hidden vector which is this brown thing here."}, {"start": 651.36, "end": 668.36, "text": " Then you take the next one the next slice and you encode it and that will give you this blue thing here then you run this sequence through the vector quantization step where each of those will be mapped so you have a code book here right you have your code book."}, {"start": 668.36, "end": 694.36, "text": " And you look up the first one and you decide ah this probably goes here to this code vector so you put that code vector into the first place and take the second place and you might decide now that's this one so you put this one into the second place and the third one you might decide oh no that also is closest to the first code book vector so you again put the first code book vector into that slot."}, {"start": 694.36, "end": 715.36, "text": " Now the that doesn't mean that it's the same music but of course the decoder now is going to look at the entire sequence and can decide I probably this isn't the exact same note as here but it might decide you know that the the chord played will repeat or something like this."}, {"start": 715.36, "end": 738.36, "text": " So there's this vector quantization step and the code book look up sorry yeah this minimizes which which vector of the code book is closest and the code book look up I think we'll just replace then the the code the this vector with the actual code book things."}, {"start": 738.36, "end": 761.36, "text": " And so there's this slight difference here so Z here as you can see is the argument K so the argument that is the actual number K which code book vector is the closest and then this E ZT will be the actual vectors so this here is actually what I described right here."}, {"start": 761.36, "end": 782.36, "text": " But this is I think a detail and you you're going to do this at different scales now you can imagine that the bottom one is going to give you the best most faithful reconstruction when you decode it right but it is also going to learn about the kind of details in the music the short term details"}, {"start": 782.36, "end": 801.36, "text": " whereas this course grain one it can learn things about long range compositions it might not produce as correct of a reconstruction but it can learn long range dependencies such as the structure of a song or the structure of a verse or something like this."}, {"start": 801.36, "end": 824.36, "text": " So these are independent of each other and they make an argument as to why so people have tried to kind of share these architectures but have found that mainly the models will will basically ignore the top two and only only go over the course grain ones so that's why they completely they separate these at this stage of training."}, {"start": 824.36, "end": 832.36, "text": " So we have trained three different VIE's at three different scales of music to always reconstruct the input."}, {"start": 832.36, "end": 853.36, "text": " What does that give us that gives us a distribution right here that gives us a way to take a piece of music and map it to this hidden space to this very compressed representation in this quantized world."}, {"start": 853.36, "end": 859.36, "text": " I've said before this is a very compressed representation of your data."}, {"start": 859.36, "end": 873.36, "text": " Why can you do that? What's that useful for? What you can do now is you can try to sample in that hidden space so instead of sampling music we have no clue of how to sample music unless we are given some music."}, {"start": 873.36, "end": 902.36, "text": " What we can do is we can say maybe this thing here because it's compressed it kind of so if we just sample a waveform it's very unlikely that it's music and but if we sample these hidden things you know it's quite likely that if we feed it through the decoder something will come out and even better maybe our data set in this hidden space follows a kind of a simpler distribution one that we can use."}, {"start": 902.36, "end": 931.36, "text": " So we're trying we're going to try to learn a prior distribution over the distribution of code book vectors and that is naturally going to be a joint distribution between the top middle and bottom VQ V A is and we can decompose this into the following thing simply by applying the standard probabilistic transfer algebra."}, {"start": 931.36, "end": 951.36, "text": " Transfer algebra transformation and we can then they say when trained separate models sorry that we train separate models for the top level prior Z top the middle and the bottom so what that means is basically these are now neural networks."}, {"start": 951.36, "end": 980.36, "text": " If you read something like this in a paper like this this is going to be a neural network that takes the right side as an input and produces the left side right so you start out with this one this is a neural network that simply takes as an input sorry I'm going to draw this neural network takes as an input maybe something like a Gaussian super prior right."}, {"start": 980.36, "end": 1009.36, "text": " You sample from that and that will as an output give you this Z top then the next neural network will take this as an input and will give you Z middle as an output and then the final neural network will input the two of those and give you Z top and you can train these neural networks simply by kind of training a prior to produce this thing right."}, {"start": 1009.36, "end": 1037.3600000000001, "text": " You can simply use your data compress it to the hidden space and then train an neural network to produce that distribution and you can do this in any number of ways you can use classic V A's you can use"}, {"start": 1037.36, "end": 1059.36, "text": " your formulas with sparse attention as they are currently state of the art in autoregressive modeling and they say we propose a simplified version which we call the scalable transformer that is easier to implement and scale right but they see you see they model this distribution with these scalable transformers."}, {"start": 1059.36, "end": 1079.36, "text": " So now what do we have we have a way to sample these hidden vectors right so we don't need we don't need this part anymore this part sorry about this part here was just used for training."}, {"start": 1079.36, "end": 1107.36, "text": " Now have our transformers they take nothing as an input or they take like a Gaussian as an input and they can directly output this hidden representation so we can technically sample from that and then just push it through this decoder of the VQVA but the question is which of the three do we take and wouldn't it be great if we can combine them because if we simply sample"}, {"start": 1107.36, "end": 1125.36, "text": " these this higher scale one we just get not very long range dependencies right because that's what the VQVA learned if we just sample this one then we just get a course music and we can sample all three but they will just give us three different tracks of music."}, {"start": 1125.36, "end": 1143.36, "text": " So we want to combine the three decoders into one somehow and that's we do this through these up samplers so what will use what will target actually is this bottom one we target this one because"}, {"start": 1143.36, "end": 1154.36, "text": " this one gives us the best quality music right because it was trained with the shortest time scale we're going to try to take the other signals and influence it."}, {"start": 1154.36, "end": 1183.36, "text": " So we'll start with the top level prior right that will produce us these transformers will give us a sequence a sequence of tokens in the hidden space that is very course as you can see here and then we'll feed that into a up sampler and these up samplers again are on the neural networks that can connect the different scales"}, {"start": 1183.36, "end": 1212.36, "text": " through with each other right so you can connect this to this it's basically like conditioning the model that produces this sequence on this sequence right here and again we use an up sampler to up sample this to the finest scale and that we feed in the bottom scale and then we get our music now throughout all of this that you have conditioning information here which is a bit of an addition"}, {"start": 1212.36, "end": 1241.36, "text": " to the model so the conditioning information can be things like artist genre and timing and this is seems appears to be pretty important because you kind of want first of all want some variety and then second of all use sort of want to control what music is produced and you don't just want to train this model for one single art"}, {"start": 1241.36, "end": 1258.36, "text": " single artist because you have much more data across all of music so this conditioning information is just included here via another neural network and you can find all the architectures for all of these models in the paper"}, {"start": 1258.36, "end": 1268.36, "text": " it's not particularly important I believe how exactly you include them but the fact that you do"}, {"start": 1268.36, "end": 1278.36, "text": " the last thing is what they do is they do this kind of windowed sampling so in order to produce music you are going to have to produce these"}, {"start": 1278.36, "end": 1298.36, "text": " slices of music right here but you sort of have a maximum length here that your models can handle and this is usually not the length of a song you may know transformers and so on they have usually have token limits of like 512 tokens in terms of audio"}, {"start": 1298.36, "end": 1316.36, "text": " that's not that much so what you do is this windowed sampling where you sample something and then you condition basically on the first part and then you just sample the next thing and then you again condition on the first part and then you just sample the next thing"}, {"start": 1316.36, "end": 1334.36, "text": " the next few ones and that guarantees that each of the sampling steps is basically conditioned on what comes before as you see up here so you would always sort of condition on a part produce the next part"}, {"start": 1334.36, "end": 1357.36, "text": " all right and they say you can also basically condition on so you can feed in you don't have to sample the very first one you can also feed in an existing song in order to prime the system so what you can do is if you have a beginning of a song then you can let the system finish the song by simply taking the song"}, {"start": 1357.36, "end": 1374.36, "text": " running it through the encoder that we produce during training right you get these hidden representation so you don't actually have to sample them from your prior and then you run this generation process as if this came out of your prior instead of what you sampled"}, {"start": 1374.36, "end": 1392.36, "text": " okay so let's have a look at how that sounds or a listen this this is an explorer they release many many samples from this and the part here where we're going to listen is called no lyrics conditioning"}, {"start": 1392.36, "end": 1417.36, "text": " so as you can hear this is already pretty good music and the genre is American folk the singer is Peter Seeger sorry Pete Seeger"}, {"start": 1417.36, "end": 1444.36, "text": " this already sounds very authentic but you can hear that the lyrics are just kind of mumbly right and that's because the model is basically asked to come up with lyrics from as pure audio waveforms and that results in some subpar lyrics basically it just produces phonemes that sound like the singer it doesn't produce entire words"}, {"start": 1444.36, "end": 1465.36, "text": " and of course it also doesn't produce sentences that make any sort of sense and that's why they're building in an additional thing to do lyrics conditioning so with lyrics conditioning the idea is that in the conditioning information you also add lyrics so here is plus text"}, {"start": 1465.36, "end": 1488.36, "text": " so you add text and then the model is basically can also look at the text now you never you still you still so even before we had music with lyrics and the decoder was always asked to reconstruct that and so none of that changes"}, {"start": 1488.36, "end": 1504.36, "text": " and that's why it has learned to produce phonemes right but now the decoder can also and also the encoder the system can look at the lyrics that you provide right here in order to help with its decoding"}, {"start": 1504.36, "end": 1533.36, "text": " so technically it could learn to bypass the encoding of the exact way the lyrics are uttered and it could just look at the text that you provide now this of course requires that during training you provide the lyrics of the song that are actually that you feed in but also it means that during decoding if you sample you can then provide your own lyrics and look what happens"}, {"start": 1533.36, "end": 1561.36, "text": " so they say they provide lyrics they always have to provide lyrics for chunks of audio so our data set includes song level lyrics but to make it easier we train on shorter 24 second chunks of audio and this is partly to make it easier for the model but also partly because those appear to be the limitations of these systems right if you have transformers in there and whatnot"}, {"start": 1561.36, "end": 1578.36, "text": " 24 seconds of raw audio waveform is lot so they have this problem of they have this problem of they have a song from here to here and they have the lyrics blah blah blah"}, {"start": 1578.36, "end": 1595.36, "text": " and they need to know which lyrics belong to which part of the song and usually it's monotonic right in linear because you get the lyrics from some lyrics website but you don't know particularly to which 24 second chunk they belong"}, {"start": 1595.36, "end": 1621.36, "text": " so they say first of all they started with simply linearly aligning the lyrics but then they had some they had some problems with fast songs so they had some heuristic here but ultimately the decoder needs to learn to attend to these lyrics and these the graphics like this you see here is the music to composition and lyrics to composition"}, {"start": 1621.36, "end": 1639.36, "text": " so here you see the system learns that for example if it has this music token it needs to attend to this token in the lyric so you can by inspecting these attention heads that you have on the lyrics text in the system"}, {"start": 1639.36, "end": 1659.36, "text": " you can see which lyrics the model is paying attention to and the fact that it learns to pay linearly attention to these things is kind of a confirmation because you don't you give the whole text or at least the 24 second chunks of audio you give that at once as a as a text"}, {"start": 1659.36, "end": 1683.36, "text": " and the fact that it learns to linearly attend to the tokens is a confirmation that it actually includes that information into decoding and that is a pretty gives you pretty much better results so we can maybe go to classic pop"}, {"start": 1689.36, "end": 1703.36, "text": " it's Christmas time when you know what that way"}, {"start": 1703.36, "end": 1731.36, "text": " oh the touch of time as I like the tree to shield you'll be so this are unseen lyrics so the model has never seen these lyrics right it's it was just asked to produce classic pop in the style of Frank Sinatra with these lyrics and that's what it came up with that is pretty pretty pretty cool I think they also have"}, {"start": 1731.36, "end": 1759.36, "text": " re-renditions where they basically feed I believe feed in the original lyrics with condition on lyrics scene during training and they have fun songs and in the fun songs I like the hip hop in the style of Kanye West where they provide the lyrics of M&M's lose yourself"}, {"start": 1759.36, "end": 1775.36, "text": " look because you had one shot over an opportunity to seize every thing you ever wanted in one moment with two shots shielding the kids that is spending"}, {"start": 1775.36, "end": 1792.36, "text": " yeah he's not a sad but soon up strong maybe you thought wrong I'm groovin I know what you're thinking but this is cool and they can also as we said to do these completions where they start with part of a song and just I have to do this I have to do this"}, {"start": 1792.36, "end": 1810.36, "text": " hi there so the first version of this video was copy striked because what you would hear would be the original never gonna give you up like 10 seconds of it and then followed by what the model continues with so as a substitute you're not going to have to listen to me I hope that suffices"}, {"start": 1822.36, "end": 1829.36, "text": " you know the rules and so you are I'm focused on that"}, {"start": 1852.36, "end": 1874.36, "text": " almost as good almost as good as the original so as you can see this the results here are pretty pretty cool and I want to show you one last thing and that is this Christmas song in the style of Frank Sinatra I believe it's this one right here"}, {"start": 1874.36, "end": 1892.36, "text": " and the special thing here is it's again classic pop in the style of Frank Sinatra and you see on the bottom here you see on the bottom which of the lyrics it's attending to and you see you know this this graph right here that shows you that first it's attending"}, {"start": 1892.36, "end": 1910.36, "text": " linearly through the lyrics but then it kind of jumps around and attends two different things because it doesn't it doesn't it doesn't just continue so"}, {"start": 1922.36, "end": 1951.36, "text": " it's pop some time some rather the lyrics being a see where oh that's more of a battle time and this is great so it it kind of falls out of this linearly attending to the lyrics and probably because there was sort of a pause in the"}, {"start": 1951.36, "end": 1969.36, "text": " lyrics and maybe this is just more than one audio window so it doesn't have this auto regressive property anymore and then it doesn't find the proper place to attend anymore and so just again comes up with sort of"}, {"start": 1969.36, "end": 1987.36, "text": " really cool but it sounds pretty pretty cool yeah so this they have released many many samples here some cherry picked and just a lot of samples with unseen lyrics re-renditions and so on this all is very cool"}, {"start": 1987.36, "end": 2007.36, "text": " so they're training set up described I believe they also release their code many more results in the paper of how to make this thing work if you want to do that yourself and with that I invite you to read the paper if you're still here please subscribe if you like this content leave a comment and bye bye"}, {"start": 2017.36, "end": 2023.36, "text": " I'm gonna sing my I'm gonna run around and hurt you"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=RrBapqCPnmE | [ML Coding Tips] Separate Computation & Plotting using locals | Here's a lazy way to separate computation and subsequent analysis in a notebook without the overhead of manually saving local variables.
WARNING: Don't do this in a serious project.
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. So today I just wanted to bring you a quick coding tip that I often encounter in my daily machine learning researcher life that might not be super common in let's say traditional software engineering or elsewhere. So often I have a bunch of let's say I have a bunch of models right and I use these ipython notebooks or collapse to analyze my data plot things and so on. So I have a bunch of models let's say they're called M1 and M2 and I usually run my big jobs on a cluster. So let's say I have run some jobs for one for each model and have some logs that I want to analyze. So I'll go through my models and I hear I you know load a bunch of logs and I'll also compute some stuff some statistics and some just things right that I want to have computed and maybe these things are called a and let's this and B right. So now I've computed these things now I want to analyze them and let's let's short cut and say printing is plotting. So think of these this might be numbers right and now I want to plot them here out that just print them which I do this now every time I want to you know change something here in my printing maybe I want the separator to be that I'll have to load all the logs and compute all the stuff right each time I run this cell which is not super cool right so I usually would like to factor out the plotting and and stuff like this from the computation. So I could extract one of them into like a function but then the point of these notebooks is that I can run each of the cells and they'll run right there right so functions aren't really cool in these notebooks. So what I'll usually end up doing is you'll have some second loop in here right and let's see you'll have some data. Dict up here and you'll hear at the end you'll say something like data for this model is a and and B or something like this right and then down here the first thing I do is I'll get my data and then I'll unpack again so D a D B either I'll unpack or I'll just address them in dictionary notation like this and then I can do my plotting right some people use two pulls here right they just go A and B but then you'll have to do this unpacking the problem is now if I want to add something here right right compute something new I need to add something here right I need to remember to store it in the data array and then I need to hear remember to unpack it in the same order right and then I need to produce to put it in in the plotting right so this this is very cumbersome this line here and this line here they're very because you kind of duplicate your variable names all over the place just because you want to compute them here and use them here software engineer would usually tell you let's do something like a data class or or or in its most simplest form is say of a class and you know there are multiple ways of achieving this but let's just do A and B here this is probably the most verbose you can also do name two pulls at our classes data classes and so on but ultimately you produce a class like this and then here you say this is a data class A and B and then here down here you can at least address them like this right and and you don't have to do the dictionary notation or remember the remember the the order but now again if you want to add the C now you know not only do you have to add it here but you have to add it up here and you have to add it here and be aware of there's a doc string and then you can use it here right this is just I did two cumbersome so here is a trick and please only use these in like notebooks like this this will lead to so much memory problems and everything and if you work with the software engineer you have to get them chocolate for doing this but but all right so what you can do is you can save your local variables in the in this dictionary right so this is a built in that saves the local variables sorry that gives you a dict of the local variables the local variables here are ABC and all a bunch of other things right it's not clear in these ipythin notebooks they have a bunch of stuff around them such that the meaning is slightly different depending where local is but in essence you'll get the A B and C what you want now the locals dict refers in order for this to go through the local state refers of course the same objects not newly constructed so we're safe here to make a copy of that right like this and then down here we simply retrieve these local variables and update the current local variables using the local variables we stored and voila we can use A B and C without ever having to find them right if this doesn't work that means that the locals here are is is a copy basically and this is a Python optimization and I read I don't have to use it because in these ipythin notebooks it appears to work but you might want to have an empty exec statement here such that the Python interpreter can never be sure which variables are created in here and therefore can't optimize away so that that is a horrible horrible trick again don't build anything serious upon this but it is very duper super easy you can just add any variable here and then use it down here so easy right and so wrong all right this was it I hope you enjoyed this I want to bring these kind of tips every now and then as an as an intermix into the research papers I hope you enjoyed this bye bye | [{"start": 0.0, "end": 16.0, "text": " Hi there. So today I just wanted to bring you a quick coding tip that I often encounter in my daily machine learning researcher life that might not be super common in let's say traditional software engineering or elsewhere."}, {"start": 16.0, "end": 26.0, "text": " So often I have a bunch of let's say I have a bunch of models right and I use these ipython notebooks or collapse to analyze my data plot things and so on."}, {"start": 26.0, "end": 34.0, "text": " So I have a bunch of models let's say they're called M1 and M2 and I usually run my big jobs on a cluster."}, {"start": 34.0, "end": 61.0, "text": " So let's say I have run some jobs for one for each model and have some logs that I want to analyze. So I'll go through my models and I hear I you know load a bunch of logs and I'll also compute some stuff some statistics and some just things right that I want to have computed and maybe these things are called a and let's"}, {"start": 61.0, "end": 90.0, "text": " this and B right. So now I've computed these things now I want to analyze them and let's let's short cut and say printing is plotting. So think of these this might be numbers right and now I want to plot them here out that just print them which I do this now every time I want to you know change something here in my printing maybe I want the separator to be that I'll have to load"}, {"start": 90.0, "end": 102.0, "text": " all the logs and compute all the stuff right each time I run this cell which is not super cool right so I usually would like to factor out the plotting and and stuff like this from the computation."}, {"start": 102.0, "end": 115.0, "text": " So I could extract one of them into like a function but then the point of these notebooks is that I can run each of the cells and they'll run right there right so functions aren't really cool in these notebooks."}, {"start": 115.0, "end": 125.0, "text": " So what I'll usually end up doing is you'll have some second loop in here right and let's see you'll have some data."}, {"start": 125.0, "end": 153.0, "text": " Dict up here and you'll hear at the end you'll say something like data for this model is a and and B or something like this right and then down here the first thing I do is I'll get my data and then I'll unpack again so D a D B either I'll unpack or I'll just"}, {"start": 153.0, "end": 172.0, "text": " address them in dictionary notation like this and then I can do my plotting right some people use two pulls here right they just go A and B but then you'll have to do this unpacking the problem is now if I want to add something here right right compute something new I"}, {"start": 172.0, "end": 185.0, "text": " need to add something here right I need to remember to store it in the data array and then I need to hear remember to unpack it in the same order right and then I need to produce to put it in in the"}, {"start": 185.0, "end": 197.0, "text": " plotting right so this this is very cumbersome this line here and this line here they're very because you kind of duplicate your variable names all over the place just because"}, {"start": 197.0, "end": 215.0, "text": " you want to compute them here and use them here software engineer would usually tell you let's do something like a data class or or or in its most simplest form is say of a class and you know there are multiple"}, {"start": 215.0, "end": 235.0, "text": " ways of achieving this but let's just do A and B here this is probably the most verbose you can also do name two pulls at our classes data classes and so on but ultimately you produce a class like this and then here you say this is a data class A and B"}, {"start": 235.0, "end": 254.0, "text": " and then here down here you can at least address them like this right and and you don't have to do the dictionary notation or remember the remember the the order but now again if you want to add the C"}, {"start": 254.0, "end": 270.0, "text": " now you know not only do you have to add it here but you have to add it up here and you have to add it here and be aware of there's a doc string and then you can use it here right this is just I"}, {"start": 270.0, "end": 282.0, "text": " did two cumbersome so here is a trick and please only use these in like notebooks like this this will lead to so much memory problems and everything and if you work with the software engineer you"}, {"start": 282.0, "end": 298.0, "text": " have to get them chocolate for doing this but but all right so what you can do is you can save your local variables in the in this dictionary right so this is a built in"}, {"start": 298.0, "end": 310.0, "text": " that saves the local variables sorry that gives you a dict of the local variables the local variables here are ABC and all a bunch of other things right"}, {"start": 310.0, "end": 320.0, "text": " it's not clear in these ipythin notebooks they have a bunch of stuff around them such that the meaning is slightly different depending where local is but in essence you'll get the A"}, {"start": 320.0, "end": 338.0, "text": " B and C what you want now the locals dict refers in order for this to go through the local state refers of course the same objects not newly constructed so we're safe here to make a copy of that right like this"}, {"start": 338.0, "end": 360.0, "text": " and then down here we simply retrieve these local variables and update the current local variables using the local variables we stored and voila we can use A B and C without ever having to find them right"}, {"start": 360.0, "end": 388.0, "text": " if this doesn't work that means that the locals here are is is a copy basically and this is a Python optimization and I read I don't have to use it because in these ipythin notebooks it appears to work but you might want to have an empty exec statement here such that the Python interpreter can never be sure which variables are created in here and therefore can't optimize away"}, {"start": 388.0, "end": 408.0, "text": " so that that is a horrible horrible trick again don't build anything serious upon this but it is very duper super easy you can just add any variable here and then use it down here"}, {"start": 408.0, "end": 426.0, "text": " so easy right and so wrong all right this was it I hope you enjoyed this I want to bring these kind of tips every now and then as an as an intermix into the research papers I hope you enjoyed this bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=F5aaXrIMWyU | The AI Economist: Improving Equality and Productivity with AI-Driven Tax Policies (Paper Explained) | Hail the AI Tax Collector! This very visual framework has RL Agents maximize their coins in a tiny world through collecting, building and trading. But at the same time, the government is also an AI trying to maximize social welfare via taxes. What emerges is very interesting.
Paper: https://arxiv.org/abs/2004.13332
Blog: https://blog.einstein.ai/the-ai-economist/
Abstract:
Tackling real-world socio-economic challenges requires designing and testing economic policies. However, this is hard in practice, due to a lack of appropriate (micro-level) economic data and limited opportunity to experiment. In this work, we train social planners that discover tax policies in dynamic economies that can effectively trade-off economic equality and productivity. We propose a two-level deep reinforcement learning approach to learn dynamic tax policies, based on economic simulations in which both agents and a government learn and adapt. Our data-driven approach does not make use of economic modeling assumptions, and learns from observational data alone. We make four main contributions. First, we present an economic simulation environment that features competitive pressures and market dynamics. We validate the simulation by showing that baseline tax systems perform in a way that is consistent with economic theory, including in regard to learned agent behaviors and specializations. Second, we show that AI-driven tax policies improve the trade-off between equality and productivity by 16% over baseline policies, including the prominent Saez tax framework. Third, we showcase several emergent features: AI-driven tax policies are qualitatively different from baselines, setting a higher top tax rate and higher net subsidies for low incomes. Moreover, AI-driven tax policies perform strongly in the face of emergent tax-gaming strategies learned by AI agents. Lastly, AI-driven tax policies are also effective when used in experiments with human participants. In experiments conducted on MTurk, an AI tax policy provides an equality-productivity trade-off that is similar to that provided by the Saez framework along with higher inverse-income weighted social welfare.
Authors: Stephan Zheng, Alexander Trott, Sunil Srinivasa, Nikhil Naik, Melvin Gruesbeck, David C. Parkes, Richard Socher
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 | Alright, today we're going to find out why AI is much better at governing people, why poor people really should pay more taxes and how Donald Trump is just a normal human. Alright, we'll dive into it. We're looking at the AI economist by Salesforce Research. Now Salesforce Research has kind of created a simulated world environment where they can place agents in it and the agents, they can move around, they can collect resources, they can trade those resources and they can use those resources to build houses and that will earn them coins. And each agent wants to maximize its own coins but also there's the government and the government can set taxes so they collect money from everyone and they redistribute it. And the goal now is to going to be that the AI handles both the agent and the taxes and we want to maximize the social welfare of the entire population. Alright, that's the goal. So the paper here is called the AI economist, improving equality and productivity with AI-driven tax policies by Stefan Cheng and Alexander Trott and other people from Salesforce Research and Harvard University. So as I said, this is a simulated environment and the simulated environment works like this. There is a 2D plane, kind of like a game playing field and in this game there are agents. Here you can see the agents, there are always four agents. Oh, down here. What are you doing in the corner? Come on, be productive. The agents are in this world and they can do certain things, they have certain actions at their disposal. So first of all they can move around, they can move down, left, right and so on. Whenever they walk past a resource tile, they collect the resource. This is stone and this is wood. So there are two kinds of resources. And then the last actions the agents have is building a house. One wood and one stone will create one house and the house gives you coins. So this is a house and that will give you coins. But how much coins you get is different from agent to agent and this represents the agent's different skill levels. This is an abstraction and the kind of economic theory behind it is that the income inequality in people, one of the main drivers of it is that they are skilled differently and therefore are able to convert one unit of labor into more money than another lower skilled worker. So this is here represented by the fact that maybe if this agent here builds the house, they'll get 50 coins. But if this agent here would build the same house, they'll only get 10 coins. So we'll call this here a high skilled worker and this here a low skilled worker. Now the last thing, sorry, I saw the last thing before, but the very last thing the agents can do is they can trade. So if one agent has too many resources and the other one has not enough, they can trade those resources among each other for those coins. So once you build a house, you collect some coins. You can then either go and collect more resources or you can use those coins in order to buy resources of other people. This is unlucky. No coins, no houses and no resources. Look at that. Oh yeah. So you also can't move across the water here. You can only move on the grass. You can also not move through a house, which gives you some interesting abilities because you can just build a house right here. And yes, so you can't move over other players, but these are the rules are pretty simple. And the goal here is for the agents to maximize the number of coins they get in a thousand steps. So the number eight here is 1000, which is the number of steps that the agents can take before the game is over and it restarts again. So each agent is using reinforcement learning in order to learn how to achieve the maximum number of coins. Now the policies of course going to be different depending on whether that is a high or a low skilled worker. The catch here is that outside of this there is the government, the government here, let's draw this big house with the flag of our fictitious nation, which is like this. That's the flag. And the government will observe what's happening here and they will issue a tax taxes. So it will issue a tax distribution. Now how do you imagine that? So if you imagine the government says something like this for the first 10 coins you own you owe us 5% of that. For the next 10 coins, so from 10 to 20 you earn you owe us 10% and so on. So if you earn even more you owe us more and more percent of those extra coins. This is what you might know as a progressive tax schedule. The more you earn, the more percentage wise you pay on that extra earned money. This is what you might be used to but there are other tax schedules and the exact histogram you see or the exact how many percent for which amount of coins that is the action of the government. So the government decides on the taxes and the taxes are just collected from the income. So if you even agent earns these coins then it has to pay taxes to the government. And the government will redistribute all the taxes it has collected equally among the population. So if you pay a lot you might lose through this process and if you just pay a little taxes you might gain through this process. So that's it. That is the basic premise of the game. The agents are using reinforcement learning and I believe the newness of this paper is also that the government now is using reinforcement learning in order to determine the optimal tax policy. There is kind of this inner loop here and there is this outer game where the government also tries to maximize the RL. And what does the government try to maximize? Good question. It is a measure that's called social welfare. Now social welfare consists of two things and they have this here way down in the paper. Social welfare in this paper consists of two things. First of all economic productivity which basically just means how many coins have has anyone produced. It doesn't matter who but just the total amount of coins produced. The second one is income equality and this is related to the genie index. So if you plot the cumulative distribution of wealth and fully equal society would be a straight line because 50% of the people would have 50% of the money and so on. But a almost all true societies have something like this where 50% of the people might have 10% of the money and the rest 50% of the people has the other 90%. And the measure of inequality is this area here. This is called the genie index and one minus this area is what this paper has as an equality measure. So the higher this number the more equal is the society in terms of their income distribution. Now what is actually optimized for here is this thing equality times productivity. So you want both to be high your income equality and your productivity. There's a trade off here of course. But you can have multiple ways to trade that off and that will give you the different thing. They call this the social welfare function. And that's the thing that the government or L agent optimizes for. So you can see here already the free market even though it's the most productive produces the most coins because if you have a free market means no taxes. If you have no taxes then people are basically encouraged to earn more money because they don't have to pay taxes on them. As soon as you tax them they're less encouraged to earn more money. And therefore if you have no taxes the most coins will be earned in total. But the equality suffers. So the equality is the lowest among these things considered. If you compare that to the AI economist the AI economist achieves the highest social welfare. It achieves the highest equality. But it doesn't suffer as much in productivity as other systems here. And the baseline systems are first of all the US federal system. This is not particularly tight to the US. This is basically every system or most of the systems that you have currently in the world is the progressive tax system in the size formula which I believe is an economically theory based system which is a regressive tax schedule. You can see them down here where the US federal will be progressive means the more you earn the more percentage wise you pay while this says formula will be regressive which generally means the more you earn the less you pay. I believe this was derived under some assumptions to be the optimal tax distribution and the AI economist will come will come to will come to this in in a second. Let's actually just look at one of these things first one of these games. The cool thing here is that they have pretty flashy animations so you can look how does one of these games turn out. Now this is a free market game. And you can see the agents moving around collecting things building houses and you might notice that one of the agents namely agent one is just building all of the houses. Generally just kind of being a dick being in everyone's face and building things everywhere and the other ones don't. Or just a very few like the light blue on the bottom left build some houses on the right you can see how the distribution of wealth is structured and you see agent one ends up with most of the wealth. And the size of the circle I think is the total productivity so you can see this grows over time mainly because agent one becomes so rich. And if you analyze this if you analyze what's happening here then you'll see that agent one and I might be. Yeah they have a graph up here so so it is very interesting what happens. This is kind of the same game so agent one here is this orange dot and agents two three and four are these dots here and this graph here is coin from trading so how much money they win or lose from trading. Now the green bars are trading wood and the brown bars are trading stone. So you see agent number four which is the lowest skilled the skill is just determined at the beginning of the episode it will just make all of its coins basically by selling wood. And agent three will make all of its coins by selling stone and agent two will collect both and sell both and agent one will just spend money in trading. So you'll have a specialization here agent one which is the highest skill one right here will buy resources in order to build more houses because it clearly profits from building lots and lots and lots and lots of houses. So it will use that money to buy more resources rather than go and collecting them while all the other ones basically for go building houses in favor of they just collect the resources and they just trade them way to the agent one that's more profitable for them than building houses themselves. So you see this kind of specialization emerging in these games which I find I find this to be pretty cool that you see something like this like a really stark division of labor emerging just from these very very small set of rules and you can analyze this game in different ways they have a few more plots where this becomes quite apparent that sorry that these agents specialize so you see here resources collected. That resources collected if you have the lowest skill and the highest skill labor the rest the lowest skills they mainly this should be 10 they mainly collect resources while the highest skill labor mainly goes for building things it doesn't collect resources but net income from building is really high while everyone else just doesn't build it all. All right so we have a division of labor emerging. Now this was a free market let's actually compare the different algorithms so if you look at social welfare this is this thing here equality times productivity. You can see that the AI economist will outperform over time over the training progress it will outperform all of the other systems so it will outperform the free market the US federal tax system and the sales formula if trained for long enough which is to be expected right if you put RL onto a cost function it will then optimize that cost function but it's pretty cool to see that it had there's a lot of lot of headroom here over what we currently have. Now let's look at some of these strategies it comes up with so what do these games look like where the AI has imposed different tax strategies so this is with the size strategy you see that here again you see this inequality emerging with the yellow player here building most of the houses with the AI economist again there is inequality but you can see at the distribution that agent one only ends up with about half of the wealth where if you compare this to the free market here then agent one ends up with like two thirds of the wealth right this is the game we saw before but there is not qualitatively that much of a difference but there is in the end result all right let's look at what the these policies actually come up with so what is the tax policy that the AI comes up with so this tax policy outperforms on this social welfare metric and this is very interesting right so first of all you see that it's right zigzag it's like down up down up which is already weird so the first very weird thing is the spike at the very bottom so that thing here what's that thing here those are the poorest people in your society and you're taxing them the highest right so just imagine this you're here down trodden by life abandoned by society of no money no house no nothing and you're just trying to get a job you're just getting like a little bit of money and you can buy a cheeseburger and then the government comes to give us that gives that money come on so basically this these are the poor and the poor in this system is just F you F you the poor now the reason why this happens is pretty clear right the reason why this happens is because you want to encourage people to go here to earn more money right so so it's not like the government makes any money from the poor people independently of how it how high it taxes them but it is a basically an incentive structure to make them move over to the somewhat more productive population because here it's assumed kind of that even the lowest skilled ones can move over a bit if you just tax them enough at the low brackets right so this this is what I find to be you just have to realize that it is so hard I believe it is almost impossible to encapsulate what we really want in a system into a formula to be into a cost function to be optimized it is so incredibly hard and you see that here of course it is going to result in a better social outcome but it just doesn't feel right to tax the poor at what 60% okay so F the poor right and then you get to to this to this level right here and interestingly if you earn even more you'll be taxed high again right so this this this we're kind of used to that you earn little you pay little you earn more you earn you pay more but then comes this entire valley here what's up with that right like W T E and this can be this this is now of course the same reasoning as you have with this sias formula here is where the rich people you want to tax them less so that they are more productive such that they generate more coins and even though you tax them less percentage wise they will end up paying more money in absolute terms because because you basically encourage them to produce more so that is that is can that is the I guess the reasoning behind this but what you have to wreck you have to recognize what's happening here right what are we optimizing we're optimizing this productivity times equality and what do we get you see you get two big valleys of attraction one here and one here and that means that this algorithm favors a two class society right and I believe this is this is partially the limitations of this simulation here the fact that you only have four agents the fact that you can only do two things either collect or build right it encourages a two class society this specialization that you saw right so you say these here are the money makers and these here are the collectors and it is very hard to move from one group to the other because if you you earn more coins as a collector you're here and you really discouraged here if you move there you want to move all the way over here right now the people that are already over here if they earn an extra coin that doesn't bother them too much so they're very encouraged to earn more money but the very the poorer people on this side they're basically discouraged from earning more money because the system needs them to stay at that collector level right so the system encourages the two class society because we have not built social mobility into the into the into the equation we have not built a measure for social mobility into the cost function and therefore the AI doesn't care that the poor people will stay poor and the rich people will stay rich it just knows that this is the best outcome for society overall given the cost function that we had again this doesn't seem like fair to us like what we want we want someone to be able to make it over here right even if they start out from the bottom and so we'd have to we have to build that in so we have a system that is Fing F the poor right no social mobility mobility no and then get what happening at the end what's happening at the end this is beautiful very rich people these are the money maker right this is the this is the monopoly guy top hat monocle wearing scrooge meck duck bathing in coins this is where the the government makes their money and the discrepancy is really stunning because you could also argue hey why don't we apply the same reasoning as we applied here and here why is not is it not like the case that if the rich people if if you tax them lower they'll pay more money and so on I believe again this might be just a result of this how the simulation is set up so we'll move way quickly and we'll come back to this here is what I find particularly interesting about this paper which just confuses the heck out of me is a double periodic game so it's an inner outer loop game what do I mean by that they have these episodes right here is the start and here is the end and they sub divide this into as we said 1000 steps so an agent is here and it can do step step step step and it can perform these actions this is the agent there are 1000 steps here and the agent just tries to collect as much coins so this is your classic or L problem but also they divide this into 10 what they call periods and I'm just going to draw maybe 4 periods right so this thing here they call one period where the whole thing is an episode now the purpose of the period is that at the beginning of each period the government the government can impose a new tax schedule so the government doesn't only fix the taxes once but it can change the taxes over the course of the episode right now this is what I find I just don't see why so now you're formulating the tax giving objective as a sequential decision making it's like the government saying well today we have high taxes but tomorrow we have low taxes and the day after that we have high taxes again and it just doesn't make sense to for any government to do this what you should do is you should set taxes once at the beginning of the episode and then see how that turns out and then try to maximize your tax schedule and all we're looking at we're only ever looking at how the taxes are at the end right the things that we've examined are just the last taxes that the AI has issued we don't know the dynamic of what happens in between this might be super wild actually what the AI does in between I just don't see the framing as a sequential decision problem and I believe this is just an over engineered thing because someone wanted a reason and here is the architecture right you see someone wanted a reason to put an LSTM in there and one is thinking like well RL that means like sequential decisions and so on and RL in this outer loop the way I propose it would just be a one step per episode decision which is a bandit problem and as we all know bandits are boring so they didn't want this to be a bandit problem they wanted to be a sequential problem and that's why they made this period thing which I find dumb so another factor here and I'm going to tell you how this relates to the to the weird rich people are taxed high another factor here is look at this it's a CNN an MLP an LSTM and an MLP and the agent as well and I can tell you right now the CNN has two layers two and the LSTM has like 128 units in its hidden state so these are tiny tiny models and it is not a model based RL it's model three RL's proximal policy optimization and the the ability of these agents or planner to learn anything substantial here I believe is just not super duper well right so the I believe that these are rather dumb agents and you can see the tax rates given by the planner is fed into the agent model but I don't think that the agent it would given such a small model can actually adjust to these inputs because you have to do some pretty good logic in order to from these tax brackets to determine how you should act right now what I think is happening is the agent just kind of is aware of its skill level and through its rewards it's trying to maximize its future rewards and then when the government changes the tax rate it will not I am almost positive it will not directly change its response to that but it will kind of observe that something's happening in the world and then adjust maybe a little bit it's overall strategy but not in that particular instance and it will be delayed or it will be like an overall strategy and this might be one of the reasons why the tax brackets here might be screwed up because who says if I were this AI what I could do is in period one through nine I make the taxes really low for the rich people so I just encourage everyone to make more money right I like come on become more productive and I get the benefits of that and then in the last episode in last period I just freaking jack up that final tax bracket it's like you you have lots of money give it to me and then you just redistribute what you got there to the poor people in the very last period and thereby you achieve your goal of this social welfare function and of course this is not sustainable because all the rich people would just be kind of screwed through that and moved down again but it's the end of the episodes or what are they going to do so I think the fact how this is framed that there are just two different ways to get coins the fact that this is this periodic nature of the outer loop all might lead to something that becomes slowly more and more and more uninterpretable still cool though all right so the final thing they do this with humans yes real humans so they let humans try it and they have this interface here and humans they behave quite differently from the AI so there are a few different things where the humans act but look at that here AI economists this is what the agents do right so this AI economist is the tax strategies just take these develop tax strategies and let the humans be the agents so that the you you just want to observe how the agents act and whether or not the tax strategies also work when it's real humans acting in this environment and not our agents so compare this to how the humans act the humans they just build their houses in like neat little packets or straight lines or stuff like this I just I just find it to be very funny now there are some things lacking in the human environment which I find really important so first of all they have no cost for moving which I guess is minor but second of all they have no trade and I think that is that just kills the whole experiment because now of course what you're going to get is the wealth is just going to be proportional to how much you get coins per house which is different for each agent right so to me that that is now a pointless experiment if you can't trade because the outcome is just predictable and I don't think that the human behavior changes in response to the different tax brackets I think they'll just do and however they can make money they'll make money they'll build more houses until it becomes unprofitable and that's it so I don't see the I don't see the value of these experiments even though they show that again the AI economist out performs the other tax strategies in this equality times productivity metric and also in another metric that they measure the second problem I have is for the human experiments they take this distribution here they say well the AI this is one of the distributions that the AI came up with but you notice the lack of the F you poor people and the lack of this big spike here for the rich people which I find are one of the two features of the other distribution so I think there's quite a bit of variance in what this AI comes up with or maybe it's just because this is periodic but this is really confusing because they show and discuss that other distribution and now all of a sudden they say well we use this distribution that was also created by our AI and it seems to be qualitatively quite different in any case let's look at how the humans behave under the same under the different strategies so in the size formula you'll see that the light blue person here is kind of spreading out of it probably playing correctly everyone else is just neatly building their houses look at humans are so territorial most of them they kind of they kind of stay in their little corner and they're like this is my corner I'm going to build my eyes is here in nice thing and under the AI economist again you don't really see a different thing just because the taxes are different the qualitative behavior is quite the same you it's just building straight lines and they're I think the difference is more between the humans so I think it's not always the same humans and the difference might be more between the humans and you can see that humans clearly don't haven't really trained or discovered the optimal strategy they're just doing something and what you're seeing is just a result of the taxation it's not different behavior and this here this this is the best okay watch the down the bottom right the human there just first that you something there is just walling up walling up the other players and look this is this is the best I am going to build a big beautiful wall and I'm going to have the orange guy pay for it it's Donald Trump in the game amazing and look at the end they actually managed to lock in the other players so they can't move anymore Donald Trump wins amazing though actually the yellow player appears to win economy wise but what do you want with lots of money if you can't move so I again I find these human experiments to be rather pointless here because you disable trade and you don't train the humans to find a good strategy all right but in that I find the entire paper to be pretty cool code is going to be released they promise and they have checked that they have no ethical problems of course I invite you to check out the paper if you like content like this please subscribe share and leave a comment of what you think thank you so much for listening and bye bye | [{"start": 0.0, "end": 12.0, "text": " Alright, today we're going to find out why AI is much better at governing people, why poor people really should pay more taxes and how Donald Trump is just a normal human."}, {"start": 12.0, "end": 19.0, "text": " Alright, we'll dive into it. We're looking at the AI economist by Salesforce Research."}, {"start": 19.0, "end": 41.0, "text": " Now Salesforce Research has kind of created a simulated world environment where they can place agents in it and the agents, they can move around, they can collect resources, they can trade those resources and they can use those resources to build houses and that will earn them coins."}, {"start": 41.0, "end": 53.0, "text": " And each agent wants to maximize its own coins but also there's the government and the government can set taxes so they collect money from everyone and they redistribute it."}, {"start": 53.0, "end": 66.0, "text": " And the goal now is to going to be that the AI handles both the agent and the taxes and we want to maximize the social welfare of the entire population."}, {"start": 66.0, "end": 84.0, "text": " Alright, that's the goal. So the paper here is called the AI economist, improving equality and productivity with AI-driven tax policies by Stefan Cheng and Alexander Trott and other people from Salesforce Research and Harvard University."}, {"start": 84.0, "end": 93.0, "text": " So as I said, this is a simulated environment and the simulated environment works like this."}, {"start": 93.0, "end": 101.0, "text": " There is a 2D plane, kind of like a game playing field and in this game there are agents."}, {"start": 101.0, "end": 108.0, "text": " Here you can see the agents, there are always four agents. Oh, down here."}, {"start": 108.0, "end": 114.0, "text": " What are you doing in the corner? Come on, be productive."}, {"start": 114.0, "end": 128.0, "text": " The agents are in this world and they can do certain things, they have certain actions at their disposal. So first of all they can move around, they can move down, left, right and so on."}, {"start": 128.0, "end": 136.0, "text": " Whenever they walk past a resource tile, they collect the resource. This is stone and this is wood. So there are two kinds of resources."}, {"start": 136.0, "end": 147.0, "text": " And then the last actions the agents have is building a house. One wood and one stone will create one house and the house gives you coins."}, {"start": 147.0, "end": 151.0, "text": " So this is a house and that will give you coins."}, {"start": 151.0, "end": 159.0, "text": " But how much coins you get is different from agent to agent and this represents the agent's different skill levels."}, {"start": 159.0, "end": 177.0, "text": " This is an abstraction and the kind of economic theory behind it is that the income inequality in people, one of the main drivers of it is that they are skilled differently and therefore are able to"}, {"start": 177.0, "end": 193.0, "text": " convert one unit of labor into more money than another lower skilled worker. So this is here represented by the fact that maybe if this agent here builds the house, they'll get 50 coins."}, {"start": 193.0, "end": 203.0, "text": " But if this agent here would build the same house, they'll only get 10 coins. So we'll call this here a high skilled worker and this here a low skilled worker."}, {"start": 203.0, "end": 218.0, "text": " Now the last thing, sorry, I saw the last thing before, but the very last thing the agents can do is they can trade. So if one agent has too many resources and the other one has not enough, they can trade those resources among each other for those coins."}, {"start": 218.0, "end": 231.0, "text": " So once you build a house, you collect some coins. You can then either go and collect more resources or you can use those coins in order to buy resources of other people."}, {"start": 231.0, "end": 255.0, "text": " This is unlucky. No coins, no houses and no resources. Look at that. Oh yeah. So you also can't move across the water here. You can only move on the grass. You can also not move through a house, which gives you some interesting abilities because you can just build a house right here."}, {"start": 255.0, "end": 278.0, "text": " And yes, so you can't move over other players, but these are the rules are pretty simple. And the goal here is for the agents to maximize the number of coins they get in a thousand steps. So the number eight here is 1000, which is the number of steps that the agents can take before the game is over and it restarts again."}, {"start": 278.0, "end": 292.0, "text": " So each agent is using reinforcement learning in order to learn how to achieve the maximum number of coins. Now the policies of course going to be different depending on whether that is a high or a low skilled worker."}, {"start": 292.0, "end": 310.0, "text": " The catch here is that outside of this there is the government, the government here, let's draw this big house with the flag of our fictitious nation, which is like this. That's the flag."}, {"start": 310.0, "end": 334.0, "text": " And the government will observe what's happening here and they will issue a tax taxes. So it will issue a tax distribution. Now how do you imagine that? So if you imagine the government says something like this for the first 10 coins you own you owe us 5% of that."}, {"start": 334.0, "end": 347.0, "text": " For the next 10 coins, so from 10 to 20 you earn you owe us 10% and so on. So if you earn even more you owe us more and more percent of those extra coins."}, {"start": 347.0, "end": 356.0, "text": " This is what you might know as a progressive tax schedule. The more you earn, the more percentage wise you pay on that extra earned money."}, {"start": 356.0, "end": 370.0, "text": " This is what you might be used to but there are other tax schedules and the exact histogram you see or the exact how many percent for which amount of coins that is the action of the government."}, {"start": 370.0, "end": 383.0, "text": " So the government decides on the taxes and the taxes are just collected from the income. So if you even agent earns these coins then it has to pay taxes to the government."}, {"start": 383.0, "end": 397.0, "text": " And the government will redistribute all the taxes it has collected equally among the population. So if you pay a lot you might lose through this process and if you just pay a little taxes you might gain through this process."}, {"start": 397.0, "end": 417.0, "text": " So that's it. That is the basic premise of the game. The agents are using reinforcement learning and I believe the newness of this paper is also that the government now is using reinforcement learning in order to determine the optimal tax policy."}, {"start": 417.0, "end": 433.0, "text": " There is kind of this inner loop here and there is this outer game where the government also tries to maximize the RL. And what does the government try to maximize? Good question. It is a measure that's called social welfare."}, {"start": 433.0, "end": 450.0, "text": " Now social welfare consists of two things and they have this here way down in the paper. Social welfare in this paper consists of two things. First of all economic productivity which basically just means how many coins have has anyone produced."}, {"start": 450.0, "end": 473.0, "text": " It doesn't matter who but just the total amount of coins produced. The second one is income equality and this is related to the genie index. So if you plot the cumulative distribution of wealth and fully equal society would be a straight line because 50% of the people would have 50% of the money and so on."}, {"start": 473.0, "end": 486.0, "text": " But a almost all true societies have something like this where 50% of the people might have 10% of the money and the rest 50% of the people has the other 90%."}, {"start": 486.0, "end": 506.0, "text": " And the measure of inequality is this area here. This is called the genie index and one minus this area is what this paper has as an equality measure. So the higher this number the more equal is the society in terms of their income distribution."}, {"start": 506.0, "end": 520.0, "text": " Now what is actually optimized for here is this thing equality times productivity. So you want both to be high your income equality and your productivity. There's a trade off here of course."}, {"start": 520.0, "end": 532.0, "text": " But you can have multiple ways to trade that off and that will give you the different thing. They call this the social welfare function."}, {"start": 532.0, "end": 549.0, "text": " And that's the thing that the government or L agent optimizes for. So you can see here already the free market even though it's the most productive produces the most coins because if you have a free market means no taxes."}, {"start": 549.0, "end": 561.0, "text": " If you have no taxes then people are basically encouraged to earn more money because they don't have to pay taxes on them. As soon as you tax them they're less encouraged to earn more money."}, {"start": 561.0, "end": 573.0, "text": " And therefore if you have no taxes the most coins will be earned in total. But the equality suffers. So the equality is the lowest among these things considered."}, {"start": 573.0, "end": 583.0, "text": " If you compare that to the AI economist the AI economist achieves the highest social welfare. It achieves the highest equality."}, {"start": 583.0, "end": 611.0, "text": " But it doesn't suffer as much in productivity as other systems here. And the baseline systems are first of all the US federal system. This is not particularly tight to the US. This is basically every system or most of the systems that you have currently in the world is the progressive tax system in the size formula which I believe is an economically theory based system which is a regressive tax schedule."}, {"start": 611.0, "end": 628.0, "text": " You can see them down here where the US federal will be progressive means the more you earn the more percentage wise you pay while this says formula will be regressive which generally means the more you earn the less you pay."}, {"start": 628.0, "end": 642.0, "text": " I believe this was derived under some assumptions to be the optimal tax distribution and the AI economist will come will come to will come to this in in a second."}, {"start": 642.0, "end": 648.0, "text": " Let's actually just look at one of these things first one of these games."}, {"start": 648.0, "end": 658.0, "text": " The cool thing here is that they have pretty flashy animations so you can look how does one of these games turn out. Now this is a free market game."}, {"start": 658.0, "end": 669.0, "text": " And you can see the agents moving around collecting things building houses and you might notice that one of the agents namely agent one is just building all of the houses."}, {"start": 669.0, "end": 679.0, "text": " Generally just kind of being a dick being in everyone's face and building things everywhere and the other ones don't."}, {"start": 679.0, "end": 695.0, "text": " Or just a very few like the light blue on the bottom left build some houses on the right you can see how the distribution of wealth is structured and you see agent one ends up with most of the wealth."}, {"start": 695.0, "end": 706.0, "text": " And the size of the circle I think is the total productivity so you can see this grows over time mainly because agent one becomes so rich."}, {"start": 706.0, "end": 719.0, "text": " And if you analyze this if you analyze what's happening here then you'll see that agent one and I might be."}, {"start": 719.0, "end": 725.0, "text": " Yeah they have a graph up here so so it is very interesting what happens."}, {"start": 725.0, "end": 745.0, "text": " This is kind of the same game so agent one here is this orange dot and agents two three and four are these dots here and this graph here is coin from trading so how much money they win or lose from trading."}, {"start": 745.0, "end": 752.0, "text": " Now the green bars are trading wood and the brown bars are trading stone."}, {"start": 752.0, "end": 765.0, "text": " So you see agent number four which is the lowest skilled the skill is just determined at the beginning of the episode it will just make all of its coins basically by selling wood."}, {"start": 765.0, "end": 778.0, "text": " And agent three will make all of its coins by selling stone and agent two will collect both and sell both and agent one will just spend money in trading."}, {"start": 778.0, "end": 794.0, "text": " So you'll have a specialization here agent one which is the highest skill one right here will buy resources in order to build more houses because it clearly profits from building lots and lots and lots and lots of houses."}, {"start": 794.0, "end": 812.0, "text": " So it will use that money to buy more resources rather than go and collecting them while all the other ones basically for go building houses in favor of they just collect the resources and they just trade them way to the agent one that's more profitable for them than building houses themselves."}, {"start": 812.0, "end": 840.0, "text": " So you see this kind of specialization emerging in these games which I find I find this to be pretty cool that you see something like this like a really stark division of labor emerging just from these very very small set of rules and you can analyze this game in different ways they have a few more plots where this becomes quite apparent that"}, {"start": 840.0, "end": 847.0, "text": " sorry that these agents specialize so you see here resources collected."}, {"start": 847.0, "end": 876.0, "text": " That resources collected if you have the lowest skill and the highest skill labor the rest the lowest skills they mainly this should be 10 they mainly collect resources while the highest skill labor mainly goes for building things it doesn't collect resources but net income from building is really high"}, {"start": 876.0, "end": 881.0, "text": " while everyone else just doesn't build it all."}, {"start": 881.0, "end": 885.0, "text": " All right so we have a division of labor emerging."}, {"start": 885.0, "end": 897.0, "text": " Now this was a free market let's actually compare the different algorithms so if you look at social welfare this is this thing here equality times productivity."}, {"start": 897.0, "end": 926.0, "text": " You can see that the AI economist will outperform over time over the training progress it will outperform all of the other systems so it will outperform the free market the US federal tax system and the sales formula if trained for long enough which is to be expected right if you put RL onto a cost function it will then optimize that cost function but it's pretty cool to see that it had there's a lot of lot of headroom here"}, {"start": 926.0, "end": 929.0, "text": " over what we currently have."}, {"start": 929.0, "end": 944.0, "text": " Now let's look at some of these strategies it comes up with so what do these games look like where the AI has imposed different tax strategies so this is with the size strategy"}, {"start": 944.0, "end": 968.0, "text": " you see that here again you see this inequality emerging with the yellow player here building most of the houses with the AI economist again there is inequality but you can see at the distribution that agent one only ends up with about half of the wealth where if you compare this to the free market here then"}, {"start": 968.0, "end": 983.0, "text": " agent one ends up with like two thirds of the wealth right this is the game we saw before but there is not qualitatively that much of a difference but there is in the end result"}, {"start": 983.0, "end": 1010.0, "text": " all right let's look at what the these policies actually come up with so what is the tax policy that the AI comes up with so this tax policy outperforms on this social welfare metric and this is very interesting right so first of all you see that it's right zigzag it's like down up down up which is already weird"}, {"start": 1010.0, "end": 1031.0, "text": " so the first very weird thing is the spike at the very bottom so that thing here what's that thing here those are the poorest people in your society and you're taxing them the highest right so just imagine this you're here"}, {"start": 1031.0, "end": 1047.0, "text": " down trodden by life abandoned by society of no money no house no nothing and you're just trying to get a job you're just getting like a little bit of money and you can buy a cheeseburger and then the government comes"}, {"start": 1047.0, "end": 1068.0, "text": " to give us that gives that money come on so basically this these are the poor and the poor in this system is just F you F you the poor now the reason why this happens is pretty clear right"}, {"start": 1068.0, "end": 1092.0, "text": " the reason why this happens is because you want to encourage people to go here to earn more money right so so it's not like the government makes any money from the poor people independently of how it how high it taxes them but it is a basically an incentive structure to make them move over to the somewhat more productive population"}, {"start": 1092.0, "end": 1121.0, "text": " because here it's assumed kind of that even the lowest skilled ones can move over a bit if you just tax them enough at the low brackets right so this this is what I find to be you just have to realize that it is so hard I believe it is almost impossible to encapsulate what we really want in a system into a formula to be into a cost function to be optimized it is so incredibly hard"}, {"start": 1121.0, "end": 1133.0, "text": " and you see that here of course it is going to result in a better social outcome but it just doesn't feel right to tax the poor at what 60%"}, {"start": 1133.0, "end": 1149.0, "text": " okay so F the poor right and then you get to to this to this level right here and interestingly if you earn even more you'll be taxed high again right so this this"}, {"start": 1149.0, "end": 1163.0, "text": " this we're kind of used to that you earn little you pay little you earn more you earn you pay more but then comes this entire valley here what's up with that right like W T E"}, {"start": 1163.0, "end": 1178.0, "text": " and this can be this this is now of course the same reasoning as you have with this sias formula here is where the rich people you want to tax them less so that they are more productive"}, {"start": 1178.0, "end": 1198.0, "text": " such that they generate more coins and even though you tax them less percentage wise they will end up paying more money in absolute terms because because you basically encourage them to produce more so that is that is can that is the I"}, {"start": 1198.0, "end": 1210.0, "text": " guess the reasoning behind this but what you have to wreck you have to recognize what's happening here right what are we optimizing we're optimizing this productivity times equality"}, {"start": 1210.0, "end": 1226.0, "text": " and what do we get you see you get two big valleys of attraction one here and one here and that means that this algorithm favors a two class society"}, {"start": 1226.0, "end": 1246.0, "text": " right and I believe this is this is partially the limitations of this simulation here the fact that you only have four agents the fact that you can only do two things either collect or build right it encourages a two class society this specialization that you saw right so you say these here are the money makers"}, {"start": 1246.0, "end": 1266.0, "text": " and these here are the collectors and it is very hard to move from one group to the other because if you you earn more coins as a collector you're here and you really discouraged here if you move there you want to move all the way over here right now the people that are already"}, {"start": 1266.0, "end": 1282.0, "text": " over here if they earn an extra coin that doesn't bother them too much so they're very encouraged to earn more money but the very the poorer people on this side they're basically discouraged from earning more money because the system needs them to stay at that"}, {"start": 1282.0, "end": 1300.0, "text": " collector level right so the system encourages the two class society because we have not built social mobility into the into the into the equation we have not built a measure for social"}, {"start": 1300.0, "end": 1320.0, "text": " mobility into the cost function and therefore the AI doesn't care that the poor people will stay poor and the rich people will stay rich it just knows that this is the best outcome for society overall given the cost function that we had again this doesn't seem like fair to us like what we want we want"}, {"start": 1320.0, "end": 1340.0, "text": " someone to be able to make it over here right even if they start out from the bottom and so we'd have to we have to build that in so we have a system that is Fing F the poor right no social mobility mobility"}, {"start": 1340.0, "end": 1357.0, "text": " no and then get what happening at the end what's happening at the end this is beautiful very rich people these are the money maker right this is the this is the monopoly guy top hat monocle wearing"}, {"start": 1357.0, "end": 1381.0, "text": " scrooge meck duck bathing in coins this is where the the government makes their money and the discrepancy is really stunning because you could also argue hey why don't we apply the same reasoning as we applied here and here why is not is it not like the case that if the rich people if if you"}, {"start": 1381.0, "end": 1401.0, "text": " tax them lower they'll pay more money and so on I believe again this might be just a result of this how the simulation is set up so we'll move way quickly and we'll come back to this here is what I find particularly interesting about this paper which just confuses the heck out of me"}, {"start": 1401.0, "end": 1413.0, "text": " is a double periodic game so it's an inner outer loop game what do I mean by that they have these episodes right here is the start and here is the end"}, {"start": 1413.0, "end": 1427.0, "text": " and they sub divide this into as we said 1000 steps so an agent is here and it can do step step step step and it can perform these actions this is the agent"}, {"start": 1427.0, "end": 1442.0, "text": " there are 1000 steps here and the agent just tries to collect as much coins so this is your classic or L problem but also they divide this into 10 what they call periods and I'm just going to draw maybe 4"}, {"start": 1442.0, "end": 1451.0, "text": " periods right so this thing here they call one period where the whole thing is an episode"}, {"start": 1451.0, "end": 1469.0, "text": " now the purpose of the period is that at the beginning of each period the government the government can impose a new tax schedule so the government doesn't only fix the taxes once but it can change the taxes over the course of the"}, {"start": 1469.0, "end": 1492.0, "text": " episode right now this is what I find I just don't see why so now you're formulating the tax giving objective as a sequential decision making it's like the government saying well today we have high taxes but tomorrow we have low taxes and the day after that we have high taxes again"}, {"start": 1492.0, "end": 1509.0, "text": " and it just doesn't make sense to for any government to do this what you should do is you should set taxes once at the beginning of the episode and then see how that turns out and then try to maximize your tax schedule"}, {"start": 1509.0, "end": 1529.0, "text": " and all we're looking at we're only ever looking at how the taxes are at the end right the things that we've examined are just the last taxes that the AI has issued we don't know the dynamic of what happens in between this might be super wild actually what the AI does in between"}, {"start": 1529.0, "end": 1548.0, "text": " I just don't see the framing as a sequential decision problem and I believe this is just an over engineered thing because someone wanted a reason and here is the architecture right you see someone wanted a reason to put an LSTM in there"}, {"start": 1548.0, "end": 1564.0, "text": " and one is thinking like well RL that means like sequential decisions and so on and RL in this outer loop the way I propose it would just be a one step per episode decision which is a bandit problem and as we all know bandits are boring"}, {"start": 1564.0, "end": 1574.0, "text": " so they didn't want this to be a bandit problem they wanted to be a sequential problem and that's why they made this period thing which I find dumb"}, {"start": 1574.0, "end": 1590.0, "text": " so another factor here and I'm going to tell you how this relates to the to the weird rich people are taxed high another factor here is look at this it's a CNN an MLP an LSTM and an MLP and the agent as well"}, {"start": 1590.0, "end": 1610.0, "text": " and I can tell you right now the CNN has two layers two and the LSTM has like 128 units in its hidden state so these are tiny tiny models and it is not a model based RL it's model three RL's proximal policy optimization"}, {"start": 1610.0, "end": 1638.0, "text": " and the the ability of these agents or planner to learn anything substantial here I believe is just not super duper well right so the I believe that these are rather dumb agents and you can see the tax rates given by the planner is fed into the agent model"}, {"start": 1638.0, "end": 1654.0, "text": " but I don't think that the agent it would given such a small model can actually adjust to these inputs because you have to do some pretty good logic in order to from these tax brackets to determine how you should act right now"}, {"start": 1654.0, "end": 1682.0, "text": " what I think is happening is the agent just kind of is aware of its skill level and through its rewards it's trying to maximize its future rewards and then when the government changes the tax rate it will not I am almost positive it will not directly change its response to that but it will kind of observe that something's happening in the world and then adjust maybe a little bit"}, {"start": 1682.0, "end": 1698.0, "text": " it's overall strategy but not in that particular instance and it will be delayed or it will be like an overall strategy and this might be one of the reasons why the tax brackets here might be screwed up"}, {"start": 1698.0, "end": 1716.0, "text": " because who says if I were this AI what I could do is in period one through nine I make the taxes really low for the rich people so I just encourage everyone to make more money right"}, {"start": 1716.0, "end": 1731.0, "text": " I like come on become more productive and I get the benefits of that and then in the last episode in last period I just freaking jack up that final tax bracket it's like you you have lots of money give it to me"}, {"start": 1731.0, "end": 1741.0, "text": " and then you just redistribute what you got there to the poor people in the very last period and thereby you achieve your goal of this social welfare function"}, {"start": 1741.0, "end": 1751.0, "text": " and of course this is not sustainable because all the rich people would just be kind of screwed through that and moved down again but it's the end of the episodes or what are they going to do"}, {"start": 1751.0, "end": 1770.0, "text": " so I think the fact how this is framed that there are just two different ways to get coins the fact that this is this periodic nature of the outer loop all might lead to something that becomes slowly more and more and more uninterpretable"}, {"start": 1770.0, "end": 1785.0, "text": " still cool though all right so the final thing they do this with humans yes real humans so they let humans try it"}, {"start": 1785.0, "end": 1799.0, "text": " and they have this interface here and humans they behave quite differently from the AI so there are a few different things where the humans act but look at that here"}, {"start": 1799.0, "end": 1812.0, "text": " AI economists this is what the agents do right so this AI economist is the tax strategies just take these develop tax strategies and let the humans be the agents so that the you"}, {"start": 1812.0, "end": 1823.0, "text": " you just want to observe how the agents act and whether or not the tax strategies also work when it's real humans acting in this environment and not our agents"}, {"start": 1823.0, "end": 1834.0, "text": " so compare this to how the humans act the humans they just build their houses in like neat little packets or straight lines or stuff like this"}, {"start": 1834.0, "end": 1850.0, "text": " I just I just find it to be very funny now there are some things lacking in the human environment which I find really important so first of all they have no cost for moving which I guess is minor but second of all they have no trade"}, {"start": 1850.0, "end": 1866.0, "text": " and I think that is that just kills the whole experiment because now of course what you're going to get is the wealth is just going to be proportional to how much you get coins per house which is different for each agent right so to me that that is now a"}, {"start": 1866.0, "end": 1885.0, "text": " pointless experiment if you can't trade because the outcome is just predictable and I don't think that the human behavior changes in response to the different tax brackets I think they'll just do and however they can make money they'll make money they'll build more houses until it becomes"}, {"start": 1885.0, "end": 1905.0, "text": " unprofitable and that's it so I don't see the I don't see the value of these experiments even though they show that again the AI economist out performs the other tax strategies in this equality times productivity metric and also in another metric that they measure"}, {"start": 1905.0, "end": 1925.0, "text": " the second problem I have is for the human experiments they take this distribution here they say well the AI this is one of the distributions that the AI came up with but you notice the lack of the F you poor people and the lack of this big spike here for the rich people which I find"}, {"start": 1925.0, "end": 1932.0, "text": " are one of the two features of the other distribution so I think there's quite a bit of variance in what this AI comes up with or maybe it's just because this is periodic but this is really confusing because they show and discuss that other distribution and now all of a sudden they say well we use this distribution that was also created by our AI and it seems to be qualitatively quite different in any case let's look at how the humans behave under the same"}, {"start": 1955.0, "end": 1980.0, "text": " under the different strategies so in the size formula you'll see that the light blue person here is kind of spreading out of it probably playing correctly everyone else is just neatly building their houses look at humans are so territorial most of them they kind of they kind of stay in their little corner and they're like this is my corner I'm going to build my eyes is here in nice thing"}, {"start": 1980.0, "end": 2004.0, "text": " and under the AI economist again you don't really see a different thing just because the taxes are different the qualitative behavior is quite the same you it's just building straight lines and they're I think the difference is more between the humans so I think it's not always the same humans and the difference might be more between the humans and you can"}, {"start": 2004.0, "end": 2022.0, "text": " see that humans clearly don't haven't really trained or discovered the optimal strategy they're just doing something and what you're seeing is just a result of the taxation it's not different behavior and this here this this is the best okay watch the down the bottom right the human"}, {"start": 2022.0, "end": 2041.0, "text": " there just first that you something there is just walling up walling up the other players and look this is this is the best I am going to build a big beautiful wall and I'm going to have the orange guy pay for it"}, {"start": 2041.0, "end": 2066.0, "text": " it's Donald Trump in the game amazing and look at the end they actually managed to lock in the other players so they can't move anymore Donald Trump wins amazing though actually the yellow player appears to win economy wise but what do you want with lots of money if you can't move"}, {"start": 2066.0, "end": 2078.0, "text": " so I again I find these human experiments to be rather pointless here because you disable trade and you don't train the humans to find a good strategy"}, {"start": 2078.0, "end": 2104.0, "text": " all right but in that I find the entire paper to be pretty cool code is going to be released they promise and they have checked that they have no ethical problems of course I invite you to check out the paper if you like content like this please subscribe share and leave a comment of what you think thank you so much for listening and bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=jhCInVFE2sc | Deconstructing Lottery Tickets: Zeros, Signs, and the Supermask (Paper Explained) | This paper dives into the intrinsics of the Lottery Ticket Hypothesis and attempts to shine some light on what's important and what isn't.
https://arxiv.org/abs/1905.01067
Abstract:
The recent "Lottery Ticket Hypothesis" paper by Frankle & Carbin showed that a simple approach to creating sparse networks (keeping the large weights) results in models that are trainable from scratch, but only when starting from the same initial weights. The performance of these networks often exceeds the performance of the non-sparse base model, but for reasons that were not well understood. In this paper we study the three critical components of the Lottery Ticket (LT) algorithm, showing that each may be varied significantly without impacting the overall results. Ablating these factors leads to new insights for why LT networks perform as well as they do. We show why setting weights to zero is important, how signs are all you need to make the reinitialized network train, and why masking behaves like training. Finally, we discover the existence of Supermasks, masks that can be applied to an untrained, randomly initialized network to produce a model with performance far better than chance (86% on MNIST, 41% on CIFAR-10).
Authors: Hattie Zhou, Janice Lan, Rosanne Liu, Jason Yosinski
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 deconstructing lottery tickets, zeros, signs, and the supermask by Hadi Jo, Janis Lahn, Rosanne Liu, and Jason Yosinski of Uber AI. So this is a follower paper to the original paper that was called the lottery ticket hypothesis. I have done a video on that paper, so if you don't know what the lottery ticket hypothesis is, I suggest you go watch it. Just very quickly, very quickly. The lottery ticket hypothesis states the following. If you have a neural network that has, let's say it has these layers and has some weights, lottery ticket hypothesis states that there are a subset of weights that are significantly less number of weights than in the original network. A subset of weights are already enough for this network to be trained in a successful fashion. So there are subnetworks here. If you train them, you will get the same or even higher accuracy than if you train the full network. Now, the intrinsic part here is that the subnetwork must be initialized at the same place as the full network. And so with that goes the lottery ticket algorithm. The lottery ticket algorithm is the following. First, train the full network. Second, select the largest weights. Select the largest weights at the end of the training. And then third, reset the weights to their initial value. And this needs to be the same initial value at which you initialize them at step one and then train. So once you have the desired weights, these ones, right, you need to reset them to their original value before training. And then you can retrain just the small subnetwork. And that will work the same or better than the original network. So it's basically a pruning technique. So this is the lottery ticket hypothesis. The fact that there are these subnetworks or the proposition and the lottery ticket algorithm is the process by which you obtain the so-called winning tickets. Again, the full weight video will make this clearer. So this paper is going to shine some light on different aspects of these winning tickets and what is really important and what isn't and how you can obtain even better ones. So they often show the following 2D plots here. And these 2D plots will spend like a little time understanding them. There is two dimensions here and each one of these plots is represents a single weight in the neural network. So a single weight is just one floating point number, right? On the x-axis you have w-i, which is the initial value of the weight. Now this is randomly initialized, right? So here's zero. And you randomly initialize these weights in the neural networks. So this number is random. The w-f is on the y-axis and that is the final value of the weight. This is after training, right? This is trained. So if a point is for example here, that means it had this like three-value of three before training and then after training it went to a value of one, right? So it got initialized at three and as GD thought, no, it's better at one. So you see that there's an ellipsis here, right? Why is there an ellipsis? That's because very often the initial and the final weight value are positively correlated. So even if a weight initially was positive, it tends to also be positive at the final. And that's just because of the nature of SGD. It just takes little steps and basically tries to do as little effort as possible in order to reach its goal, right? It always just goes downhill in a greedy fashion. And that means probably it will, if it can, it will elect to not move the weights too far from their initial position or the position of the previous step. So that's why they're correlated and that's why you have a ellipsis. But they don't have to be. That's just the author superimposing their kind of view. So then they say what happens during these lottery ticket pruning is in the original algorithm, right? You had the following pruning technique. You would select all the weights that at the end of the training had a certain magnitude or higher. And that's this here. So add on the y-axis, which is the final weight. You define a threshold here. And everything that is smaller magnitude than the threshold, you mask to zero, right? You prune away. You don't want to retain. But everything that is above that, either positively or negatively, you mask to one, which means that you retain it in the winning ticket. So the light regions here will be the regions where you set the weight to zero or you mask it to zero. And the dark regions will be the weights that you retain. So if a weight was initially here, but then it traveled to here during the training, then sorry, of course, initially, well, if the y-axis is the process during training and will visualize this here, then we'll say initially it was here, right? Initially, it was here. And then in subsequent steps, it traveled over this line, then we would retain it because its final value was higher than the threshold. All right. So this paper generalizes the lottery ticket algorithm. It states it in a bit of a convoluted way, but just to go quickly over it, it says, first initialize a mask to all ones, randomly initialize the parameters of the network like this. Now to convolve it with the mask here is a bit superfluous because it's all ones, but they do it for consistency. Then they say, train the parameters of the network to completion. Do you know the initial weights before training by WI? That's what we saw in the plot and the final weights by WF. Then here is the first generalization. Use the mask criterion M to produce a masking score for each currently unmasked weight, rank the weights in each layer by their scores, set the mask value for the top, to 1 on the bottom, 100 minus P percent to zero. So this, this masking criterion here is now how you select the weights to be in the winning ticket basically. So you select how the, you select the weights that you want to be part of that trainable sub network. In the original lottery ticket algorithm, this was simply the absolute value as you can see here. Then they say there's a mask one action and a mask zero action, which is describing what happens to the weights that were part that are part of the winning ticket and what happens to the weights that aren't part of the winning ticket. Now to the second one first, the weights that aren't part of the winning ticket in the original algorithm, they were just pruned, right? Set to zero and frozen during any subsequent training. That's what we looked at before. But you can think of different things like setting them to a constant value and just not training them. The common thing is that they are masked to zero. So they will not be trained. But you can still kind of retain them at like a constant value or a random value, something like this. And same for the mask one, all it means here is that they will be trained in the original algorithm. These weights were reset to their initial values and more of for training in the next run, but you can think of different things, right? So this paper will experiment with all of these with these three steps, basically step two, step three and step four and decide on what's important and what isn't. So the first they go with the mass criteria. This is the criteria. How do we select which weights we should retain and which ones we shouldn't. So we're thinking we have our full network. We have trained it to completion. Right. And for each weight, we know it's initial and it's final value. And based on that, we now need to make a decision. Should this particular weight be included in the winning ticket or shouldn't it? The original paper, as we said, simply took the absolute value of the final weight, completely ignoring the original weight. So they do experiment with different things. First, and you can see this in the pot here, large final is what we had. And we saw this small final is this score here, which is just retain the weights that have a small final value. You can see the Y threshold is stays the same, but it is inverted. We retain the weights that are inside of the threshold. This is a control criterion, right, just to kind of do the opposite of what the initial paper did. Large in it, ignores the final value and simply goes on the initial value of the of the weight. Right. As you can see here, now the threshold is on the x axis and the same for small in it, the control case for that. Then there is a large in it large final where you say, okay, I only retain a weight if it both was large at initialization and large in the final value. So it's an additional criterion to the original paper. Now, of course, these are ranking scores. So you won't actually have the same thresholds. You will simply make the thresholds lower and then that region up here that you retain will become larger to reach the same percentage of weights retained. So that's something you have to keep in mind. To control case, small in a small final, then the interesting case here magnitude increase, which means all everywhere where the final weight is larger than the initial weight or the ranking score is basically based on how much you move. And this depicted here if so if a weight was originally here, it just needs to be larger. It just needs to be above that. So basically, it needs to be above the diagonal here. D diagonal are basically weights that are as high in the final trained version as they were at initialization and everything above this here or of course below this here. So you need to think of a second one here and then everything in this region and in this region magnitude wise will fulfill that criterion. And then movement simply describes how far they move. Now this is the same as the magnitude increase, but just the they don't do the absolute values before they subtract. So it's basically everything above this diagonal. So we don't look at how much the magnitude increase, but if a weight goes from very much negative to just a little positive, this will already qualify because it moved very far away. And then random, you simply mask at random, this is a control case. So our focus is going to be on the following, the large final, which is the original, right. The large in it might be interesting. The large in it large final might be interesting and the magnitude increase might be interesting. What do they find? We'll go to the plot with the most effects. The star here is simply a significance indicator. So disregard the stars for now. The magnitude increase tends to perform the best as you can see magnitude increase and compare that to large final large final is the original algorithm magnitude increase tends to perform better than the large final interestingly. But if you look across the experiments, it doesn't tend to do that consistently or often and there are these effects here when you go to really small networks, doesn't and these stars, I said disregard them, they are significance indicators for a T test, but the T test is just across five samples. And what you're seeing here is not a standard deviation, but the min and max over the five runs. So I see there might be an effect here, but I'm absolutely not trusting the this, the claim here that this is significant because it's just in one plot in one network on one data set. And yeah, so if you want to make the claim that the magnitude increase works better than the large final may be what you can say for sure is that for that things like large in it, they don't work. We don't really care. Interestingly, large in it large final doesn't work as well as you can see here, it kind of goes below these, I just think that's what I said, you by imposing two thresholds, each of them needs to be lower than the original threshold. So now it's not really the fact that it's large in it large final, but it's the fact that the large finals have a lower threshold than the ones that are only thresholding on large final. And therefore, it's just an additionally relevant criterion. Yeah, so those are those are the results, but basically you can see that it really tends to be in my opinion, that means it tends to be a good criterion to select the large final weights. And I don't trust this magnitude increase thing too much, I think it pretty much measures the same thing as the large final and I don't really see that it outperforms. Then they go over the mask one actions and the mask one actions remember these are how should we treat the weights that we have selected to be in the winning ticket. Now we can do the following things we can re in it, which basically means we set them back to the beginning of the optimization procedure. That is what the original algorithm does. We can re shuffle, which means that we get all the weights that we got from the that are masked to one, and we just shuffle them around. That guarantees us that the same weight distribution is still followed, but it's not that each weight is at the original weight. So this if this performs well, it could just mean that it is about the distribution of initial weights and not the exact configuration. And then constant, it just means we'll set them to some constants. So either we set them to a negative or a positive constant and then the weights that are masked to zero will become a zero. So here are the results. Now as you can see, there are a bunch of things performing about at the same level, which are the red, orange and blue curves here. The blue curve is rewind with large final. Now that is the original algorithm. The orange is reshuffle in it sign and the red is constant in it sign. Now what does in it sign mean? You see that these things will perform well if they have this in it sign instead of ran sign. Which basically means we reshuffle or we initialize to the constant with fifth like the constant will be 50, 50, whether it's plus or minus alpha. So the reshuffle will mean we don't care how we shuffle the weights as long as we shuffle the same weights somehow. With in it sign what they mean is that they make sure that the sign of the sign of the weight that is reinitialized is equal to the sign of the weight in the final train network. So they basically saying that this weight is positive in the winning ticket. So we should initialize them to a positive thing to a positive sign. That means that all the all the alpha in this case here it is going to be a plus alpha if the original weight was positive weight and the negative alpha if the original weight was a negative weight. And also here that shuffling will only happen between the positive and the negative weights. Now this might actually be at initial not at final but there are extremely correlated so there shouldn't be a big difference. So these perform all about the same level which again is interesting. So that the authors here claim it's just about the sign so that the important part here seems to be the sign. So I think what's happening here is if you do these things what you'll do is you'll automatically be closer let's actually give a benefit of the doubt here and you say this is the initial what you'll do is if you do plus alpha only if the initial weight was positive they will be closer together. Right those two things are closer together than a random plus or minus alpha in expectation they will be close together and also with the reshuffle basically what with this in its sign thing what you ensure is that your your initialization is closer to this one here so it will be more like the large final initialization where you rewind the weights. And I don't think you can make the claim it's just about the sign I would guess that any algorithm that makes the weights closer to this original lottery ticket thing will also perform well what is true and that's what the author says that the so called like the base and of attraction seems to be much larger than you have to exactly hit the original weights. But I think this effect here is not at all about the sign and just about the fact that you make them closer and by matching the sign you already make them closer and expectation and that's why it might work. Also stop testing it 0.005 significance level with five runs that's no. Alright so the last thing they do is the mask 0 actions basically how do we treat the weights that we want to get rid of that are not part of the trainable winning ticket. So they experiment with different things they say okay here is the original network it's at a certain it's at a certain accuracy right this are the black lines and then the blue lines are set the mask 0 weights to 0 so forget about them don't include them which is what the original algorithm did right so that's why see this plot right here. And these are the blue lines and as you can see in the original paper this outperforms the original work at first and then as you prune more and more and more here you just have whatever 1.2% of the weights then it finally gets worse now you can do original sorry different actions one of them is set them to their initial values right. And here they try to allude that by the numbers they put here right so the this thing here means whatever you don't mask put it to the initial value which is this I plus and this means set everything else to 0 now this thing here means set it to this to the initial value and also set this to the initial value so set everything to the initial value just don't train the one. So now you end up with a network where some of the connections are simply frozen at their original value and that as you can see performs worse often it's so it's below the especially here you can see it's below the original algorithm where you set it to 0 this is very interesting I think because I think that's just because you use the same thing as I said before and I think that's just because you you introduce some ever some noise signal in there so you introduce some unnecessary signal and the authors here claim well these weights you mask them because they were small and magnitude right so the optimal value for those weights seems to be close to 0 so by setting them to 0 the original algorithm lottery ticket algorithm basically freezes them at their optimal position and if you freeze them to any other position right away from 0 then that means the that means the you you have a less optimal configuration here and I can I can believe that I can follow that not fully convinced but I can follow so they they come up with a cool experiment what I think is that they they say for all the weights that we mask we're going to set the ones below this line to 0 and the ones above them to their initial value basically if a weight during training moved so a weight is let's say this is the magnitude and this is now the training steps if a weight started out here and during training moved up in magnitude but it's still it's still below the masking threshold right the masking threshold is here so it's not included in the ticket but it moved up will set it to its initial value but if it moved down so it's lower then will set it to 0 right so you have the an additional threshold of how it moves during training that's the line here you can see this here and that often performs better than the original ticket algorithm not much and it mainly tends to be in the in the regions where you really have low weights and then it come up with a further variant where they also do the same thing to the trainable weights so these trainable weights appear they do the same thing where they say okay we're going to set the ones that actually move down to during training now these are going to be very few ones but some of them are going to move down during training but they don't don't go below the threshold we're going to set the ones to 0 those ones because they were too high initially and that performs even better sometimes and again I don't I don't see this as a an algorithm where it's set to 0 or set I it's simply because you were again setting something closer to its optimal value during training if a weight that is trainable during training sorry went down a bit that means that its optimal value is lower than it originally was and it can just be that by setting it to 0 you were actually you're doing it sorry by setting it to 0 you end up at a point that is closer in magnitude sorry to the optimal value than at the initial point so I think my comment here is that a lot of these things I think are a bit overinterpreted by the authors and ultimately it's it's just about getting the weights close to where they where their optimal value is either at the beginning or at the end of the training and I think the original lottery ticket paper already did a good job analyzing that right the last section here they call super masks and now super masks are is is a is a thing where they say hey if we have a mask can't we just apply this to the original untrained network and how will the network perform when we do that now if you simply take a network with random weights on let's say on M this you have a 10% chance because there are 10 classes right so it will perform at 10% accuracy if you randomly mask a bunch of weights then again you'll stay at 10% but if you apply the mask the large final mask you will already get some accuracy really interesting so without training just by applying the mask you'll get some accuracy and again we can interpret this by simply the fact that the masking action it will mask weights that are not part of the winning ticket it will retain weights that are part of the winning ticket weights tend to not move that much by SGD so basically the mask network is a closer at a place closer to its optimal value than the unmasked network and therefore it will perform better so I think their findings are fairly easy to interpret here and the last thing that is they say can we optimize these masks can we train the mask now rather than basically just training the network full determining the mask from there can we now take that mask and further optimize it and they do basically a they optimize this mask by SGD of course you have to make it continuous during training to do that but what you end up with is a binary mask and they say here that it works better than the original mask so interestingly interestingly the if you apply the mask of the lottery ticket just at the beginning of training without training the network you can see here that it already reaches whatever 40% accuracy on MNIST and it also reaches non negligible accuracy on C for 10 so 20% if you do a special thing where you also look see that the sign agrees so if the final and the original weight have the same sign then you get a much higher performance in this again this is the untrained network and they also do this at constant values for the same sign so the same as we saw before and again they make this big deal about the sign here I really think this is just because you're closer to the optimum when you do when you match the sign but that's just my opinion and then if they train the mask they get even higher so you see here you get even higher performance and this is the top is on MNIST and the bottom is on C for 10 so if you train the mask if you if you just apply the mask you get non random performance better than random if you look that the mask also agrees with the signs so that you have a sign criterion where you say I'm only going to take the initial weights into the mask if they have the same sign as the end weights then you get a better performing so initial sub network and if you train the mask again you've never trained the weights you just train the mask you can get an even better performance and I mean that's somewhat not surprising because now you train the mask and yeah so I don't think that's too surprising but what you can see here is that the effect on MNIST is appears to be very high between these two and the effect on C for 10 seems to be different it seems to be low between these two and then high between these two so I wonder if there's a big dependence on the actual task here they also use this dynamic weight rescaling which is basically a kind of a rescaling trick and then they put the following table so here you have the different networks and here you have the original trained weights the performance they reach on the task and here you have the performance that they reach after learned mask and dynamic weight rescaling and you can see here that the MNIST even outperforms the original trained weights simply by learning the mask now you can also see that on C for 10 this effect is not present and I've already seen a paper that states that on like Resnets and ImageNet the lottery ticket hypothesis isn't really measurable so I want to pose another hypothesis here and the hypothesis is the following that you may find these winning tickets that are performing well at initialization or being trained well if the task is sufficiently easy the more you can basically do with it and you can already basically MNIST is so easy that you simply have to mask out some of the initial weights and you will already perform extremely well where C for 10 is harder ImageNet is harder again and I believe as the tasks get harder and harder these methods will work less and less to the point where they don't work anymore that's my opinion so basically my opinion is it appears to be very much about how close you are to some kind of initial lottery ticket and I think the experiments here are very cool or very well designed but I think they're often a bit overinterpreted alright that was it for me I invite you to check out the paper and bye bye | [{"start": 0.0, "end": 13.0, "text": " Hi there! Today we're looking at deconstructing lottery tickets, zeros, signs, and the supermask by Hadi Jo, Janis Lahn, Rosanne Liu, and Jason Yosinski of Uber AI."}, {"start": 13.0, "end": 20.0, "text": " So this is a follower paper to the original paper that was called the lottery ticket hypothesis."}, {"start": 20.0, "end": 27.0, "text": " I have done a video on that paper, so if you don't know what the lottery ticket hypothesis is, I suggest you go watch it."}, {"start": 27.0, "end": 33.0, "text": " Just very quickly, very quickly. The lottery ticket hypothesis states the following."}, {"start": 33.0, "end": 40.0, "text": " If you have a neural network that has, let's say it has these layers and has some weights,"}, {"start": 40.0, "end": 53.0, "text": " lottery ticket hypothesis states that there are a subset of weights that are significantly less number of weights than in the original network."}, {"start": 53.0, "end": 62.0, "text": " A subset of weights are already enough for this network to be trained in a successful fashion."}, {"start": 62.0, "end": 73.0, "text": " So there are subnetworks here. If you train them, you will get the same or even higher accuracy than if you train the full network."}, {"start": 73.0, "end": 83.0, "text": " Now, the intrinsic part here is that the subnetwork must be initialized at the same place as the full network."}, {"start": 83.0, "end": 89.0, "text": " And so with that goes the lottery ticket algorithm. The lottery ticket algorithm is the following."}, {"start": 89.0, "end": 105.0, "text": " First, train the full network. Second, select the largest weights. Select the largest weights at the end of the training."}, {"start": 105.0, "end": 125.0, "text": " And then third, reset the weights to their initial value. And this needs to be the same initial value at which you initialize them at step one and then train."}, {"start": 125.0, "end": 135.0, "text": " So once you have the desired weights, these ones, right, you need to reset them to their original value before training."}, {"start": 135.0, "end": 143.0, "text": " And then you can retrain just the small subnetwork. And that will work the same or better than the original network."}, {"start": 143.0, "end": 148.0, "text": " So it's basically a pruning technique. So this is the lottery ticket hypothesis."}, {"start": 148.0, "end": 162.0, "text": " The fact that there are these subnetworks or the proposition and the lottery ticket algorithm is the process by which you obtain the so-called winning tickets."}, {"start": 162.0, "end": 183.0, "text": " Again, the full weight video will make this clearer. So this paper is going to shine some light on different aspects of these winning tickets and what is really important and what isn't and how you can obtain even better ones."}, {"start": 183.0, "end": 201.0, "text": " So they often show the following 2D plots here. And these 2D plots will spend like a little time understanding them. There is two dimensions here and each one of these plots is represents a single weight in the neural network."}, {"start": 201.0, "end": 215.0, "text": " So a single weight is just one floating point number, right? On the x-axis you have w-i, which is the initial value of the weight. Now this is randomly initialized, right? So here's zero."}, {"start": 215.0, "end": 224.0, "text": " And you randomly initialize these weights in the neural networks. So this number is random."}, {"start": 224.0, "end": 238.0, "text": " The w-f is on the y-axis and that is the final value of the weight. This is after training, right? This is trained."}, {"start": 238.0, "end": 256.0, "text": " So if a point is for example here, that means it had this like three-value of three before training and then after training it went to a value of one, right? So it got initialized at three and as GD thought, no, it's better at one."}, {"start": 256.0, "end": 270.0, "text": " So you see that there's an ellipsis here, right? Why is there an ellipsis? That's because very often the initial and the final weight value are positively correlated."}, {"start": 270.0, "end": 293.0, "text": " So even if a weight initially was positive, it tends to also be positive at the final. And that's just because of the nature of SGD. It just takes little steps and basically tries to do as little effort as possible in order to reach its goal, right? It always just goes downhill in a greedy fashion."}, {"start": 293.0, "end": 305.0, "text": " And that means probably it will, if it can, it will elect to not move the weights too far from their initial position or the position of the previous step."}, {"start": 305.0, "end": 316.0, "text": " So that's why they're correlated and that's why you have a ellipsis. But they don't have to be. That's just the author superimposing their kind of view."}, {"start": 316.0, "end": 328.0, "text": " So then they say what happens during these lottery ticket pruning is in the original algorithm, right? You had the following pruning technique."}, {"start": 328.0, "end": 340.0, "text": " You would select all the weights that at the end of the training had a certain magnitude or higher. And that's this here. So add on the y-axis, which is the final weight."}, {"start": 340.0, "end": 355.0, "text": " You define a threshold here. And everything that is smaller magnitude than the threshold, you mask to zero, right? You prune away. You don't want to retain."}, {"start": 355.0, "end": 367.0, "text": " But everything that is above that, either positively or negatively, you mask to one, which means that you retain it in the winning ticket."}, {"start": 367.0, "end": 380.0, "text": " So the light regions here will be the regions where you set the weight to zero or you mask it to zero. And the dark regions will be the weights that you retain."}, {"start": 380.0, "end": 401.0, "text": " So if a weight was initially here, but then it traveled to here during the training, then sorry, of course, initially, well, if the y-axis is the process during training and will visualize this here, then we'll say initially it was here, right?"}, {"start": 401.0, "end": 416.0, "text": " Initially, it was here. And then in subsequent steps, it traveled over this line, then we would retain it because its final value was higher than the threshold."}, {"start": 416.0, "end": 428.0, "text": " All right. So this paper generalizes the lottery ticket algorithm. It states it in a bit of a convoluted way, but just to go quickly over it, it says,"}, {"start": 428.0, "end": 441.0, "text": " first initialize a mask to all ones, randomly initialize the parameters of the network like this. Now to convolve it with the mask here is a bit superfluous because it's all ones, but they do it for consistency."}, {"start": 441.0, "end": 453.0, "text": " Then they say, train the parameters of the network to completion. Do you know the initial weights before training by WI? That's what we saw in the plot and the final weights by WF."}, {"start": 453.0, "end": 466.0, "text": " Then here is the first generalization. Use the mask criterion M to produce a masking score for each currently unmasked weight, rank the weights in each layer by their scores, set the mask value for the top,"}, {"start": 466.0, "end": 492.0, "text": " to 1 on the bottom, 100 minus P percent to zero. So this, this masking criterion here is now how you select the weights to be in the winning ticket basically. So you select how the, you select the weights that you want to be part of that trainable sub network."}, {"start": 492.0, "end": 515.0, "text": " In the original lottery ticket algorithm, this was simply the absolute value as you can see here. Then they say there's a mask one action and a mask zero action, which is describing what happens to the weights that were part that are part of the winning ticket and what happens to the weights that aren't part of the winning ticket."}, {"start": 515.0, "end": 528.0, "text": " Now to the second one first, the weights that aren't part of the winning ticket in the original algorithm, they were just pruned, right? Set to zero and frozen during any subsequent training. That's what we looked at before."}, {"start": 528.0, "end": 541.0, "text": " But you can think of different things like setting them to a constant value and just not training them. The common thing is that they are masked to zero. So they will not be trained."}, {"start": 541.0, "end": 556.0, "text": " But you can still kind of retain them at like a constant value or a random value, something like this. And same for the mask one, all it means here is that they will be trained in the original algorithm."}, {"start": 556.0, "end": 564.0, "text": " These weights were reset to their initial values and more of for training in the next run, but you can think of different things, right?"}, {"start": 564.0, "end": 576.0, "text": " So this paper will experiment with all of these with these three steps, basically step two, step three and step four and decide on what's important and what isn't."}, {"start": 576.0, "end": 586.0, "text": " So the first they go with the mass criteria. This is the criteria. How do we select which weights we should retain and which ones we shouldn't."}, {"start": 586.0, "end": 600.0, "text": " So we're thinking we have our full network. We have trained it to completion. Right. And for each weight, we know it's initial and it's final value. And based on that, we now need to make a decision."}, {"start": 600.0, "end": 613.0, "text": " Should this particular weight be included in the winning ticket or shouldn't it? The original paper, as we said, simply took the absolute value of the final weight, completely ignoring the original weight."}, {"start": 613.0, "end": 634.0, "text": " So they do experiment with different things. First, and you can see this in the pot here, large final is what we had. And we saw this small final is this score here, which is just retain the weights that have a small final value."}, {"start": 634.0, "end": 651.0, "text": " You can see the Y threshold is stays the same, but it is inverted. We retain the weights that are inside of the threshold. This is a control criterion, right, just to kind of do the opposite of what the initial paper did."}, {"start": 651.0, "end": 668.0, "text": " Large in it, ignores the final value and simply goes on the initial value of the of the weight. Right. As you can see here, now the threshold is on the x axis and the same for small in it, the control case for that."}, {"start": 668.0, "end": 681.0, "text": " Then there is a large in it large final where you say, okay, I only retain a weight if it both was large at initialization and large in the final value."}, {"start": 681.0, "end": 703.0, "text": " So it's an additional criterion to the original paper. Now, of course, these are ranking scores. So you won't actually have the same thresholds. You will simply make the thresholds lower and then that region up here that you retain will become larger to reach the same percentage of weights retained."}, {"start": 703.0, "end": 725.0, "text": " So that's something you have to keep in mind. To control case, small in a small final, then the interesting case here magnitude increase, which means all everywhere where the final weight is larger than the initial weight or the ranking score is basically based on how much you move."}, {"start": 725.0, "end": 741.0, "text": " And this depicted here if so if a weight was originally here, it just needs to be larger. It just needs to be above that. So basically, it needs to be above the diagonal here."}, {"start": 741.0, "end": 755.0, "text": " D diagonal are basically weights that are as high in the final trained version as they were at initialization and everything above this here or of course below this here."}, {"start": 755.0, "end": 781.0, "text": " So you need to think of a second one here and then everything in this region and in this region magnitude wise will fulfill that criterion. And then movement simply describes how far they move. Now this is the same as the magnitude increase, but just the they don't do the absolute values before they subtract."}, {"start": 781.0, "end": 803.0, "text": " So it's basically everything above this diagonal. So we don't look at how much the magnitude increase, but if a weight goes from very much negative to just a little positive, this will already qualify because it moved very far away."}, {"start": 803.0, "end": 817.0, "text": " And then random, you simply mask at random, this is a control case. So our focus is going to be on the following, the large final, which is the original, right."}, {"start": 817.0, "end": 821.0, "text": " The large in it might be interesting."}, {"start": 821.0, "end": 829.0, "text": " The large in it large final might be interesting and the magnitude increase might be interesting."}, {"start": 829.0, "end": 843.0, "text": " What do they find? We'll go to the plot with the most effects. The star here is simply a significance indicator. So disregard the stars for now."}, {"start": 843.0, "end": 864.0, "text": " The magnitude increase tends to perform the best as you can see magnitude increase and compare that to large final large final is the original algorithm magnitude increase tends to perform better than the large final interestingly."}, {"start": 864.0, "end": 886.0, "text": " But if you look across the experiments, it doesn't tend to do that consistently or often and there are these effects here when you go to really small networks, doesn't and these stars, I said disregard them, they are significance indicators for a T test, but the T test is just across five samples."}, {"start": 886.0, "end": 913.0, "text": " And what you're seeing here is not a standard deviation, but the min and max over the five runs. So I see there might be an effect here, but I'm absolutely not trusting the this, the claim here that this is significant because it's just in one plot in one network on one data set."}, {"start": 913.0, "end": 932.0, "text": " And yeah, so if you want to make the claim that the magnitude increase works better than the large final may be what you can say for sure is that for that things like large in it, they don't work."}, {"start": 932.0, "end": 956.0, "text": " We don't really care. Interestingly, large in it large final doesn't work as well as you can see here, it kind of goes below these, I just think that's what I said, you by imposing two thresholds, each of them needs to be lower than the original threshold."}, {"start": 956.0, "end": 972.0, "text": " So now it's not really the fact that it's large in it large final, but it's the fact that the large finals have a lower threshold than the ones that are only thresholding on large final."}, {"start": 972.0, "end": 978.0, "text": " And therefore, it's just an additionally relevant criterion."}, {"start": 978.0, "end": 994.0, "text": " Yeah, so those are those are the results, but basically you can see that it really tends to be in my opinion, that means it tends to be a good criterion to select the large final weights."}, {"start": 994.0, "end": 1010.0, "text": " And I don't trust this magnitude increase thing too much, I think it pretty much measures the same thing as the large final and I don't really see that it outperforms."}, {"start": 1010.0, "end": 1024.0, "text": " Then they go over the mask one actions and the mask one actions remember these are how should we treat the weights that we have selected to be in the winning ticket."}, {"start": 1024.0, "end": 1034.0, "text": " Now we can do the following things we can re in it, which basically means we set them back to the beginning of the optimization procedure."}, {"start": 1034.0, "end": 1050.0, "text": " That is what the original algorithm does. We can re shuffle, which means that we get all the weights that we got from the that are masked to one, and we just shuffle them around."}, {"start": 1050.0, "end": 1068.0, "text": " That guarantees us that the same weight distribution is still followed, but it's not that each weight is at the original weight. So this if this performs well, it could just mean that it is about the distribution of initial weights and not the exact configuration."}, {"start": 1068.0, "end": 1074.0, "text": " And then constant, it just means we'll set them to some constants."}, {"start": 1074.0, "end": 1090.0, "text": " So either we set them to a negative or a positive constant and then the weights that are masked to zero will become a zero."}, {"start": 1090.0, "end": 1094.0, "text": " So here are the results."}, {"start": 1094.0, "end": 1104.0, "text": " Now as you can see, there are a bunch of things performing about at the same level, which are the red, orange and blue curves here."}, {"start": 1104.0, "end": 1112.0, "text": " The blue curve is rewind with large final. Now that is the original algorithm."}, {"start": 1112.0, "end": 1130.0, "text": " The orange is reshuffle in it sign and the red is constant in it sign. Now what does in it sign mean? You see that these things will perform well if they have this in it sign instead of ran sign."}, {"start": 1130.0, "end": 1144.0, "text": " Which basically means we reshuffle or we initialize to the constant with fifth like the constant will be 50, 50, whether it's plus or minus alpha."}, {"start": 1144.0, "end": 1172.0, "text": " So the reshuffle will mean we don't care how we shuffle the weights as long as we shuffle the same weights somehow. With in it sign what they mean is that they make sure that the sign of the sign of the weight that is reinitialized is equal to the sign of the weight in the final"}, {"start": 1172.0, "end": 1188.0, "text": " train network. So they basically saying that this weight is positive in the winning ticket. So we should initialize them to a positive thing to a positive sign."}, {"start": 1188.0, "end": 1204.0, "text": " That means that all the all the alpha in this case here it is going to be a plus alpha if the original weight was positive weight and the negative alpha if the original weight was a negative weight."}, {"start": 1204.0, "end": 1218.0, "text": " And also here that shuffling will only happen between the positive and the negative weights. Now this might actually be at initial not at final but there are extremely correlated so there shouldn't be a big difference."}, {"start": 1218.0, "end": 1231.0, "text": " So these perform all about the same level which again is interesting. So that the authors here claim it's just about the sign so that the important part here seems to be the sign."}, {"start": 1231.0, "end": 1257.0, "text": " So I think what's happening here is if you do these things what you'll do is you'll automatically be closer let's actually give a benefit of the doubt here and you say this is the initial what you'll do is if you do plus alpha only if the initial weight was positive they will be closer together."}, {"start": 1257.0, "end": 1286.0, "text": " Right those two things are closer together than a random plus or minus alpha in expectation they will be close together and also with the reshuffle basically what with this in its sign thing what you ensure is that your your initialization is closer to this one here so it will be more like the large final initialization where you rewind the weights."}, {"start": 1286.0, "end": 1313.0, "text": " And I don't think you can make the claim it's just about the sign I would guess that any algorithm that makes the weights closer to this original lottery ticket thing will also perform well what is true and that's what the author says that the so called like the base and of attraction seems to be much larger than you have to exactly hit the original weights."}, {"start": 1313.0, "end": 1330.0, "text": " But I think this effect here is not at all about the sign and just about the fact that you make them closer and by matching the sign you already make them closer and expectation and that's why it might work."}, {"start": 1330.0, "end": 1341.0, "text": " Also stop testing it 0.005 significance level with five runs that's no."}, {"start": 1341.0, "end": 1354.0, "text": " Alright so the last thing they do is the mask 0 actions basically how do we treat the weights that we want to get rid of that are not part of the trainable winning ticket."}, {"start": 1354.0, "end": 1382.0, "text": " So they experiment with different things they say okay here is the original network it's at a certain it's at a certain accuracy right this are the black lines and then the blue lines are set the mask 0 weights to 0 so forget about them don't include them which is what the original algorithm did right so that's why see this plot right here."}, {"start": 1382.0, "end": 1409.0, "text": " And these are the blue lines and as you can see in the original paper this outperforms the original work at first and then as you prune more and more and more here you just have whatever 1.2% of the weights then it finally gets worse now you can do original sorry different actions one of them is set them to their initial values right."}, {"start": 1409.0, "end": 1438.0, "text": " And here they try to allude that by the numbers they put here right so the this thing here means whatever you don't mask put it to the initial value which is this I plus and this means set everything else to 0 now this thing here means set it to this to the initial value and also set this to the initial value so set everything to the initial value just don't train the one."}, {"start": 1438.0, "end": 1466.0, "text": " So now you end up with a network where some of the connections are simply frozen at their original value and that as you can see performs worse often it's so it's below the especially here you can see it's below the original algorithm where you set it to 0 this is very interesting I think because I think that's just because you use the same thing as I said before"}, {"start": 1466.0, "end": 1487.0, "text": " and I think that's just because you you introduce some ever some noise signal in there so you introduce some unnecessary signal and the authors here claim well these weights you mask them because they were small and magnitude right so the optimal value for those weights"}, {"start": 1487.0, "end": 1508.0, "text": " seems to be close to 0 so by setting them to 0 the original algorithm lottery ticket algorithm basically freezes them at their optimal position and if you freeze them to any other position right away from 0 then that means the that means the"}, {"start": 1508.0, "end": 1535.0, "text": " you you have a less optimal configuration here and I can I can believe that I can follow that not fully convinced but I can follow so they they come up with a cool experiment what I think is that they they say for all the weights that we mask we're going to set the ones below this line to 0 and the ones above them to their initial value"}, {"start": 1535.0, "end": 1554.0, "text": " basically if a weight during training moved so a weight is let's say this is the magnitude and this is now the training steps if a weight started out here and during training moved up in magnitude"}, {"start": 1554.0, "end": 1577.0, "text": " but it's still it's still below the masking threshold right the masking threshold is here so it's not included in the ticket but it moved up will set it to its initial value but if it moved down so it's lower then will set it to 0 right so you have the an additional threshold of how it moves during training that's the line here"}, {"start": 1577.0, "end": 1596.0, "text": " you can see this here and that often performs better than the original ticket algorithm not much and it mainly tends to be in the in the regions where you really have low weights"}, {"start": 1596.0, "end": 1613.0, "text": " and then it come up with a further variant where they also do the same thing to the trainable weights so these trainable weights appear they do the same thing where they say okay we're going to set the ones that actually move down to during training"}, {"start": 1613.0, "end": 1632.0, "text": " now these are going to be very few ones but some of them are going to move down during training but they don't don't go below the threshold we're going to set the ones to 0 those ones because they were too high initially and that performs even better sometimes"}, {"start": 1632.0, "end": 1647.0, "text": " and again I don't I don't see this as a an algorithm where it's set to 0 or set I it's simply because you were again setting something closer to its optimal value"}, {"start": 1647.0, "end": 1667.0, "text": " during training if a weight that is trainable during training sorry went down a bit that means that its optimal value is lower than it originally was and it can just be that by setting it to 0 you were actually"}, {"start": 1667.0, "end": 1682.0, "text": " you're doing it sorry by setting it to 0 you end up at a point that is closer in magnitude sorry to the optimal value than at the initial point"}, {"start": 1682.0, "end": 1704.0, "text": " so I think my comment here is that a lot of these things I think are a bit overinterpreted by the authors and ultimately it's it's just about getting the weights close to where they where their optimal value is either at the beginning or at the end of the training"}, {"start": 1704.0, "end": 1722.0, "text": " and I think the original lottery ticket paper already did a good job analyzing that right the last section here they call super masks and now super masks are is is a is a thing where they say"}, {"start": 1722.0, "end": 1745.0, "text": " hey if we have a mask can't we just apply this to the original untrained network and how will the network perform when we do that now if you simply take a network with random weights on let's say on M"}, {"start": 1745.0, "end": 1758.0, "text": " this you have a 10% chance because there are 10 classes right so it will perform at 10% accuracy if you randomly mask a bunch of weights then again you'll stay at 10%"}, {"start": 1758.0, "end": 1771.0, "text": " but if you apply the mask the large final mask you will already get some accuracy really interesting so without training just by applying the mask you'll get some accuracy"}, {"start": 1771.0, "end": 1789.0, "text": " and again we can interpret this by simply the fact that the masking action it will mask weights that are not part of the winning ticket it will retain weights that are part of the winning ticket weights tend to not move that much by SGD"}, {"start": 1789.0, "end": 1803.0, "text": " so basically the mask network is a closer at a place closer to its optimal value than the unmasked network and therefore it will perform better"}, {"start": 1803.0, "end": 1829.0, "text": " so I think their findings are fairly easy to interpret here and the last thing that is they say can we optimize these masks can we train the mask now rather than basically just training the network full determining the mask from there can we now take that mask and further optimize it and they do basically a"}, {"start": 1829.0, "end": 1846.0, "text": " they optimize this mask by SGD of course you have to make it continuous during training to do that but what you end up with is a binary mask and they say here that it works better than the original mask"}, {"start": 1846.0, "end": 1875.0, "text": " so interestingly interestingly the if you apply the mask of the lottery ticket just at the beginning of training without training the network you can see here that it already reaches whatever 40% accuracy on MNIST and it also reaches non negligible accuracy on C for 10 so 20%"}, {"start": 1875.0, "end": 1895.0, "text": " if you do a special thing where you also look see that the sign agrees so if the final and the original weight have the same sign then you get a much higher performance in this again this is the untrained network"}, {"start": 1895.0, "end": 1923.0, "text": " and they also do this at constant values for the same sign so the same as we saw before and again they make this big deal about the sign here I really think this is just because you're closer to the optimum when you do when you match the sign but that's just my opinion and then if they train the mask they get even higher so you see here you get even higher performance"}, {"start": 1923.0, "end": 1951.0, "text": " and this is the top is on MNIST and the bottom is on C for 10 so if you train the mask if you if you just apply the mask you get non random performance better than random if you look that the mask also agrees with the signs so that you have a sign criterion where you say I'm only going to take the initial weights into the mask if they have the same sign as the end weights"}, {"start": 1951.0, "end": 1966.0, "text": " then you get a better performing so initial sub network and if you train the mask again you've never trained the weights you just train the mask you can get an even better performance"}, {"start": 1966.0, "end": 1993.0, "text": " and I mean that's somewhat not surprising because now you train the mask and yeah so I don't think that's too surprising but what you can see here is that the effect on MNIST is appears to be very high between these two"}, {"start": 1993.0, "end": 2006.0, "text": " and the effect on C for 10 seems to be different it seems to be low between these two and then high between these two so I wonder if there's a big dependence on the actual task here"}, {"start": 2006.0, "end": 2016.0, "text": " they also use this dynamic weight rescaling which is basically a kind of a rescaling trick and then they put the following table"}, {"start": 2016.0, "end": 2038.0, "text": " so here you have the different networks and here you have the original trained weights the performance they reach on the task and here you have the performance that they reach after learned mask and dynamic weight rescaling"}, {"start": 2038.0, "end": 2048.0, "text": " and you can see here that the MNIST even outperforms the original trained weights simply by learning the mask"}, {"start": 2048.0, "end": 2063.0, "text": " now you can also see that on C for 10 this effect is not present and I've already seen a paper that states that on like Resnets and ImageNet the lottery ticket hypothesis isn't really measurable"}, {"start": 2063.0, "end": 2081.0, "text": " so I want to pose another hypothesis here and the hypothesis is the following that you may find these winning tickets that are performing well at initialization or being trained well if the task is sufficiently easy"}, {"start": 2081.0, "end": 2096.0, "text": " the more you can basically do with it and you can already basically MNIST is so easy that you simply have to mask out some of the initial weights and you will already perform extremely well"}, {"start": 2096.0, "end": 2110.0, "text": " where C for 10 is harder ImageNet is harder again and I believe as the tasks get harder and harder these methods will work less and less to the point where they don't work anymore"}, {"start": 2110.0, "end": 2134.0, "text": " that's my opinion so basically my opinion is it appears to be very much about how close you are to some kind of initial lottery ticket and I think the experiments here are very cool or very well designed but I think they're often a bit overinterpreted"}, {"start": 2134.0, "end": 2140.0, "text": " alright that was it for me I invite you to check out the paper and bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=h9w3KffPPmQ | [Rant] Online Conferences | Are virtual conferences good or bad? What's missing? How do we go forward?
Pictures from here:
https://twitter.com/srush_nlp/status/1253786329575538691
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 | Hey machine learners, young Ikea. Okay, that is stolen. Today I want to give some quick thoughts about online conferences. As you might know, I clear this year is fully online because of the global situation. Big props to the organizers of the conference for putting something together in this short amount of time. Ikea is one of the largest machine learning conferences and if you're not registered, you don't get access to that website right now. So today I'll just talk about things that are public and we'll do like analysis of what happened when the materials are actually released. If you want to run an online conference, there are basically two things you need to take care of. Actually three, one of them is networking but it's going to be online. We're going to have to sacrifice that. I know there are efforts but that's be real. So there are paper presentations and there are things like talks, panels, workshops and so on. For the papers in Ikea, what they have is their website and you can kind of click on each of the papers you get to a sub page and you'll find a video that the authors have loaded which is about five minutes long. You'll get the abstract and the reviews directly there from open review and during the poster sessions, you'll have a chat window where you can chat with the authors and so so people can come there and kind of chat about the paper at a given time. What people have pointed out here in the I agree is that watching a five minute video, often you need like two or three minutes of that video to even see whether you're interested in the paper which is much longer than you would have at a poster. At a poster you could clearly see people say they just open the PDF and just kind of gloss over it and that takes 30 seconds to decide whether or not you're interested. If I were to suggest an improvement it would be also have the authors upload a poster. So at a glance you'll be able to see what interests you right. For the talks and the panels, the talks are pre-recorded and then there is a question and answer session that is live. The questions are voted beforehand and then the most voted questions I believe will be answered in a live session by either the talk giver or the panel discussionists. That is the conference but what are we doing here? I kind of think it's a paradoxical thing to take the live conference and just try to map it as closely as possible to online. Look at these paper poster, poster sessions right. It is cool that you have all this but now I have to go at that particular time to chat with the authors and this is in competition to everything else that's happening at the same time right. So there will be a hundred papers that are presented in a given session and now I can go to this one and chat here but I'll miss the chat over there. Of course I can read it later but the only reason that is in the live conference is because everyone is just there for one week right that's about the span you can hold people in one place. So you need to cram things at the same time so you're at the poster session. You will miss this poster if you go to this poster right. You just don't have time but online we're not constrained by this. So why are we doing this at the same time? Why aren't we doing this asynchronously? We actually have a perfect system for doing things like this. It's called YouTube. You publish a paper, you can make it, you can be five minutes, it can be 30 minutes. You put it on YouTube, you link to your paper, your abstract and your reviews can put them in the description and then okay there's no live chat but there is a comment section. I appreciate it. Thank you. But we have a perfectly fine system for that to do this in an asynchronous way. I don't see the benefit of having really this live chat and the talks and the panels, the same thing. You already have pre-recorded talks. What are you doing? Having them compete with other things at the same time. Okay I'm going to go to this workshop but this one's happening too. Right now I have to go in this line because everything needs to be crammed into this one week. It just seems to make no sense. For example, on our channel machine learning street talk we have guests on and we'll read it threads to ask people which questions would they like the authors or the people that we have on to answer and people up and down vote the questions and then we have a panel discussion. We can't even do this live right on YouTube and then record it and it will be almost the same experience because let's be honest if Yoshua Benjo is in a panel in a live conference you'll be lucky to even get a single question and it will almost never happen that you'll get a follow up question because you're right there live. It's just not something that is really happening. I think the main advantage of these live conferences is the fact that you're there. If you go to a post-recession the face-to-face interaction is something very different from a chat window you can kind of see what the author is thinking in real time. You can ask them questions so in writing you can always wease a lot of difficult questions or so. Yeah so it seems like you lose all the benefits of the live conference but if you do it in this way you retain all the bad sides namely the crowdedness, different things competing at the same time, entry fees. I get it. I don't know if it's a myth when the car was first invented. It still had the police to pull the horse because people were just used to horseboggies and not cars. It seems like we're doing the same thing with online conferences. You were just so used to the live conferences that we don't see the mega possibilities that we have online. Please provide thoughts on online conferences. If you agree, disagree, leave a comment and maybe in the future we'll go to true online conferences. A. Synchronous. Thank you for being here and bye bye. | [{"start": 0.0, "end": 3.68, "text": " Hey machine learners, young Ikea."}, {"start": 3.68, "end": 5.4, "text": " Okay, that is stolen."}, {"start": 5.4, "end": 9.68, "text": " Today I want to give some quick thoughts about online conferences."}, {"start": 9.68, "end": 15.92, "text": " As you might know, I clear this year is fully online because of the global situation."}, {"start": 15.92, "end": 20.96, "text": " Big props to the organizers of the conference for putting something together in this short"}, {"start": 20.96, "end": 22.48, "text": " amount of time."}, {"start": 22.48, "end": 27.72, "text": " Ikea is one of the largest machine learning conferences and if you're not registered,"}, {"start": 27.72, "end": 30.2, "text": " you don't get access to that website right now."}, {"start": 30.2, "end": 35.24, "text": " So today I'll just talk about things that are public and we'll do like analysis of what"}, {"start": 35.24, "end": 38.239999999999995, "text": " happened when the materials are actually released."}, {"start": 38.239999999999995, "end": 42.56, "text": " If you want to run an online conference, there are basically two things you need to take"}, {"start": 42.56, "end": 43.56, "text": " care of."}, {"start": 43.56, "end": 47.519999999999996, "text": " Actually three, one of them is networking but it's going to be online."}, {"start": 47.519999999999996, "end": 49.0, "text": " We're going to have to sacrifice that."}, {"start": 49.0, "end": 52.36, "text": " I know there are efforts but that's be real."}, {"start": 52.36, "end": 57.599999999999994, "text": " So there are paper presentations and there are things like talks, panels, workshops and"}, {"start": 57.6, "end": 58.6, "text": " so on."}, {"start": 58.6, "end": 64.0, "text": " For the papers in Ikea, what they have is their website and you can kind of click on"}, {"start": 64.0, "end": 68.48, "text": " each of the papers you get to a sub page and you'll find a video that the authors have"}, {"start": 68.48, "end": 70.8, "text": " loaded which is about five minutes long."}, {"start": 70.8, "end": 78.36, "text": " You'll get the abstract and the reviews directly there from open review and during the poster"}, {"start": 78.36, "end": 84.52000000000001, "text": " sessions, you'll have a chat window where you can chat with the authors and so so people"}, {"start": 84.52, "end": 88.64, "text": " can come there and kind of chat about the paper at a given time."}, {"start": 88.64, "end": 93.16, "text": " What people have pointed out here in the I agree is that watching a five minute video,"}, {"start": 93.16, "end": 97.96, "text": " often you need like two or three minutes of that video to even see whether you're interested"}, {"start": 97.96, "end": 101.52, "text": " in the paper which is much longer than you would have at a poster."}, {"start": 101.52, "end": 106.88, "text": " At a poster you could clearly see people say they just open the PDF and just kind of gloss"}, {"start": 106.88, "end": 110.67999999999999, "text": " over it and that takes 30 seconds to decide whether or not you're interested."}, {"start": 110.68, "end": 117.4, "text": " If I were to suggest an improvement it would be also have the authors upload a poster."}, {"start": 117.4, "end": 121.04, "text": " So at a glance you'll be able to see what interests you right."}, {"start": 121.04, "end": 127.92000000000002, "text": " For the talks and the panels, the talks are pre-recorded and then there is a question and answer"}, {"start": 127.92000000000002, "end": 129.16, "text": " session that is live."}, {"start": 129.16, "end": 136.12, "text": " The questions are voted beforehand and then the most voted questions I believe will be"}, {"start": 136.12, "end": 144.0, "text": " answered in a live session by either the talk giver or the panel discussionists."}, {"start": 144.0, "end": 147.08, "text": " That is the conference but what are we doing here?"}, {"start": 147.08, "end": 153.96, "text": " I kind of think it's a paradoxical thing to take the live conference and just try to"}, {"start": 153.96, "end": 157.52, "text": " map it as closely as possible to online."}, {"start": 157.52, "end": 161.64000000000001, "text": " Look at these paper poster, poster sessions right."}, {"start": 161.64, "end": 168.16, "text": " It is cool that you have all this but now I have to go at that particular time to chat"}, {"start": 168.16, "end": 173.04, "text": " with the authors and this is in competition to everything else that's happening at the"}, {"start": 173.04, "end": 174.04, "text": " same time right."}, {"start": 174.04, "end": 178.72, "text": " So there will be a hundred papers that are presented in a given session and now I can go to"}, {"start": 178.72, "end": 181.56, "text": " this one and chat here but I'll miss the chat over there."}, {"start": 181.56, "end": 187.07999999999998, "text": " Of course I can read it later but the only reason that is in the live conference is because"}, {"start": 187.08, "end": 191.88000000000002, "text": " everyone is just there for one week right that's about the span you can hold people in"}, {"start": 191.88000000000002, "end": 192.88000000000002, "text": " one place."}, {"start": 192.88000000000002, "end": 197.44, "text": " So you need to cram things at the same time so you're at the poster session."}, {"start": 197.44, "end": 200.28, "text": " You will miss this poster if you go to this poster right."}, {"start": 200.28, "end": 203.84, "text": " You just don't have time but online we're not constrained by this."}, {"start": 203.84, "end": 206.92000000000002, "text": " So why are we doing this at the same time?"}, {"start": 206.92000000000002, "end": 209.12, "text": " Why aren't we doing this asynchronously?"}, {"start": 209.12, "end": 212.96, "text": " We actually have a perfect system for doing things like this."}, {"start": 212.96, "end": 214.76000000000002, "text": " It's called YouTube."}, {"start": 214.76, "end": 219.64, "text": " You publish a paper, you can make it, you can be five minutes, it can be 30 minutes."}, {"start": 219.64, "end": 224.35999999999999, "text": " You put it on YouTube, you link to your paper, your abstract and your reviews can put them"}, {"start": 224.35999999999999, "end": 230.48, "text": " in the description and then okay there's no live chat but there is a comment section."}, {"start": 230.48, "end": 231.48, "text": " I appreciate it."}, {"start": 231.48, "end": 232.48, "text": " Thank you."}, {"start": 232.48, "end": 236.48, "text": " But we have a perfectly fine system for that to do this in an asynchronous way."}, {"start": 236.48, "end": 243.44, "text": " I don't see the benefit of having really this live chat and the talks and the panels,"}, {"start": 243.44, "end": 244.44, "text": " the same thing."}, {"start": 244.44, "end": 246.92, "text": " You already have pre-recorded talks."}, {"start": 246.92, "end": 248.76, "text": " What are you doing?"}, {"start": 248.76, "end": 252.04, "text": " Having them compete with other things at the same time."}, {"start": 252.04, "end": 255.64, "text": " Okay I'm going to go to this workshop but this one's happening too."}, {"start": 255.64, "end": 260.68, "text": " Right now I have to go in this line because everything needs to be crammed into this one"}, {"start": 260.68, "end": 261.68, "text": " week."}, {"start": 261.68, "end": 263.8, "text": " It just seems to make no sense."}, {"start": 263.8, "end": 270.84, "text": " For example, on our channel machine learning street talk we have guests on and we'll"}, {"start": 270.84, "end": 277.76, "text": " read it threads to ask people which questions would they like the authors or the people that"}, {"start": 277.76, "end": 283.59999999999997, "text": " we have on to answer and people up and down vote the questions and then we have a panel"}, {"start": 283.59999999999997, "end": 284.59999999999997, "text": " discussion."}, {"start": 284.59999999999997, "end": 290.28, "text": " We can't even do this live right on YouTube and then record it and it will be almost"}, {"start": 290.28, "end": 297.12, "text": " the same experience because let's be honest if Yoshua Benjo is in a panel in a live conference"}, {"start": 297.12, "end": 303.28000000000003, "text": " you'll be lucky to even get a single question and it will almost never happen that you'll"}, {"start": 303.28000000000003, "end": 308.44, "text": " get a follow up question because you're right there live."}, {"start": 308.44, "end": 311.2, "text": " It's just not something that is really happening."}, {"start": 311.2, "end": 316.8, "text": " I think the main advantage of these live conferences is the fact that you're there."}, {"start": 316.8, "end": 321.96, "text": " If you go to a post-recession the face-to-face interaction is something very different from"}, {"start": 321.96, "end": 327.4, "text": " a chat window you can kind of see what the author is thinking in real time."}, {"start": 327.4, "end": 333.08, "text": " You can ask them questions so in writing you can always wease a lot of difficult questions"}, {"start": 333.08, "end": 334.08, "text": " or so."}, {"start": 334.08, "end": 338.79999999999995, "text": " Yeah so it seems like you lose all the benefits of the live conference but if you do it"}, {"start": 338.79999999999995, "end": 345.03999999999996, "text": " in this way you retain all the bad sides namely the crowdedness, different things competing"}, {"start": 345.03999999999996, "end": 347.35999999999996, "text": " at the same time, entry fees."}, {"start": 347.35999999999996, "end": 348.35999999999996, "text": " I get it."}, {"start": 348.36, "end": 354.40000000000003, "text": " I don't know if it's a myth when the car was first invented."}, {"start": 354.40000000000003, "end": 368.56, "text": " It still had the police to pull the horse because people were just used to horseboggies and"}, {"start": 368.56, "end": 369.56, "text": " not cars."}, {"start": 369.56, "end": 372.64, "text": " It seems like we're doing the same thing with online conferences."}, {"start": 372.64, "end": 378.76, "text": " You were just so used to the live conferences that we don't see the mega possibilities that"}, {"start": 378.76, "end": 379.76, "text": " we have online."}, {"start": 379.76, "end": 382.24, "text": " Please provide thoughts on online conferences."}, {"start": 382.24, "end": 389.03999999999996, "text": " If you agree, disagree, leave a comment and maybe in the future we'll go to true online"}, {"start": 389.03999999999996, "end": 390.03999999999996, "text": " conferences."}, {"start": 390.03999999999996, "end": 391.03999999999996, "text": " A. Synchronous."}, {"start": 391.04, "end": 409.88, "text": " Thank you for being here and bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=fvctpYph8Pc | Do ImageNet Classifiers Generalize to ImageNet? (Paper Explained) | Has the world overfitted to ImageNet? What if we collect another dataset in exactly the same fashion? This paper gives a surprising answer!
Paper: https://arxiv.org/abs/1902.10811
Data: https://github.com/modestyachts/ImageNetV2
Abstract:
We build new test sets for the CIFAR-10 and ImageNet datasets. Both benchmarks have been the focus of intense research for almost a decade, raising the danger of overfitting to excessively re-used test sets. By closely following the original dataset creation processes, we test to what extent current classification models generalize to new data. We evaluate a broad range of models and find accuracy drops of 3% - 15% on CIFAR-10 and 11% - 14% on ImageNet. However, accuracy gains on the original test sets translate to larger gains on the new test sets. Our results suggest that the accuracy drops are not caused by adaptivity, but by the models' inability to generalize to slightly "harder" images than those found in the original test sets.
Authors: Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, Vaishaal Shankar
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 to do ImageNet classifiers generalized to ImageNet by Benjamin Rekt, Rebecca Rolofs, Ludwig Schmidt and Vaishal Shankar. So the premise of this paper is pretty simple. We've been training models on ImageNet now for a while, almost 10 years to be exact. ImageNet is this data set with a lot of images, millions of images, categorized into many thousands of categories. Now the classic part of ImageNet that people know is that has about 1.5 million images in 1,000 different classes. And this ImageNet was one of the main data sets now, or has been for the last few years. And as you can see on the right here, the error rate year after year was pretty much, I think, cut in half every year since 2012, when the first net, AlexNet was using deep learning instead of the classical visual computer vision approaches. So we've been training on ImageNet for a while, and the idea or the question this paper asks if we collect a second test set, right? So for ImageNet, we have a train and a test set. If we now collect a second test set here, test V2, right? If we have a model that was trained on training here and evaluated on test, does it also perform well on this second test set, right? The idea of this being that maybe over the years, we've tuned our hyper parameters in all such that the model is performed well on that particular test set. Let's call this V1, right? And it might not be as successful on a new test set. So this paper goes about collecting a test set to ImageNet in exactly the way that the V1 test set was collected, right? So they try to match exactly the process of how V1 was collected to create another test set, and then they evaluate models on that new test set. They do this not only for ImageNet, but also for C410, which is a much smaller data set, but also a lot of computer vision algorithms are evaluated on C410. So let's just put up a hypothesis here. The hypothesis is that we have pretty much overfitted to ImageNet by now. This is a very prestigious number to get if you have state of the art on ImageNet, and therefore tuning your hyper parameters and your learning rate and everything such that it performs well on the test set, V1 is very likely. So this paper has the most important plots are like this. It has two axes, and on the bottom axis is the performance on V1, right? And so performance. That means accuracy, basically, so accuracy. And on line two is V2 accuracy. Now here is one, here is zero. This line here means that if a model is performing 50% accuracy on V1, it is also performing 50% accuracy on V2. So being on this line would basically mean we have not overfitted and the model is performing equally well on both sets. So what now if we assume that we have overfitted? If we have overfitted, we would assume that the models that perform really poorly might also, they perform kind of, they're not really overfitted, but over the years, as we've gotten better on V1, we stray away from this. So we get better on V1, but we don't really get better on V2, right? And that means we've overfitted to V1, and this might even go down, right? The more kind of we might overfit to V1, the worse we're actually going to get on V2. So this is kind of a meta overfitting. So this is what we would expect if we overfit, right? Overfit to V1. And I think this was the initial hypothesis behind the people that ran this experiment to check, can we see an effect like this or is the effect more a continuous one where we don't overfit? And what they found was neither. And these are basically these interesting plots here. So again, the dashed line here would be the not overfitting line. So what they find, if you, for example, look at ImageNet, every dot here is a model, right? So this model right here is performing with like a 67% accuracy on V1, and it is performing with something like a 53% accuracy on V2. If you look at this line here, what that means is every model kind of drops by about this much, right? So not only not, we don't see this and we don't see this, but we see this line is shifted down. And if you look closely, especially in C410, you can see the line rather than being tilted like this is actually tilted a bit, slanted upwards, right? So the angle is not, is higher, is greater, the slope is greater than the one to one slope. This is extremely interesting. If you think about what does that mean? It means that if you take a model, right, right here. If you look at its order, it's, it's a, this, let's look at this model here. This model is number one, best model in the world, right? It will still be number one on V2. This model here is number number three, rank three on V1. It will also be rank three on V2, right? So the order of models is pretty much constant. So if a model was doing well on V1, it is also doing well on V2 in relation to other models. But every model experiences this drop in, in accuracy. And the most interesting part is that, and again, you can see this more here. The, the better you're doing, the smaller this drop gets, right? This drop here is smaller than this drop here. This is exactly counter to the notion of overfitting, where it seems the more accurate you get on V1, the more you're able to close this gap between V1 and V2. And if you extrapolate here, you might as well think that once we are at, or actually, 100% is already here. If you could go higher, maybe, or maybe you can see here that in the end, the, these will actually converge. But nevertheless, if the models that are doing better on V1 aren't only not overfit, but they are actually experienced less of a drop with regards to a new test set. So they generalize better to the new test set than the, the worst models, right? And, and that is crazy. And it is not only neural networks, right? So up here, for, you up here, you have the, the deep neural networks and whatnot. But you can also go with, I believe some of these, or even further down here, are canierous neighbor, sorry, canierous neighbor classifiers and things like this. So it doesn't seem to be a property of neural networks. It really seems to be a property of the data set. And this paper, first of all, goes over how they collected these. And second of all, their hypotheses and investigations into why this phenomenon exists. Why we are all of a sudden worse on the new test set, but completely worse in a different way than we expected compared to the original test set. All right, so they first say potential causes of accuracy drops. And they propose a model. They say here are two, here is the entire difference between two data sets with regards to a classifier. It can be decomposed into three different gaps. And you see the first and the last part here are the ones from the left side. So this is an expanding sum in the middle. So there is the generalization gap. The generalization gap refers to the gap that you have between different data sets of the same distribution. So this is like you know from the train versus test set. You train on the training set and then you have a generalization gap to the test set. In this case, the generalization gap simply refers to the difference between the generalization to the first and to the second set. They argue that this isn't really an issue here because the they say the confidence they can put up confidence intervals. So if those were identically distributed, how much would the generalization gap be at maximum given some kind of confidence interval, 95% confidence interval would only give you plus minus a 1% difference in generalization gap. So they rule out that this is the reason for the big discrepancy. Then have two others. They have the adaptivity gap and the distribution gap. So the adaptivity gap is what we hypothesized at the beginning. It is the overfitting to the first data set or to one of the two data sets. So if you have a big adaptivity gap, then you have fitted much more to one than to the other data set. Now because of the shape of the curve, being the way it is, they also rule out the adaptivity gap and we went over why, right? Because it would look completely different than it does. Now the only thing remaining here is this distribution gap. So they explain that this difference here most likely comes from the fact that the old and the new test set have a different distribution and they go into why that is. And I'm going to compress their hypothesis of why that is into a short summary. Let's say we won't go over the entire paper. They basically say that the mechanical Turk has a mechanical Turk part of the processing pipeline has a very big influence. So what happens when you collect an image net test that you start with Flickr? This is a big image database. And the images as far as I can understand, they are tagged and you can search for them and so on. They start by going to Flickr and searching for images. And their ground truth class labels come, you may know this from a system called word net. And word net is sort of a linguistic classification of words into groups. So it would have hierarchically would have animals, animal being a word and then below animal, it would have dog and then it would have terrier. And it would have these hierarchical groupings of these words. And they search on Flickr for images and then they put the images to a human rater. So the human rater in on a system called mechanical Turk, you may know it's that you can just sign up there and do these kind of tasks. They present the human with a grid of images and a class terrier. And they say, please select all the images where a terrier appears. So the human might select this, this, this, and this one. And that will give you what they call a selection frequency. So selection frequency. So how often was a particular image selected given that class? And of course, the higher. So you do this over many, sorry, the selection frequency is across many of these mechanical Turk workers. So if for a given image, the selection frequency is high, let's say going towards 1.0, that means every single human selected that image to be in this class. So you can be pretty sure it's in the class. If it goes towards zero, then you can be pretty sure it's not in the class. And this selection frequency. Criterium, the paper thinks that this is the main criterion why the data sets are of different of different difficulties, let's say, because even though they try to match the process exactly, even what the questions they post to the Turk workers, they even restricted their flicker date range to the date range where the original image net was collected. They still think that there is a difference in how the mechanical Turk workers basically rated the images or then after that, how they were selected using this selection frequency. So what they do is they do different, they select different images depending on criteria so they can test these hypotheses. Their original V2 test set is called matched frequency. Now what you do in matched frequency is you kind of play a little game. What you do is every now and then you will implant an image here of the V1 test set. So thereby of the V1 test set, either of this class or another class. So you can kind of do a quality control. And from this you can now find out what is the selection frequency of images in the V1 class for terrier. And then you can simply select the same one in the V2. So if you know the selection frequency for V1 was 0.8, you can just put the threshold here at 0.8 and you know you can be reasonably sure that you have selected a similar difficulty. Or so you would think, right? So if they do it like this, then they get this drop that you saw at the beginning. They also do this threshold 0.7 which I guess is arbitrary ish. And then they also say top images where they say for each class we chose the 10 images with the highest selection frequency. So these would be the sort of easiest ones. And if you look at the graphs, and this is image net for these different data sets, so if you do the threshold 0.7 that they selected. Now the old line was somewhere here. Now the new line is much closer. You see that here. And if you do these top images, so you just select the easy ones, the new line is actually above. Right? This is now note that the red line here is above the black line. Well here it's below. It is still extremely interesting that still there is this almost linear relationship between the V1 and V2 accuracies. And even here on this easier data set there is. So they basically hypothesize by thresholding differently for the new data set. You can you have a very good grip on the difficulty of the new data set. So this process of matching the selection frequency, so this matched frequency data set, it might actually not result in the same difficulty in data set. They do have some more experiments where they experiment with different different difficulties. So let's actually jump down there. It's a bit of a jump because there are over 70 pages in this paper. The appendix has its own content directory. That's how crazy that is. But I want to show you these plots. So here what they do is they do different bins of the of this set. So they have bins of easy samples, less easy samples and so on. And you can see that you have a pretty good grip on this where this line is. So if you only take the easy samples you're up here and this is what we saw before. If this is the old line, it's the red line, right? If you take the entire new test set, if you just take bin the second hardest bin you're somewhere here or here or here. So you have a good hold on where this line is. But it still doesn't explain that if you try to follow the protocol exactly, why does the accuracy drop that that is still a mystery. Even though they say here is a variable that influences this a lot. If they try to set the variable as it was set in V1, it is not equal. So still mystery remains, I would say. So the last thing they do is they try to to just come up with a model for this. So they had both this is now is that the new test set just is harder. And they have a analytical kind of a formal model of why if you assume certain things, this results in this line, right? The really interesting thing about the paper is that the the accuracies they all fall exactly on this line. There's this linear relationship, especially they say if you do like probits scaling of accuracies, there's this line. So they put up a model where you say what if we assume that each example I has a difficulty right? It's just a number, how difficult it is. And each model J has a probability of correctly classifying an image with difficulty tau here given by this function. So this here is the probability that the model will classify an image correctly giving that it's tau hard. And so this is an increasing function and they put up this following parameterization. This is the CDF of the so they put up a model for this function now, right? For this they say if we assume that it is like this that each model has a sort of a skill number. So each model has a skill and each image has a difficulty that is tau. If we if the skill is higher than the tau, probably it will classify correctly. If the skill is lower, probably then this number is negative, it will classify it incorrectly. So this is the CDF of a normal distribution. It goes something like this, right? and if the zero point is here. So if this number here is zero, it's like 50, 50, whether it will classify it correctly. So if you assume this and you assume a bunch of other Gaussian error distributions, then the the difficult, sorry, the performance of a model on the test set V2 is exactly the performance of the model under test set V1 times this scalar here plus this scalar here, which is a linear relationship. So they put up a model for for this. Of course, it doesn't explain anything, right? This doesn't explain the phenomena, but they it still gives a clue of why the linear relationship here might result from the test sets having a different difficulty setting or a different difficulty properties. So they go on after discussing related work, they go on to say what can one do and um, suggestions for future research, I especially like the super hold out. So if you ever make a data set, um, if you ever make a data set, then make a super hold out set. And once you're like almost out of your career, just come up with it and say, oh, I have this lost data set here that I made way back. It will be fantastic. Um, all right. So I think this paper is very interesting and I think everyone that sees and reads this comes up with their own hypotheses of why this is and what's going on here. They have investigated a lot of this, especially I want to highlight an experiment where they take part of V2 here. So they split this one into a train and a test, sorry, train and a test and they put this and this training together into like a super train, right? So so you train on both things together and they see whether it improves at this test set, right? You would think that if you put this training in there, that it would improve and it does improve, but it improves by like a miniscule amount. So they've done a whole bunch of experiments like this to investigate what's going on. This is all in this 70 page appendix that you can go over. Right. That was what I had to say for this paper. If you like this video, consider subscribing and comment whatever you think. I usually answer or like or read most comments. Thanks for listening. Bye bye. | [{"start": 0.0, "end": 5.8, "text": " Hi there, today we're looking at to do ImageNet classifiers generalized to ImageNet by Benjamin"}, {"start": 5.8, "end": 10.68, "text": " Rekt, Rebecca Rolofs, Ludwig Schmidt and Vaishal Shankar."}, {"start": 10.68, "end": 13.56, "text": " So the premise of this paper is pretty simple."}, {"start": 13.56, "end": 20.12, "text": " We've been training models on ImageNet now for a while, almost 10 years to be exact."}, {"start": 20.12, "end": 27.54, "text": " ImageNet is this data set with a lot of images, millions of images, categorized into many"}, {"start": 27.54, "end": 33.1, "text": " thousands of categories. Now the classic part of ImageNet that people know is that has"}, {"start": 33.1, "end": 38.62, "text": " about 1.5 million images in 1,000 different classes."}, {"start": 38.62, "end": 46.42, "text": " And this ImageNet was one of the main data sets now, or has been for the last few years."}, {"start": 46.42, "end": 53.14, "text": " And as you can see on the right here, the error rate year after year was pretty much,"}, {"start": 53.14, "end": 61.1, "text": " I think, cut in half every year since 2012, when the first net, AlexNet was using deep learning"}, {"start": 61.1, "end": 66.46000000000001, "text": " instead of the classical visual computer vision approaches."}, {"start": 66.46000000000001, "end": 72.98, "text": " So we've been training on ImageNet for a while, and the idea or the question this paper"}, {"start": 72.98, "end": 79.18, "text": " asks if we collect a second test set, right?"}, {"start": 79.18, "end": 84.66000000000001, "text": " So for ImageNet, we have a train and a test set."}, {"start": 84.66000000000001, "end": 92.62, "text": " If we now collect a second test set here, test V2, right?"}, {"start": 92.62, "end": 98.94000000000001, "text": " If we have a model that was trained on training here and evaluated on test, does it also perform"}, {"start": 98.94000000000001, "end": 103.66000000000001, "text": " well on this second test set, right?"}, {"start": 103.66, "end": 111.17999999999999, "text": " The idea of this being that maybe over the years, we've tuned our hyper parameters in all"}, {"start": 111.17999999999999, "end": 114.89999999999999, "text": " such that the model is performed well on that particular test set."}, {"start": 114.89999999999999, "end": 117.62, "text": " Let's call this V1, right?"}, {"start": 117.62, "end": 123.58, "text": " And it might not be as successful on a new test set."}, {"start": 123.58, "end": 130.3, "text": " So this paper goes about collecting a test set to ImageNet in exactly the way that the"}, {"start": 130.3, "end": 133.42, "text": " V1 test set was collected, right?"}, {"start": 133.42, "end": 139.78, "text": " So they try to match exactly the process of how V1 was collected to create another test"}, {"start": 139.78, "end": 144.17999999999998, "text": " set, and then they evaluate models on that new test set."}, {"start": 144.17999999999998, "end": 150.14, "text": " They do this not only for ImageNet, but also for C410, which is a much smaller data set,"}, {"start": 150.14, "end": 155.98, "text": " but also a lot of computer vision algorithms are evaluated on C410."}, {"start": 155.98, "end": 159.17999999999998, "text": " So let's just put up a hypothesis here."}, {"start": 159.18, "end": 164.82, "text": " The hypothesis is that we have pretty much overfitted to ImageNet by now."}, {"start": 164.82, "end": 171.58, "text": " This is a very prestigious number to get if you have state of the art on ImageNet, and therefore"}, {"start": 171.58, "end": 175.5, "text": " tuning your hyper parameters and your learning rate and everything such that it performs"}, {"start": 175.5, "end": 179.3, "text": " well on the test set, V1 is very likely."}, {"start": 179.3, "end": 183.38, "text": " So this paper has the most important plots are like this."}, {"start": 183.38, "end": 188.9, "text": " It has two axes, and on the bottom axis is the performance on V1, right?"}, {"start": 188.9, "end": 192.70000000000002, "text": " And so performance."}, {"start": 192.70000000000002, "end": 196.3, "text": " That means accuracy, basically, so accuracy."}, {"start": 196.3, "end": 200.54000000000002, "text": " And on line two is V2 accuracy."}, {"start": 200.54000000000002, "end": 206.38, "text": " Now here is one, here is zero."}, {"start": 206.38, "end": 215.78, "text": " This line here means that if a model is performing 50% accuracy on V1, it is also performing"}, {"start": 215.78, "end": 218.22, "text": " 50% accuracy on V2."}, {"start": 218.22, "end": 224.34, "text": " So being on this line would basically mean we have not overfitted and the model is performing"}, {"start": 224.34, "end": 228.26, "text": " equally well on both sets."}, {"start": 228.26, "end": 233.22, "text": " So what now if we assume that we have overfitted?"}, {"start": 233.22, "end": 238.66, "text": " If we have overfitted, we would assume that the models that perform really poorly might"}, {"start": 238.66, "end": 243.66, "text": " also, they perform kind of, they're not really overfitted, but over the years, as we've"}, {"start": 243.66, "end": 248.34, "text": " gotten better on V1, we stray away from this."}, {"start": 248.34, "end": 253.57999999999998, "text": " So we get better on V1, but we don't really get better on V2, right?"}, {"start": 253.57999999999998, "end": 258.26, "text": " And that means we've overfitted to V1, and this might even go down, right?"}, {"start": 258.26, "end": 266.62, "text": " The more kind of we might overfit to V1, the worse we're actually going to get on V2."}, {"start": 266.62, "end": 270.1, "text": " So this is kind of a meta overfitting."}, {"start": 270.1, "end": 274.26000000000005, "text": " So this is what we would expect if we overfit, right?"}, {"start": 274.26000000000005, "end": 279.1, "text": " Overfit to V1."}, {"start": 279.1, "end": 283.78000000000003, "text": " And I think this was the initial hypothesis behind the people that ran this experiment to"}, {"start": 283.78000000000003, "end": 292.18, "text": " check, can we see an effect like this or is the effect more a continuous one where we"}, {"start": 292.18, "end": 294.1, "text": " don't overfit?"}, {"start": 294.1, "end": 296.78000000000003, "text": " And what they found was neither."}, {"start": 296.78, "end": 300.29999999999995, "text": " And these are basically these interesting plots here."}, {"start": 300.29999999999995, "end": 305.34, "text": " So again, the dashed line here would be the not overfitting line."}, {"start": 305.34, "end": 311.21999999999997, "text": " So what they find, if you, for example, look at ImageNet, every dot here is a model, right?"}, {"start": 311.21999999999997, "end": 319.73999999999995, "text": " So this model right here is performing with like a 67% accuracy on V1, and it is performing"}, {"start": 319.73999999999995, "end": 323.78, "text": " with something like a 53% accuracy on V2."}, {"start": 323.78, "end": 332.38, "text": " If you look at this line here, what that means is every model kind of drops by about this"}, {"start": 332.38, "end": 335.21999999999997, "text": " much, right?"}, {"start": 335.21999999999997, "end": 343.65999999999997, "text": " So not only not, we don't see this and we don't see this, but we see this line is shifted"}, {"start": 343.65999999999997, "end": 344.65999999999997, "text": " down."}, {"start": 344.65999999999997, "end": 349.5, "text": " And if you look closely, especially in C410, you can see the line rather than being tilted"}, {"start": 349.5, "end": 354.38, "text": " like this is actually tilted a bit, slanted upwards, right?"}, {"start": 354.38, "end": 363.18, "text": " So the angle is not, is higher, is greater, the slope is greater than the one to one slope."}, {"start": 363.18, "end": 365.86, "text": " This is extremely interesting."}, {"start": 365.86, "end": 368.82, "text": " If you think about what does that mean?"}, {"start": 368.82, "end": 378.34, "text": " It means that if you take a model, right, right here."}, {"start": 378.34, "end": 385.06, "text": " If you look at its order, it's, it's a, this, let's look at this model here."}, {"start": 385.06, "end": 388.82, "text": " This model is number one, best model in the world, right?"}, {"start": 388.82, "end": 392.65999999999997, "text": " It will still be number one on V2."}, {"start": 392.65999999999997, "end": 397.26, "text": " This model here is number number three, rank three on V1."}, {"start": 397.26, "end": 400.65999999999997, "text": " It will also be rank three on V2, right?"}, {"start": 400.65999999999997, "end": 404.05999999999995, "text": " So the order of models is pretty much constant."}, {"start": 404.06, "end": 411.44, "text": " So if a model was doing well on V1, it is also doing well on V2 in relation to other models."}, {"start": 411.44, "end": 418.62, "text": " But every model experiences this drop in, in accuracy."}, {"start": 418.62, "end": 426.38, "text": " And the most interesting part is that, and again, you can see this more here."}, {"start": 426.38, "end": 429.82, "text": " The, the better you're doing, the smaller this drop gets, right?"}, {"start": 429.82, "end": 433.5, "text": " This drop here is smaller than this drop here."}, {"start": 433.5, "end": 440.26, "text": " This is exactly counter to the notion of overfitting, where it seems the more accurate you"}, {"start": 440.26, "end": 447.34, "text": " get on V1, the more you're able to close this gap between V1 and V2."}, {"start": 447.34, "end": 454.46, "text": " And if you extrapolate here, you might as well think that once we are at, or actually,"}, {"start": 454.46, "end": 457.02, "text": " 100% is already here."}, {"start": 457.02, "end": 463.02, "text": " If you could go higher, maybe, or maybe you can see here that in the end, the, these"}, {"start": 463.02, "end": 464.46, "text": " will actually converge."}, {"start": 464.46, "end": 473.21999999999997, "text": " But nevertheless, if the models that are doing better on V1 aren't only not overfit,"}, {"start": 473.21999999999997, "end": 477.82, "text": " but they are actually experienced less of a drop with regards to a new test set."}, {"start": 477.82, "end": 485.21999999999997, "text": " So they generalize better to the new test set than the, the worst models, right?"}, {"start": 485.21999999999997, "end": 487.38, "text": " And, and that is crazy."}, {"start": 487.38, "end": 490.06, "text": " And it is not only neural networks, right?"}, {"start": 490.06, "end": 495.62, "text": " So up here, for, you up here, you have the, the deep neural networks and whatnot."}, {"start": 495.62, "end": 501.74, "text": " But you can also go with, I believe some of these, or even further down here, are canierous"}, {"start": 501.74, "end": 506.42, "text": " neighbor, sorry, canierous neighbor classifiers and things like this."}, {"start": 506.42, "end": 511.62, "text": " So it doesn't seem to be a property of neural networks."}, {"start": 511.62, "end": 514.26, "text": " It really seems to be a property of the data set."}, {"start": 514.26, "end": 520.42, "text": " And this paper, first of all, goes over how they collected these."}, {"start": 520.42, "end": 528.34, "text": " And second of all, their hypotheses and investigations into why this phenomenon exists."}, {"start": 528.34, "end": 537.58, "text": " Why we are all of a sudden worse on the new test set, but completely worse in a different"}, {"start": 537.58, "end": 543.14, "text": " way than we expected compared to the original test set."}, {"start": 543.14, "end": 552.26, "text": " All right, so they first say potential causes of accuracy drops."}, {"start": 552.26, "end": 554.98, "text": " And they propose a model."}, {"start": 554.98, "end": 563.86, "text": " They say here are two, here is the entire difference between two data sets with regards to a classifier."}, {"start": 563.86, "end": 567.42, "text": " It can be decomposed into three different gaps."}, {"start": 567.42, "end": 572.46, "text": " And you see the first and the last part here are the ones from the left side."}, {"start": 572.46, "end": 577.34, "text": " So this is an expanding sum in the middle."}, {"start": 577.34, "end": 579.6600000000001, "text": " So there is the generalization gap."}, {"start": 579.6600000000001, "end": 587.1800000000001, "text": " The generalization gap refers to the gap that you have between different data sets of"}, {"start": 587.1800000000001, "end": 588.98, "text": " the same distribution."}, {"start": 588.98, "end": 594.38, "text": " So this is like you know from the train versus test set."}, {"start": 594.38, "end": 599.3000000000001, "text": " You train on the training set and then you have a generalization gap to the test set."}, {"start": 599.3, "end": 606.4599999999999, "text": " In this case, the generalization gap simply refers to the difference between the generalization"}, {"start": 606.4599999999999, "end": 608.5, "text": " to the first and to the second set."}, {"start": 608.5, "end": 619.9, "text": " They argue that this isn't really an issue here because the they say the confidence they"}, {"start": 619.9, "end": 623.3, "text": " can put up confidence intervals."}, {"start": 623.3, "end": 629.9399999999999, "text": " So if those were identically distributed, how much would the generalization gap be at"}, {"start": 629.9399999999999, "end": 636.6999999999999, "text": " maximum given some kind of confidence interval, 95% confidence interval would only give you"}, {"start": 636.6999999999999, "end": 640.9, "text": " plus minus a 1% difference in generalization gap."}, {"start": 640.9, "end": 646.26, "text": " So they rule out that this is the reason for the big discrepancy."}, {"start": 646.26, "end": 647.26, "text": " Then have two others."}, {"start": 647.26, "end": 652.26, "text": " They have the adaptivity gap and the distribution gap."}, {"start": 652.26, "end": 657.74, "text": " So the adaptivity gap is what we hypothesized at the beginning."}, {"start": 657.74, "end": 664.26, "text": " It is the overfitting to the first data set or to one of the two data sets."}, {"start": 664.26, "end": 671.1, "text": " So if you have a big adaptivity gap, then you have fitted much more to one than to the"}, {"start": 671.1, "end": 673.98, "text": " other data set."}, {"start": 673.98, "end": 680.22, "text": " Now because of the shape of the curve, being the way it is, they also rule out the adaptivity"}, {"start": 680.22, "end": 684.78, "text": " gap and we went over why, right?"}, {"start": 684.78, "end": 688.74, "text": " Because it would look completely different than it does."}, {"start": 688.74, "end": 693.26, "text": " Now the only thing remaining here is this distribution gap."}, {"start": 693.26, "end": 701.0600000000001, "text": " So they explain that this difference here most likely comes from the fact that the old"}, {"start": 701.0600000000001, "end": 709.74, "text": " and the new test set have a different distribution and they go into why that is."}, {"start": 709.74, "end": 725.14, "text": " And I'm going to compress their hypothesis of why that is into a short summary."}, {"start": 725.14, "end": 733.26, "text": " Let's say we won't go over the entire paper."}, {"start": 733.26, "end": 741.3, "text": " They basically say that the mechanical Turk has a mechanical Turk part of the processing"}, {"start": 741.3, "end": 744.54, "text": " pipeline has a very big influence."}, {"start": 744.54, "end": 751.14, "text": " So what happens when you collect an image net test that you start with Flickr?"}, {"start": 751.14, "end": 753.62, "text": " This is a big image database."}, {"start": 753.62, "end": 759.38, "text": " And the images as far as I can understand, they are tagged and you can search for them and"}, {"start": 759.38, "end": 760.38, "text": " so on."}, {"start": 760.38, "end": 766.14, "text": " They start by going to Flickr and searching for images."}, {"start": 766.14, "end": 771.82, "text": " And their ground truth class labels come, you may know this from a system called word"}, {"start": 771.82, "end": 772.82, "text": " net."}, {"start": 772.82, "end": 778.66, "text": " And word net is sort of a linguistic classification of words into groups."}, {"start": 778.66, "end": 784.58, "text": " So it would have hierarchically would have animals, animal being a word and then below"}, {"start": 784.58, "end": 788.3, "text": " animal, it would have dog and then it would have terrier."}, {"start": 788.3, "end": 791.9799999999999, "text": " And it would have these hierarchical groupings of these words."}, {"start": 791.9799999999999, "end": 800.9399999999999, "text": " And they search on Flickr for images and then they put the images to a human rater."}, {"start": 800.9399999999999, "end": 806.9799999999999, "text": " So the human rater in on a system called mechanical Turk, you may know it's that you can just"}, {"start": 806.9799999999999, "end": 809.4599999999999, "text": " sign up there and do these kind of tasks."}, {"start": 809.4599999999999, "end": 817.5799999999999, "text": " They present the human with a grid of images and a class terrier."}, {"start": 817.58, "end": 822.7800000000001, "text": " And they say, please select all the images where a terrier appears."}, {"start": 822.7800000000001, "end": 828.0600000000001, "text": " So the human might select this, this, this, and this one."}, {"start": 828.0600000000001, "end": 832.58, "text": " And that will give you what they call a selection frequency."}, {"start": 832.58, "end": 837.26, "text": " So selection frequency."}, {"start": 837.26, "end": 843.6600000000001, "text": " So how often was a particular image selected given that class?"}, {"start": 843.6600000000001, "end": 845.1, "text": " And of course, the higher."}, {"start": 845.1, "end": 851.02, "text": " So you do this over many, sorry, the selection frequency is across many of these mechanical"}, {"start": 851.02, "end": 853.5, "text": " Turk workers."}, {"start": 853.5, "end": 859.9, "text": " So if for a given image, the selection frequency is high, let's say going towards 1.0, that"}, {"start": 859.9, "end": 866.14, "text": " means every single human selected that image to be in this class."}, {"start": 866.14, "end": 868.78, "text": " So you can be pretty sure it's in the class."}, {"start": 868.78, "end": 874.1, "text": " If it goes towards zero, then you can be pretty sure it's not in the class."}, {"start": 874.1, "end": 879.34, "text": " And this selection frequency."}, {"start": 879.34, "end": 887.94, "text": " Criterium, the paper thinks that this is the main criterion why the data sets are of different"}, {"start": 887.94, "end": 895.94, "text": " of different difficulties, let's say, because even though they try to match the process"}, {"start": 895.94, "end": 901.4200000000001, "text": " exactly, even what the questions they post to the Turk workers, they even restricted their"}, {"start": 901.42, "end": 908.3399999999999, "text": " flicker date range to the date range where the original image net was collected."}, {"start": 908.3399999999999, "end": 913.54, "text": " They still think that there is a difference in how the mechanical Turk workers basically"}, {"start": 913.54, "end": 921.66, "text": " rated the images or then after that, how they were selected using this selection frequency."}, {"start": 921.66, "end": 928.98, "text": " So what they do is they do different, they select different images depending on criteria"}, {"start": 928.98, "end": 931.54, "text": " so they can test these hypotheses."}, {"start": 931.54, "end": 935.7, "text": " Their original V2 test set is called matched frequency."}, {"start": 935.7, "end": 942.0600000000001, "text": " Now what you do in matched frequency is you kind of play a little game."}, {"start": 942.0600000000001, "end": 952.02, "text": " What you do is every now and then you will implant an image here of the V1 test set."}, {"start": 952.02, "end": 957.66, "text": " So thereby of the V1 test set, either of this class or another class."}, {"start": 957.66, "end": 960.62, "text": " So you can kind of do a quality control."}, {"start": 960.62, "end": 969.1, "text": " And from this you can now find out what is the selection frequency of images in the V1"}, {"start": 969.1, "end": 971.2199999999999, "text": " class for terrier."}, {"start": 971.2199999999999, "end": 977.8199999999999, "text": " And then you can simply select the same one in the V2."}, {"start": 977.8199999999999, "end": 984.42, "text": " So if you know the selection frequency for V1 was 0.8, you can just put the threshold"}, {"start": 984.42, "end": 993.9, "text": " here at 0.8 and you know you can be reasonably sure that you have selected a similar difficulty."}, {"start": 993.9, "end": 995.78, "text": " Or so you would think, right?"}, {"start": 995.78, "end": 1002.5799999999999, "text": " So if they do it like this, then they get this drop that you saw at the beginning."}, {"start": 1002.5799999999999, "end": 1010.62, "text": " They also do this threshold 0.7 which I guess is arbitrary ish."}, {"start": 1010.62, "end": 1018.22, "text": " And then they also say top images where they say for each class we chose the 10 images"}, {"start": 1018.22, "end": 1020.3, "text": " with the highest selection frequency."}, {"start": 1020.3, "end": 1027.5, "text": " So these would be the sort of easiest ones."}, {"start": 1027.5, "end": 1034.98, "text": " And if you look at the graphs, and this is image net for these different data sets,"}, {"start": 1034.98, "end": 1039.5, "text": " so if you do the threshold 0.7 that they selected."}, {"start": 1039.5, "end": 1043.5, "text": " Now the old line was somewhere here."}, {"start": 1043.5, "end": 1045.86, "text": " Now the new line is much closer."}, {"start": 1045.86, "end": 1047.78, "text": " You see that here."}, {"start": 1047.78, "end": 1054.3, "text": " And if you do these top images, so you just select the easy ones, the new line is actually"}, {"start": 1054.3, "end": 1055.3, "text": " above."}, {"start": 1055.3, "end": 1056.3, "text": " Right?"}, {"start": 1056.3, "end": 1061.66, "text": " This is now note that the red line here is above the black line."}, {"start": 1061.66, "end": 1064.34, "text": " Well here it's below."}, {"start": 1064.34, "end": 1073.1399999999999, "text": " It is still extremely interesting that still there is this almost linear relationship between"}, {"start": 1073.1399999999999, "end": 1075.98, "text": " the V1 and V2 accuracies."}, {"start": 1075.98, "end": 1079.54, "text": " And even here on this easier data set there is."}, {"start": 1079.54, "end": 1088.54, "text": " So they basically hypothesize by thresholding differently for the new data set."}, {"start": 1088.54, "end": 1096.54, "text": " You can you have a very good grip on the difficulty of the new data set."}, {"start": 1096.54, "end": 1102.3, "text": " So this process of matching the selection frequency, so this matched frequency data set,"}, {"start": 1102.3, "end": 1108.34, "text": " it might actually not result in the same difficulty in data set."}, {"start": 1108.34, "end": 1117.3799999999999, "text": " They do have some more experiments where they experiment with different different difficulties."}, {"start": 1117.38, "end": 1121.6200000000001, "text": " So let's actually jump down there."}, {"start": 1121.6200000000001, "end": 1127.7800000000002, "text": " It's a bit of a jump because there are over 70 pages in this paper."}, {"start": 1127.7800000000002, "end": 1132.8200000000002, "text": " The appendix has its own content directory."}, {"start": 1132.8200000000002, "end": 1136.2600000000002, "text": " That's how crazy that is."}, {"start": 1136.2600000000002, "end": 1138.46, "text": " But I want to show you these plots."}, {"start": 1138.46, "end": 1146.22, "text": " So here what they do is they do different bins of the of this set."}, {"start": 1146.22, "end": 1151.18, "text": " So they have bins of easy samples, less easy samples and so on."}, {"start": 1151.18, "end": 1157.54, "text": " And you can see that you have a pretty good grip on this where this line is."}, {"start": 1157.54, "end": 1163.82, "text": " So if you only take the easy samples you're up here and this is what we saw before."}, {"start": 1163.82, "end": 1167.34, "text": " If this is the old line, it's the red line, right?"}, {"start": 1167.34, "end": 1173.34, "text": " If you take the entire new test set, if you just take bin the second hardest bin you're"}, {"start": 1173.34, "end": 1176.6599999999999, "text": " somewhere here or here or here."}, {"start": 1176.6599999999999, "end": 1182.1799999999998, "text": " So you have a good hold on where this line is."}, {"start": 1182.1799999999998, "end": 1188.1799999999998, "text": " But it still doesn't explain that if you try to follow the protocol exactly, why does the"}, {"start": 1188.1799999999998, "end": 1191.22, "text": " accuracy drop that that is still a mystery."}, {"start": 1191.22, "end": 1197.22, "text": " Even though they say here is a variable that influences this a lot."}, {"start": 1197.22, "end": 1202.98, "text": " If they try to set the variable as it was set in V1, it is not equal."}, {"start": 1202.98, "end": 1208.82, "text": " So still mystery remains, I would say."}, {"start": 1208.82, "end": 1216.8600000000001, "text": " So the last thing they do is they try to to just come up with a model for this."}, {"start": 1216.8600000000001, "end": 1223.8600000000001, "text": " So they had both this is now is that the new test set just is harder."}, {"start": 1223.8600000000001, "end": 1231.26, "text": " And they have a analytical kind of a formal model of why if you assume certain things, this"}, {"start": 1231.26, "end": 1234.62, "text": " results in this line, right?"}, {"start": 1234.62, "end": 1240.7, "text": " The really interesting thing about the paper is that the the accuracies they all fall exactly"}, {"start": 1240.7, "end": 1241.7, "text": " on this line."}, {"start": 1241.7, "end": 1248.06, "text": " There's this linear relationship, especially they say if you do like probits scaling of accuracies,"}, {"start": 1248.06, "end": 1249.78, "text": " there's this line."}, {"start": 1249.78, "end": 1261.18, "text": " So they put up a model where you say what if we assume that each example I has a difficulty"}, {"start": 1261.18, "end": 1262.18, "text": " right?"}, {"start": 1262.18, "end": 1264.74, "text": " It's just a number, how difficult it is."}, {"start": 1264.74, "end": 1277.0600000000002, "text": " And each model J has a probability of correctly classifying an image with difficulty tau here"}, {"start": 1277.0600000000002, "end": 1279.42, "text": " given by this function."}, {"start": 1279.42, "end": 1286.18, "text": " So this here is the probability that the model will classify an image correctly giving"}, {"start": 1286.18, "end": 1289.3, "text": " that it's tau hard."}, {"start": 1289.3, "end": 1304.4199999999998, "text": " And so this is an increasing function and they put up this following parameterization."}, {"start": 1304.4199999999998, "end": 1311.5, "text": " This is the CDF of the so they put up a model for this function now, right?"}, {"start": 1311.5, "end": 1319.18, "text": " For this they say if we assume that it is like this that each model has a sort of"}, {"start": 1319.18, "end": 1321.42, "text": " a skill number."}, {"start": 1321.42, "end": 1328.0600000000002, "text": " So each model has a skill and each image has a difficulty that is tau."}, {"start": 1328.0600000000002, "end": 1333.18, "text": " If we if the skill is higher than the tau, probably it will classify correctly."}, {"start": 1333.18, "end": 1338.0600000000002, "text": " If the skill is lower, probably then this number is negative, it will classify it incorrectly."}, {"start": 1338.0600000000002, "end": 1342.9, "text": " So this is the CDF of a normal distribution."}, {"start": 1342.9, "end": 1349.8200000000002, "text": " It goes something like this, right? and if the zero point is here."}, {"start": 1349.8200000000002, "end": 1359.46, "text": " So if this number here is zero, it's like 50, 50, whether it will classify it correctly."}, {"start": 1359.46, "end": 1367.9, "text": " So if you assume this and you assume a bunch of other Gaussian error distributions, then"}, {"start": 1367.9, "end": 1377.42, "text": " the the difficult, sorry, the performance of a model on the test set V2 is exactly the"}, {"start": 1377.42, "end": 1385.0600000000002, "text": " performance of the model under test set V1 times this scalar here plus this scalar here,"}, {"start": 1385.0600000000002, "end": 1387.5, "text": " which is a linear relationship."}, {"start": 1387.5, "end": 1390.66, "text": " So they put up a model for for this."}, {"start": 1390.66, "end": 1393.38, "text": " Of course, it doesn't explain anything, right?"}, {"start": 1393.38, "end": 1399.9, "text": " This doesn't explain the phenomena, but they it still gives a clue of why the linear"}, {"start": 1399.9, "end": 1408.2600000000002, "text": " relationship here might result from the test sets having a different difficulty setting"}, {"start": 1408.2600000000002, "end": 1412.18, "text": " or a different difficulty properties."}, {"start": 1412.18, "end": 1421.0600000000002, "text": " So they go on after discussing related work, they go on to say what can one do and"}, {"start": 1421.06, "end": 1429.1399999999999, "text": " um, suggestions for future research, I especially like the super hold out."}, {"start": 1429.1399999999999, "end": 1440.22, "text": " So if you ever make a data set, um, if you ever make a data set, then make a super hold"}, {"start": 1440.22, "end": 1441.3799999999999, "text": " out set."}, {"start": 1441.3799999999999, "end": 1447.3799999999999, "text": " And once you're like almost out of your career, just come up with it and say, oh, I have"}, {"start": 1447.38, "end": 1452.18, "text": " this lost data set here that I made way back."}, {"start": 1452.18, "end": 1454.22, "text": " It will be fantastic."}, {"start": 1454.22, "end": 1455.5, "text": " Um, all right."}, {"start": 1455.5, "end": 1462.1000000000001, "text": " So I think this paper is very interesting and I think everyone that sees and reads this"}, {"start": 1462.1000000000001, "end": 1467.5400000000002, "text": " comes up with their own hypotheses of why this is and what's going on here."}, {"start": 1467.5400000000002, "end": 1473.0600000000002, "text": " They have investigated a lot of this, especially I want to highlight an experiment where they"}, {"start": 1473.0600000000002, "end": 1477.3000000000002, "text": " take part of V2 here."}, {"start": 1477.3, "end": 1487.54, "text": " So they split this one into a train and a test, sorry, train and a test and they put this"}, {"start": 1487.54, "end": 1492.58, "text": " and this training together into like a super train, right?"}, {"start": 1492.58, "end": 1498.98, "text": " So so you train on both things together and they see whether it improves at this test"}, {"start": 1498.98, "end": 1499.98, "text": " set, right?"}, {"start": 1499.98, "end": 1506.26, "text": " You would think that if you put this training in there, that it would improve and it"}, {"start": 1506.26, "end": 1510.58, "text": " does improve, but it improves by like a miniscule amount."}, {"start": 1510.58, "end": 1514.58, "text": " So they've done a whole bunch of experiments like this to investigate what's going on."}, {"start": 1514.58, "end": 1519.78, "text": " This is all in this 70 page appendix that you can go over."}, {"start": 1519.78, "end": 1520.78, "text": " Right."}, {"start": 1520.78, "end": 1523.02, "text": " That was what I had to say for this paper."}, {"start": 1523.02, "end": 1529.02, "text": " If you like this video, consider subscribing and comment whatever you think."}, {"start": 1529.02, "end": 1533.3799999999999, "text": " I usually answer or like or read most comments."}, {"start": 1533.3799999999999, "end": 1535.22, "text": " Thanks for listening."}, {"start": 1535.22, "end": 1536.22, "text": " Bye bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=hDQNCWR3HLQ | [Drama] Schmidhuber: Critique of Honda Prize for Dr. Hinton | Schmidhuber writes up a critique of Hinton receiving the Honda Price... AND HINTON REPLIES!
Schmidhuber's Blog Entry: http://people.idsia.ch/~juergen/critique-honda-prize-hinton.html
Hinton's Reply: https://www.reddit.com/r/MachineLearning/comments/g5ali0/d_schmidhuber_critique_of_honda_prize_for_dr/
Thumbnail Images:
By Eviatar Bach -https://de.m.wikipedia.org/wiki/Datei:Geoffrey_Hinton_at_UBC.jpg
By ITU/R.Farrell - https://www.flickr.com/photos/itupictures/34343385563, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=75018240
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 | On April 21st, the Irgunshmiduver tweeted out, stop crediting the wrong people for inventions made by others. At least in science, the facts will always win at the end, as long as the facts have not yet won. It is not yet the end. No fancy award can ever change that. Hashtag self-correcting science, hashtag plagiarism, and links to an article of his own website where he wrote. Critique of Honda Prize for Dr. Hinton. This is on Shmiduver's own website and it's by himself. Don't you love this? How to pronounce his name? You again. Sorry. This is absolutely great. So both actually Shmiduver and Hinton are on Twitter. You can tweet at them and follow them. This article here is basically a critique of the press release of Honda when they awarded Jeff Hinton for his achievements. And it goes through it step by step and we won't look at the whole thing but just for you to get the flavor. So here Honda says Dr. Hinton has created a number of technologies that have enabled the broader application of AI, including the back propagation algorithm that forms the basis of deep learning approach to AI. And Shmiduver just goes off. He basically claims while Hinton and his co-workers have made certain significant contributions to deep learning, the claim above is plain wrong. That's Hinton did not invent back propagation. The person who invented back propagation was set up in Linai Ma. And the many papers he says basically many papers failed to cite Linai Ma. And this was the original inventor of back prop and so on and he kind of goes through a history of this and how it's even earlier. And then he's also a bit of a trouble with claims like who invented what because when is an algorithm really the same thing right and when is it a variation on another algorithm and when is it something completely new? It's never entirely clear but the points here made that the things the back propagation algorithm existed before Hinton. And also that some of the papers, some of the seminal papers did not cite the correct origin. Statement 2 in 2002 he introduced the a fast learning algorithm for restricted Boltzmann machines that allowed them to learn a single layer of distributed representation without requiring any labeled data. These methods allowed deep learning to work better and they led to the current deep learning revolution. No, Dr. Hinton's interesting unsupervised pre-training for deep neural networks was irrelevant for the current deep learning revolution. In 2010 our team showed that the feed for networks can be trained by plain back prop do not at all require pre-training. And he basically again says apart from this Hinton's unsupervised pre-training was conceptually a rehash of my unsupervised pre-training for deep recurrent neural networks. So he, you know, as you know, Schmeiduber has done a lot of work in recurrent neural networks and he basically says it was just a rehash of his algorithm. Now I have to say I have, so first of all he makes a point here that we don't really do unsupervised pre-training anymore until now of course. But you like for to train an M-ness classifier you don't have to do that. But it's also doubtful that this was a step even though even if it wasn't on the exact path to the current situation it was a thing that got people excited maybe. And so the critique is like half valid and also it doesn't help Schmeiduber that he always compares it to his own things like it just it just like either criticize them for you know in general things but then avoid bringing your own things in because it just sounds like I did this before. And also I read some papers from from these times people just wrote papers sometimes I haven't read this specific one but sometimes people just wrote papers writing down their ideas like one could do this and this and this never do any experiments are actually specifying exactly what they mean they just kind of wrote down a bunch of ideas and that got published. And especially like there's some some reinforcement learning papers where people are just like oh one I imagine agents doing this and learning from that. So it is again it is never really clear. Ideas are just had by everyone I think people people mistake this that think that the ideas are unique it's not ideas that are unique many people have the same ideas but some there's also execution and exact formalization and so on. And exact level of specificity this all of this is really hard and then the Honda says in 2009 Dr. Hinton and two of his students used multilayerinolats to make major break the speech recognition that led directly to greatly improved and this of course Schmeiduber goes off by this because speech recognition is of course prime LSTM territory so you don't want to go near this. And the Honda further says revolutionized computer vision by showing that deep learning worked far better than existing state of the art and again he says the basic ingredients were already there and so on. And the our team in Switzerland already used his first superior or board winning GPU based CNN and so on that's what is called then that was produced by his group and again this seems correct right this seems when he lays it out like this but it doesn't change the fact that Alex net one image net in 2012 and that was like the start of the deep learning revolution. As it was like wow you can cut the learn like the error rates by something like 30% simply by doing this deep learning stuff. So again even if Dan net. He says it blew away the competition. It just seems it always seems like Schmeiduber is kind of right but then also he's not. He's like exactly academic work and the idea being there on a paper isn't the only thing that drives progress. And it says to achieve their dramatic results doctor hint also invented a widely used new method called drop out which reduces over 50 no like no like no just like. Randomly dropping parts in order to make something more robust that is surely not a new thing and he also says much earlier this there's the stochastic delta rule and so on and he also critiques that the paper did not cite this. They just gave it the name right this is an idea that is kind of so simple that you wouldn't even necessarily think about researching whether that has existed already I think they just did it and then because it's a natural idea and then they gave it a name and the name stock right it's not about the idea itself. And then lastly they say of the countless AI based technological services across the world it is no exaggeration to say that few would have been possible without the results doctor hint created. I love this name one that would not have been possible. And he just gives a list of their own group that are basically possible without hint and contributions and this is just it's a bit of a cheap shot right clearly Honda if they're not saying it would have been you know physically impossible without his contributions. But certainly hints and has has if even if he hadn't invented any of those things he certainly has created like a spark and his these things created a splash got people excited people thinking about new ways of applying things even you know if this is all true so right and but but I would like you to notice this is a critique of what Honda says about hint and if I read through the statements of Schmitt who were most of them are technically correct right and you know that so that that was that and then I thought okay cool but then someone posted and read it and then hint and reply and this is the answer is that he is not going to be able to do that. Don't you love this so hint and says having a public debate with Schmitt you were about academic credit is not at advisable because it just encourages him and there is no limit to the time and effort that he is willing to put into trying to discredit his perceived rivals. And then he says even as courted to tricks like having multiple aliases in Wikipedia to make it look as if other people agree the page on this website about Alan Turing is a nice example of how he goes on trying to these are like these are shots fired. He says I'm going to respond once and only once I have never claimed that I invented back propagation David Rumehard invented it independently after other after other people in other fields had invented it is true when we first published we did not know the history so he basically says okay we did forget to site it when we first published about back prop. But he doesn't say he invented it what I've claimed is that I was the person clearly demonstrate the back prop could learn interesting in terms of representations and that that this is what made it popular right so this goes into into the direction Schmitt was very much on academic contributions idea was there before and hint and basically says know what we did is kind of we showed that it works in this particular way and we kind of got people excited about it. I did is by forcing that blah blah blah and it is he says it is true that many people in the press have said I invented back prop and I spent a lot of time correcting them here is an excerpt from 2018 where this is I guess a quote from this book that quotes hint and where he says lots of people invented different versions of back prop before David Rumehard they were mainly independent inventions something I feel I have got too much credit for it's one of these rare cases where an academic feels he has got too much credit for something my main contribution was to show you can use it for learning distributor representations so I'd like to set the record straight on that. Then he says maybe Jurgen would like to set the record straight on who invented LSTM boom boom crazy shots fired by hint and here this is I mean this is just great but again look at what hint and says hint and basically says yes I have not invented that I have corrected this on public record in the past and yeah so that's what hint and says and I mean the comments here are just gold I really like to read it and then Schmidt Uber of course being Schmidt Uber replies again down here he has a response to the reply and I don't expect hint and to reply again so I waited for a bit but I believe hint when he says he does it only once so he goes into this. This is just summary the facts presented in sections one two three four five are still valid so he goes what kind of statement by statement is having a public debate blah blah blah and he just says well this is an ad hormone attack which is true right this is true and he says he even has multiple aliases in Wikipedia and he just says another ad hormone attack and then he goes into that Schmidt Uber tries to discredit Alan touring and then Schmidt Uber goes into this big long big long basically claim that Alan touring wasn't as important as people made him out to be and people invented this kind of touring machine equivalence before that again is kind of Schmidt Uber's take that the idea basically was already there and these people don't get the correct credit and also he's correct that this is a this is a true it's an at home and attack right so you know me as it may this is correct and then when when hint goes that he doesn't say an event back prop and Schmidt Uber says this is finally response related to my post which is true right however it does not at all contradict what I wrote and it is true that he created this core through Rommelhart with the invention but neither cited a linema and also the statement lots of people he says it wasn't created by lots of different people but exactly one person so this I find come up like can you really say now this is the exact time when back prop was invented even though it probably wasn't in the current exact current formulation and it probably existed someone like this so but again and he he his main claim is doctor hint accepted the Honda price although he apparently agrees that Honda's claims are false he should ask Honda to correct their statements and maybe you're going to like to set the record straight and we invented LSTM's and you know as we as you may know se poch writer kind of invented LSTM's under you're going to Schmidt Uber as a as a PhD advisor but the two summarized doctor hint comments and add how many arguments diverge from the contents of my post and do not challenge the facts and so on and I have to say after reading this this this is a this is correct right hint basically replies to hey I I never claimed I invented back prop and other people have invented it and Schmidt who we're doesn't criticize hint in this particular post he may otherwise Schmidt Uber doesn't criticize hint in for claiming that he criticizes Honda for claiming that hint did and hint doesn't hint basically agrees with him and also Schmidt Uber says doctor hint accepted the Honda price although he apparently agrees that the claims are false he should ask Honda to correct their statements and it is true that hint accepted this price under this release right now you you might be able to say hint hint also says he's on the record basically saying he didn't do this and I guess if you're hinting and you know you've had this you had the successful career and so on and you have previously really publicly stated that you didn't invent these things and you know made it clear and then you get a prize and they write this thing maybe you just don't want to go after every single press statement and correcting that but you know in essence basically hint and understood this as an attack on himself that he claims he invented back prop and Schmidt Uber says Honda claims hint invented back prop and hint accepted the price so he agrees with it and hint basically agrees with it but doesn't say Honda should have corrected it which I can understand so this is my take on this issue it's kind of both are correct and they just kind of talk past each other and Schmidt Uber is always on the the idea existed before and hint is correct when he says it's not always just about the idea progress is also made by people being excited people actually getting something to work people you know doing something at the right time the right place which is also correct but it is fun it is fun so I just I enjoyed I enjoy this honestly like because ultimately this is the kind of discussions also need to happen in science because credit assignment is an important thing in science and even though sometimes it's over the top like Schmidt Uber always going after it I think we need people like him just kind of to keep the field in check a bit and yeah I will link to all of this I hope you enjoyed this and I wish you a nice rest of the weekend if you're still here consider subscribing and leave comment if you want I usually read them bye bye | [{"start": 0.0, "end": 8.0, "text": " On April 21st, the Irgunshmiduver tweeted out, stop crediting the wrong people for inventions made by others."}, {"start": 8.0, "end": 14.0, "text": " At least in science, the facts will always win at the end, as long as the facts have not yet won."}, {"start": 14.0, "end": 16.0, "text": " It is not yet the end."}, {"start": 16.0, "end": 19.0, "text": " No fancy award can ever change that."}, {"start": 19.0, "end": 29.0, "text": " Hashtag self-correcting science, hashtag plagiarism, and links to an article of his own website where he wrote."}, {"start": 29.0, "end": 34.0, "text": " Critique of Honda Prize for Dr. Hinton."}, {"start": 34.0, "end": 39.0, "text": " This is on Shmiduver's own website and it's by himself."}, {"start": 39.0, "end": 44.0, "text": " Don't you love this? How to pronounce his name?"}, {"start": 44.0, "end": 49.0, "text": " You again. Sorry. This is absolutely great."}, {"start": 49.0, "end": 55.0, "text": " So both actually Shmiduver and Hinton are on Twitter. You can tweet at them and follow them."}, {"start": 55.0, "end": 68.0, "text": " This article here is basically a critique of the press release of Honda when they awarded Jeff Hinton for his achievements."}, {"start": 68.0, "end": 75.0, "text": " And it goes through it step by step and we won't look at the whole thing but just for you to get the flavor."}, {"start": 75.0, "end": 89.0, "text": " So here Honda says Dr. Hinton has created a number of technologies that have enabled the broader application of AI, including the back propagation algorithm that forms the basis of deep learning approach to AI."}, {"start": 89.0, "end": 92.0, "text": " And Shmiduver just goes off."}, {"start": 92.0, "end": 101.0, "text": " He basically claims while Hinton and his co-workers have made certain significant contributions to deep learning, the claim above is plain wrong."}, {"start": 101.0, "end": 110.0, "text": " That's Hinton did not invent back propagation. The person who invented back propagation was set up in Linai Ma."}, {"start": 110.0, "end": 119.0, "text": " And the many papers he says basically many papers failed to cite Linai Ma."}, {"start": 119.0, "end": 130.0, "text": " And this was the original inventor of back prop and so on and he kind of goes through a history of this and how it's even earlier."}, {"start": 130.0, "end": 141.0, "text": " And then he's also a bit of a trouble with claims like who invented what because when is an algorithm really the same thing right and when is it a variation on another algorithm and when is it something completely new?"}, {"start": 141.0, "end": 153.0, "text": " It's never entirely clear but the points here made that the things the back propagation algorithm existed before Hinton."}, {"start": 153.0, "end": 161.0, "text": " And also that some of the papers, some of the seminal papers did not cite the correct origin."}, {"start": 161.0, "end": 174.0, "text": " Statement 2 in 2002 he introduced the a fast learning algorithm for restricted Boltzmann machines that allowed them to learn a single layer of distributed representation without requiring any labeled data."}, {"start": 174.0, "end": 180.0, "text": " These methods allowed deep learning to work better and they led to the current deep learning revolution."}, {"start": 180.0, "end": 190.0, "text": " No, Dr. Hinton's interesting unsupervised pre-training for deep neural networks was irrelevant for the current deep learning revolution."}, {"start": 190.0, "end": 198.0, "text": " In 2010 our team showed that the feed for networks can be trained by plain back prop do not at all require pre-training."}, {"start": 198.0, "end": 210.0, "text": " And he basically again says apart from this Hinton's unsupervised pre-training was conceptually a rehash of my unsupervised pre-training for deep recurrent neural networks."}, {"start": 210.0, "end": 220.0, "text": " So he, you know, as you know, Schmeiduber has done a lot of work in recurrent neural networks and he basically says it was just a rehash of his algorithm."}, {"start": 220.0, "end": 232.0, "text": " Now I have to say I have, so first of all he makes a point here that we don't really do unsupervised pre-training anymore until now of course."}, {"start": 232.0, "end": 237.0, "text": " But you like for to train an M-ness classifier you don't have to do that."}, {"start": 237.0, "end": 252.0, "text": " But it's also doubtful that this was a step even though even if it wasn't on the exact path to the current situation it was a thing that got people excited maybe."}, {"start": 252.0, "end": 273.0, "text": " And so the critique is like half valid and also it doesn't help Schmeiduber that he always compares it to his own things like it just it just like either criticize them for you know in general things but then avoid bringing your own things in because it just sounds like I did this before."}, {"start": 273.0, "end": 298.0, "text": " And also I read some papers from from these times people just wrote papers sometimes I haven't read this specific one but sometimes people just wrote papers writing down their ideas like one could do this and this and this never do any experiments are actually specifying exactly what they mean they just kind of wrote down a bunch of ideas and that got published."}, {"start": 298.0, "end": 309.0, "text": " And especially like there's some some reinforcement learning papers where people are just like oh one I imagine agents doing this and learning from that."}, {"start": 309.0, "end": 313.0, "text": " So it is again it is never really clear."}, {"start": 313.0, "end": 331.0, "text": " Ideas are just had by everyone I think people people mistake this that think that the ideas are unique it's not ideas that are unique many people have the same ideas but some there's also execution and exact formalization and so on."}, {"start": 331.0, "end": 359.0, "text": " And exact level of specificity this all of this is really hard and then the Honda says in 2009 Dr. Hinton and two of his students used multilayerinolats to make major break the speech recognition that led directly to greatly improved and this of course Schmeiduber goes off by this because speech recognition is of course prime LSTM territory so you don't want to go near this."}, {"start": 359.0, "end": 375.0, "text": " And the Honda further says revolutionized computer vision by showing that deep learning worked far better than existing state of the art and again he says the basic ingredients were already there and so on."}, {"start": 375.0, "end": 403.0, "text": " And the our team in Switzerland already used his first superior or board winning GPU based CNN and so on that's what is called then that was produced by his group and again this seems correct right this seems when he lays it out like this but it doesn't change the fact that Alex net one image net in 2012 and that was like the start of the deep learning revolution."}, {"start": 403.0, "end": 413.0, "text": " As it was like wow you can cut the learn like the error rates by something like 30% simply by doing this deep learning stuff."}, {"start": 413.0, "end": 417.0, "text": " So again even if Dan net."}, {"start": 417.0, "end": 420.0, "text": " He says it blew away the competition."}, {"start": 420.0, "end": 428.0, "text": " It just seems it always seems like Schmeiduber is kind of right but then also he's not."}, {"start": 428.0, "end": 442.0, "text": " He's like exactly academic work and the idea being there on a paper isn't the only thing that drives progress."}, {"start": 442.0, "end": 456.0, "text": " And it says to achieve their dramatic results doctor hint also invented a widely used new method called drop out which reduces over 50 no like no like no just like."}, {"start": 456.0, "end": 478.0, "text": " Randomly dropping parts in order to make something more robust that is surely not a new thing and he also says much earlier this there's the stochastic delta rule and so on and he also critiques that the paper did not cite this."}, {"start": 478.0, "end": 499.0, "text": " They just gave it the name right this is an idea that is kind of so simple that you wouldn't even necessarily think about researching whether that has existed already I think they just did it and then because it's a natural idea and then they gave it a name and the name stock right it's not about the idea itself."}, {"start": 499.0, "end": 509.0, "text": " And then lastly they say of the countless AI based technological services across the world it is no exaggeration to say that few would have been possible without the results doctor hint created."}, {"start": 509.0, "end": 516.0, "text": " I love this name one that would not have been possible."}, {"start": 516.0, "end": 539.0, "text": " And he just gives a list of their own group that are basically possible without hint and contributions and this is just it's a bit of a cheap shot right clearly Honda if they're not saying it would have been you know physically impossible without his contributions."}, {"start": 539.0, "end": 567.0, "text": " But certainly hints and has has if even if he hadn't invented any of those things he certainly has created like a spark and his these things created a splash got people excited people thinking about new ways of applying things even you know if this is all true so right and but but I would like you to"}, {"start": 567.0, "end": 594.0, "text": " notice this is a critique of what Honda says about hint and if I read through the statements of Schmitt who were most of them are technically correct right and you know that so that that was that and then I thought okay cool but then someone posted and read it and then hint and reply and this is"}, {"start": 594.0, "end": 597.0, "text": " the answer is that he is not going to be able to do that."}, {"start": 597.0, "end": 614.0, "text": " Don't you love this so hint and says having a public debate with Schmitt you were about academic credit is not at advisable because it just encourages him and there is no limit to the time and effort that he is willing to put into trying to discredit his perceived rivals."}, {"start": 614.0, "end": 632.0, "text": " And then he says even as courted to tricks like having multiple aliases in Wikipedia to make it look as if other people agree the page on this website about Alan Turing is a nice example of how he goes on trying to these are like these are shots fired."}, {"start": 632.0, "end": 661.0, "text": " He says I'm going to respond once and only once I have never claimed that I invented back propagation David Rumehard invented it independently after other after other people in other fields had invented it is true when we first published we did not know the history so he basically says okay we did forget to site it when we first published about back prop."}, {"start": 661.0, "end": 688.0, "text": " But he doesn't say he invented it what I've claimed is that I was the person clearly demonstrate the back prop could learn interesting in terms of representations and that that this is what made it popular right so this goes into into the direction Schmitt was very much on academic contributions idea was there before and hint and basically says know what we did is kind of we showed that it works in this particular way and we kind of got people excited about it."}, {"start": 688.0, "end": 715.0, "text": " I did is by forcing that blah blah blah and it is he says it is true that many people in the press have said I invented back prop and I spent a lot of time correcting them here is an excerpt from 2018 where this is I guess a quote from this book that quotes hint and where he says lots of people invented different versions of back prop before David Rumehard"}, {"start": 715.0, "end": 734.0, "text": " they were mainly independent inventions something I feel I have got too much credit for it's one of these rare cases where an academic feels he has got too much credit for something my main contribution was to show you can use it for learning distributor representations so I'd like to set the record straight on that."}, {"start": 734.0, "end": 763.0, "text": " Then he says maybe Jurgen would like to set the record straight on who invented LSTM boom boom crazy shots fired by hint and here this is I mean this is just great but again look at what hint and says hint and basically says yes I have not invented that I have corrected this on public record in the past"}, {"start": 763.0, "end": 792.0, "text": " and yeah so that's what hint and says and I mean the comments here are just gold I really like to read it and then Schmidt Uber of course being Schmidt Uber replies again down here he has a response to the reply and I don't expect hint and to reply again so I waited for a bit but I believe hint when he says he does it only"}, {"start": 792.0, "end": 795.0, "text": " once so he goes into this."}, {"start": 795.0, "end": 824.0, "text": " This is just summary the facts presented in sections one two three four five are still valid so he goes what kind of statement by statement is having a public debate blah blah blah and he just says well this is an ad hormone attack which is true right this is true and he says he even has multiple aliases in Wikipedia and he just says another ad hormone attack"}, {"start": 824.0, "end": 843.0, "text": " and then he goes into that Schmidt Uber tries to discredit Alan touring and then Schmidt Uber goes into this big long big long basically claim that Alan touring wasn't as important as people made him out to be and people invented this kind of"}, {"start": 843.0, "end": 871.0, "text": " touring machine equivalence before that again is kind of Schmidt Uber's take that the idea basically was already there and these people don't get the correct credit and also he's correct that this is a this is a true it's an at home and attack right so you know me as it may this is correct"}, {"start": 871.0, "end": 886.0, "text": " and then when when hint goes that he doesn't say an event back prop and Schmidt Uber says this is finally response related to my post which is true right however it does not at all contradict what I wrote"}, {"start": 886.0, "end": 909.0, "text": " and it is true that he created this core through Rommelhart with the invention but neither cited a linema and also the statement lots of people he says it wasn't created by lots of different people but exactly one person so this I find come up like can you really say now this is the exact time when back prop was invented"}, {"start": 909.0, "end": 934.0, "text": " even though it probably wasn't in the current exact current formulation and it probably existed someone like this so but again and he he his main claim is doctor hint accepted the Honda price although he apparently agrees that Honda's claims are false he should ask Honda to correct their statements"}, {"start": 934.0, "end": 962.0, "text": " and maybe you're going to like to set the record straight and we invented LSTM's and you know as we as you may know se poch writer kind of invented LSTM's under you're going to Schmidt Uber as a as a PhD advisor but the two summarized doctor hint comments and add how many arguments diverge from the contents of my post and do not challenge the facts and so on"}, {"start": 962.0, "end": 983.0, "text": " and I have to say after reading this this this is a this is correct right hint basically replies to hey I I never claimed I invented back prop and other people have invented it and Schmidt who we're doesn't criticize hint in this particular post he may otherwise"}, {"start": 983.0, "end": 1003.0, "text": " Schmidt Uber doesn't criticize hint in for claiming that he criticizes Honda for claiming that hint did and hint doesn't hint basically agrees with him and also Schmidt Uber says doctor hint accepted the Honda price although he apparently agrees that the claims are false he should ask Honda to correct their statements"}, {"start": 1003.0, "end": 1028.0, "text": " and it is true that hint accepted this price under this release right now you you might be able to say hint hint also says he's on the record basically saying he didn't do this and I guess if you're hinting and you know you've had this you had the successful career and so on and you have previously really publicly stated that you didn't invent these things and you know made it clear"}, {"start": 1028.0, "end": 1055.0, "text": " and then you get a prize and they write this thing maybe you just don't want to go after every single press statement and correcting that but you know in essence basically hint and understood this as an attack on himself that he claims he invented back prop and Schmidt Uber says Honda claims hint invented back prop and hint accepted the price so he agrees with it and hint"}, {"start": 1055.0, "end": 1073.0, "text": " basically agrees with it but doesn't say Honda should have corrected it which I can understand so this is my take on this issue it's kind of both are correct and they just kind of talk past each other"}, {"start": 1073.0, "end": 1097.0, "text": " and Schmidt Uber is always on the the idea existed before and hint is correct when he says it's not always just about the idea progress is also made by people being excited people actually getting something to work people you know doing something at the right time the right place which is also correct"}, {"start": 1097.0, "end": 1126.0, "text": " but it is fun it is fun so I just I enjoyed I enjoy this honestly like because ultimately this is the kind of discussions also need to happen in science because credit assignment is an important thing in science and even though sometimes it's over the top like Schmidt Uber always going after it I think we need people like him just kind of to keep the field"}, {"start": 1126.0, "end": 1143.0, "text": " in check a bit and yeah I will link to all of this I hope you enjoyed this and I wish you a nice rest of the weekend if you're still here consider subscribing and leave comment if you want I usually read them bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=gJR28onlqzs | How much memory does Longformer use? | A calculation of the memory requirements of the Longformer.
Original video: https://youtu.be/_8KNb5iqblE
Paper: https://arxiv.org/abs/2004.05150
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 | So I wanted to come back to this paper here about the long former. I have done a video on this. If you haven't seen it, then this video is probably not going to make much sense to you, but in the video I go over what the long former is, what it does, how it compares, and so on. And the gist of the long former is that it can now do a transformer model on a long document as you can read here. So I've gotten a lot of questions of like, does that mean we can now have much longer documents, right? The birth model doesn't fit into my memory, can dissolve my problem, and I just kind of want to go into the math of the long former memory requirements here, because I think I've alluded to it, but it is quite a, I think the graphics here are just a bit misleading from the way they implemented. Now I've already gone over something like this in the last thing. So Roberta, let's spell this correctly, Roberta that is their baseline has a size, let's call that n0 of 512. So they can have 512 tokens at the same time. So if you have a sequence that is way longer than 512, you need to chunk it up into pieces of 512, and usually do something like overlapping pieces or something like this, right? And now the promise of the long former, as it is in the paper, is that you can put all of this into the long former, right? And it will do this sliding window attention thing, where it basically slides a window here, this window across this input sequence, and only does this local attention, right, within the window. And then it also has some global attention that it constantly has. Now what I find interesting is that in their experiments, their window size here, so the long former window size is 512, right? So within that window, you have the classic n squared full attention, all right? So let's just go into that. How much memory does the long former really do? We've already calculated it here a bit, but I want to take this still apart a bit. So as you can see on the left here, you have n times w, that you have for this middle band, right? So this middle band is n times w. Then you want to add the global attention, right? So the global attention, you can all already see it right here, if you have 1, 2, 3, 4 locations of global attention, you have 4 times 2 because you also have them in this direction, right? You have them in both directions, times your full sequence length. So plus 2 times full sequence length times the number of global attention, I call this s over here. So as we saw up here, the window size here was n0 in their experiments. So let's replace this window size by n0 and actually let's factor out the n. So we'll get to n times n0 plus 2s. All right, so you can already see that Roberto originally had n0 squared. Now if n is larger than n0, that means you already use more here. The kind of trick, let's say it's not really a trick, it is true that this is order of n, right? If n is your input sequence length, but in this here is technically order of n squared if n, if this is n, but the sequence length in Roberto was the window size of the long former. So this is n0 squared, right? And here technically you'd have to say this is n times n0. So if n is larger than n0, you can see that this uses more memory given that. So in their experiments, they use a model that on paper uses more memory than the baseline model. And saying that it scales linearly with sequence length is because, I mean, of course, it scales linearly because they can now input these long sequences, right? And the attention, sorry, the memory requirements scales basically linear and also linear with the window size. Now the window size still needs to be apparently largeish in order to achieve the performance. So the fact that the performance is equal or better is not really a secret because it uses more memory, right? It's not like this model uses less memory, but outperforms the old one. It uses more. If you want to look at it, you have to ask, okay, I have Roberto. And right now I can do n squared. So this is n, this is n, so there's n0 and zero. This is my sequence length that I can put into Roberto. You have to ask yourself, what kind of sequence do I want to put in? And if you say I want to put in a sequence that's twice as long, right? I want to put in this long of a sequence. So n here would be twice n0. Then you have to take this, put it here, put it here, and then you realize, yes, that your window size of the long former can only be half, right? So if you have the same amount of memory, you can double your sequence length at the cost of having your having your window size. But that doesn't yet include the cost of the global attention. So any global attention you do will come basically on top of the window size. You see this here, right? So the you decide on, let's do it like this. You decide on how long you want your thing, your input sequence length to be. Then you decide, then that means that's this rectangle here. Then you decide how many global attentions do I want? And here I say I want one global attention. And you have to cross out as many rows here as you want global attention. And what remains is your window? Actually, I have to cross out twice. But we don't have, we only have one left. But you get the point, you have to cross out two times s rows of how many global attention you want. And what remains will be your window size. In this case, it's just a window size of one. So that's how you would construct a long former that takes in the same amount of memory as a your classic model, but can take a full and sequence length. Alright, so I just wanted to kind of make that clear go through the calculation myself. And I hope that helped. Thanks for listening. And if you like this, consider subscribing, liking and bye-bye. | [{"start": 0.0, "end": 7.44, "text": " So I wanted to come back to this paper here about the long former. I have done a"}, {"start": 7.44, "end": 11.040000000000001, "text": " video on this. If you haven't seen it, then this video is probably not going to"}, {"start": 11.040000000000001, "end": 16.28, "text": " make much sense to you, but in the video I go over what the long former is, what"}, {"start": 16.28, "end": 21.400000000000002, "text": " it does, how it compares, and so on. And the gist of the long former is that it"}, {"start": 21.400000000000002, "end": 29.560000000000002, "text": " can now do a transformer model on a long document as you can read here."}, {"start": 29.56, "end": 35.64, "text": " So I've gotten a lot of questions of like, does that mean we can now have much"}, {"start": 35.64, "end": 40.519999999999996, "text": " longer documents, right? The birth model doesn't fit into my memory, can"}, {"start": 40.519999999999996, "end": 46.239999999999995, "text": " dissolve my problem, and I just kind of want to go into the math of the long"}, {"start": 46.239999999999995, "end": 52.36, "text": " former memory requirements here, because I think I've alluded to it, but it is"}, {"start": 52.36, "end": 62.0, "text": " quite a, I think the graphics here are just a bit misleading from the way they"}, {"start": 62.0, "end": 66.76, "text": " implemented. Now I've already gone over something like this in the last"}, {"start": 66.76, "end": 75.52, "text": " thing. So Roberta, let's spell this correctly, Roberta that is their baseline has a"}, {"start": 75.52, "end": 87.75999999999999, "text": " size, let's call that n0 of 512. So they can have 512 tokens at the same time."}, {"start": 87.75999999999999, "end": 94.19999999999999, "text": " So if you have a sequence that is way longer than 512, you need to chunk it up"}, {"start": 94.19999999999999, "end": 101.08, "text": " into pieces of 512, and usually do something like overlapping pieces or something"}, {"start": 101.08, "end": 106.67999999999999, "text": " like this, right? And now the promise of the long former, as it is in the paper,"}, {"start": 106.67999999999999, "end": 114.96, "text": " is that you can put all of this into the long former, right? And it will do this"}, {"start": 114.96, "end": 123.6, "text": " sliding window attention thing, where it basically slides a window here, this"}, {"start": 123.6, "end": 130.12, "text": " window across this input sequence, and only does this local attention, right,"}, {"start": 130.12, "end": 136.56, "text": " within the window. And then it also has some global attention that it constantly"}, {"start": 136.56, "end": 141.8, "text": " has. Now what I find interesting is that in their experiments, their window size"}, {"start": 141.8, "end": 152.64000000000001, "text": " here, so the long former window size is 512, right? So within that window, you have"}, {"start": 152.64, "end": 162.92, "text": " the classic n squared full attention, all right? So let's just go into that. How"}, {"start": 162.92, "end": 168.76, "text": " much memory does the long former really do? We've already calculated it here a"}, {"start": 168.76, "end": 178.27999999999997, "text": " bit, but I want to take this still apart a bit. So as you can see on the left"}, {"start": 178.28, "end": 187.48, "text": " here, you have n times w, that you have for this middle band, right? So this"}, {"start": 187.48, "end": 195.8, "text": " middle band is n times w. Then you want to add the global attention, right? So the"}, {"start": 195.8, "end": 203.6, "text": " global attention, you can all already see it right here, if you have 1, 2, 3, 4"}, {"start": 203.6, "end": 210.84, "text": " locations of global attention, you have 4 times 2 because you also have them in"}, {"start": 210.84, "end": 217.04, "text": " this direction, right? You have them in both directions, times your full sequence"}, {"start": 217.04, "end": 226.6, "text": " length. So plus 2 times full sequence length times the number of global attention,"}, {"start": 226.6, "end": 240.4, "text": " I call this s over here. So as we saw up here, the window size here was n0 in"}, {"start": 240.4, "end": 249.56, "text": " their experiments. So let's replace this window size by n0 and actually let's"}, {"start": 249.56, "end": 265.32, "text": " factor out the n. So we'll get to n times n0 plus 2s. All right, so you can"}, {"start": 265.32, "end": 277.16, "text": " already see that Roberto originally had n0 squared. Now if n is larger than n0,"}, {"start": 277.16, "end": 287.20000000000005, "text": " that means you already use more here. The kind of trick, let's say it's not"}, {"start": 287.20000000000005, "end": 295.40000000000003, "text": " really a trick, it is true that this is order of n, right? If n is your input"}, {"start": 295.40000000000003, "end": 304.40000000000003, "text": " sequence length, but in this here is technically order of n squared if n, if this"}, {"start": 304.4, "end": 313.44, "text": " is n, but the sequence length in Roberto was the window size of the long"}, {"start": 313.44, "end": 319.91999999999996, "text": " former. So this is n0 squared, right? And here technically you'd have to say"}, {"start": 319.91999999999996, "end": 330.44, "text": " this is n times n0. So if n is larger than n0, you can see that this uses more"}, {"start": 330.44, "end": 339.48, "text": " memory given that. So in their experiments, they use a model that on paper uses"}, {"start": 339.48, "end": 347.04, "text": " more memory than the baseline model. And saying that it scales linearly with"}, {"start": 347.04, "end": 352.6, "text": " sequence length is because, I mean, of course, it scales linearly because they can"}, {"start": 352.6, "end": 359.08, "text": " now input these long sequences, right? And the attention, sorry, the memory"}, {"start": 359.08, "end": 366.12, "text": " requirements scales basically linear and also linear with the window size. Now"}, {"start": 366.12, "end": 372.08, "text": " the window size still needs to be apparently largeish in order to achieve the"}, {"start": 372.08, "end": 378.91999999999996, "text": " performance. So the fact that the performance is equal or better is not really a"}, {"start": 378.91999999999996, "end": 387.15999999999997, "text": " secret because it uses more memory, right? It's not like this model uses less"}, {"start": 387.16, "end": 396.16, "text": " memory, but outperforms the old one. It uses more. If you want to look at it, you"}, {"start": 396.16, "end": 407.76000000000005, "text": " have to ask, okay, I have Roberto. And right now I can do n squared. So this is"}, {"start": 407.76000000000005, "end": 413.40000000000003, "text": " n, this is n, so there's n0 and zero. This is my sequence length that I can put"}, {"start": 413.4, "end": 419.44, "text": " into Roberto. You have to ask yourself, what kind of sequence do I want to put"}, {"start": 419.44, "end": 429.56, "text": " in? And if you say I want to put in a sequence that's twice as long, right? I"}, {"start": 429.56, "end": 437.0, "text": " want to put in this long of a sequence. So n here would be twice n0. Then you"}, {"start": 437.0, "end": 445.08, "text": " have to take this, put it here, put it here, and then you realize, yes, that your"}, {"start": 445.08, "end": 451.12, "text": " window size of the long former can only be half, right? So if you have the"}, {"start": 451.12, "end": 455.56, "text": " same amount of memory, you can double your sequence length at the cost of"}, {"start": 455.56, "end": 462.28, "text": " having your having your window size. But that doesn't yet include the cost of"}, {"start": 462.28, "end": 468.11999999999995, "text": " the global attention. So any global attention you do will come basically on top of"}, {"start": 468.11999999999995, "end": 477.35999999999996, "text": " the window size. You see this here, right? So the you decide on, let's do it like"}, {"start": 477.35999999999996, "end": 483.15999999999997, "text": " this. You decide on how long you want your thing, your input sequence length to"}, {"start": 483.15999999999997, "end": 488.23999999999995, "text": " be. Then you decide, then that means that's this rectangle here. Then you"}, {"start": 488.24, "end": 494.44, "text": " decide how many global attentions do I want? And here I say I want one global"}, {"start": 494.44, "end": 501.52, "text": " attention. And you have to cross out as many rows here as you want global attention."}, {"start": 501.52, "end": 506.32, "text": " And what remains is your window? Actually, I have to cross out twice. But we don't"}, {"start": 506.32, "end": 511.44, "text": " have, we only have one left. But you get the point, you have to cross out two"}, {"start": 511.44, "end": 519.68, "text": " times s rows of how many global attention you want. And what remains will be your"}, {"start": 519.68, "end": 526.0, "text": " window size. In this case, it's just a window size of one. So that's how you would"}, {"start": 526.0, "end": 532.64, "text": " construct a long former that takes in the same amount of memory as a your"}, {"start": 532.64, "end": 541.52, "text": " classic model, but can take a full and sequence length. Alright, so I just wanted"}, {"start": 541.52, "end": 549.3199999999999, "text": " to kind of make that clear go through the calculation myself. And I hope that"}, {"start": 549.3199999999999, "end": 556.0, "text": " helped. Thanks for listening. And if you like this, consider subscribing, liking"}, {"start": 556.0, "end": 566.0, "text": " and bye-bye."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=MpdbFLXOOIw | Supervised Contrastive Learning | The cross-entropy loss has been the default in deep learning for the last few years for supervised learning. This paper proposes a new loss, the supervised contrastive loss, and uses it to pre-train the network in a supervised fashion. The resulting model, when fine-tuned to ImageNet, achieves new state-of-the-art.
https://arxiv.org/abs/2004.11362
Abstract:
Cross entropy is the most widely used loss function for supervised training of image classification models. In this paper, we propose a novel training methodology that consistently outperforms cross entropy on supervised learning tasks across different architectures and data augmentations. We modify the batch contrastive loss, which has recently been shown to be very effective at learning powerful representations in the self-supervised setting. We are thus able to leverage label information more effectively than cross entropy. Clusters of points belonging to the same class are pulled together in embedding space, while simultaneously pushing apart clusters of samples from different classes. In addition to this, we leverage key ingredients such as large batch sizes and normalized embeddings, which have been shown to benefit self-supervised learning. On both ResNet-50 and ResNet-200, we outperform cross entropy by over 1%, setting a new state of the art number of 78.8% among methods that use AutoAugment data augmentation. The loss also shows clear benefits for robustness to natural corruptions on standard benchmarks on both calibration and accuracy. Compared to cross entropy, our supervised contrastive loss is more stable to hyperparameter settings such as optimizers or data augmentations.
Authors: Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, Dilip Krishnan
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 supervised contrastive learning by people from Google Research and MIT. Now, this paper proposes a new loss for supervised learning. And you might recognize that this is a big claim. So, forever now, we've basically used this cross entropy loss in order to do supervised training of neural networks. This paper proposes to replace that with the supervised contrastive loss. And let's jump straight into the results here. They say our supervised contrastive loss outperforms the cross entropy loss with standard data augmentations such as auto augment and random augment. So, these are some of the previous state-of-the-art data augmentation techniques used together with the cross entropy loss. And they say their supervised contrastive loss outperforms them. You can see here on ImageNet, which is the biggest vision benchmark or the most famous one, this new loss, the supervised contrastive loss outperforms these other methods by something like a percent. One percent is a big improvement on ImageNet right now. So, it is a big claim, right? You recognize if this is true, this could be a game changer basically for all of supervised learning. And supervised learning is really the only thing right now in deep learning that works. So, it could revolutionize the field. But, so here's the butt. It is actually not a new loss to replace the cross entropy loss. And that's... They do come about this pretty quickly. So, I don't think they're dishonest or lying or anything here. But it is sort of if you start reading, you'd be like, what? This is a new loss. It is not. It is a new way of pre-training the network for a classification task. And so, let's look into this. So, if you look at what does it mean to build a classifier? This is what you usually do. This is supervised cross entropy training. You have an image and the image here is of a dog. You put it through your network and you obtain a representation. So, the representation here is this last layer or the second to last layer. And you put that through a classification layer and then a softmax. And what you get as an output is basically a probability distribution. And let's say you have three classes here. There's dog, there's cat, and there's horse. And let's say the network doesn't yet... isn't yet trained very well. So, the probability for dog here is fairly low. So, this is basically what the network thinks of that image. Like, which classes it belonged to with what probability? You also have this label right here. So, the label dog for that image, what you do with that is you do a one-way. So, that would look like this. So, the one is at the position where the correct class is. And then the cross entropy loss takes all of this and does the following. There's a sum over all your classes. In this case, you have three classes. And let's call these the labels L. And you want to always take the label of the class times the log probability that the network thinks belongs to this class. So, you can quickly see that this, if the label is zero, so for all the incorrect classes, that means this entire term drops away. And only if the label is one. So, only the correct class that will result in the log probability of the class where the label is the correct label. So, in order to make this a loss, you actually have to put a negative sign in front of here because you want to, so this entire thing reduces to the log probability of the correct class. This is what you want to maximize. Therefore, if you want to minimize something you need. So, you minimize the negative log probability of the correct class, which means you maximize the probability. If you've never looked at the cross entropy loss like this, it is important to notice that you're going to say, hey, all this does is pull this here up. And it doesn't do anything to the other ones, but you have to realize that this soft max operation, since this is a probability distribution. All of this is normalized to sum up to one. So, implicitly, you will push these down through the normalization. So, what this does is it pushes the correct class up, and it pushes the other classes down. So, to look at this is going to be important later, because if you look at what this representation here does. So, again, you have the network produces a representation here. This is 2000 dimensional, and then it does, it adds on top this classification layer. This classification layer is simply a linear layer, and then a soft max on top. So, how you have to imagine this is that there is a representation space, this 2000 dimensional space, and the representations are made in such a way that the labels such that, sorry, let's have three classes here. The representations are made in such a way that a linear classifier can separate them correctly. So, here this would be like a boundary, and then this would be another boundary, and this maybe would be another decision boundary. So, you can see that linear classifier can separate the classes well. That is the goal if you use these soft max cross entropy loss. That is implicitly what will happen in the representation space W. All it cares about is that the classes are on one side of the decision boundary, and everything else is on the other side of a decision boundary. So, if you have the network isn't trained very well at the beginning, and you maybe have a sample of the green class here, it will push the network such that the representation of that sample will go onto the other side of this decision boundary, and it will push the decision boundary at the same time to make that happen more easily. So, it will optimize all of this at the same time. That's what you do. That's how you optimize the representations. So, this work here, and the other work has said, wouldn't it be great if the representation and decision boundaries weren't just trained at the same time for this, but we learn a good representations first, such that classifying them becomes very simple. And, in essence, what this paper says is, if we have a representation space W, shouldn't images of the same class, shouldn't we just make them close together? So, without caring about decision boundaries, we just want them to be close to each other, and we want them to be far apart from other classes. If that happens, you can see that a linear class if I was going to have a very easy time separating these classes later. So, that's exactly what this paper does. It has a pre-training stage and a training stage. So, in the pre-training stage, this is over here, supervised contrastive. In the pre-training stage, it simply tries to learn these representations, like, over, like, down here, such that, without the decision boundaries, class images of the same class are close together, and images of different classes are far apart, which notice the subtle difference, right, to the cross-entropy loss, where you just care about them being on one or the other side of a decision boundary. And in stage one, and then in stage two, and there is where it comes in, you basically freeze the network, so you freeze these weights down here. These are frozen. You don't train them anymore. So, the train is this one classification layer. So, the represent, you actually freeze also the representation layer here. You only train the classifier on top in stage two, but you train it using softmax and using the cross-entropy loss. So, you train the classifier in the old cross-entropy way, using just normal supervised learning. The difference here is that the stage one pre-training is what's training the network, and the cross-entropy loss only trains the classifier. So, let's look at how this pre-training actually works. What it's using is a method called contrastive pre-training. Now, in contrastive pre-training, and they have a little diagram up here, what this does, is if you look at the classic way of doing contrastive pre-training, you have to go to the unsupervised pre-training literature. People have kind of discovered that they can improve a neural network by pre-training it first in an unsupervised way. This is also called, some of these methods are called self-supervised. So, the advantage here of self-supervised or unsupervised pre-training is that you don't need labels. What you want to do is simply to make the representation space somewhat meaningful. So, you simply want the network to learn representations of images that are somehow meaningful. And here's how you do it. So, you want to take an image like this dog here. And then you want to randomly augment this image, which just means you want to produce different versions of the same image. In this case down here, this is a random crop. It's cropped about here. It's still the same image, but it's kind of a different version of it. In the case here, you can see that it's flipped left-right and the brightness is slightly increased. So, these are just different versions of the same image. And what you also want are what's called negatives. Negatives are simply different images from your data set. For example, this or this or this. You don't care as long as they're different. You just sample a bunch. And what you want, so you're embedding space. And they make a big deal here that they are normalized and that seems to work better. But this is not necessary for the idea to work. The big idea is here that if you have an image, right here, let's say this is the dog, and the blue dots here are the augmented versions of the same dog. And the green dots are all the other images in the data set. What you want is that all the images that come from the original same image are pulled close together and everything else is pushed apart. Right, so that's why these are called positives and these are called negatives. So the contrastive training basically means that you always want to have a set that you pull together in representation space and a set called the negatives that you push apart. So the network basically learns about these random transformations that you have here. The network kind of learns what it means to come from the same image. It learns to be robust to these kind of transformations. It learns about the data in general and how to kind of spread the data in embedding space with these transformations. So this usually ends up in a pretty good representation space. And people have been using this in recent years in order to gain significant improvements. Now, the problem here, if you specifically do this to pre-training a classifier, is the thing they show on the right. So on the left here, you have a picture of a dog. Right, but if you just do this self-supervised, you do it without the labels. So it can happen that this image here shows up in the negatives. But it is also of a dog. Right, and now this image here is going to end up maybe being this image here. And you see what happens to it. It's a green one. So it's going to get pushed apart. And this is going to make the entire task for the later classifier much harder. Because if they are pushed apart from each other, how is a linear classifier going to have them on the same side of the decision boundary while having everything else on a different side? Right, so the task here is implicitly making the task for the later class if they are harder by pushing apart samples that should be of the same class. And so this is not happening if you introduce a labels to the pre-training objective. That's what they do. The supervised contrastive objective. Now, you still, all you want to do is here, we're going to draw the same embedding space. And we're going to draw this original dog image. And we're going to draw the augmented version of the original dog image. But now we also have the following. We also have these images, which are images of the same class. So we're going to put them in black here. And let's say the augmented versions around them in smaller black dots, augmented versions of those, right? You can augment them as well. And then you have the negative samples. And the negative samples are not just any images, but just images of different classes. So you just go over your mini batch and all everything that's of the same class becomes positives, including their augmentations. And everything that is not in the same class becomes negatives. And also you can augment them as well. So now we have a bunch of things in our embedding space. And our objective is simply going to be, again, we want to push away all the images that are not of the same class as our original, as our red original image, which is called the anchor. So all of this needs to be pushed away. But now we want to pull together all the augmented versions of the original image, but also we want to pull together all of the other images of the same class, including also their augmented version. So all of this is going to be pulled together. So not only does the network learn about these augmentations, which, again, for this idea, the augmentations aren't even necessary. The network learns a representation space where images of the same class are close together, which, again, is going to make the task of later linear classifiers that needs to separate this class from other classes very, very easy. And again, the other images aren't just going to be pushed away, but if they're from the same class, let's say this and this image are from the same class. All of those are going to be pushed apart from our red dot, but by themselves being pushed together to their own cluster here of their own class. I hope this makes sense, and I hope the difference to the cross entropy objective is sort of clear. The cross entropy objective simply from the beginning just cares about which side of the decision boundary you're on, while this pre-training objective first cares to put things close together that are in the same class, and then the decision classifier will have a much easier time. The reason why this works better than the, because it's not entirely clear from the beginning that why this should work better, because it's working with the same information. It's just because people have generally found that these pre-training, contrastive pre-training objectives, they just are somewhat better at exploiting the information in the data set. Then if you just hammer on hammer with the cross entropy loss from the beginning. But it is not fully explained yet why this works better, because it's working with the same data. Again, the difference here is that the previous methods of contrastive pre-training, the self-supervised ones, they did not have access to the labels. And the advantage of that is you can have a giant database of unlabeled additional data that you do the pre-training on. Whereas here we do the pre-training including the labels. So here the label dog is an intrinsic part because we need to know which of the samples we need to pull together. But that also means we cannot leverage the, maybe, that we have more unlabeled data. So the data is pretty cheap to obtain. So that's the advantages and disadvantages here. So this new loss, so they do compare this here. And usually in these contrastive objectives you have somewhat like two encoders, one to encode the anchor and one to encode the augmented versions. And this one is like a momentum with shared weights and so on. And all of this isn't really important if you want to look into that, look into papers like momentum contrast or I did one on curl for reinforcement learning. I think the general gist of it is clear. So they compare the formulation of their loss to the self-supervised one. Usually it takes the form of things like this. So one is the anchor here and then the ZJI would be the positive example. And you see here that the inner product between the anchor and the positive example, sorry about that. The inner product should be high because here the loss is the negative of whatever is here. So if you minimize the loss you say I want the inner product between my anchor and whatever is the positive example to be high. And everything else here, which includes the thing on the top, but it also includes everything else, I want the inner product to be low. And which is exactly the thing where you push, you pull together the positives and you push apart everything else. That is the standard objective that you had before they extend this, but it looks almost the same. So compared to the unsupervised objective now, first of all they extend this such that you can have more than one positive sample. Now this is also possible in the unsupervised way. So they just augmented by this and they also now this is the crucial part they include the labels into the pre-turning objective. So they say everywhere where I and J have the same label should be maximized in the inner product. So should be pulled together while everything else is being pushed apart. Yeah, so they say we generalize to an arbitrary number of positives. And they also say contrastive power increases with more negatives. I think that's just a finding that they have that when they add more negatives so when they increase the batch size that contrastive power increases. They do analyze their gradient which I find it's pretty neat. You can already see that if you formulate a loss of course the gradient is going to go in the negative direction, but they make it clear that if you look at the gradient for the positive cases, what appears is this one minus PIJ quantity and the PIJ quantity is exactly the inner product between I and J normalized of course. So if you mean so the gradient is going to point into the negative direction of that for the positive. So it means you're going to pull them together and it's going to push into this direction with for the negative classes which means you push them apart. And they also analyze what happens in with relation to hardness. So they say there are two kinds of if you just look at the positive samples, there are two kinds that are easy positives where the network has already learned to match them closely where the inner product is almost one if you look at them. That means the PIJ quantity is large because that is basically the inner product and you look at this term this term is exactly what we saw in the gradient. Then you see that this here since this is one this entire thing is zero this is also high this is close to one so this entire thing is zero this is almost zero. But if you have a hard positive where the network hasn't learned yet to align the inner product properly or align the representation properly. Then the angle between the things again these are normalized the angle is there approximately orthogonal so the gradient magnitude is going to be this here is going to be approximately zero so this is close to one and this here since this is also zero is also close to one. So this is going to be larger than zero which means that their loss focuses on the examples that are that the network cannot yet represent well according to their objective which makes sense right first of all. But second of all it that is exactly the same thing as in the cross entropy loss if you if you look at the cross entropy loss and you have a situation where the network is really good already for a given sample so it already puts a dog into the dog class then the gradient will not be pulling much for that sample it might mainly focuses on where you're still wrong. So it is like I appreciate the analysis but it is not a notable difference I think what they want to show is that their loss if you do gradient descent really does what it is supposed to do namely first of all it does this pulling together pushing a part of inner products for the positive and negative samples and it mainly focuses on samples where you not yet have found a good representation. So it focuses on pairs that are not yet correctly close or together or for a part they also connect this to the triplet loss where they can show after some approximation that if their loss only has one positive and one negative sample it is going to be proportional to the triplet loss. The triplet loss is basically where you have an image and you find one positive I think that's going to be of the same class right here and you find one negative of a different class and you try to push those apart while pulling those together. The problem here they say is the problem of hard negative sampling in order for this to make sense you need the negative sample to be what's called a hard negative sample so this is hard negative mining because you only have one negative sample you better make this something where the network can learn from right and if it's too easy the network can learn anything and there were there by you have the problem of hard negative mining where you often have to fill it up. You can find a good negative sample to go along with this pair of positive samples but I don't really see how their method except that it has a bunch of positives and negative samples except for that which I guess you could also apply to the triplet loss. Again if your method is a contrastive method you do have the problem that if you simply sample at random your negative samples are going to become easier and easier over the training over the course of training and you get the problem of at some point you're going to have to do actively sample hard negatives. This paper just gets surrounded by having huge batch sizes so yeah but again they do get state of the art on image net for these types of networks and augmentation strategies and they do look at how their loss appears to be more hyper parameter stable so if they change out the augmentation if they change the optimizer or the learning rate you can see here that the spread in accuracy is much smaller than for the cross entropy loss except here but it is it is hard to compare variances of things that don't have the same means in terms of accuracy so take this on the right here with a grain of salt they also evaluate this on corrupted image net so there's an image net data set where you it has several levels of corruptedness of the data set and you can see your accuracy goes down but the accuracy for the cross entropy loss goes down faster than for the supervised contrastive loss you see they start together like this and they go further apart now it is not clear to me whether that's just an effect like if you just train a supervised contrastive loss also to this level whether it would fall off at the same speed or whether because it is the supervised contrastive loss it would kind of match that curve is not clear whether that's really an effect of the difference of the losses or is just an effect of the fact that they aren't the same accuracy to begin with again this kind of shifting you can't really compare things that have different means in the first place but let's it is an interesting finding that their method is more stable to these corruptions I just want to point out at the end they are training details and just highlight they train for up to 700 epochs during the pre training stage which is I think standard but they had and they trained up models with batch size up to 8,192 so you need like a super TPU cluster to run these kind of things and I am never exactly trusting of numbers like this even though it's it's kind of a good improvement it is still like a 1% improvement and in these small numbers I feel I just feel the there might be there might be a big effect that things like batch sizes and how much you put into computing how much compute you put into it and what else you're doing there might be so much influence of that that I first want to see this replicated multiple times across the entire field before I'm going to really trust this is a good thing to do alright so I hope you like this if you're still here thank you consider subscribing if you have a comment please leave it I usually read them and with that bye bye | [{"start": 0.0, "end": 6.0, "text": " Hi there, today we're looking at supervised contrastive learning by people from Google"}, {"start": 6.0, "end": 8.0, "text": " Research and MIT."}, {"start": 8.0, "end": 14.0, "text": " Now, this paper proposes a new loss for supervised learning."}, {"start": 14.0, "end": 19.0, "text": " And you might recognize that this is a big claim."}, {"start": 19.0, "end": 25.0, "text": " So, forever now, we've basically used this cross entropy loss in order to do supervised"}, {"start": 25.0, "end": 27.0, "text": " training of neural networks."}, {"start": 27.0, "end": 33.0, "text": " This paper proposes to replace that with the supervised contrastive loss."}, {"start": 33.0, "end": 36.0, "text": " And let's jump straight into the results here."}, {"start": 36.0, "end": 41.0, "text": " They say our supervised contrastive loss outperforms the cross entropy loss"}, {"start": 41.0, "end": 46.0, "text": " with standard data augmentations such as auto augment and random augment."}, {"start": 46.0, "end": 52.0, "text": " So, these are some of the previous state-of-the-art data augmentation techniques"}, {"start": 52.0, "end": 55.0, "text": " used together with the cross entropy loss."}, {"start": 55.0, "end": 59.0, "text": " And they say their supervised contrastive loss outperforms them."}, {"start": 59.0, "end": 65.0, "text": " You can see here on ImageNet, which is the biggest vision benchmark or the most famous one,"}, {"start": 65.0, "end": 74.0, "text": " this new loss, the supervised contrastive loss outperforms these other methods by something like a percent."}, {"start": 74.0, "end": 78.0, "text": " One percent is a big improvement on ImageNet right now."}, {"start": 78.0, "end": 82.0, "text": " So, it is a big claim, right?"}, {"start": 82.0, "end": 89.0, "text": " You recognize if this is true, this could be a game changer basically for all of supervised learning."}, {"start": 89.0, "end": 95.0, "text": " And supervised learning is really the only thing right now in deep learning that works."}, {"start": 95.0, "end": 98.0, "text": " So, it could revolutionize the field."}, {"start": 98.0, "end": 100.0, "text": " But, so here's the butt."}, {"start": 100.0, "end": 105.0, "text": " It is actually not a new loss to replace the cross entropy loss."}, {"start": 105.0, "end": 108.0, "text": " And that's..."}, {"start": 108.0, "end": 115.0, "text": " They do come about this pretty quickly. So, I don't think they're dishonest or lying or anything here."}, {"start": 115.0, "end": 120.0, "text": " But it is sort of if you start reading, you'd be like, what? This is a new loss."}, {"start": 120.0, "end": 121.0, "text": " It is not."}, {"start": 121.0, "end": 127.0, "text": " It is a new way of pre-training the network for a classification task."}, {"start": 127.0, "end": 131.0, "text": " And so, let's look into this."}, {"start": 131.0, "end": 136.0, "text": " So, if you look at what does it mean to build a classifier?"}, {"start": 136.0, "end": 141.0, "text": " This is what you usually do. This is supervised cross entropy training."}, {"start": 141.0, "end": 143.0, "text": " You have an image and the image here is of a dog."}, {"start": 143.0, "end": 148.0, "text": " You put it through your network and you obtain a representation."}, {"start": 148.0, "end": 154.0, "text": " So, the representation here is this last layer or the second to last layer."}, {"start": 154.0, "end": 159.0, "text": " And you put that through a classification layer and then a softmax."}, {"start": 159.0, "end": 164.0, "text": " And what you get as an output is basically a probability distribution."}, {"start": 164.0, "end": 167.0, "text": " And let's say you have three classes here."}, {"start": 167.0, "end": 171.0, "text": " There's dog, there's cat, and there's horse."}, {"start": 171.0, "end": 175.0, "text": " And let's say the network doesn't yet... isn't yet trained very well."}, {"start": 175.0, "end": 179.0, "text": " So, the probability for dog here is fairly low."}, {"start": 179.0, "end": 183.0, "text": " So, this is basically what the network thinks of that image."}, {"start": 183.0, "end": 186.0, "text": " Like, which classes it belonged to with what probability?"}, {"start": 186.0, "end": 189.0, "text": " You also have this label right here."}, {"start": 189.0, "end": 193.0, "text": " So, the label dog for that image, what you do with that is you do a one-way."}, {"start": 193.0, "end": 196.0, "text": " So, that would look like this."}, {"start": 196.0, "end": 200.0, "text": " So, the one is at the position where the correct class is."}, {"start": 200.0, "end": 204.0, "text": " And then the cross entropy loss takes all of this and does the following."}, {"start": 204.0, "end": 207.0, "text": " There's a sum over all your classes."}, {"start": 207.0, "end": 210.0, "text": " In this case, you have three classes."}, {"start": 210.0, "end": 214.0, "text": " And let's call these the labels L."}, {"start": 214.0, "end": 221.0, "text": " And you want to always take the label of the class times the log probability"}, {"start": 221.0, "end": 226.0, "text": " that the network thinks belongs to this class."}, {"start": 226.0, "end": 231.0, "text": " So, you can quickly see that this, if the label is zero,"}, {"start": 231.0, "end": 236.0, "text": " so for all the incorrect classes, that means this entire term drops away."}, {"start": 236.0, "end": 239.0, "text": " And only if the label is one."}, {"start": 239.0, "end": 247.0, "text": " So, only the correct class that will result in the log probability of the class"}, {"start": 247.0, "end": 252.0, "text": " where the label is the correct label."}, {"start": 252.0, "end": 258.0, "text": " So, in order to make this a loss, you actually have to put a negative sign in front of here"}, {"start": 258.0, "end": 265.0, "text": " because you want to, so this entire thing reduces to the log probability of the correct class."}, {"start": 265.0, "end": 268.0, "text": " This is what you want to maximize."}, {"start": 268.0, "end": 273.0, "text": " Therefore, if you want to minimize something you need."}, {"start": 273.0, "end": 278.0, "text": " So, you minimize the negative log probability of the correct class,"}, {"start": 278.0, "end": 282.0, "text": " which means you maximize the probability."}, {"start": 282.0, "end": 286.0, "text": " If you've never looked at the cross entropy loss like this,"}, {"start": 286.0, "end": 289.0, "text": " it is important to notice that you're going to say,"}, {"start": 289.0, "end": 293.0, "text": " hey, all this does is pull this here up."}, {"start": 293.0, "end": 296.0, "text": " And it doesn't do anything to the other ones,"}, {"start": 296.0, "end": 299.0, "text": " but you have to realize that this soft max operation,"}, {"start": 299.0, "end": 301.0, "text": " since this is a probability distribution."}, {"start": 301.0, "end": 304.0, "text": " All of this is normalized to sum up to one."}, {"start": 304.0, "end": 309.0, "text": " So, implicitly, you will push these down through the normalization."}, {"start": 309.0, "end": 312.0, "text": " So, what this does is it pushes the correct class up,"}, {"start": 312.0, "end": 315.0, "text": " and it pushes the other classes down."}, {"start": 315.0, "end": 319.0, "text": " So, to look at this is going to be important later,"}, {"start": 319.0, "end": 324.0, "text": " because if you look at what this representation here does."}, {"start": 324.0, "end": 328.0, "text": " So, again, you have the network produces a representation here."}, {"start": 328.0, "end": 331.0, "text": " This is 2000 dimensional, and then it does,"}, {"start": 331.0, "end": 334.0, "text": " it adds on top this classification layer."}, {"start": 334.0, "end": 337.0, "text": " This classification layer is simply a linear layer,"}, {"start": 337.0, "end": 340.0, "text": " and then a soft max on top."}, {"start": 340.0, "end": 344.0, "text": " So, how you have to imagine this is that there is a representation space,"}, {"start": 344.0, "end": 347.0, "text": " this 2000 dimensional space,"}, {"start": 347.0, "end": 356.0, "text": " and the representations are made in such a way that the labels such that,"}, {"start": 356.0, "end": 359.0, "text": " sorry, let's have three classes here."}, {"start": 359.0, "end": 363.0, "text": " The representations are made in such a way that a linear classifier"}, {"start": 363.0, "end": 367.0, "text": " can separate them correctly."}, {"start": 367.0, "end": 370.0, "text": " So, here this would be like a boundary,"}, {"start": 370.0, "end": 373.0, "text": " and then this would be another boundary,"}, {"start": 373.0, "end": 377.0, "text": " and this maybe would be another decision boundary."}, {"start": 377.0, "end": 382.0, "text": " So, you can see that linear classifier can separate the classes well."}, {"start": 382.0, "end": 386.0, "text": " That is the goal if you use these soft max cross entropy loss."}, {"start": 386.0, "end": 391.0, "text": " That is implicitly what will happen in the representation space W."}, {"start": 391.0, "end": 395.0, "text": " All it cares about is that the classes are on one side of the decision boundary,"}, {"start": 395.0, "end": 400.0, "text": " and everything else is on the other side of a decision boundary."}, {"start": 400.0, "end": 405.0, "text": " So, if you have the network isn't trained very well at the beginning,"}, {"start": 405.0, "end": 408.0, "text": " and you maybe have a sample of the green class here,"}, {"start": 408.0, "end": 414.0, "text": " it will push the network such that the representation of that sample"}, {"start": 414.0, "end": 418.0, "text": " will go onto the other side of this decision boundary,"}, {"start": 418.0, "end": 421.0, "text": " and it will push the decision boundary at the same time"}, {"start": 421.0, "end": 424.0, "text": " to make that happen more easily."}, {"start": 424.0, "end": 426.0, "text": " So, it will optimize all of this at the same time."}, {"start": 426.0, "end": 428.0, "text": " That's what you do."}, {"start": 428.0, "end": 430.0, "text": " That's how you optimize the representations."}, {"start": 430.0, "end": 434.0, "text": " So, this work here, and the other work has said,"}, {"start": 434.0, "end": 440.0, "text": " wouldn't it be great if the representation and decision boundaries"}, {"start": 440.0, "end": 443.0, "text": " weren't just trained at the same time for this,"}, {"start": 443.0, "end": 446.0, "text": " but we learn a good representations first,"}, {"start": 446.0, "end": 450.0, "text": " such that classifying them becomes very simple."}, {"start": 450.0, "end": 453.0, "text": " And, in essence, what this paper says is,"}, {"start": 453.0, "end": 457.0, "text": " if we have a representation space W,"}, {"start": 457.0, "end": 461.0, "text": " shouldn't images of the same class,"}, {"start": 461.0, "end": 464.0, "text": " shouldn't we just make them close together?"}, {"start": 464.0, "end": 467.0, "text": " So, without caring about decision boundaries,"}, {"start": 467.0, "end": 471.0, "text": " we just want them to be close to each other,"}, {"start": 471.0, "end": 475.0, "text": " and we want them to be far apart from other classes."}, {"start": 475.0, "end": 478.0, "text": " If that happens, you can see that a linear class"}, {"start": 478.0, "end": 484.0, "text": " if I was going to have a very easy time separating these classes later."}, {"start": 484.0, "end": 488.0, "text": " So, that's exactly what this paper does."}, {"start": 488.0, "end": 492.0, "text": " It has a pre-training stage and a training stage."}, {"start": 492.0, "end": 495.0, "text": " So, in the pre-training stage, this is over here,"}, {"start": 495.0, "end": 497.0, "text": " supervised contrastive."}, {"start": 497.0, "end": 502.0, "text": " In the pre-training stage, it simply tries to learn these representations,"}, {"start": 502.0, "end": 506.0, "text": " like, over, like, down here, such that,"}, {"start": 506.0, "end": 510.0, "text": " without the decision boundaries,"}, {"start": 510.0, "end": 514.0, "text": " class images of the same class are close together,"}, {"start": 514.0, "end": 517.0, "text": " and images of different classes are far apart,"}, {"start": 517.0, "end": 520.0, "text": " which notice the subtle difference, right,"}, {"start": 520.0, "end": 522.0, "text": " to the cross-entropy loss,"}, {"start": 522.0, "end": 527.0, "text": " where you just care about them being on one or the other side of a decision boundary."}, {"start": 527.0, "end": 531.0, "text": " And in stage one,"}, {"start": 531.0, "end": 535.0, "text": " and then in stage two,"}, {"start": 535.0, "end": 538.0, "text": " and there is where it comes in,"}, {"start": 538.0, "end": 540.0, "text": " you basically freeze the network,"}, {"start": 540.0, "end": 543.0, "text": " so you freeze these weights down here."}, {"start": 543.0, "end": 544.0, "text": " These are frozen."}, {"start": 544.0, "end": 546.0, "text": " You don't train them anymore."}, {"start": 546.0, "end": 550.0, "text": " So, the train is this one classification layer."}, {"start": 550.0, "end": 554.0, "text": " So, the represent, you actually freeze also the representation layer here."}, {"start": 554.0, "end": 559.0, "text": " You only train the classifier on top in stage two,"}, {"start": 559.0, "end": 564.0, "text": " but you train it using softmax and using the cross-entropy loss."}, {"start": 564.0, "end": 569.0, "text": " So, you train the classifier in the old cross-entropy way,"}, {"start": 569.0, "end": 572.0, "text": " using just normal supervised learning."}, {"start": 572.0, "end": 579.0, "text": " The difference here is that the stage one pre-training is what's training the network,"}, {"start": 579.0, "end": 583.0, "text": " and the cross-entropy loss only trains the classifier."}, {"start": 583.0, "end": 587.0, "text": " So, let's look at how this pre-training actually works."}, {"start": 587.0, "end": 592.0, "text": " What it's using is a method called contrastive pre-training."}, {"start": 592.0, "end": 594.0, "text": " Now, in contrastive pre-training,"}, {"start": 594.0, "end": 597.0, "text": " and they have a little diagram up here, what this does,"}, {"start": 597.0, "end": 603.0, "text": " is if you look at the classic way of doing contrastive pre-training,"}, {"start": 603.0, "end": 607.0, "text": " you have to go to the unsupervised pre-training literature."}, {"start": 607.0, "end": 612.0, "text": " People have kind of discovered that they can improve a neural network"}, {"start": 612.0, "end": 616.0, "text": " by pre-training it first in an unsupervised way."}, {"start": 616.0, "end": 620.0, "text": " This is also called, some of these methods are called self-supervised."}, {"start": 620.0, "end": 626.0, "text": " So, the advantage here of self-supervised or unsupervised pre-training"}, {"start": 626.0, "end": 628.0, "text": " is that you don't need labels."}, {"start": 628.0, "end": 635.0, "text": " What you want to do is simply to make the representation space somewhat meaningful."}, {"start": 635.0, "end": 644.0, "text": " So, you simply want the network to learn representations of images that are somehow meaningful."}, {"start": 644.0, "end": 646.0, "text": " And here's how you do it."}, {"start": 646.0, "end": 653.0, "text": " So, you want to take an image like this dog here."}, {"start": 653.0, "end": 658.0, "text": " And then you want to randomly augment this image,"}, {"start": 658.0, "end": 662.0, "text": " which just means you want to produce different versions of the same image."}, {"start": 662.0, "end": 665.0, "text": " In this case down here, this is a random crop."}, {"start": 665.0, "end": 666.0, "text": " It's cropped about here."}, {"start": 666.0, "end": 669.0, "text": " It's still the same image, but it's kind of a different version of it."}, {"start": 669.0, "end": 673.0, "text": " In the case here, you can see that it's flipped left-right"}, {"start": 673.0, "end": 676.0, "text": " and the brightness is slightly increased."}, {"start": 676.0, "end": 679.0, "text": " So, these are just different versions of the same image."}, {"start": 679.0, "end": 683.0, "text": " And what you also want are what's called negatives."}, {"start": 683.0, "end": 687.0, "text": " Negatives are simply different images from your data set."}, {"start": 687.0, "end": 690.0, "text": " For example, this or this or this."}, {"start": 690.0, "end": 692.0, "text": " You don't care as long as they're different."}, {"start": 692.0, "end": 693.0, "text": " You just sample a bunch."}, {"start": 693.0, "end": 698.0, "text": " And what you want, so you're embedding space."}, {"start": 698.0, "end": 702.0, "text": " And they make a big deal here that they are normalized and that seems to work better."}, {"start": 702.0, "end": 706.0, "text": " But this is not necessary for the idea to work."}, {"start": 706.0, "end": 713.0, "text": " The big idea is here that if you have an image,"}, {"start": 713.0, "end": 717.0, "text": " right here, let's say this is the dog,"}, {"start": 717.0, "end": 722.0, "text": " and the blue dots here are the augmented versions of the same dog."}, {"start": 722.0, "end": 726.0, "text": " And the green dots are all the other images in the data set."}, {"start": 726.0, "end": 734.0, "text": " What you want is that all the images that come from the original same image"}, {"start": 734.0, "end": 740.0, "text": " are pulled close together and everything else is pushed apart."}, {"start": 740.0, "end": 746.0, "text": " Right, so that's why these are called positives and these are called negatives."}, {"start": 746.0, "end": 751.0, "text": " So the contrastive training basically means that you always want to have a set"}, {"start": 751.0, "end": 757.0, "text": " that you pull together in representation space and a set called the negatives that you push apart."}, {"start": 757.0, "end": 763.0, "text": " So the network basically learns about these random transformations that you have here."}, {"start": 763.0, "end": 768.0, "text": " The network kind of learns what it means to come from the same image."}, {"start": 768.0, "end": 771.0, "text": " It learns to be robust to these kind of transformations."}, {"start": 771.0, "end": 777.0, "text": " It learns about the data in general and how to kind of spread the data in embedding space"}, {"start": 777.0, "end": 778.0, "text": " with these transformations."}, {"start": 778.0, "end": 782.0, "text": " So this usually ends up in a pretty good representation space."}, {"start": 782.0, "end": 789.0, "text": " And people have been using this in recent years in order to gain significant improvements."}, {"start": 789.0, "end": 796.0, "text": " Now, the problem here, if you specifically do this to pre-training a classifier,"}, {"start": 796.0, "end": 799.0, "text": " is the thing they show on the right."}, {"start": 799.0, "end": 803.0, "text": " So on the left here, you have a picture of a dog."}, {"start": 803.0, "end": 809.0, "text": " Right, but if you just do this self-supervised, you do it without the labels."}, {"start": 809.0, "end": 815.0, "text": " So it can happen that this image here shows up in the negatives."}, {"start": 815.0, "end": 823.0, "text": " But it is also of a dog. Right, and now this image here is going to end up maybe being this image here."}, {"start": 823.0, "end": 825.0, "text": " And you see what happens to it. It's a green one."}, {"start": 825.0, "end": 827.0, "text": " So it's going to get pushed apart."}, {"start": 827.0, "end": 832.0, "text": " And this is going to make the entire task for the later classifier much harder."}, {"start": 832.0, "end": 835.0, "text": " Because if they are pushed apart from each other,"}, {"start": 835.0, "end": 841.0, "text": " how is a linear classifier going to have them on the same side of the decision boundary"}, {"start": 841.0, "end": 844.0, "text": " while having everything else on a different side?"}, {"start": 844.0, "end": 851.0, "text": " Right, so the task here is implicitly making the task for the later class"}, {"start": 851.0, "end": 857.0, "text": " if they are harder by pushing apart samples that should be of the same class."}, {"start": 857.0, "end": 864.0, "text": " And so this is not happening if you introduce a labels to the pre-training objective."}, {"start": 864.0, "end": 867.0, "text": " That's what they do. The supervised contrastive objective."}, {"start": 867.0, "end": 874.0, "text": " Now, you still, all you want to do is here, we're going to draw the same embedding space."}, {"start": 874.0, "end": 877.0, "text": " And we're going to draw this original dog image."}, {"start": 877.0, "end": 881.0, "text": " And we're going to draw the augmented version of the original dog image."}, {"start": 881.0, "end": 884.0, "text": " But now we also have the following."}, {"start": 884.0, "end": 889.0, "text": " We also have these images, which are images of the same class."}, {"start": 889.0, "end": 892.0, "text": " So we're going to put them in black here."}, {"start": 892.0, "end": 897.0, "text": " And let's say the augmented versions around them in smaller black dots,"}, {"start": 897.0, "end": 901.0, "text": " augmented versions of those, right? You can augment them as well."}, {"start": 901.0, "end": 904.0, "text": " And then you have the negative samples."}, {"start": 904.0, "end": 910.0, "text": " And the negative samples are not just any images, but just images of different classes."}, {"start": 910.0, "end": 916.0, "text": " So you just go over your mini batch and all everything that's of the same class becomes positives,"}, {"start": 916.0, "end": 918.0, "text": " including their augmentations."}, {"start": 918.0, "end": 922.0, "text": " And everything that is not in the same class becomes negatives."}, {"start": 922.0, "end": 924.0, "text": " And also you can augment them as well."}, {"start": 924.0, "end": 928.0, "text": " So now we have a bunch of things in our embedding space."}, {"start": 928.0, "end": 934.0, "text": " And our objective is simply going to be, again, we want to push away all the images"}, {"start": 934.0, "end": 939.0, "text": " that are not of the same class as our original, as our red original image,"}, {"start": 939.0, "end": 941.0, "text": " which is called the anchor."}, {"start": 941.0, "end": 944.0, "text": " So all of this needs to be pushed away."}, {"start": 944.0, "end": 949.0, "text": " But now we want to pull together all the augmented versions of the original image,"}, {"start": 949.0, "end": 955.0, "text": " but also we want to pull together all of the other images of the same class,"}, {"start": 955.0, "end": 958.0, "text": " including also their augmented version."}, {"start": 958.0, "end": 961.0, "text": " So all of this is going to be pulled together."}, {"start": 961.0, "end": 965.0, "text": " So not only does the network learn about these augmentations, which, again,"}, {"start": 965.0, "end": 968.0, "text": " for this idea, the augmentations aren't even necessary."}, {"start": 968.0, "end": 973.0, "text": " The network learns a representation space where images of the same class"}, {"start": 973.0, "end": 979.0, "text": " are close together, which, again, is going to make the task of later linear classifiers"}, {"start": 979.0, "end": 984.0, "text": " that needs to separate this class from other classes very, very easy."}, {"start": 984.0, "end": 987.0, "text": " And again, the other images aren't just going to be pushed away,"}, {"start": 987.0, "end": 991.0, "text": " but if they're from the same class, let's say this and this image are from the same class."}, {"start": 991.0, "end": 995.0, "text": " All of those are going to be pushed apart from our red dot,"}, {"start": 995.0, "end": 1002.0, "text": " but by themselves being pushed together to their own cluster here of their own class."}, {"start": 1002.0, "end": 1009.0, "text": " I hope this makes sense, and I hope the difference to the cross entropy objective"}, {"start": 1009.0, "end": 1011.0, "text": " is sort of clear."}, {"start": 1011.0, "end": 1015.0, "text": " The cross entropy objective simply from the beginning just cares about which side"}, {"start": 1015.0, "end": 1021.0, "text": " of the decision boundary you're on, while this pre-training objective first cares"}, {"start": 1021.0, "end": 1024.0, "text": " to put things close together that are in the same class,"}, {"start": 1024.0, "end": 1030.0, "text": " and then the decision classifier will have a much easier time."}, {"start": 1030.0, "end": 1037.0, "text": " The reason why this works better than the, because it's not entirely clear"}, {"start": 1037.0, "end": 1041.0, "text": " from the beginning that why this should work better, because it's working with the same information."}, {"start": 1041.0, "end": 1046.0, "text": " It's just because people have generally found that these pre-training,"}, {"start": 1046.0, "end": 1051.0, "text": " contrastive pre-training objectives, they just are somewhat better at exploiting"}, {"start": 1051.0, "end": 1054.0, "text": " the information in the data set."}, {"start": 1054.0, "end": 1064.0, "text": " Then if you just hammer on hammer with the cross entropy loss from the beginning."}, {"start": 1064.0, "end": 1070.0, "text": " But it is not fully explained yet why this works better, because it's working with the same data."}, {"start": 1070.0, "end": 1076.0, "text": " Again, the difference here is that the previous methods of contrastive pre-training,"}, {"start": 1076.0, "end": 1081.0, "text": " the self-supervised ones, they did not have access to the labels."}, {"start": 1081.0, "end": 1088.0, "text": " And the advantage of that is you can have a giant database of unlabeled additional data"}, {"start": 1088.0, "end": 1092.0, "text": " that you do the pre-training on."}, {"start": 1092.0, "end": 1096.0, "text": " Whereas here we do the pre-training including the labels."}, {"start": 1096.0, "end": 1102.0, "text": " So here the label dog is an intrinsic part because we need to know which of the samples we need to pull together."}, {"start": 1102.0, "end": 1109.0, "text": " But that also means we cannot leverage the, maybe, that we have more unlabeled data."}, {"start": 1109.0, "end": 1112.0, "text": " So the data is pretty cheap to obtain."}, {"start": 1112.0, "end": 1116.0, "text": " So that's the advantages and disadvantages here."}, {"start": 1116.0, "end": 1122.0, "text": " So this new loss, so they do compare this here."}, {"start": 1122.0, "end": 1128.0, "text": " And usually in these contrastive objectives you have somewhat like two encoders,"}, {"start": 1128.0, "end": 1133.0, "text": " one to encode the anchor and one to encode the augmented versions."}, {"start": 1133.0, "end": 1137.0, "text": " And this one is like a momentum with shared weights and so on."}, {"start": 1137.0, "end": 1143.0, "text": " And all of this isn't really important if you want to look into that, look into papers like momentum contrast"}, {"start": 1143.0, "end": 1147.0, "text": " or I did one on curl for reinforcement learning."}, {"start": 1147.0, "end": 1154.0, "text": " I think the general gist of it is clear."}, {"start": 1154.0, "end": 1159.0, "text": " So they compare the formulation of their loss to the self-supervised one."}, {"start": 1159.0, "end": 1162.0, "text": " Usually it takes the form of things like this."}, {"start": 1162.0, "end": 1170.0, "text": " So one is the anchor here and then the ZJI would be the positive example."}, {"start": 1170.0, "end": 1176.0, "text": " And you see here that the inner product between the anchor and the positive example, sorry about that."}, {"start": 1176.0, "end": 1186.0, "text": " The inner product should be high because here the loss is the negative of whatever is here."}, {"start": 1186.0, "end": 1195.0, "text": " So if you minimize the loss you say I want the inner product between my anchor and whatever is the positive example to be high."}, {"start": 1195.0, "end": 1201.0, "text": " And everything else here, which includes the thing on the top, but it also includes everything else,"}, {"start": 1201.0, "end": 1204.0, "text": " I want the inner product to be low."}, {"start": 1204.0, "end": 1215.0, "text": " And which is exactly the thing where you push, you pull together the positives and you push apart everything else."}, {"start": 1215.0, "end": 1223.0, "text": " That is the standard objective that you had before they extend this, but it looks almost the same."}, {"start": 1223.0, "end": 1232.0, "text": " So compared to the unsupervised objective now, first of all they extend this such that you can have more than one positive sample."}, {"start": 1232.0, "end": 1236.0, "text": " Now this is also possible in the unsupervised way."}, {"start": 1236.0, "end": 1246.0, "text": " So they just augmented by this and they also now this is the crucial part they include the labels into the pre-turning objective."}, {"start": 1246.0, "end": 1254.0, "text": " So they say everywhere where I and J have the same label should be maximized in the inner product."}, {"start": 1254.0, "end": 1263.0, "text": " So should be pulled together while everything else is being pushed apart."}, {"start": 1263.0, "end": 1271.0, "text": " Yeah, so they say we generalize to an arbitrary number of positives."}, {"start": 1271.0, "end": 1275.0, "text": " And they also say contrastive power increases with more negatives."}, {"start": 1275.0, "end": 1286.0, "text": " I think that's just a finding that they have that when they add more negatives so when they increase the batch size that contrastive power increases."}, {"start": 1286.0, "end": 1313.0, "text": " They do analyze their gradient which I find it's pretty neat. You can already see that if you formulate a loss of course the gradient is going to go in the negative direction, but they make it clear that if you look at the gradient for the positive cases, what appears is this one minus PIJ quantity and the PIJ quantity is exactly the inner product between I and J normalized of course."}, {"start": 1313.0, "end": 1335.0, "text": " So if you mean so the gradient is going to point into the negative direction of that for the positive. So it means you're going to pull them together and it's going to push into this direction with for the negative classes which means you push them apart."}, {"start": 1335.0, "end": 1355.0, "text": " And they also analyze what happens in with relation to hardness. So they say there are two kinds of if you just look at the positive samples, there are two kinds that are easy positives where the network has already learned to match them closely where the inner product is almost one if you look at them."}, {"start": 1355.0, "end": 1368.0, "text": " That means the PIJ quantity is large because that is basically the inner product and you look at this term this term is exactly what we saw in the gradient."}, {"start": 1368.0, "end": 1389.0, "text": " Then you see that this here since this is one this entire thing is zero this is also high this is close to one so this entire thing is zero this is almost zero. But if you have a hard positive where the network hasn't learned yet to align the inner product properly or align the representation properly."}, {"start": 1389.0, "end": 1414.0, "text": " Then the angle between the things again these are normalized the angle is there approximately orthogonal so the gradient magnitude is going to be this here is going to be approximately zero so this is close to one and this here since this is also zero is also close to one."}, {"start": 1414.0, "end": 1433.0, "text": " So this is going to be larger than zero which means that their loss focuses on the examples that are that the network cannot yet represent well according to their objective which makes sense right first of all."}, {"start": 1433.0, "end": 1458.0, "text": " But second of all it that is exactly the same thing as in the cross entropy loss if you if you look at the cross entropy loss and you have a situation where the network is really good already for a given sample so it already puts a dog into the dog class then the gradient will not be pulling much for that sample it might mainly focuses on where you're still wrong."}, {"start": 1458.0, "end": 1487.0, "text": " So it is like I appreciate the analysis but it is not a notable difference I think what they want to show is that their loss if you do gradient descent really does what it is supposed to do namely first of all it does this pulling together pushing a part of inner products for the positive and negative samples and it mainly focuses on samples where you not yet have found a good representation."}, {"start": 1487.0, "end": 1513.0, "text": " So it focuses on pairs that are not yet correctly close or together or for a part they also connect this to the triplet loss where they can show after some approximation that if their loss only has one positive and one negative sample it is going to be proportional to the triplet loss."}, {"start": 1513.0, "end": 1530.0, "text": " The triplet loss is basically where you have an image and you find one positive I think that's going to be of the same class right here and you find one negative of a different class and you try to push those apart while pulling those together."}, {"start": 1530.0, "end": 1559.0, "text": " The problem here they say is the problem of hard negative sampling in order for this to make sense you need the negative sample to be what's called a hard negative sample so this is hard negative mining because you only have one negative sample you better make this something where the network can learn from right and if it's too easy the network can learn anything and there were there by you have the problem of hard negative mining where you often have to fill it up."}, {"start": 1559.0, "end": 1582.0, "text": " You can find a good negative sample to go along with this pair of positive samples but I don't really see how their method except that it has a bunch of positives and negative samples except for that which I guess you could also apply to the triplet loss."}, {"start": 1582.0, "end": 1608.0, "text": " Again if your method is a contrastive method you do have the problem that if you simply sample at random your negative samples are going to become easier and easier over the training over the course of training and you get the problem of at some point you're going to have to do actively sample hard negatives."}, {"start": 1608.0, "end": 1636.0, "text": " This paper just gets surrounded by having huge batch sizes so yeah but again they do get state of the art on image net for these types of networks and augmentation strategies and they do look at how their loss appears to be more hyper parameter stable so if they change out the augmentation if they change the optimizer or the learning rate you can see here that the spread in accuracy is much smaller than for the"}, {"start": 1636.0, "end": 1664.0, "text": " cross entropy loss except here but it is it is hard to compare variances of things that don't have the same means in terms of accuracy so take this on the right here with a grain of salt they also evaluate this on corrupted image net so there's an image net data set where you it has several levels of corruptedness of the data set and you can see your"}, {"start": 1664.0, "end": 1692.0, "text": " accuracy goes down but the accuracy for the cross entropy loss goes down faster than for the supervised contrastive loss you see they start together like this and they go further apart now it is not clear to me whether that's just an effect like if you just train a supervised contrastive loss also to this level whether it would fall off at the same speed or whether because it is the supervised"}, {"start": 1692.0, "end": 1710.0, "text": " contrastive loss it would kind of match that curve is not clear whether that's really an effect of the difference of the losses or is just an effect of the fact that they aren't the same accuracy to begin with again this kind of shifting"}, {"start": 1710.0, "end": 1736.0, "text": " you can't really compare things that have different means in the first place but let's it is an interesting finding that their method is more stable to these corruptions I just want to point out at the end they are training details and just highlight they train for up to 700 epochs during the pre training stage which is I think standard but"}, {"start": 1736.0, "end": 1764.0, "text": " they had and they trained up models with batch size up to 8,192 so you need like a super TPU cluster to run these kind of things and I am never exactly trusting of numbers like this even though it's it's kind of a good improvement it is still like a 1% improvement and in these small numbers I feel I just feel the"}, {"start": 1764.0, "end": 1792.0, "text": " there might be there might be a big effect that things like batch sizes and how much you put into computing how much compute you put into it and what else you're doing there might be so much influence of that that I first want to see this replicated multiple times across the entire field before I'm going to really trust"}, {"start": 1792.0, "end": 1808.0, "text": " this is a good thing to do alright so I hope you like this if you're still here thank you consider subscribing if you have a comment please leave it I usually read them and with that bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=pZyxlf6l0N8 | Thinking While Moving: Deep Reinforcement Learning with Concurrent Control | Classic RL "stops" the world whenever the Agent computes a new action. This paper considers a more realistic scenario where the agent is thinking about the next action to take while still performing the last action. This results in a fascinating way of reformulating Q-learning in continuous time, then introducing concurrency and finally going back to discrete time.
https://arxiv.org/abs/2004.06089
Abstract:
We study reinforcement learning in settings where sampling an action from the policy must be done concurrently with the time evolution of the controlled system, such as when a robot must decide on the next action while still performing the previous action. Much like a person or an animal, the robot must think and move at the same time, deciding on its next action before the previous one has completed. In order to develop an algorithmic framework for such concurrent control problems, we start with a continuous-time formulation of the Bellman equations, and then discretize them in a way that is aware of system delays. We instantiate this new class of approximate dynamic programming methods via a simple architectural extension to existing value-based deep reinforcement learning algorithms. We evaluate our methods on simulated benchmark tasks and a large-scale robotic grasping task where the robot must "think while moving".
Authors: Ted Xiao, Eric Jang, Dmitry Kalashnikov, Sergey Levine, Julian Ibarz, Karol Hausman, Alexander Herzog
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. So if you look at these two robots, the left one labeled blocking the right one labeled concurrent. The blocking robot, as you can see, always has these little pauses in its movement, where it does nothing. And then it kind of continues with its motion, while the one on the right is one continuous motion that it does. So the reasoning here is that the robot has a camera, and the camera takes some time to register what's going on. And then also the robot has a computer inside, and the computer also takes some time to decide what to do based on what the camera saw. And while all of this is happening, the robot on the left just freezes, so it performs an action, and then it freezes because it takes time to register a state and compute a new action. Whereas the robot on the right, it takes the same amount of time to do these things. It also takes a time to register the state and compute an action, but it does that as it is executing the last action. So it does this in parallel, and then it executes the action. Once it is computed a new action, it executes that new action right on top of the old action. And that gives this one big fluid motion. So this requires a new formulation of reinforcement learning, and that's what this paper does. Thinking while moving deep reinforcement learning with concurrent control by people from Google Brain, UC Berkeley, and X. So they have a nice diagram here in the supplementary material to show you what is going on in their framework. So in classic reinforcement learning right here, in classic reinforcement learning, you have this dichotomy between agent and environment, right? So the agent and the environment. Now the agent is supposed to kind of act in the environment in the following manner. The environment will send an observation to the agent. The observation in this case is the picture of the camera. So it sends an observation, and the agent will think what to do with the observation, which is called a policy, the policy pi, will take an observation and then output an action of what to do. And we'll send back the action to that environment. So in classic RL, you assume that this part here is kind of free this time. So the environment will output an observation and as and the process of registering the observation of computing the action and of sending the action back is happens in zero time. Of course it doesn't happen in zero time, but in our reinforcement learning problems, for example, the open AI gym, the environment just stops until it gets the next action and then it performs the action right. It performs the action in the environment and by that the environment changes and time happens. And then it stops again as we think of the next action, right. So this is we usually call this one step in the in the kind of classic formulation of RL. The only point that time happens is when the action is executed. No time happens when the state is registered or when the action is computed. And that's what you see here on the left. In blue, you have the state registration. This is for example, the camera. The camera has some time in order to register and store the image that it has taken, right. Maybe post process it a little bit. So that's what the camera does. But in our classic formulation, as you can see here, if this is time, it happens instantaneously all at the same time. And also this is the policy. This is thinking what to do, right. This is your evaluation of your neural network. If this is a neural network, trying a small neural network here. This happens instantaneously in these formulations. And only as the action is executed time happens. And then until here time freezes again. And only once the action is determined time happens again. In the new formulation now, as you've already seen, what's what we have here is this, this kind of continuous framework where, let's say you're here, it actually takes time for the camera to post process the image. It takes more time for you to think about what to do. And then once you decide on an action, that action is going to happen, right. But we can say, for example, at this point, you tell the camera to take a new picture of the state, right. But that takes time. And while that's happening, the old action is still ongoing. So you don't even have to say the action is still ongoing, but the world is still moving. The world is still changing while you think, while you post process and while you evaluate your policy, the world is thinking. And only after some time, right, after this lag time here, have you decided on a new action. And then you can break that old action and kind of perform your new action. And all of this is happening in time. So this is the new framework. Now you see the problem here. The problem is that you base your decisions on the state and time t on time, sorry, time h here. You base your decisions on a state as it was at that time, right. That's what you used to think right here. That's what you store and think about. But you perform. So you perform the action at this point in time. So there is a considerable difference here because the world has now changed. So you see the problem, the action you perform is based on an old knowledge of the world. And you have basically no way of making the action dependent on the current state of the world because that would require you to capture the current state and that takes time. And in that time, the world has already shifted again. So the agent is kind of required to think ahead about the action that it is currently performing and how the world changes according to that. So this new formulation of reinforcement learning, um, formulates this in a formal way. So it formulates it in a formal way and we'll quickly go through that. Yes. So they go into the very basics here. We'll quickly, quickly go through them. So they introduce these quantities like the policy pi, the transition distribution, the reward, and the Q and value function will just quickly go over these. So you have the agent. Sorry about that. You have the agent and you have the environment. Hello. So if you think of the agent and the environment, um, the environment has this transition function transition function, it takes it says, OK, I'm in this state. And the agent does this action and here's the probability distribution over the next state. Right. So it says that your little spaceship is here. Right. And the meteors are here. And then you push the button. If if you push the button for shoot, then you'll be in the same place. Meteors will still be here, but you'll have a little shot coming out of your spaceship. That's what the environment does. Right. So you give it a state and the action and it will give you the next state. And I will also give you a reward. Right. The reward in the same thing reward here will be a second output here that tells you either, let's say, negative one, if you die or zero, if nothing happens or plus one, if you shoot a meteor. That's the reward. So this you can think of as the real world. So these two quantities are in the real world in the environment. So that's how you model the environment. Then the agent has these quantities called the policy. Pi. So pi, what Pi does is much like the transition, but Pi takes in a state and gives you an action. Right. So this is now the agent deciding this is thinking. The policy takes in a state and gives an action. And this this can take various forms, but it's just a function for now. The agent also has a queue and a V function. And these are quite quite similar. So the queue function, what the queue function will do with if you are in a state and you have several options of what to do, right. You have action one action two and action three, right. You're in state S. The queue function of S and a one, super script, Pi would tell you the following. It would tell you what's my expected reward. If I'm in state S, that's here, and perform action a. So a one. So if I now take this path and after this path, I follow the policy pi, right. The policy pi for each of the following. So it's like right now I take action a one. I don't care about my policy, but after that, I follow the policy pi. What is my expected reward going to be until the end of the episode. That's the queue function and the value function here, very similar, but it only cares about the state. It says if I'm in state S and I just follow the policy pi, even in the first step, right. I just follow this policy pi. What is my expected reward going to be over the course of the episode. That is the queue and the value functions. You can see why queue learning is popular. If you have a good queue function and the queue and the value function, these are the things that you actually want to learn, right. If you have a good queue function, you can simply always plug in every action into your queue function and then simply take the maximum the action that has the maximum queue value. Because that will give you the best reward if your policy pi, right. It's kind of self referential. If your policy is to always take the maximum queue value, then taking the maximum queue value with the policy given that you take the maximum queue value will be optimal. This was very convoluted. Let's start off with modeling the environment in this continuous framework. Instead of having the next state be determined by the current state and action in the continuous framework, they do this via differential equation. The ds is how does the environment change. This is the change in the environment that is determined by two functions, f and g. So f is your classic environment function. It takes in a state and an action at time t, right. These are not functions. It will output how the state changes. The g here is, this is a weiner process, is to introduce stochasticity as I understand it. Because in the classic formulation, the transition model gives you a probability up here, a probability distribution. So this weiner process is responsible for introducing that probabilistic nature into this differential equation. But ultimately it simply tells you how does the state change depending on my state current state and action that I perform. So the reward function now is also pretty simple. The tau here is a trajectory and the trajectory is simply the state and action over time. So if I integrate from time zero to infinity or to the end of the episode, my reward function at each point in time, right. So I go through my episode and I get high reward, not so high and so on. So the integral under this curve will be my total reward, just like we sum up the reward of individual steps in the discrete case. In the continuous case, you can think of each infinitesimal time step giving you a tiny bit of reward. So the entire reward is just an integral. Then we go on the value function for a given state at time t, right. So think about what this is. The value function for a state means what reward can I expect starting in this particular state and then following policy pi until the end of the episode. And that here is the expectation over all trajectories that come from my policy of the reward in that trajectory. So I can, you know, if I'm here, my policy now is also a distribution. It can go multiple trajectories, right. And I want to, I want to have the expected value of the reward for each one of these has a reward. The expected value of the reward overall trajectories starting from state s t. And again, here you say that that is the integral over the now here I have a bit of a problem because here they say t equals zero going from here and here, but here the t is already here. So I believe this should be this should be t equals t prime and then t prime t prime. And t minus t prime or something like this in any case, I think it should actually start from this state here and not from time zero, but I might be missing something. I'm not the biggest integrator in the world. So, you know, all right, then you have the q function. Now think of it what the q function is in this grid case, the q function tells you if I'm in state s and perform action a, what is my expected reward going to be that I have to introduce some different things here they say if I'm in state s. And I act action a, at time t until time h, right, now you have to say how long you're going to perform the action for until you perform the next action. Right, so h is your your lag time here until you perform the next action. So this now I actually agree with this formulation. With the integral here, so this is going to be the integral from time t to time t plus h, that's how long you perform the action. You're reward of performing that action, right, given the state plus the value function at the end of that. So you're here, you're in s t and you perform action a, right, and then this is your state at time t plus h. And then you're here and from there on, you could perform many, many, many actions, right, but in the original notion of the q function, the q function tells you if I'm here and I perform this action and after that, I act according to policy pi, what is my, what is my expected reward and there's a classic recurrence relation in reinforcement learning where you can say the q function in s t given to a is the reward that I get from performing a in state s plus the value function at state s at this, at the next state, right. Because the value function is exactly the reward that you would get by following policy pi in that next state and the q function means I perform a now and after that I perform pi. So this is the continuous analog that's why you have this part here where you perform the action for h time and after h time you just go after go with your policy and that will be the value function. So this is the continuous formulation of the of the problem right and now they can introduce these these lagging times so in their diagram up here, they define these notions. So you have your state s t right here, then after this time you capture the new state right. So after that time you capture the new state and decide on an action and then you perform it for h time is that correct until here. So the the i minus one of action is performed at this time and the i action is performed at this time. No, that makes no sense. So let's read it. So this is when you capture the state and you need the time to perform to to think right this is thinking. And then you perform this action at that time, this is the lag time now and you perform this action. You want to know you want to know if I perform this action until this time here, what is what is happening. So this is the new q function takes into account this thing it tells you if I'm in state s and I think this is thinking leads me to here. This is the old action right this is the old action that's still happening while I observe this state right so it means if I do this right now and after thinking I do this right. So I'm at state I'm at time t and this is still happening and then after I think thinking leads me here t plus T as I perform this new action. I'm out of colors. I perform this new action at that point until time h. What's my q function. So my q function is going to be the integral time t where I start observing the state and start thinking until t plus T as. That's when I still perform the old action right so this is going to be the reward in the state given the old action and then at that time I switch over to the new action right so at that time until time h now I perform the new action. So this entire part here this part until here is taking the place of this first part here in the q function of this first part right so because before it was simply executing one action we didn't have this concurrency yet. So executing the action and after that it's going to be the value function and now it's executing two actions first execute the old action then once you're done thinking execute the new action and then it's the value function from their own. This is clear it wasn't clear until just now as well. All right so they define the Monte Carlo estimator where you can do this with just samples of the of trajectories instead of expectations and then they define the Bellman operator the Bellman backup operator now the Bellman backup operator is an important quantity in in value based reinforcement learning because the Bellman backup operators basically. What I talked about before it's it tells you that if your policy is to always select the maximum the action with the maximum q value right that's what's down here after you do this action then the policy you arrive at and you can give certain optimality guarantees but in the state of the code in essence this is so called a contraction so if you always do that and you calculate your q function that way it will mean that in the contraction is defined as if you have an operator if you have two things that are x1 and x2 that are some apart from each other then after you apply the operator this t here x1 minus t x2 they will be closer together which basically means that the q to q functions of the individual states will be closer together and you'll converge to a single q function so given enough time and enough data you'll converge on one q function there's one fixed point q function that you'll converge to and you can show under assumption in classic or that this is going to be the optimal q function the true let's say q function so they first prove this and then they prove a now they go back to discrete time so now they were in continuous time they go back to discrete time but now they have a discrete time formulation with this lag here and also they prove that that Bellman operator is a contraction so the contraction part basically means that if you perform q learning you're going to arrive at a solution that's what this means to be contraction but now obviously that solution in classic or I was going to be the optimal q function but here actually don't know all right so they try this out and they introduce one last important concept here what they call vector to go which basically means that at the point where they start thinking where is the good thing to show this at the point where they start thinking they give a they give the the last action with so at this point right here where they sorry where they capture the state they also sort of the state contains a information about what part of the action that you started here is still outstanding so maybe your action was and they illustrate this down here maybe your action was to move your robot arm from down here to up here right that was your planned action at this point in time now if you are at step if you perform the action here and here you start capturing the next state then you would also give this particular vector here to the to the to the agent so not only will you tell it hey by the way my last action was a team one as you would need in the q value you will also say and this much is outstanding this much is where as I still have to do that much so basically you're saying I wanted to move my arm right here and I still have to do this part of the action now you can see while the algorithm is able to learn much better given that information because otherwise it has it would have to basically infer that vector from kind of differencing the action minus the what probably happened in the meantime so they test this out and what results is the robot videos you've seen before where they say they can recover the original the original q learning in this continuous framework so here on the left side you have blocking actions and it says when it says yes here this kind of the old old framework you see the grasp success at like 92% whereas if you go to non blocking actions but do none of the none of the concurrent information the grasp success suffers but you can recover the grasp success if you if you give these concurrent information like if you introduce a time step penalty and you give this vector to go and the information about the previous action and you can also see that the episode duration here is much lower when you go for the continuous actions then when you are in the old framework naturally because you don't need to pause pause right in this is so this is the simulated robotics and the real world robotic grasping results you see kind of similar results in that if you do have blocking actions your grasp success is higher than if you don't your duration of your of your policy is cut in half so maybe this is a trade-off worth considering I think this is a is a pretty cool framework and I think there's going to be a lot of work still outstanding here and I invite you to check out the paper and look at their videos and their evaluation studies of what's important and what not and with that bye bye | [{"start": 0.0, "end": 7.0, "text": " Hi there. So if you look at these two robots, the left one labeled blocking the right one labeled concurrent."}, {"start": 7.0, "end": 15.0, "text": " The blocking robot, as you can see, always has these little pauses in its movement, where it does nothing."}, {"start": 15.0, "end": 24.0, "text": " And then it kind of continues with its motion, while the one on the right is one continuous motion that it does."}, {"start": 24.0, "end": 33.0, "text": " So the reasoning here is that the robot has a camera, and the camera takes some time to register what's going on."}, {"start": 33.0, "end": 41.0, "text": " And then also the robot has a computer inside, and the computer also takes some time to decide what to do based on what the camera saw."}, {"start": 41.0, "end": 52.0, "text": " And while all of this is happening, the robot on the left just freezes, so it performs an action, and then it freezes because it takes time to register a state and compute a new action."}, {"start": 52.0, "end": 57.0, "text": " Whereas the robot on the right, it takes the same amount of time to do these things."}, {"start": 57.0, "end": 66.0, "text": " It also takes a time to register the state and compute an action, but it does that as it is executing the last action."}, {"start": 66.0, "end": 75.0, "text": " So it does this in parallel, and then it executes the action. Once it is computed a new action, it executes that new action right on top of the old action."}, {"start": 75.0, "end": 78.0, "text": " And that gives this one big fluid motion."}, {"start": 78.0, "end": 84.0, "text": " So this requires a new formulation of reinforcement learning, and that's what this paper does."}, {"start": 84.0, "end": 92.0, "text": " Thinking while moving deep reinforcement learning with concurrent control by people from Google Brain, UC Berkeley, and X."}, {"start": 92.0, "end": 102.0, "text": " So they have a nice diagram here in the supplementary material to show you what is going on in their framework."}, {"start": 102.0, "end": 111.0, "text": " So in classic reinforcement learning right here, in classic reinforcement learning, you have this dichotomy between agent and environment, right?"}, {"start": 111.0, "end": 114.0, "text": " So the agent and the environment."}, {"start": 114.0, "end": 120.0, "text": " Now the agent is supposed to kind of act in the environment in the following manner."}, {"start": 120.0, "end": 125.0, "text": " The environment will send an observation to the agent."}, {"start": 125.0, "end": 129.0, "text": " The observation in this case is the picture of the camera."}, {"start": 129.0, "end": 146.0, "text": " So it sends an observation, and the agent will think what to do with the observation, which is called a policy, the policy pi, will take an observation and then output an action of what to do."}, {"start": 146.0, "end": 151.0, "text": " And we'll send back the action to that environment."}, {"start": 151.0, "end": 161.0, "text": " So in classic RL, you assume that this part here is kind of free this time."}, {"start": 161.0, "end": 175.0, "text": " So the environment will output an observation and as and the process of registering the observation of computing the action and of sending the action back is happens in zero time."}, {"start": 175.0, "end": 189.0, "text": " Of course it doesn't happen in zero time, but in our reinforcement learning problems, for example, the open AI gym, the environment just stops until it gets the next action and then it performs the action right."}, {"start": 189.0, "end": 195.0, "text": " It performs the action in the environment and by that the environment changes and time happens."}, {"start": 195.0, "end": 207.0, "text": " And then it stops again as we think of the next action, right. So this is we usually call this one step in the in the kind of classic formulation of RL."}, {"start": 207.0, "end": 212.0, "text": " The only point that time happens is when the action is executed."}, {"start": 212.0, "end": 217.0, "text": " No time happens when the state is registered or when the action is computed."}, {"start": 217.0, "end": 219.0, "text": " And that's what you see here on the left."}, {"start": 219.0, "end": 227.0, "text": " In blue, you have the state registration. This is for example, the camera."}, {"start": 227.0, "end": 237.0, "text": " The camera has some time in order to register and store the image that it has taken, right. Maybe post process it a little bit."}, {"start": 237.0, "end": 248.0, "text": " So that's what the camera does. But in our classic formulation, as you can see here, if this is time, it happens instantaneously all at the same time."}, {"start": 248.0, "end": 254.0, "text": " And also this is the policy. This is thinking what to do, right."}, {"start": 254.0, "end": 263.0, "text": " This is your evaluation of your neural network. If this is a neural network, trying a small neural network here."}, {"start": 263.0, "end": 273.0, "text": " This happens instantaneously in these formulations. And only as the action is executed time happens."}, {"start": 273.0, "end": 281.0, "text": " And then until here time freezes again. And only once the action is determined time happens again."}, {"start": 281.0, "end": 292.0, "text": " In the new formulation now, as you've already seen, what's what we have here is this, this kind of continuous framework where, let's say you're here,"}, {"start": 292.0, "end": 300.0, "text": " it actually takes time for the camera to post process the image. It takes more time for you to think about what to do."}, {"start": 300.0, "end": 306.0, "text": " And then once you decide on an action, that action is going to happen, right."}, {"start": 306.0, "end": 314.0, "text": " But we can say, for example, at this point, you tell the camera to take a new picture of the state, right."}, {"start": 314.0, "end": 320.0, "text": " But that takes time. And while that's happening, the old action is still ongoing."}, {"start": 320.0, "end": 330.0, "text": " So you don't even have to say the action is still ongoing, but the world is still moving. The world is still changing while you think,"}, {"start": 330.0, "end": 335.0, "text": " while you post process and while you evaluate your policy, the world is thinking."}, {"start": 335.0, "end": 343.0, "text": " And only after some time, right, after this lag time here, have you decided on a new action."}, {"start": 343.0, "end": 352.0, "text": " And then you can break that old action and kind of perform your new action. And all of this is happening in time."}, {"start": 352.0, "end": 366.0, "text": " So this is the new framework. Now you see the problem here. The problem is that you base your decisions on the state and time t on time, sorry, time h here."}, {"start": 366.0, "end": 376.0, "text": " You base your decisions on a state as it was at that time, right. That's what you used to think right here. That's what you store and think about."}, {"start": 376.0, "end": 381.0, "text": " But you perform. So you perform the action at this point in time."}, {"start": 381.0, "end": 386.0, "text": " So there is a considerable difference here because the world has now changed."}, {"start": 386.0, "end": 403.0, "text": " So you see the problem, the action you perform is based on an old knowledge of the world. And you have basically no way of making the action dependent on the current state of the world because that would require you to capture the current state and that takes time."}, {"start": 403.0, "end": 406.0, "text": " And in that time, the world has already shifted again."}, {"start": 406.0, "end": 417.0, "text": " So the agent is kind of required to think ahead about the action that it is currently performing and how the world changes according to that."}, {"start": 417.0, "end": 425.0, "text": " So this new formulation of reinforcement learning, um, formulates this in a formal way."}, {"start": 425.0, "end": 440.0, "text": " So it formulates it in a formal way and we'll quickly go through that. Yes. So they go into the very basics here. We'll quickly, quickly go through them."}, {"start": 440.0, "end": 456.0, "text": " So they introduce these quantities like the policy pi, the transition distribution, the reward, and the Q and value function will just quickly go over these."}, {"start": 456.0, "end": 464.0, "text": " So you have the agent. Sorry about that. You have the agent and you have the environment."}, {"start": 464.0, "end": 488.0, "text": " Hello. So if you think of the agent and the environment, um, the environment has this transition function transition function, it takes it says, OK, I'm in this state."}, {"start": 488.0, "end": 501.0, "text": " And the agent does this action and here's the probability distribution over the next state. Right. So it says that your little spaceship is here. Right."}, {"start": 501.0, "end": 515.0, "text": " And the meteors are here. And then you push the button. If if you push the button for shoot, then you'll be in the same place."}, {"start": 515.0, "end": 528.0, "text": " Meteors will still be here, but you'll have a little shot coming out of your spaceship. That's what the environment does. Right. So you give it a state and the action and it will give you the next state."}, {"start": 528.0, "end": 548.0, "text": " And I will also give you a reward. Right. The reward in the same thing reward here will be a second output here that tells you either, let's say, negative one, if you die or zero, if nothing happens or plus one, if you shoot a meteor."}, {"start": 548.0, "end": 563.0, "text": " That's the reward. So this you can think of as the real world. So these two quantities are in the real world in the environment. So that's how you model the environment. Then the agent has these quantities called the policy."}, {"start": 563.0, "end": 579.0, "text": " Pi. So pi, what Pi does is much like the transition, but Pi takes in a state and gives you an action. Right. So this is now the agent deciding this is thinking."}, {"start": 579.0, "end": 596.0, "text": " The policy takes in a state and gives an action. And this this can take various forms, but it's just a function for now. The agent also has a queue and a V function. And these are quite quite similar."}, {"start": 596.0, "end": 609.0, "text": " So the queue function, what the queue function will do with if you are in a state and you have several options of what to do, right. You have action one action two and action three, right. You're in state S."}, {"start": 609.0, "end": 630.0, "text": " The queue function of S and a one, super script, Pi would tell you the following. It would tell you what's my expected reward. If I'm in state S, that's here, and perform action a. So a one."}, {"start": 630.0, "end": 645.0, "text": " So if I now take this path and after this path, I follow the policy pi, right. The policy pi for each of the following. So it's like right now I take action a one."}, {"start": 645.0, "end": 653.0, "text": " I don't care about my policy, but after that, I follow the policy pi. What is my expected reward going to be until the end of the episode."}, {"start": 653.0, "end": 669.0, "text": " That's the queue function and the value function here, very similar, but it only cares about the state. It says if I'm in state S and I just follow the policy pi, even in the first step, right."}, {"start": 669.0, "end": 678.0, "text": " I just follow this policy pi. What is my expected reward going to be over the course of the episode."}, {"start": 678.0, "end": 689.0, "text": " That is the queue and the value functions. You can see why queue learning is popular. If you have a good queue function and the queue and the value function, these are the things that you actually want to learn, right."}, {"start": 689.0, "end": 703.0, "text": " If you have a good queue function, you can simply always plug in every action into your queue function and then simply take the maximum the action that has the maximum queue value."}, {"start": 703.0, "end": 726.0, "text": " Because that will give you the best reward if your policy pi, right. It's kind of self referential. If your policy is to always take the maximum queue value, then taking the maximum queue value with the policy given that you take the maximum queue value will be optimal."}, {"start": 726.0, "end": 736.0, "text": " This was very convoluted. Let's start off with modeling the environment in this continuous framework."}, {"start": 736.0, "end": 745.0, "text": " Instead of having the next state be determined by the current state and action in the continuous framework, they do this via differential equation."}, {"start": 745.0, "end": 758.0, "text": " The ds is how does the environment change. This is the change in the environment that is determined by two functions, f and g. So f is your classic environment function."}, {"start": 758.0, "end": 768.0, "text": " It takes in a state and an action at time t, right. These are not functions. It will output how the state changes."}, {"start": 768.0, "end": 784.0, "text": " The g here is, this is a weiner process, is to introduce stochasticity as I understand it. Because in the classic formulation, the transition model gives you a probability up here, a probability distribution."}, {"start": 784.0, "end": 802.0, "text": " So this weiner process is responsible for introducing that probabilistic nature into this differential equation. But ultimately it simply tells you how does the state change depending on my state current state and action that I perform."}, {"start": 802.0, "end": 815.0, "text": " So the reward function now is also pretty simple. The tau here is a trajectory and the trajectory is simply the state and action over time."}, {"start": 815.0, "end": 843.0, "text": " So if I integrate from time zero to infinity or to the end of the episode, my reward function at each point in time, right. So I go through my episode and I get high reward, not so high and so on. So the integral under this curve will be my total reward, just like we sum up the reward of individual steps in the discrete case."}, {"start": 843.0, "end": 855.0, "text": " In the continuous case, you can think of each infinitesimal time step giving you a tiny bit of reward. So the entire reward is just an integral."}, {"start": 855.0, "end": 877.0, "text": " Then we go on the value function for a given state at time t, right. So think about what this is. The value function for a state means what reward can I expect starting in this particular state and then following policy pi until the end of the episode."}, {"start": 877.0, "end": 894.0, "text": " And that here is the expectation over all trajectories that come from my policy of the reward in that trajectory. So I can, you know, if I'm here, my policy now is also a distribution."}, {"start": 894.0, "end": 911.0, "text": " It can go multiple trajectories, right. And I want to, I want to have the expected value of the reward for each one of these has a reward. The expected value of the reward overall trajectories starting from state s t."}, {"start": 911.0, "end": 927.0, "text": " And again, here you say that that is the integral over the now here I have a bit of a problem because here they say t equals zero going from here and here, but here the t is already here."}, {"start": 927.0, "end": 941.0, "text": " So I believe this should be this should be t equals t prime and then t prime t prime."}, {"start": 941.0, "end": 958.0, "text": " And t minus t prime or something like this in any case, I think it should actually start from this state here and not from time zero, but I might be missing something."}, {"start": 958.0, "end": 983.0, "text": " I'm not the biggest integrator in the world. So, you know, all right, then you have the q function. Now think of it what the q function is in this grid case, the q function tells you if I'm in state s and perform action a, what is my expected reward going to be that I have to introduce some different things here they say if I'm in state s."}, {"start": 983.0, "end": 999.0, "text": " And I act action a, at time t until time h, right, now you have to say how long you're going to perform the action for until you perform the next action."}, {"start": 999.0, "end": 1009.0, "text": " Right, so h is your your lag time here until you perform the next action. So this now I actually agree with this formulation."}, {"start": 1009.0, "end": 1019.0, "text": " With the integral here, so this is going to be the integral from time t to time t plus h, that's how long you perform the action."}, {"start": 1019.0, "end": 1042.0, "text": " You're reward of performing that action, right, given the state plus the value function at the end of that. So you're here, you're in s t and you perform action a, right, and then this is your state at time t plus h."}, {"start": 1042.0, "end": 1063.0, "text": " And then you're here and from there on, you could perform many, many, many actions, right, but in the original notion of the q function, the q function tells you if I'm here and I perform this action and after that, I act according to policy pi, what is my,"}, {"start": 1063.0, "end": 1087.0, "text": " what is my expected reward and there's a classic recurrence relation in reinforcement learning where you can say the q function in s t given to a is the reward that I get from performing a in state s plus the value function at state s at this, at the next state, right."}, {"start": 1087.0, "end": 1100.0, "text": " Because the value function is exactly the reward that you would get by following policy pi in that next state and the q function means I perform a now and after that I perform pi."}, {"start": 1100.0, "end": 1117.0, "text": " So this is the continuous analog that's why you have this part here where you perform the action for h time and after h time you just go after go with your policy and that will be the value function."}, {"start": 1117.0, "end": 1135.0, "text": " So this is the continuous formulation of the of the problem right and now they can introduce these these lagging times so in their diagram up here, they define these notions."}, {"start": 1135.0, "end": 1148.0, "text": " So you have your state s t right here, then after this time you capture the new state right."}, {"start": 1148.0, "end": 1163.0, "text": " So after that time you capture the new state and decide on an action and then you perform it for h time is that correct until here."}, {"start": 1163.0, "end": 1175.0, "text": " So the the i minus one of action is performed at this time and the i action is performed at this time."}, {"start": 1175.0, "end": 1179.0, "text": " No, that makes no sense."}, {"start": 1179.0, "end": 1198.0, "text": " So let's read it. So this is when you capture the state and you need the time to perform to to think right this is thinking."}, {"start": 1198.0, "end": 1216.0, "text": " And then you perform this action at that time, this is the lag time now and you perform this action. You want to know you want to know if I perform this action until this time here, what is what is happening."}, {"start": 1216.0, "end": 1235.0, "text": " So this is the new q function takes into account this thing it tells you if I'm in state s and I think this is thinking leads me to here."}, {"start": 1235.0, "end": 1256.0, "text": " This is the old action right this is the old action that's still happening while I observe this state right so it means if I do this right now and after thinking I do this right."}, {"start": 1256.0, "end": 1277.0, "text": " So I'm at state I'm at time t and this is still happening and then after I think thinking leads me here t plus T as I perform this new action."}, {"start": 1277.0, "end": 1303.0, "text": " I'm out of colors. I perform this new action at that point until time h. What's my q function. So my q function is going to be the integral time t where I start observing the state and start thinking until t plus T as."}, {"start": 1303.0, "end": 1322.0, "text": " That's when I still perform the old action right so this is going to be the reward in the state given the old action and then at that time I switch over to the new action right so at that time until time h now I perform the new action."}, {"start": 1322.0, "end": 1346.0, "text": " So this entire part here this part until here is taking the place of this first part here in the q function of this first part right so because before it was simply executing one action we didn't have this concurrency yet."}, {"start": 1346.0, "end": 1362.0, "text": " So executing the action and after that it's going to be the value function and now it's executing two actions first execute the old action then once you're done thinking execute the new action and then it's the value function from their own."}, {"start": 1362.0, "end": 1391.0, "text": " This is clear it wasn't clear until just now as well. All right so they define the Monte Carlo estimator where you can do this with just samples of the of trajectories instead of expectations and then they define the Bellman operator the Bellman backup operator now the Bellman backup operator is an important quantity in in value based reinforcement learning because the Bellman backup operators basically."}, {"start": 1391.0, "end": 1420.0, "text": " What I talked about before it's it tells you that if your policy is to always select the maximum the action with the maximum q value right that's what's down here after you do this action then the policy you arrive at and you can give certain optimality guarantees but in the state of the"}, {"start": 1420.0, "end": 1435.0, "text": " code in essence this is so called a contraction so if you always do that and you calculate your q function that way it will mean that in the contraction is defined as if you have an operator"}, {"start": 1435.0, "end": 1464.0, "text": " if you have two things that are x1 and x2 that are some apart from each other then after you apply the operator this t here x1 minus t x2 they will be closer together which basically means that the q to q functions of the individual states will be closer together and you'll converge to a single q function"}, {"start": 1464.0, "end": 1484.0, "text": " so given enough time and enough data you'll converge on one q function there's one fixed point q function that you'll converge to and you can show under assumption in classic or that this is going to be the optimal q function the true let's say q function"}, {"start": 1484.0, "end": 1504.0, "text": " so they first prove this and then they prove a now they go back to discrete time so now they were in continuous time they go back to discrete time but now they have a discrete time formulation with this lag here and also they prove that that Bellman operator is a contraction"}, {"start": 1504.0, "end": 1524.0, "text": " so the contraction part basically means that if you perform q learning you're going to arrive at a solution that's what this means to be contraction but now obviously that solution in classic or I was going to be the optimal q function but here actually don't know"}, {"start": 1524.0, "end": 1544.0, "text": " all right so they try this out and they introduce one last important concept here what they call vector to go which basically means that at the point where they start thinking"}, {"start": 1544.0, "end": 1564.0, "text": " where is the good thing to show this at the point where they start thinking they give a they give the the last action with so at this point right here where they sorry where they capture the state"}, {"start": 1564.0, "end": 1592.0, "text": " they also sort of the state contains a information about what part of the action that you started here is still outstanding so maybe your action was and they illustrate this down here maybe your action was to move your robot arm from down here to up here"}, {"start": 1592.0, "end": 1620.0, "text": " right that was your planned action at this point in time now if you are at step if you perform the action here and here you start capturing the next state then you would also give this particular vector here to the to the to the agent so not only will you tell it hey by the way my last action was a team"}, {"start": 1620.0, "end": 1638.0, "text": " one as you would need in the q value you will also say and this much is outstanding this much is where as I still have to do that much so basically you're saying I wanted to move my arm right here and I still have to do this part of the action"}, {"start": 1638.0, "end": 1660.0, "text": " now you can see while the algorithm is able to learn much better given that information because otherwise it has it would have to basically infer that vector from kind of differencing the action minus the what probably happened in the meantime"}, {"start": 1660.0, "end": 1676.0, "text": " so they test this out and what results is the robot videos you've seen before where they say they can recover the original the original q learning in this continuous framework"}, {"start": 1676.0, "end": 1690.0, "text": " so here on the left side you have blocking actions and it says when it says yes here this kind of the old old framework you see the grasp success at like 92%"}, {"start": 1690.0, "end": 1714.0, "text": " whereas if you go to non blocking actions but do none of the none of the concurrent information the grasp success suffers but you can recover the grasp success if you if you give these concurrent information like if you introduce a time step penalty and you give this vector to go and the information about the previous action"}, {"start": 1714.0, "end": 1730.0, "text": " and you can also see that the episode duration here is much lower when you go for the continuous actions then when you are in the old framework naturally because you don't need to pause"}, {"start": 1730.0, "end": 1750.0, "text": " pause right in this is so this is the simulated robotics and the real world robotic grasping results you see kind of similar results in that if you do have blocking actions your grasp success is higher than if you don't"}, {"start": 1750.0, "end": 1768.0, "text": " your duration of your of your policy is cut in half so maybe this is a trade-off worth considering I think this is a is a pretty cool framework and I think there's going to be a lot of work still outstanding here"}, {"start": 1768.0, "end": 1780.0, "text": " and I invite you to check out the paper and look at their videos and their evaluation studies of what's important and what not and with that bye bye"}] |
Yannic Kilcher | https://www.youtube.com/watch?v=yPjuAo53uNI | [Rant] The Male Only History of Deep Learning | This casting of our field in terms of ideological narrow-sighted group-think is disgusting. Keep Science about ideas!
https://twitter.com/timnitGebru/status/1252752743942328321
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 | Alright, so instead of reviewing a paper today, I thought I might review this thing. So this person on Twitter posted this link to an article called Brief History of Deep Learning from 1943 to 2019 of Machine Learning Knowledge.ai. So let's look at this. Actually let's look at the tweet first because this is, I just saw this. The male only history of deep learning where you say AlexNet makes history but ImageNet doesn't because women's contributions don't count and contributions from anyone except for white and white adjacent people for that matter. That is the tweet and it has 109 retweets over 400 likes and people generally agreeing with this sentiment. So the person is expressing concerns that this article is only over one particular group of people. So let's look at the article. They basically go over the history of neural networks of deep learning in an algorithmic sense. So let's check it out. So first we go into neurons starting in 1943 and the perceptron paper right here, the first back propagation algorithm from Kelly. This actually I think people like Schmidhuber would be proud as far as I can tell this is kind of more of a forgotten history or some of these things are more of a forgotten history of course, Minsk's paper very famous but here back propagation attributed to this paper and so on and you can see things people like hinting only coming up later here the Boltzmann machine back propagation in neural networks now. So this as far as I can tell it's just a take on kind of the history of algorithmic development and you can see here it really is about algorithms the algorithms behind deep learning. So here is the vanishing gradient problem the LSTM as an architectural component deep belief networks then you have GPUs for training again vanishing gradients Alex net and GANS AlphaGo so we're now going a bit faster and then the end it says to a godfathers when the touring award for their immense contribution in advancements in area of deep learning and artificial intelligence. This is a defining moment for those who had worked relentlessly on neural networks when the entire machine learning community had moved away from it in the 1970s. So the article clearly is focused on algorithmic developments in deep learning and that's why Alex net is here. Now this person rags that Alex net is here but ImageNet isn't and clearly you can see from the article ImageNet is a data set it was not made with deep learning in mind it was simply made as a data set it's not an algorithmic development. So GANS are here as well right but Celeb A isn't C410 isn't MNIST isn't the pen tree bank isn't right so I think we've skipped a lot of architectural advancements here like Transformers or all kinds of all kinds of things here but the history is clearly about the algorithmic developments and to reframe this it's clearly states ImageNet doesn't because women's contributions don't count right the insinuation here absolutely I find this to be absolutely intellectually dishonest and they say and contributions from anyone except for white and white adjacent people for that matter. At this point you just have to laugh like because of course the narrative that the person wanted to tell was that it's only white people that count but then you scroll and turn like it doesn't fit my narrative right this GPU is not a white person so you to make it fit your narrative you have to call white adjacent what is white adjacent it's like if whatever I don't like I now call white and but people just people just agreeing with this I find this absolutely disgusting and I find the article to be okay I don't know better but if you have a problem with I definitely think there is misattribution in science throughout even systematic but to say that ImageNet wasn't included because women's contributions don't count that is just a straight out lie and to call people white adjacent is like how does you not have a bell in your head that goes ding ding ding ding ding when you do something like this so I find this to be dishonest either willfully or just because people have so become used to seeing the world in one particular frame and this is I think these calls they only get they only get big whenever there is money and attention going into a field right if you look at like any any field where it's just a bunch of weirdos doing their thing the weirdos don't care who's there they just care about the ideas that people have right and I believe we should take that view in science in general I don't care who has the idea and these people do and I disagree all right that was it keep pushing back on these things if you agree as well and keep science for ideas thanks. | [{"start": 0.0, "end": 6.36, "text": " Alright, so instead of reviewing a paper today, I thought I might review this thing."}, {"start": 6.36, "end": 13.32, "text": " So this person on Twitter posted this link to an article called Brief History of Deep"}, {"start": 13.32, "end": 21.2, "text": " Learning from 1943 to 2019 of Machine Learning Knowledge.ai."}, {"start": 21.2, "end": 24.36, "text": " So let's look at this."}, {"start": 24.36, "end": 29.72, "text": " Actually let's look at the tweet first because this is, I just saw this."}, {"start": 29.72, "end": 36.28, "text": " The male only history of deep learning where you say AlexNet makes history but ImageNet"}, {"start": 36.28, "end": 43.2, "text": " doesn't because women's contributions don't count and contributions from anyone except"}, {"start": 43.2, "end": 47.96, "text": " for white and white adjacent people for that matter."}, {"start": 47.96, "end": 57.04, "text": " That is the tweet and it has 109 retweets over 400 likes and people generally agreeing"}, {"start": 57.04, "end": 58.239999999999995, "text": " with this sentiment."}, {"start": 58.24, "end": 68.84, "text": " So the person is expressing concerns that this article is only over one particular"}, {"start": 68.84, "end": 70.76, "text": " group of people."}, {"start": 70.76, "end": 73.32000000000001, "text": " So let's look at the article."}, {"start": 73.32000000000001, "end": 80.8, "text": " They basically go over the history of neural networks of deep learning in an algorithmic"}, {"start": 80.8, "end": 81.8, "text": " sense."}, {"start": 81.8, "end": 83.2, "text": " So let's check it out."}, {"start": 83.2, "end": 93.92, "text": " So first we go into neurons starting in 1943 and the perceptron paper right here, the"}, {"start": 93.92, "end": 97.44, "text": " first back propagation algorithm from Kelly."}, {"start": 97.44, "end": 103.80000000000001, "text": " This actually I think people like Schmidhuber would be proud as far as I can tell this"}, {"start": 103.80000000000001, "end": 109.44, "text": " is kind of more of a forgotten history or some of these things are more of a forgotten"}, {"start": 109.44, "end": 118.32, "text": " history of course, Minsk's paper very famous but here back propagation attributed to this"}, {"start": 118.32, "end": 126.03999999999999, "text": " paper and so on and you can see things people like hinting only coming up later here the"}, {"start": 126.03999999999999, "end": 132.52, "text": " Boltzmann machine back propagation in neural networks now."}, {"start": 132.52, "end": 140.08, "text": " So this as far as I can tell it's just a take on kind of the history of algorithmic development"}, {"start": 140.08, "end": 147.68, "text": " and you can see here it really is about algorithms the algorithms behind deep learning."}, {"start": 147.68, "end": 154.56, "text": " So here is the vanishing gradient problem the LSTM as an architectural component deep belief"}, {"start": 154.56, "end": 163.44, "text": " networks then you have GPUs for training again vanishing gradients Alex net and GANS"}, {"start": 163.44, "end": 168.76, "text": " AlphaGo so we're now going a bit faster and then the end it says to a godfathers when"}, {"start": 168.76, "end": 173.64000000000001, "text": " the touring award for their immense contribution in advancements in area of deep learning and"}, {"start": 173.64000000000001, "end": 174.8, "text": " artificial intelligence."}, {"start": 174.8, "end": 179.4, "text": " This is a defining moment for those who had worked relentlessly on neural networks when"}, {"start": 179.4, "end": 183.92000000000002, "text": " the entire machine learning community had moved away from it in the 1970s."}, {"start": 183.92, "end": 192.2, "text": " So the article clearly is focused on algorithmic developments in deep learning and that's"}, {"start": 192.2, "end": 194.16, "text": " why Alex net is here."}, {"start": 194.16, "end": 203.0, "text": " Now this person rags that Alex net is here but ImageNet isn't and clearly you can see"}, {"start": 203.0, "end": 208.48, "text": " from the article ImageNet is a data set it was not made with deep learning in mind it"}, {"start": 208.48, "end": 212.83999999999997, "text": " was simply made as a data set it's not an algorithmic development."}, {"start": 212.84, "end": 222.84, "text": " So GANS are here as well right but Celeb A isn't C410 isn't MNIST isn't the pen tree"}, {"start": 222.84, "end": 229.92000000000002, "text": " bank isn't right so I think we've skipped a lot of architectural advancements here like"}, {"start": 229.92000000000002, "end": 236.08, "text": " Transformers or all kinds of all kinds of things here but the history is clearly about"}, {"start": 236.08, "end": 242.72, "text": " the algorithmic developments and to reframe this it's clearly states ImageNet doesn't"}, {"start": 242.72, "end": 250.0, "text": " because women's contributions don't count right the insinuation here absolutely I find"}, {"start": 250.0, "end": 256.28, "text": " this to be absolutely intellectually dishonest and they say and contributions from anyone except"}, {"start": 256.28, "end": 259.8, "text": " for white and white adjacent people for that matter."}, {"start": 259.8, "end": 264.8, "text": " At this point you just have to laugh like because of course the narrative that the person"}, {"start": 264.8, "end": 273.36, "text": " wanted to tell was that it's only white people that count but then you scroll and turn"}, {"start": 273.36, "end": 283.04, "text": " like it doesn't fit my narrative right this GPU is not a white person so you to make"}, {"start": 283.04, "end": 289.28000000000003, "text": " it fit your narrative you have to call white adjacent what is white adjacent it's like"}, {"start": 289.28, "end": 297.47999999999996, "text": " if whatever I don't like I now call white and but people just people just agreeing with"}, {"start": 297.47999999999996, "end": 304.15999999999997, "text": " this I find this absolutely disgusting and I find the article to be okay I don't know"}, {"start": 304.15999999999997, "end": 309.55999999999995, "text": " better but if you have a problem with I definitely think there is misattribution in science"}, {"start": 309.55999999999995, "end": 315.79999999999995, "text": " throughout even systematic but to say that ImageNet wasn't included because women's contributions"}, {"start": 315.8, "end": 323.40000000000003, "text": " don't count that is just a straight out lie and to call people white adjacent is like how"}, {"start": 323.40000000000003, "end": 327.72, "text": " does you not have a bell in your head that goes ding ding ding ding ding when you do something"}, {"start": 327.72, "end": 337.96000000000004, "text": " like this so I find this to be dishonest either willfully or just because people have so become"}, {"start": 337.96, "end": 345.96, "text": " used to seeing the world in one particular frame and this is I think these calls they only"}, {"start": 345.96, "end": 352.2, "text": " get they only get big whenever there is money and attention going into a field right if you"}, {"start": 352.2, "end": 359.12, "text": " look at like any any field where it's just a bunch of weirdos doing their thing the weirdos"}, {"start": 359.12, "end": 365.47999999999996, "text": " don't care who's there they just care about the ideas that people have right and I believe"}, {"start": 365.48, "end": 375.36, "text": " we should take that view in science in general I don't care who has the idea and these people"}, {"start": 375.36, "end": 382.28000000000003, "text": " do and I disagree all right that was it keep pushing back on these things if you agree"}, {"start": 382.28, "end": 412.23999999999995, "text": " as well and keep science for ideas thanks."}] |
Yannic Kilcher | https://www.youtube.com/watch?v=PZypP7PiKi0 | Gradient Surgery for Multi-Task Learning | Multi-Task Learning can be very challenging when gradients of different tasks are of severely different magnitudes or point into conflicting directions. PCGrad eliminates this problem by projecting conflicting gradients while still retaining optimality guarantees.
https://arxiv.org/abs/2001.06782
Abstract:
While deep learning and deep reinforcement learning (RL) systems have demonstrated impressive results in domains such as image classification, game playing, and robotic control, data efficiency remains a major challenge. Multi-task learning has emerged as a promising approach for sharing structure across multiple tasks to enable more efficient learning. However, the multi-task setting presents a number of optimization challenges, making it difficult to realize large efficiency gains compared to learning tasks independently. The reasons why multi-task learning is so challenging compared to single-task learning are not fully understood. In this work, we identify a set of three conditions of the multi-task optimization landscape that cause detrimental gradient interference, and develop a simple yet general approach for avoiding such interference between task gradients. We propose a form of gradient surgery that projects a task's gradient onto the normal plane of the gradient of any other task that has a conflicting gradient. On a series of challenging multi-task supervised and multi-task RL problems, this approach leads to substantial gains in efficiency and performance. Further, it is model-agnostic and can be combined with previously-proposed multi-task architectures for enhanced performance.
Authors: Tianhe Yu, Saurabh Kumar, Abhishek Gupta, Sergey Levine, Karol Hausman, Chelsea Finn
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 gradient surgery for multi-task learning by Tian He Yu, Saurab Kumar, Abhishek Kupta, Sergei Levine, Carol Haosman and Chelsea Finn. So in this paper the the concern is a thing called multi-task learning. Now what is multi-task learning? So this has some very subtle distinctions from other things that's I think why it's important to look at it a bit. So let's say you have multiple tasks, a learning problem in multiple tasks. This seems easy enough, right? So what we mean is that we have the same input, but then we want to perform two different tasks. So task one and task two. Sorry, two. So it could be something like task one if if the input is a food, right? Food object. The task one could be is it a fruit? Right, task two could be how many calories calories does it have? Right, the input is this this food item here and you want to know both things. Is it a fruit? And how many calories does it have? And ideally, so what you could do is you could train two separate machine learning classifiers, right? Classifier one simply does the is it a fruit thing? Task two simply does how many calories does it have? Let's say this is let's actually say this is a food picture, right? Since Instagram is full of food pictures, we have lots of training data, right? At least unsupervised people usually label it. And we could train two different things, but it would be nice since they're both kind of dealing with the same input. So they're not kind of they actually deal with the same input distribution. It would be nice if we could kind of share a representation, right? So maybe we have some neural network here with many layers. And then we have at the end, we take this hidden representation here. And we just have maybe one or two fully connected layers for each individual task, but our goal would be that the hidden representation here is shared. So shared representation. And why could that help? Because we might have maybe maybe we have lots of maybe we have lots of training data for the how many calories does it have? Right? But we don't have that much training data for is it a fruit? So lots of training data here, big database, but only like a handful of data points for the second task. Or we might just not have much training data at all for both tasks. And we just might benefit from training this shared representation. You might have already seen this with something like Bert. So in Bert's case, the input is text, right? And then you do something different. That's why Bert is different than multitask learning. What you do in Bert is you do first, you do this masked language model pre training. So that's step one. And then in step two, you take this and then you you fine tune it on a number of tasks, right? So here question answering sentiment detection, entailment, and so on. This is different. This is called pre training and fine tuning. Tuning. In multitask learning, we actually want to train on different tasks at the same time. Maybe they have different data, right? And we simply want to create this shared representation. And we hope that by combining these tasks, we might learn them better than if we were to learn each task individually. All right, so this paper says there are there's a big problem with things like this. And they illustrate this in this example right here. So let's say you have a multitask objective and the learning landscape looks like this. So the objective for task one is the following. So this you have to have to imagine this is maybe a neural network with just two weights, right? Here is weight one and here is weight two. And this is what the optimization landscape look looks like for task one. If you're not used to this kind of depiction, the light parts up here and here are high values for the loss function and the darker parts are low values for the loss function. So you want to get to the darker parts. Now usually we discuss things like this in terms of optimization. So for example, we would talk about SGD and we would talk about the fact that oh, if we have too large of a, so if you're here, where does the gradient point, the gradient points towards the direction of steepest increase. So here, so the negative gradient would point down. Now if we have a SGD, maybe we'd go here and then we take another gradient step, we would go here, right? Oh, now we've gone too far, right? So the gradient now points this direction. So we go here and then we just continue this, right? So this is a problem with with SGD and what we can do is we can decrease the step size, for example, and then we converge in this or we can use something like a atom that adjusts the gradient to the variance of the gradient landscape, things like this, right? So these are problems in optimization. But what happens when you have a multi task objective is that for just task one, the optimization landscape would look like this, right? If you were just to train your neural network, if you were to just train this part and we just look here is like theta one and here is theta two. These are the two weights we care about right now. Everything else, let's say, is fixed. Task one looks like this, but for task two, because it's a different task, right? We need to set the weights differently to get our desired output. It looks different. So our loss function is going to be a combination. So our loss function is going to be the loss of task, loss function for a given sample. It's going to be the loss on task one of that sample plus the loss of task two on that sample. So that's going to be the combination, the combination you see on the right. So this plus this equals this right here. So you can see in task one, it almost, let's say, didn't matter whether we were here or here, both had a relatively low loss value, right? But you can you can see in task two, this point here is not an optimum. Well, this point or maybe these are slight, these are seem what's almost close together. So if you add them, you can see that now this thing here still has a low value, but not as low as this is much darker, right? So the landscape for both tasks together looks differently from the landscape of either task alone. So your goal is to find this optimal point and optimal point here that works for both tasks. Now the paper identifies many, sorry, sorry, the paper identifies problems with this multitask learning. And they say the problem is that you can have what are called conflicting gradients. So if you look, if you look at, if you look at where the gradients point in the different, in the different tasks. So if we go by task two, sorry, let me put that in again. And we care about the point right here that they care about, right? And they use Adam in this case. And their starting point is right here. And they've come this way so far. So we're going to draw this in here and draw this in right here. And we'll stop a little bit before that valley, right? So let's analyze the gradient. The gradient task one actually points in this direction. You see down the valley, right? And it's pretty big because it's pretty steep, right? You can see the curves here getting closer and closer together. That means the gradient is pretty steep and it points in that direction. Whereas for task two, if you're here, right, the gradient actually points in this direction, but not as steep, right? Because here the lines are pretty far apart still. So that means it's relatively flat. This is what the paper calls conflicting gradients and they're drawn in here. I'm going to draw them just a little bit larger. So these two gradients, first of all, they have different magnitude. You see that the magnitude of this is much larger than the magnitude of this. And also their angle between them is large. That means conflicting that they're more than than 90 degrees apart from each other. And this results, if you calculate the resulting gradient, of course, this results in a gradient like this, right? So our algorithm wouldn't actually go down this valley. It will go up the hill again because you have differently sized gradients from the different tasks that go in different directions. That important point, I was wondering for a long time, what's the difference between this and simply saying, look, any data set, right, your loss on any data set, D, is just the sum of the loss of your individual data points, X, I, because it is the same case that you can have different data points and the gradients that you get, right? So that would result. If you've never done optimization, I'm sorry, I'm going a bit fast, that would result in the gradient with respect to your weights of your loss over the entire data set is, of course, approximated by the one over n in your mini batch. So by the gradients in your mini batch, right? So let's call this the loss of X, I, this is completely illegible. But what I'm saying is that your total gradient is the average of your individual data points. And these might be conflicting as well, right? You could have that one points in this direction and the other one points in that direction. And we've done this just and things like things like Adam and SGD actually are able to handle that just fine because we do this average operation. I think what is different here is in multitask learning is that the multitask, the task distribution is not like stochastically IID, let's say. So in this case, you can always count on that the expectation will average out this noise. So this noise, if you go in expectation, right, if you do mini batches and aggregate over the whole data set, then that will kind of even out because for the different data points, okay, one gradient might be larger, one might be smaller, but there's no systematic error or there's no systematic bias that comes from the different data points. Here you have, as we said, one task might be much harder than the other task, right? Or you might have much more data or the loss function is just larger like magnitude wise. So you can have any number of systematic biases that different tasks have with each other and therefore the conflicting gradients seem to be a problem. So this paper does a good job of analyzing the situation of conflicting gradients and what I find particularly interesting is that they, first of all, they propose an algorithm to deal with these conflicting gradients. So they say whenever two gradients are conflicting, right? What we would do is we would project them on the normal plane of each other, right? So for example, here in the in step B, we take the gradient of task i and we project it onto the normal plane of gradient from the task j, right? And if we do this and they have a whole algorithm where it's in general, so if we do this for multiple tasks, so basically we get a mini batch of tasks, right? So they generalize this to that you have a bunch of tasks. We get the different gradients and these can be stochastic because we can do this with stochastic data sets. We go through the batch and if the gradients are conflicting, we simply project the gradients onto each other and that will result now in a set of non-conflicting gradients. You might be a bit appalled by this. I was at first when I saw this, but they actually do, as I said, a good job of analyzing this. So they have two theorems here, which I find interesting. So theorem one is assume these are convex and differentiable. So somewhat standard assumptions in optimization. They say then the PC grad update rule with a step size smaller than one over L, L is delipsiates constant, will converge either to a location where the cosine is exactly negative one between two gradients. You can that never happens except if you construct it or the optimal value, right? So this is basically a consistency theorem saying that this algorithm will still converge to the optimum value. This here is the loss. So this loss is the sum of loss one and loss two, right? Of these two tasks. So for two tasks, they prove that the algorithm will still go to the correct point if you run it long enough. Doesn't say anything about the speed though. This is where theorem two comes in. The theorem two says suppose L is differentiable and the gradient of L is lips its continuous. But this again, same assumptions except no longer need convexity. Let theta mt, which is the multi task gradient and theta, sorry, not the gradient, the parameters theta PC grad be the parameters after applying one update to theta with g and PC grad modified g. So this mt is the that would be kind of the original algorithm without their method. And this here would be with their method. Moreover, assume a bunch of things which will go into soon. Then the loss function of the PC grad theta is smaller or equal than the loss function of the mt of the original. So what does it mean? It means that if you're in your optimization landscape and you're somewhere here, right? And your optimum is somewhere here. And your loss function is kind of how far away are you from this from this optimum? It means that as long as these conditions are given, if you do your update without the their method, which would be so here would be theta mt or with their method theta PC grad, then the loss function that you get from their method will be smaller than the loss function that you get without their method. So this is a theorem they prove it. And for this to be the case, they need these three things. So let's go from the back. The third one is a is a condition on the on the loss function. Sorry on the step size. And you can say, okay, the step size needs to be large enough. You can set the step size. This here, what is this? This here needs to be a this is a condition on the on this epsilon. So what's this thing? It is a curvature bounding measure. And that is compared to little L. And little L here is this thing. It is a constant that must be smaller than h. And h is up here is the curvature. So it depends on the curvature, right? It depends on the curvature fulfilling some condition. They stayed down here. The curvature of the multitask gradient should be large. Yeah. And the first condition we've already seen is that the cosine of the angles needs to be smaller than negative something that depends on the gradients. And this here turns out actually to be the magnitudes of the gradients. So this this first this here, we can neglect that's a step size condition. This here means the gradients should be conflicting. And this here means that there should be sufficient curvature in the loss function. This is exactly what we saw at the beginning in this, and this thing here. So there was a sufficient curvature because in one direction the gradient was very steep and in the other direction it wasn't, which basically means there is a change of steepness, right? There is a change of steepness in one direction versus the other direction. And also the two gradients were conflicting, which we saw right here. If this is the case, then this algorithm will bring you faster to the optimum than the the normal algorithm. But only if this is given. And notably this can change step to step. They actually call this the I think the holy trifecta evil trifect something. They have a name for it. But I'm going to read you the the conditions that how they describe it. The conditions are first the angle between the task gradients is not too small. I the two tasks need to conflict sufficiently. Second, the difference in magnitude needs to be sufficiently large. Third, the curvature of the multitask gradient should be large. And fourth, the learning rate should be big enough such that large curvature would lead to overestimation of performance improvement on the dominating task and underestimation of performance degradation on the dominated task. So here you see a little subtle team. I said before that this condition here was negligible because you can set the task size in actuality. This you can so I'm not meaning to rag on this. But what does it mean? The learning rate should be big enough such that blah blah blah. And what comes here seems to be negative, right? Such that the large curvature would lead to overestimation, which basically means this method, this thing here counts if the step size is large. So that means if I were to play devil's advocate, if I have a problem like this, I could either, right? I could either use their method, PC grad, or I could just decrease my learning rate and use the classic algorithm. Because if I just decrease my learning rate relative to the curvature, then this steering would no longer hold and it would no longer be the case that their algorithm gives me a faster convergence. So there's there's two ways of looking at these things. It's like, yes, in in these conditions, this algorithm is better, but it is better because someone has set the learning rate to high and this algorithm kind of fixes that. Now the upside to this is of course that the usually you don't want to kind of set your learning rate in accordance with the curvature of the with the curvature of the problem and so on. You don't know the curvature most of the time. So you just set some learning rate and their algorithm appears to be working also when this learning rate is smaller. It's just not guaranteed to outperform the classic algorithm. But I just found find this interesting in terms of how you read a paper, right? If you read a paper, you come across something like this. These conditions, you can always see them as here is what needs to happen for us to succeed or here is what needs to happen for the others to fail. And therefore, we're the only ones that succeed in this regime. Though, yeah, as I said, it's a cool algorithm, but I found that to be funny. Alright, so they test this on multi-task which these MT10 and MT50 benchmarks are these robotic manipulation. So multi-task doesn't only mean like supervised learning in this case is actually multi-task reinforcement learning. So here you have everything, you have mini batches, you have episodes and you have you have multiple tasks. So this is everything together. Very cool. And you in their actual implementation, they say what they do is they have these multiple tasks. So they have the agent and they first select the tasks. So for example, here pull this, right? Then they generate an episode by interacting with the environment, forth and back, forth and back. Then they put that episode into a replay buffer. Then they maybe select another task and so on. So until they have a bunch of data in their replay buffer from different tasks, then they sample episodes from different tasks, right? From task one, task two and so on. And that will become a mini batch in the learning procedure. So pretty intricate thing. But of course, the hope is that you can learn kind of a share representation that you can then perform all of these tasks faster than if you were to learn them each independently. So the MT10 and MT50 come from this and I think they also have goal condition pushing where the task is simply to push something to a what they call goal condition. And the cool thing about this is it's not only 50 tasks, but you can produce an infinity of tasks because you can always specify a new location where you should push something to. So that's that's fairly fairly cool. And oh yeah, the curves. So you see that if you do something like soft actor critic or multi head soft actor critic. So this multi head soft actor critic is probably the closest to what I defined in to what I defined at the beginning where you have this shared representation and then and then the individual heads. And you can see that severely underperforms against the SIC plus PC grad plus their method that seems to outperform fairly consistently even against learning the tasks independently. So it learns much faster than if you were to learn these tasks just independently from each other. Which is pretty cool, right? So I think that's pretty cool. All right. So they do actually interesting investigations. First of all, they research okay in during these learning runs. How what is the curvature here? And the curvature of the loss function they measure like this. So basically all this is a consequence of the Taylor approximation. So if you have like f of x, you can you can write this as f of some x 0 plus the gradient of f that plus the gradient of f times x here. Sorry, at x 0 times x in this direction. And then if you subtract, so this is a first order approximation to this to the function on the right. Then if you bring this over here, you or if you sorry if you subtract the two sides from each other, then you can see there's the difference between the actual function and the first order approximation of the function. That must be or that is most likely the curvature. Now it is not it is like every higher order term, but the assumption is that the dominant higher order term will be the curvature. All right. So this is this would be this except they don't they do it not doing the x and x 0. They do it at theta t and theta t plus 1. So you can see this is the first order approximation. And this is the actual function value after they do a step. And the resulting thing will be the curvature or dominated by the curvature. So they analyze this over the course of learning. And they see that it actually increases as you as you go on. And just I'm not a big fan of like just large numbers, but they numbers seem to be large, right? Just compared to what you can handle with the computer that numbers seem to be large and they seem to be getting larger in order of magnitude steps across training iterations. So I'm going to believe them that this curvature is given. I would have liked to have it seen compared to just a single task instead of a multitask. Instead of you know comparing these things, which is useless because they reach different losses, right? So it's pretty useless to compare their curvature across the number of iterations. What I would have liked to see is a comparison multitask versus single task. And to show me that in single task learning, this curvature doesn't happen. Here you have the percentage of updates, steps where conditions A and B are held. You remember condition A was the condition on the conflicting angle. Condition B was the condition that the curvature is large enough. And you can see that as you go on with learning, these dotted and dashed lines, the conditions hold almost entirely at the beginning of learning. But then still hold by in a big time of the steps. So here is like about half the steps still at the end of training. These conditions hold. So it is fairly fairly good evidence that often the problems that they say are real or really there. And then therefore their algorithm helps. Right. So here is the average per task average return. And interestingly, they say in the text, look, this task here seems to be easier, right? And the task two, which is the dotted line, seems to be harder. So SAC, the baseline algorithm, never really manages to learn task two, whereas this PC grad manages after a while to learn it. And at that point, something happens over here, which I'm not super sure. Yeah, that's what they say in the text. But I have to squint a lot to see that exactly at that position, something happens. Suffice to say that the PC grad is able to learn the task that SAC isn't able to learn because probably task one is completely dominating the gradient at that point, right? All right. So this was the paper. I invite you to read it. And thanks for listening. Bye bye. | [{"start": 0.0, "end": 5.6000000000000005, "text": " Hi there. Today we're looking at gradient surgery for multi-task learning by"}, {"start": 5.6000000000000005, "end": 13.280000000000001, "text": " Tian He Yu, Saurab Kumar, Abhishek Kupta, Sergei Levine, Carol Haosman and"}, {"start": 13.280000000000001, "end": 20.8, "text": " Chelsea Finn. So in this paper the the concern is a thing called multi-task"}, {"start": 20.8, "end": 26.76, "text": " learning. Now what is multi-task learning? So this has some very subtle"}, {"start": 26.76, "end": 31.560000000000002, "text": " distinctions from other things that's I think why it's important to look at it"}, {"start": 31.560000000000002, "end": 36.84, "text": " a bit. So let's say you have multiple tasks, a learning problem in multiple"}, {"start": 36.84, "end": 42.040000000000006, "text": " tasks. This seems easy enough, right? So what we mean is that we have the same"}, {"start": 42.040000000000006, "end": 50.36, "text": " input, but then we want to perform two different tasks. So task one and task"}, {"start": 50.36, "end": 61.36, "text": " two. Sorry, two. So it could be something like task one if if the input is a"}, {"start": 61.36, "end": 73.52, "text": " food, right? Food object. The task one could be is it a fruit? Right, task two"}, {"start": 73.52, "end": 82.92, "text": " could be how many calories calories does it have? Right, the input is this"}, {"start": 82.92, "end": 89.32, "text": " this food item here and you want to know both things. Is it a fruit? And how many"}, {"start": 89.32, "end": 96.36, "text": " calories does it have? And ideally, so what you could do is you could train two"}, {"start": 96.36, "end": 102.67999999999999, "text": " separate machine learning classifiers, right? Classifier one simply does the"}, {"start": 102.68, "end": 107.64, "text": " is it a fruit thing? Task two simply does how many calories does it have? Let's"}, {"start": 107.64, "end": 116.24000000000001, "text": " say this is let's actually say this is a food picture, right? Since Instagram is"}, {"start": 116.24000000000001, "end": 122.28, "text": " full of food pictures, we have lots of training data, right? At least unsupervised"}, {"start": 122.28, "end": 127.56, "text": " people usually label it. And we could train two different things, but it would be"}, {"start": 127.56, "end": 131.96, "text": " nice since they're both kind of dealing with the same input. So they're not"}, {"start": 131.96, "end": 138.56, "text": " kind of they actually deal with the same input distribution. It would be nice if"}, {"start": 138.56, "end": 144.76000000000002, "text": " we could kind of share a representation, right? So maybe we have some neural"}, {"start": 144.76000000000002, "end": 150.92000000000002, "text": " network here with many layers. And then we have at the end, we take this hidden"}, {"start": 150.92000000000002, "end": 158.0, "text": " representation here. And we just have maybe one or two fully connected layers for"}, {"start": 158.0, "end": 163.8, "text": " each individual task, but our goal would be that the hidden representation here is"}, {"start": 163.8, "end": 175.28, "text": " shared. So shared representation. And why could that help? Because we might have"}, {"start": 175.28, "end": 181.88, "text": " maybe maybe we have lots of maybe we have lots of training data for the how many"}, {"start": 181.88, "end": 187.0, "text": " calories does it have? Right? But we don't have that much training data for"}, {"start": 187.0, "end": 191.84, "text": " is it a fruit? So lots of training data here, big database, but only like a"}, {"start": 191.84, "end": 198.04, "text": " handful of data points for the second task. Or we might just not have much"}, {"start": 198.04, "end": 203.32, "text": " training data at all for both tasks. And we just might benefit from training"}, {"start": 203.32, "end": 208.0, "text": " this shared representation. You might have already seen this with something like"}, {"start": 208.0, "end": 219.12, "text": " Bert. So in Bert's case, the input is text, right? And then you do something"}, {"start": 219.12, "end": 222.96, "text": " different. That's why Bert is different than multitask learning. What you do in"}, {"start": 222.96, "end": 230.76, "text": " Bert is you do first, you do this masked language model pre training. So that's"}, {"start": 230.76, "end": 238.95999999999998, "text": " step one. And then in step two, you take this and then you you fine tune it on a"}, {"start": 238.95999999999998, "end": 245.0, "text": " number of tasks, right? So here question answering sentiment detection,"}, {"start": 245.0, "end": 252.32, "text": " entailment, and so on. This is different. This is called pre training and fine"}, {"start": 252.32, "end": 262.76, "text": " tuning. Tuning. In multitask learning, we actually want to train on different"}, {"start": 262.76, "end": 267.15999999999997, "text": " tasks at the same time. Maybe they have different data, right? And we simply"}, {"start": 267.15999999999997, "end": 273.28, "text": " want to create this shared representation. And we hope that by combining these"}, {"start": 273.28, "end": 279.0, "text": " tasks, we might learn them better than if we were to learn each task individually."}, {"start": 279.0, "end": 285.16, "text": " All right, so this paper says there are there's a big problem with things like"}, {"start": 285.16, "end": 290.0, "text": " this. And they illustrate this in this example right here. So let's say you have"}, {"start": 290.0, "end": 295.88, "text": " a multitask objective and the learning landscape looks like this. So the objective"}, {"start": 295.88, "end": 300.84, "text": " for task one is the following. So this you have to have to imagine this is maybe a"}, {"start": 300.84, "end": 306.0, "text": " neural network with just two weights, right? Here is weight one and here is weight"}, {"start": 306.0, "end": 310.92, "text": " two. And this is what the optimization landscape look looks like for task one."}, {"start": 310.92, "end": 316.84, "text": " If you're not used to this kind of depiction, the light parts up here and here are"}, {"start": 316.84, "end": 324.4, "text": " high values for the loss function and the darker parts are low values for the"}, {"start": 324.4, "end": 330.52, "text": " loss function. So you want to get to the darker parts. Now usually we discuss"}, {"start": 330.52, "end": 336.35999999999996, "text": " things like this in terms of optimization. So for example, we would talk about"}, {"start": 336.35999999999996, "end": 341.15999999999997, "text": " SGD and we would talk about the fact that oh, if we have too large of a, so if you're"}, {"start": 341.15999999999997, "end": 346.15999999999997, "text": " here, where does the gradient point, the gradient points towards the direction of"}, {"start": 346.15999999999997, "end": 351.2, "text": " steepest increase. So here, so the negative gradient would point down. Now if we"}, {"start": 351.2, "end": 356.79999999999995, "text": " have a SGD, maybe we'd go here and then we take another gradient step, we would"}, {"start": 356.8, "end": 362.96000000000004, "text": " go here, right? Oh, now we've gone too far, right? So the gradient now points this"}, {"start": 362.96000000000004, "end": 371.0, "text": " direction. So we go here and then we just continue this, right? So this is a"}, {"start": 371.0, "end": 375.64, "text": " problem with with SGD and what we can do is we can decrease the step size, for"}, {"start": 375.64, "end": 381.36, "text": " example, and then we converge in this or we can use something like a atom that"}, {"start": 381.36, "end": 390.48, "text": " adjusts the gradient to the variance of the gradient landscape, things like this,"}, {"start": 390.48, "end": 395.24, "text": " right? So these are problems in optimization. But what happens when you have a"}, {"start": 395.24, "end": 400.48, "text": " multi task objective is that for just task one, the optimization landscape would"}, {"start": 400.48, "end": 406.92, "text": " look like this, right? If you were just to train your neural network, if you were to"}, {"start": 406.92, "end": 412.52000000000004, "text": " just train this part and we just look here is like theta one and here is theta"}, {"start": 412.52000000000004, "end": 416.88, "text": " two. These are the two weights we care about right now. Everything else, let's"}, {"start": 416.88, "end": 422.04, "text": " say, is fixed. Task one looks like this, but for task two, because it's a"}, {"start": 422.04, "end": 425.64, "text": " different task, right? We need to set the weights differently to get our desired"}, {"start": 425.64, "end": 431.76, "text": " output. It looks different. So our loss function is going to be a combination. So"}, {"start": 431.76, "end": 437.4, "text": " our loss function is going to be the loss of task, loss function for a given sample."}, {"start": 437.4, "end": 441.92, "text": " It's going to be the loss on task one of that sample plus the loss of task two on"}, {"start": 441.92, "end": 447.96, "text": " that sample. So that's going to be the combination, the combination you see on"}, {"start": 447.96, "end": 460.0, "text": " the right. So this plus this equals this right here. So you can see in task one, it"}, {"start": 460.0, "end": 464.64, "text": " almost, let's say, didn't matter whether we were here or here, both had a"}, {"start": 464.64, "end": 472.52, "text": " relatively low loss value, right? But you can you can see in task two, this point"}, {"start": 472.52, "end": 478.24, "text": " here is not an optimum. Well, this point or maybe these are slight, these are"}, {"start": 478.24, "end": 482.88, "text": " seem what's almost close together. So if you add them, you can see that now this"}, {"start": 482.88, "end": 487.76, "text": " thing here still has a low value, but not as low as this is much darker, right?"}, {"start": 487.76, "end": 499.2, "text": " So the landscape for both tasks together looks differently from the landscape of"}, {"start": 499.2, "end": 504.52, "text": " either task alone. So your goal is to find this optimal point and optimal point here"}, {"start": 504.52, "end": 513.04, "text": " that works for both tasks. Now the paper identifies many, sorry, sorry, the paper"}, {"start": 513.04, "end": 520.0799999999999, "text": " identifies problems with this multitask learning. And they say the problem is that"}, {"start": 520.0799999999999, "end": 527.4, "text": " you can have what are called conflicting gradients. So if you look, if you look at,"}, {"start": 527.4, "end": 539.04, "text": " if you look at where the gradients point in the different, in the different tasks. So if"}, {"start": 539.04, "end": 543.64, "text": " we go by task two, sorry, let me put that in again. And we care about the point"}, {"start": 543.64, "end": 549.88, "text": " right here that they care about, right? And they use Adam in this case. And their"}, {"start": 549.88, "end": 555.16, "text": " starting point is right here. And they've come this way so far. So we're going"}, {"start": 555.16, "end": 562.9599999999999, "text": " to draw this in here and draw this in right here. And we'll stop a little bit"}, {"start": 562.9599999999999, "end": 568.1999999999999, "text": " before that valley, right? So let's analyze the gradient. The gradient task one"}, {"start": 568.2, "end": 573.24, "text": " actually points in this direction. You see down the valley, right? And it's"}, {"start": 573.24, "end": 577.08, "text": " pretty big because it's pretty steep, right? You can see the curves here getting"}, {"start": 577.08, "end": 582.24, "text": " closer and closer together. That means the gradient is pretty steep and it points"}, {"start": 582.24, "end": 586.44, "text": " in that direction. Whereas for task two, if you're here, right, the gradient"}, {"start": 586.44, "end": 592.32, "text": " actually points in this direction, but not as steep, right? Because here the"}, {"start": 592.32, "end": 599.36, "text": " lines are pretty far apart still. So that means it's relatively flat. This is"}, {"start": 599.36, "end": 603.5600000000001, "text": " what the paper calls conflicting gradients and they're drawn in here. I'm going"}, {"start": 603.5600000000001, "end": 611.08, "text": " to draw them just a little bit larger. So these two gradients, first of all, they"}, {"start": 611.08, "end": 616.36, "text": " have different magnitude. You see that the magnitude of this is much larger than"}, {"start": 616.36, "end": 622.64, "text": " the magnitude of this. And also their angle between them is large. That means"}, {"start": 622.64, "end": 628.0, "text": " conflicting that they're more than than 90 degrees apart from each other. And"}, {"start": 628.0, "end": 634.8000000000001, "text": " this results, if you calculate the resulting gradient, of course, this"}, {"start": 634.8000000000001, "end": 640.64, "text": " results in a gradient like this, right? So our algorithm wouldn't actually go"}, {"start": 640.64, "end": 645.72, "text": " down this valley. It will go up the hill again because you have differently"}, {"start": 645.72, "end": 654.12, "text": " sized gradients from the different tasks that go in different directions. That"}, {"start": 654.12, "end": 657.1600000000001, "text": " important point, I was wondering for a long time, what's the difference between"}, {"start": 657.1600000000001, "end": 663.44, "text": " this and simply saying, look, any data set, right, your loss on any data set, D,"}, {"start": 663.44, "end": 671.64, "text": " is just the sum of the loss of your individual data points, X, I, because it is"}, {"start": 671.64, "end": 677.4399999999999, "text": " the same case that you can have different data points and the gradients that"}, {"start": 677.4399999999999, "end": 682.4, "text": " you get, right? So that would result. If you've never done optimization, I'm"}, {"start": 682.4, "end": 686.8, "text": " sorry, I'm going a bit fast, that would result in the gradient with respect to"}, {"start": 686.8, "end": 693.92, "text": " your weights of your loss over the entire data set is, of course, approximated by"}, {"start": 693.92, "end": 702.8, "text": " the one over n in your mini batch. So by the gradients in your mini batch, right?"}, {"start": 702.8, "end": 711.16, "text": " So let's call this the loss of X, I, this is completely illegible. But what I'm"}, {"start": 711.16, "end": 717.36, "text": " saying is that your total gradient is the average of your individual data points."}, {"start": 717.36, "end": 722.04, "text": " And these might be conflicting as well, right? You could have that one"}, {"start": 722.04, "end": 726.5999999999999, "text": " points in this direction and the other one points in that direction. And we've"}, {"start": 726.5999999999999, "end": 732.68, "text": " done this just and things like things like Adam and SGD actually are able to"}, {"start": 732.68, "end": 737.28, "text": " handle that just fine because we do this average operation. I think what is"}, {"start": 737.28, "end": 745.4399999999999, "text": " different here is in multitask learning is that the multitask, the task"}, {"start": 745.44, "end": 753.4000000000001, "text": " distribution is not like stochastically IID, let's say. So in this case, you can"}, {"start": 753.4000000000001, "end": 759.44, "text": " always count on that the expectation will average out this noise. So this noise,"}, {"start": 759.44, "end": 766.36, "text": " if you go in expectation, right, if you do mini batches and aggregate over the"}, {"start": 766.36, "end": 771.0400000000001, "text": " whole data set, then that will kind of even out because for the different"}, {"start": 771.04, "end": 777.0, "text": " data points, okay, one gradient might be larger, one might be smaller, but there's"}, {"start": 777.0, "end": 782.8, "text": " no systematic error or there's no systematic bias that comes from the"}, {"start": 782.8, "end": 789.7199999999999, "text": " different data points. Here you have, as we said, one task might be much"}, {"start": 789.7199999999999, "end": 794.76, "text": " harder than the other task, right? Or you might have much more data or the"}, {"start": 794.76, "end": 801.96, "text": " loss function is just larger like magnitude wise. So you can have any number of"}, {"start": 801.96, "end": 808.36, "text": " systematic biases that different tasks have with each other and therefore the"}, {"start": 808.36, "end": 813.4399999999999, "text": " conflicting gradients seem to be a problem. So this paper does a good job of"}, {"start": 813.4399999999999, "end": 819.0, "text": " analyzing the situation of conflicting gradients and what I find particularly"}, {"start": 819.0, "end": 828.24, "text": " interesting is that they, first of all, they propose an algorithm to deal with"}, {"start": 828.24, "end": 833.16, "text": " these conflicting gradients. So they say whenever two gradients are conflicting,"}, {"start": 833.16, "end": 838.8, "text": " right? What we would do is we would project them on the normal plane of each"}, {"start": 838.8, "end": 845.32, "text": " other, right? So for example, here in the in step B, we take the gradient of task"}, {"start": 845.32, "end": 855.0400000000001, "text": " i and we project it onto the normal plane of gradient from the task j, right? And"}, {"start": 855.0400000000001, "end": 861.48, "text": " if we do this and they have a whole algorithm where it's in general, so if we do"}, {"start": 861.48, "end": 869.84, "text": " this for multiple tasks, so basically we get a mini batch of tasks, right? So they"}, {"start": 869.84, "end": 876.6800000000001, "text": " generalize this to that you have a bunch of tasks. We get the different"}, {"start": 876.6800000000001, "end": 881.2, "text": " gradients and these can be stochastic because we can do this with stochastic"}, {"start": 881.2, "end": 888.36, "text": " data sets. We go through the batch and if the gradients are conflicting, we"}, {"start": 888.36, "end": 897.52, "text": " simply project the gradients onto each other and that will result now in a set of"}, {"start": 897.52, "end": 904.52, "text": " non-conflicting gradients. You might be a bit appalled by this. I was at first"}, {"start": 904.52, "end": 911.84, "text": " when I saw this, but they actually do, as I said, a good job of analyzing this. So"}, {"start": 911.84, "end": 918.0, "text": " they have two theorems here, which I find interesting. So theorem one is assume"}, {"start": 918.0, "end": 922.68, "text": " these are convex and differentiable. So somewhat standard assumptions in"}, {"start": 922.68, "end": 929.12, "text": " optimization. They say then the PC grad update rule with a step size smaller than"}, {"start": 929.12, "end": 935.64, "text": " one over L, L is delipsiates constant, will converge either to a location where"}, {"start": 935.64, "end": 940.68, "text": " the cosine is exactly negative one between two gradients. You can that never"}, {"start": 940.68, "end": 946.56, "text": " happens except if you construct it or the optimal value, right? So this is"}, {"start": 946.56, "end": 952.3599999999999, "text": " basically a consistency theorem saying that this algorithm will still converge to"}, {"start": 952.36, "end": 962.8000000000001, "text": " the optimum value. This here is the loss. So this loss is the sum of loss one and"}, {"start": 962.8000000000001, "end": 969.04, "text": " loss two, right? Of these two tasks. So for two tasks, they prove that the"}, {"start": 969.04, "end": 973.36, "text": " algorithm will still go to the correct point if you run it long enough."}, {"start": 973.36, "end": 980.0, "text": " Doesn't say anything about the speed though. This is where theorem two comes in."}, {"start": 980.0, "end": 985.36, "text": " The theorem two says suppose L is differentiable and the gradient of L is"}, {"start": 985.36, "end": 991.0, "text": " lips its continuous. But this again, same assumptions except no longer need"}, {"start": 991.0, "end": 1002.56, "text": " convexity. Let theta mt, which is the multi task gradient and theta, sorry, not the"}, {"start": 1002.56, "end": 1006.28, "text": " gradient, the parameters theta PC grad be the parameters after applying one"}, {"start": 1006.28, "end": 1013.92, "text": " update to theta with g and PC grad modified g. So this mt is the that would be"}, {"start": 1013.92, "end": 1018.56, "text": " kind of the original algorithm without their method. And this here would be"}, {"start": 1018.56, "end": 1027.44, "text": " with their method. Moreover, assume a bunch of things which will go into soon."}, {"start": 1027.44, "end": 1037.44, "text": " Then the loss function of the PC grad theta is smaller or equal than the loss"}, {"start": 1037.44, "end": 1044.68, "text": " function of the mt of the original. So what does it mean? It means that if you're"}, {"start": 1044.68, "end": 1051.56, "text": " in your optimization landscape and you're somewhere here, right? And your"}, {"start": 1051.56, "end": 1058.6399999999999, "text": " optimum is somewhere here. And your loss function is kind of how far away are you"}, {"start": 1058.6399999999999, "end": 1064.08, "text": " from this from this optimum? It means that as long as these conditions are"}, {"start": 1064.08, "end": 1072.2, "text": " given, if you do your update without the their method, which would be so here"}, {"start": 1072.2, "end": 1083.92, "text": " would be theta mt or with their method theta PC grad, then the loss function that"}, {"start": 1083.92, "end": 1089.44, "text": " you get from their method will be smaller than the loss function that you get"}, {"start": 1089.44, "end": 1096.3600000000001, "text": " without their method. So this is a theorem they prove it. And for this to be the"}, {"start": 1096.36, "end": 1104.28, "text": " case, they need these three things. So let's go from the back. The third one is a"}, {"start": 1104.28, "end": 1109.36, "text": " is a condition on the on the loss function. Sorry on the step size. And you can"}, {"start": 1109.36, "end": 1115.6799999999998, "text": " say, okay, the step size needs to be large enough. You can set the step size."}, {"start": 1115.6799999999998, "end": 1124.6799999999998, "text": " This here, what is this? This here needs to be a this is a condition on the on"}, {"start": 1124.68, "end": 1133.28, "text": " this epsilon. So what's this thing? It is a curvature bounding measure. And that"}, {"start": 1133.28, "end": 1143.1200000000001, "text": " is compared to little L. And little L here is this thing. It is a constant that"}, {"start": 1143.12, "end": 1154.8, "text": " must be smaller than h. And h is up here is the curvature. So it depends on the"}, {"start": 1154.8, "end": 1160.4799999999998, "text": " curvature, right? It depends on the curvature fulfilling some condition. They"}, {"start": 1160.4799999999998, "end": 1169.12, "text": " stayed down here. The curvature of the multitask gradient should be large."}, {"start": 1169.12, "end": 1178.4799999999998, "text": " Yeah. And the first condition we've already seen is that the cosine of the"}, {"start": 1178.4799999999998, "end": 1182.7199999999998, "text": " angles needs to be smaller than negative something that depends on the"}, {"start": 1182.7199999999998, "end": 1186.28, "text": " gradients. And this here turns out actually to be the magnitudes of the"}, {"start": 1186.28, "end": 1191.8799999999999, "text": " gradients. So this this first this here, we can neglect that's a step size"}, {"start": 1191.88, "end": 1199.0800000000002, "text": " condition. This here means the gradients should be conflicting. And this here"}, {"start": 1199.0800000000002, "end": 1206.24, "text": " means that there should be sufficient curvature in the loss function. This is"}, {"start": 1206.24, "end": 1213.88, "text": " exactly what we saw at the beginning in this, and this thing here. So there was"}, {"start": 1213.88, "end": 1221.7600000000002, "text": " a sufficient curvature because in one direction the gradient was very steep and"}, {"start": 1221.76, "end": 1225.6, "text": " in the other direction it wasn't, which basically means there is a change of"}, {"start": 1225.6, "end": 1230.8, "text": " steepness, right? There is a change of steepness in one direction versus the"}, {"start": 1230.8, "end": 1236.28, "text": " other direction. And also the two gradients were conflicting, which we saw"}, {"start": 1236.28, "end": 1243.2, "text": " right here. If this is the case, then this algorithm will bring you faster to the"}, {"start": 1243.2, "end": 1250.8799999999999, "text": " optimum than the the normal algorithm. But only if this is given. And notably this"}, {"start": 1250.88, "end": 1258.3200000000002, "text": " can change step to step. They actually call this the I think the holy trifecta"}, {"start": 1258.3200000000002, "end": 1263.92, "text": " evil trifect something. They have a name for it. But I'm going to read you the"}, {"start": 1263.92, "end": 1269.0400000000002, "text": " the conditions that how they describe it. The conditions are first the angle"}, {"start": 1269.0400000000002, "end": 1273.0800000000002, "text": " between the task gradients is not too small. I the two tasks need to conflict"}, {"start": 1273.0800000000002, "end": 1278.64, "text": " sufficiently. Second, the difference in magnitude needs to be sufficiently"}, {"start": 1278.64, "end": 1285.96, "text": " large. Third, the curvature of the multitask gradient should be large. And fourth,"}, {"start": 1285.96, "end": 1290.5600000000002, "text": " the learning rate should be big enough such that large curvature would lead to"}, {"start": 1290.5600000000002, "end": 1295.88, "text": " overestimation of performance improvement on the dominating task and"}, {"start": 1295.88, "end": 1301.16, "text": " underestimation of performance degradation on the dominated task. So here you"}, {"start": 1301.16, "end": 1309.2, "text": " see a little subtle team. I said before that this condition here was negligible"}, {"start": 1309.2, "end": 1318.28, "text": " because you can set the task size in actuality. This you can so I'm not"}, {"start": 1318.28, "end": 1322.92, "text": " meaning to rag on this. But what does it mean? The learning rate should be big"}, {"start": 1322.92, "end": 1327.4, "text": " enough such that blah blah blah. And what comes here seems to be negative,"}, {"start": 1327.4, "end": 1332.3200000000002, "text": " right? Such that the large curvature would lead to overestimation, which"}, {"start": 1332.3200000000002, "end": 1340.72, "text": " basically means this method, this thing here counts if the step size is large."}, {"start": 1340.72, "end": 1347.2800000000002, "text": " So that means if I were to play devil's advocate, if I have a problem like"}, {"start": 1347.2800000000002, "end": 1356.68, "text": " this, I could either, right? I could either use their method, PC grad, or I could"}, {"start": 1356.68, "end": 1363.6000000000001, "text": " just decrease my learning rate and use the classic algorithm. Because if I just"}, {"start": 1363.6000000000001, "end": 1369.88, "text": " decrease my learning rate relative to the curvature, then this steering would"}, {"start": 1369.88, "end": 1373.68, "text": " no longer hold and it would no longer be the case that their algorithm gives me"}, {"start": 1373.68, "end": 1379.52, "text": " a faster convergence. So there's there's two ways of looking at these things."}, {"start": 1379.52, "end": 1384.44, "text": " It's like, yes, in in these conditions, this algorithm is better, but it is"}, {"start": 1384.44, "end": 1390.2, "text": " better because someone has set the learning rate to high and this algorithm"}, {"start": 1390.2, "end": 1397.68, "text": " kind of fixes that. Now the upside to this is of course that the usually you"}, {"start": 1397.68, "end": 1402.52, "text": " don't want to kind of set your learning rate in accordance with the curvature"}, {"start": 1402.52, "end": 1407.16, "text": " of the with the curvature of the problem and so on. You don't know the"}, {"start": 1407.16, "end": 1411.2, "text": " curvature most of the time. So you just set some learning rate and their algorithm"}, {"start": 1411.2, "end": 1417.24, "text": " appears to be working also when this learning rate is smaller. It's just not"}, {"start": 1417.24, "end": 1421.92, "text": " guaranteed to outperform the classic algorithm. But I just found find this"}, {"start": 1421.92, "end": 1427.44, "text": " interesting in terms of how you read a paper, right? If you read a paper, you come"}, {"start": 1427.44, "end": 1432.52, "text": " across something like this. These conditions, you can always see them as here is"}, {"start": 1432.52, "end": 1437.2, "text": " what needs to happen for us to succeed or here is what needs to happen for the"}, {"start": 1437.2, "end": 1443.1200000000001, "text": " others to fail. And therefore, we're the only ones that succeed in this"}, {"start": 1443.1200000000001, "end": 1448.76, "text": " regime. Though, yeah, as I said, it's a cool algorithm, but I found that to be"}, {"start": 1448.76, "end": 1458.52, "text": " funny. Alright, so they test this on multi-task which these MT10 and MT50"}, {"start": 1458.52, "end": 1463.72, "text": " benchmarks are these robotic manipulation. So multi-task doesn't only mean like"}, {"start": 1463.72, "end": 1467.92, "text": " supervised learning in this case is actually multi-task reinforcement learning."}, {"start": 1467.92, "end": 1472.16, "text": " So here you have everything, you have mini batches, you have episodes and you"}, {"start": 1472.16, "end": 1481.56, "text": " have you have multiple tasks. So this is everything together. Very cool. And you"}, {"start": 1482.6000000000001, "end": 1488.0, "text": " in their actual implementation, they say what they do is they have these"}, {"start": 1488.0, "end": 1493.96, "text": " multiple tasks. So they have the agent and they first select the tasks. So for"}, {"start": 1493.96, "end": 1501.12, "text": " example, here pull this, right? Then they generate an episode by interacting"}, {"start": 1501.12, "end": 1504.84, "text": " with the environment, forth and back, forth and back. Then they put that episode"}, {"start": 1504.84, "end": 1512.12, "text": " into a replay buffer. Then they maybe select another task and so on. So until"}, {"start": 1512.12, "end": 1516.6, "text": " they have a bunch of data in their replay buffer from different tasks, then"}, {"start": 1516.6, "end": 1523.56, "text": " they sample episodes from different tasks, right? From task one, task two and so"}, {"start": 1523.56, "end": 1528.08, "text": " on. And that will become a mini batch in the learning procedure. So pretty"}, {"start": 1528.08, "end": 1533.24, "text": " intricate thing. But of course, the hope is that you can learn kind of a share"}, {"start": 1533.24, "end": 1539.84, "text": " representation that you can then perform all of these tasks faster than if you"}, {"start": 1539.84, "end": 1546.48, "text": " were to learn them each independently. So the MT10 and MT50 come from this and"}, {"start": 1546.48, "end": 1553.44, "text": " I think they also have goal condition pushing where the task is simply to push"}, {"start": 1553.44, "end": 1557.56, "text": " something to a what they call goal condition. And the cool thing about this is"}, {"start": 1557.56, "end": 1562.44, "text": " it's not only 50 tasks, but you can produce an infinity of tasks because you"}, {"start": 1562.44, "end": 1569.32, "text": " can always specify a new location where you should push something to. So that's"}, {"start": 1569.32, "end": 1577.72, "text": " that's fairly fairly cool. And oh yeah, the curves. So you see that if you do"}, {"start": 1577.72, "end": 1583.4199999999998, "text": " something like soft actor critic or multi head soft actor critic. So this multi head"}, {"start": 1583.4199999999998, "end": 1589.9199999999998, "text": " soft actor critic is probably the closest to what I defined in to what I"}, {"start": 1589.9199999999998, "end": 1594.48, "text": " defined at the beginning where you have this shared representation and then"}, {"start": 1594.48, "end": 1599.48, "text": " and then the individual heads. And you can see that severely underperforms"}, {"start": 1599.48, "end": 1608.48, "text": " against the SIC plus PC grad plus their method that seems to outperform fairly"}, {"start": 1608.48, "end": 1613.48, "text": " consistently even against learning the tasks independently. So it learns much"}, {"start": 1613.48, "end": 1618.88, "text": " faster than if you were to learn these tasks just independently from each other."}, {"start": 1618.88, "end": 1627.2800000000002, "text": " Which is pretty cool, right? So I think that's pretty cool. All right. So they do"}, {"start": 1627.2800000000002, "end": 1634.3200000000002, "text": " actually interesting investigations. First of all, they research okay in during"}, {"start": 1634.3200000000002, "end": 1640.48, "text": " these learning runs. How what is the curvature here? And the curvature of the"}, {"start": 1640.48, "end": 1648.64, "text": " loss function they measure like this. So basically all this is a consequence of"}, {"start": 1648.64, "end": 1655.1200000000001, "text": " the Taylor approximation. So if you have like f of x, you can you can write this"}, {"start": 1655.1200000000001, "end": 1666.24, "text": " as f of some x 0 plus the gradient of f that plus the gradient of f times x"}, {"start": 1666.24, "end": 1675.0, "text": " here. Sorry, at x 0 times x in this direction. And then if you subtract, so this"}, {"start": 1675.0, "end": 1679.8, "text": " is a first order approximation to this to the function on the right. Then if you"}, {"start": 1679.8, "end": 1686.88, "text": " bring this over here, you or if you sorry if you subtract the two sides from"}, {"start": 1686.88, "end": 1692.52, "text": " each other, then you can see there's the difference between the actual function"}, {"start": 1692.52, "end": 1699.04, "text": " and the first order approximation of the function. That must be or that is most"}, {"start": 1699.04, "end": 1706.1599999999999, "text": " likely the curvature. Now it is not it is like every higher order term, but the"}, {"start": 1706.1599999999999, "end": 1710.6399999999999, "text": " assumption is that the dominant higher order term will be the curvature."}, {"start": 1710.6399999999999, "end": 1717.52, "text": " All right. So this is this would be this except they don't they do it not"}, {"start": 1717.52, "end": 1722.6399999999999, "text": " doing the x and x 0. They do it at theta t and theta t plus 1. So you can see"}, {"start": 1722.6399999999999, "end": 1727.72, "text": " this is the first order approximation. And this is the actual function value"}, {"start": 1727.72, "end": 1735.24, "text": " after they do a step. And the resulting thing will be the curvature or dominated"}, {"start": 1735.24, "end": 1742.68, "text": " by the curvature. So they analyze this over the course of learning. And they see"}, {"start": 1742.68, "end": 1748.4, "text": " that it actually increases as you as you go on. And just I'm not a big fan of"}, {"start": 1748.4, "end": 1755.3600000000001, "text": " like just large numbers, but they numbers seem to be large, right? Just"}, {"start": 1755.36, "end": 1758.56, "text": " compared to what you can handle with the computer that numbers seem to be"}, {"start": 1758.56, "end": 1764.04, "text": " large and they seem to be getting larger in order of magnitude steps across"}, {"start": 1764.04, "end": 1770.36, "text": " training iterations. So I'm going to believe them that this curvature is given. I"}, {"start": 1770.36, "end": 1777.12, "text": " would have liked to have it seen compared to just a single task instead of a"}, {"start": 1777.12, "end": 1783.32, "text": " multitask. Instead of you know comparing these things, which is useless because"}, {"start": 1783.32, "end": 1789.6799999999998, "text": " they reach different losses, right? So it's pretty useless to compare their"}, {"start": 1789.6799999999998, "end": 1795.0, "text": " curvature across the number of iterations. What I would have liked to see is a"}, {"start": 1795.0, "end": 1801.32, "text": " comparison multitask versus single task. And to show me that in single task"}, {"start": 1801.32, "end": 1809.52, "text": " learning, this curvature doesn't happen. Here you have the percentage of"}, {"start": 1809.52, "end": 1814.44, "text": " updates, steps where conditions A and B are held. You remember condition A was"}, {"start": 1814.44, "end": 1819.68, "text": " the condition on the conflicting angle. Condition B was the condition that the"}, {"start": 1819.68, "end": 1830.48, "text": " curvature is large enough. And you can see that as you go on with learning, these"}, {"start": 1830.48, "end": 1837.56, "text": " dotted and dashed lines, the conditions hold almost entirely at the beginning"}, {"start": 1837.56, "end": 1843.72, "text": " of learning. But then still hold by in a big time of the steps. So here is like"}, {"start": 1843.72, "end": 1851.6799999999998, "text": " about half the steps still at the end of training. These conditions hold. So it is"}, {"start": 1851.6799999999998, "end": 1858.84, "text": " fairly fairly good evidence that often the problems that they say are real or"}, {"start": 1858.84, "end": 1863.56, "text": " really there. And then therefore their algorithm helps. Right. So here is the"}, {"start": 1863.56, "end": 1872.12, "text": " average per task average return. And interestingly, they say in the text, look,"}, {"start": 1872.12, "end": 1878.52, "text": " this task here seems to be easier, right? And the task two, which is the dotted"}, {"start": 1878.52, "end": 1884.52, "text": " line, seems to be harder. So SAC, the baseline algorithm, never really manages to"}, {"start": 1884.52, "end": 1892.28, "text": " learn task two, whereas this PC grad manages after a while to learn it. And at that"}, {"start": 1892.28, "end": 1902.56, "text": " point, something happens over here, which I'm not super sure. Yeah, that's what"}, {"start": 1902.56, "end": 1908.8, "text": " they say in the text. But I have to squint a lot to see that exactly at that"}, {"start": 1908.8, "end": 1914.32, "text": " position, something happens. Suffice to say that the PC grad is able to learn the"}, {"start": 1914.32, "end": 1920.8, "text": " task that SAC isn't able to learn because probably task one is completely"}, {"start": 1920.8, "end": 1928.0, "text": " dominating the gradient at that point, right? All right. So this was the paper. I"}, {"start": 1928.0, "end": 1957.96, "text": " invite you to read it. And thanks for listening. Bye bye."}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.